composer.phar 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561
  1. #!/usr/bin/env php
  2. <?php
  3. /*
  4. * This file is part of Composer.
  5. *
  6. * (c) Nils Adermann <naderman@naderman.de>
  7. * Jordi Boggiano <j.boggiano@seld.be>
  8. *
  9. * For the full copyright and license information, please view
  10. * the license that is located at the bottom of this file.
  11. */
  12. // Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
  13. if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
  14. if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
  15. ini_set('apc.cache_by_default', 0);
  16. } else {
  17. fwrite(STDERR, 'Warning: APC <= 3.0.12 may cause fatal errors when running composer commands.'.PHP_EOL);
  18. fwrite(STDERR, 'Update APC, or set apc.enable_cli or apc.cache_by_default to 0 in your php.ini.'.PHP_EOL);
  19. }
  20. }
  21. Phar::mapPhar('composer.phar');
  22. require 'phar://composer.phar/bin/composer';
  23. __HALT_COMPILER(); ?>
  24. -–��ú������ ���composer.phar����+���src/Composer/Autoload/AutoloadGenerator.php½i��­²…_½i��Æ6ä������+���src/Composer/Autoload/ClassMapGenerator.phpõ��­²…_õ��Ó–ä5¤���������src/Composer/Cache.phpç��­²…_ç��[27¤������%���src/Composer/Command/AboutCommand.phpØ��­²…_Ø��ö÷;‡¤������'���src/Composer/Command/ArchiveCommand.phpä��­²…_ä��Õ­¤������$���src/Composer/Command/BaseCommand.phpÜ ��­²…_Ü ��gô1¤������.���src/Composer/Command/BaseDependencyCommand.phpg��­²…_g��öNp¤������1���src/Composer/Command/CheckPlatformReqsCommand.php��­²…_���„Ǥ������*���src/Composer/Command/ClearCacheCommand.php½��­²…_½��°I¤������&���src/Composer/Command/ConfigCommand.phpÎQ��­²…_ÎQ��xþÎ ¤������-���src/Composer/Command/CreateProjectCommand.phpq;��­²…_q;��¾ô¹‡¤������'���src/Composer/Command/DependsCommand.phpø��­²…_ø��ªeá¤������(���src/Composer/Command/DiagnoseCommand.php`P��­²…_`P��¼ˆ^®¤������,���src/Composer/Command/DumpAutoloadCommand.phpã ��­²…_ã ��© ]†¤������$���src/Composer/Command/ExecCommand.php ��­²…_ ��X?!“¤������$���src/Composer/Command/FundCommand.php,
  25. ��­²…_,
  26. ��9¤������&���src/Composer/Command/GlobalCommand.phpÊ ��­²…_Ê ���œE¤������$���src/Composer/Command/HomeCommand.php��­²…_��qLBޤ������$���src/Composer/Command/InitCommand.phpWU��­²…_WU��LÝÔ"¤������'���src/Composer/Command/InstallCommand.phpT��­²…_T��Þùõ›¤������(���src/Composer/Command/LicensesCommand.phpò��­²…_ò��´È¤������(���src/Composer/Command/OutdatedCommand.php ��­²…_ ��اc¤������)���src/Composer/Command/ProhibitsCommand.php��­²…_��_¤éS¤������&���src/Composer/Command/RemoveCommand.phpá��­²…_á��Å1÷&¤������'���src/Composer/Command/RequireCommand.php¯)��­²…_¯)��^ %¤������)���src/Composer/Command/RunScriptCommand.php³��­²…_³��·ü¤������+���src/Composer/Command/ScriptAliasCommand.php¯��­²…_¯��?=Ѥ������&���src/Composer/Command/SearchCommand.phpU ��­²…_U ��…ߤ������*���src/Composer/Command/SelfUpdateCommand.php½C��­²…_½C��ßðnº¤������$���src/Composer/Command/ShowCommand.phpƒ‚��­²…_ƒ‚��O‘� ¤������&���src/Composer/Command/StatusCommand.php,��­²…_,��“Âk¤������(���src/Composer/Command/SuggestsCommand.php��­²…_��ò‚Bɤ������&���src/Composer/Command/UpdateCommand.phpë#��­²…_ë#��3<&�¤������(���src/Composer/Command/ValidateCommand.phpk��­²…_k��y‚8K¤���������src/Composer/Composer.php ��­²…_ ��?æ÷Ÿ¤���������src/Composer/Config.php%��­²…_%��©ì¤������-���src/Composer/Config/ConfigSourceInterface.php��­²…_��³ [/¤������(���src/Composer/Config/JsonConfigSource.php¹��­²…_¹��”\©-¤������$���src/Composer/Console/Application.phpe8��­²…_e8�� X‚¤������,���src/Composer/Console/HtmlOutputFormatter.php3��­²…_3��Ú�Eu¤������-���src/Composer/DependencyResolver/Decisions.php6��­²…_6��à• ž¤������1���src/Composer/DependencyResolver/DefaultPolicy.php��­²…_��˜ë>#¤������/���src/Composer/DependencyResolver/GenericRule.phpµ��­²…_µ��᫤¤������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��­²…_C��´\õ*¤������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��­²…_÷��ïÎà÷¤������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��­²…_ý��3#†¤������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���­²…_Ó���Ùâ&ä¤������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��­²…_¹��&¢e
  27. ¤������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��­²…_I��FûÂɤ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.php'��­²…_'��Qúɯ¤������3���src/Composer/DependencyResolver/PolicyInterface.php­��­²…_­��Ÿ‹R¤������(���src/Composer/DependencyResolver/Pool.php#��­²…_#��ÿ…C�¤������+���src/Composer/DependencyResolver/Problem.phpú��­²…_ú��]D5¤������+���src/Composer/DependencyResolver/Request.phpƒ��­²…_ƒ��åVP„¤������(���src/Composer/DependencyResolver/Rule.php?��­²…_?��¬‘œü¤������1���src/Composer/DependencyResolver/Rule2Literals.php��­²…_��tZÅɤ������+���src/Composer/DependencyResolver/RuleSet.phpª
  28. ��­²…_ª
  29. ��_΂¤������4���src/Composer/DependencyResolver/RuleSetGenerator.php‹��­²…_‹��‡ �¤������3���src/Composer/DependencyResolver/RuleSetIterator.php��­²…_��›Cü$¤������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��­²…_i��hïš,¤������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��­²…_á��‰rôv¤������1���src/Composer/DependencyResolver/RuleWatchNode.php��­²…_���Gd7¤������*���src/Composer/DependencyResolver/Solver.phpf:��­²…_f:��Nø1´¤������6���src/Composer/DependencyResolver/SolverBugException.php™��­²…_™��Xg6¤������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��­²…_ô��×|Ŧ¤������/���src/Composer/DependencyResolver/Transaction.php×��­²…_×��Vm쟤������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��­²…_Æ ��G s0¤������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���­²…_Ì���¯à¨¿¤������+���src/Composer/Downloader/DownloadManager.php`��­²…_`��#ÏX¤������/���src/Composer/Downloader/DownloaderInterface.phpÊ��­²…_Ê��gs!l¤������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���­²…_Ñ���&Áœ¿¤������*���src/Composer/Downloader/FileDownloader.phpG��­²…_G��äOФ������/���src/Composer/Downloader/FilesystemException.php
  30. ��­²…_
  31. ��.-‹¤������,���src/Composer/Downloader/FossilDownloader.php‚ ��­²…_‚ ��Ü�Ii¤������)���src/Composer/Downloader/GitDownloader.phpû6��­²…_û6��Ëv0K¤������*���src/Composer/Downloader/GzipDownloader.phpó��­²…_ó��}Úo¤������(���src/Composer/Downloader/HgDownloader.php”��­²…_”��ßis̤������*���src/Composer/Downloader/PathDownloader.phpT��­²…_T��®–¤������0���src/Composer/Downloader/PearPackageExtractor.phpu��­²…_u��z„‡¤������.���src/Composer/Downloader/PerforceDownloader.phpž��­²…_ž��Öüñ9¤������*���src/Composer/Downloader/PharDownloader.phpå���­²…_å���ÞÉç¤������)���src/Composer/Downloader/RarDownloader.phpž��­²…_ž��6 3U¤������)���src/Composer/Downloader/SvnDownloader.phpM��­²…_M�� !`¤������)���src/Composer/Downloader/TarDownloader.phpã���­²…_ã���Í’X?¤������.���src/Composer/Downloader/TransportException.php=��­²…_=��ZÎÈÞ¤������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���­²…_Ô���`§ôö¤������)���src/Composer/Downloader/VcsDownloader.php¡��­²…_¡��( à>¤������(���src/Composer/Downloader/XzDownloader.php§��­²…_§��W$;á¤������)���src/Composer/Downloader/ZipDownloader.php���­²…_���®Û#s¤������&���src/Composer/EventDispatcher/Event.php ��­²…_ ��±™jï¤������0���src/Composer/EventDispatcher/EventDispatcher.php�7��­²…_�7��—Øa¡¤������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���­²…_©���h·0¤������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���­²…_v���wZ8S¤������)���src/Composer/Exception/NoSslException.phpf���­²…_f���ËíM�¤���������src/Composer/Factory.php?>��­²…_?>��=ˆw°¤���������src/Composer/IO/BaseIO.php•��­²…_•��ìÏA¤���������src/Composer/IO/BufferIO.php¾��­²…_¾��X~d¤���������src/Composer/IO/ConsoleIO.php��­²…_��üw·¤���������src/Composer/IO/IOInterface.phpì��­²…_ì���Õ�¤���������src/Composer/IO/NullIO.phpÀ��­²…_À��F`sʤ���������src/Composer/Installer.php¦£��­²…_¦£��8Òд¤������*���src/Composer/Installer/BinaryInstaller.php
  32. ��­²…_
  33. ��t¤{ø¤������2���src/Composer/Installer/BinaryPresenceInterface.phpË���­²…_Ë���À5š¨¤������.���src/Composer/Installer/InstallationManager.php-��­²…_-��¾}Œ7¤������)���src/Composer/Installer/InstallerEvent.php��­²…_��lÔzi¤������*���src/Composer/Installer/InstallerEvents.phpÞ���­²…_Þ���ìŸ@G¤������-���src/Composer/Installer/InstallerInterface.phpã��­²…_ã��^ƒ“ʤ������+���src/Composer/Installer/LibraryInstaller.php%��­²…_%�� »�̤������/���src/Composer/Installer/MetapackageInstaller.phpÊ��­²…_Ê��Ùti·¤������(���src/Composer/Installer/NoopInstaller.php+��­²…_+��À·M}¤������'���src/Composer/Installer/PackageEvent.phpe��­²…_e��;° ¤������(���src/Composer/Installer/PackageEvents.php¸��­²…_¸��dbØs¤������.���src/Composer/Installer/PearBinaryInstaller.phpø ��­²…_ø ��*ë•k¤������(���src/Composer/Installer/PearInstaller.php¢��­²…_¢��È‚¶Ñ¤������*���src/Composer/Installer/PluginInstaller.php¢��­²…_¢��L´a:¤������+���src/Composer/Installer/ProjectInstaller.php��­²…_��*0@P¤������4���src/Composer/Installer/SuggestedPackagesReporter.php:��­²…_:��‚´UV¤���������src/Composer/Json/JsonFile.phpL��­²…_L��rs¤������#���src/Composer/Json/JsonFormatter.phpb��­²…_b��ÝNš¤������%���src/Composer/Json/JsonManipulator.php“4��­²…_“4��Í®š¤������-���src/Composer/Json/JsonValidationException.php\��­²…_\��.Xóܤ������%���src/Composer/Package/AliasPackage.phpî��­²…_î��-�×&¤������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��­²…_ ��yY+¦¤������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��­²…_Þ�� ²²¹¤������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��­²…_Ý ��í<´B¤������3���src/Composer/Package/Archiver/ArchiverInterface.php��­²…_��ñ´> ¤������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��­²…_–��y¶=Ƥ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��­²…_��‹SZ0¤������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��­²…_r��3‘Mh¤������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��­²…_ �� •¦S¤������.���src/Composer/Package/Archiver/PharArchiver.php?��­²…_?��®— u¤������-���src/Composer/Package/Archiver/ZipArchiver.phpX��­²…_X��¤k�~¤������$���src/Composer/Package/BasePackage.php ��­²…_ ��Î&|'¤������*���src/Composer/Package/Comparer/Comparer.php½��­²…_½��¡fK}¤������(���src/Composer/Package/CompletePackage.php¦��­²…_¦��p[Ö¤������1���src/Composer/Package/CompletePackageInterface.php��­²…_��Ϋ>¤������+���src/Composer/Package/Dumper/ArrayDumper.phpb ��­²…_b ��s•°›¤���������src/Composer/Package/Link.phpˆ��­²…_ˆ��å¶Y«¤������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��­²…_‚��é~‹¤������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��­²…_d��¤ôLn¤������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��­²…_‚��ób`ý¤������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��­²…_i��Þ”š%¤������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��­²…_X��}`y¤������+���src/Composer/Package/Loader/ArrayLoader.php½��­²…_½��c
  34. @�¤������7���src/Composer/Package/Loader/InvalidPackageException.phpE��­²…_E��xb¾¤������*���src/Composer/Package/Loader/JsonLoader.phpù��­²…_ù��!~ˆ{¤������/���src/Composer/Package/Loader/LoaderInterface.php²���­²…_²���¦}úΤ������1���src/Composer/Package/Loader/RootPackageLoader.phpj��­²…_j��[¿˜û¤������5���src/Composer/Package/Loader/ValidatingArrayLoader.phpïA��­²…_ïA��ÀÛe-¤���������src/Composer/Package/Locker.php="��­²…_="��GµF+¤������ ���src/Composer/Package/Package.phpÉ��­²…_É��cÃ�h¤������)���src/Composer/Package/PackageInterface.php\��­²…_\��xåp¨¤������)���src/Composer/Package/RootAliasPackage.php ��­²…_ �� _€ø¤������$���src/Composer/Package/RootPackage.php��­²…_��ŽÎ_¤������-���src/Composer/Package/RootPackageInterface.php¹��­²…_¹��"maV¤������/���src/Composer/Package/Version/VersionGuesser.phpá#��­²…_á#��mjVȤ������.���src/Composer/Package/Version/VersionParser.php¥��­²…_¥��ô´à¤������0���src/Composer/Package/Version/VersionSelector.php¨��­²…_¨��ý5½,¤������-���src/Composer/Plugin/Capability/Capability.phpW���­²…_W���æ_¨1¤������2���src/Composer/Plugin/Capability/CommandProvider.php—���­²…_—���ûOâ>¤���������src/Composer/Plugin/Capable.php���­²…_���Æq+¤������$���src/Composer/Plugin/CommandEvent.phpâ��­²…_â��³ÆÇW¤������$���src/Composer/Plugin/PluginEvents.phpö���­²…_ö���á1=z¤������'���src/Composer/Plugin/PluginInterface.phpô���­²…_ô���)'*ؤ������%���src/Composer/Plugin/PluginManager.phpª$��­²…_ª$��m‰ƒä¤������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��­²…_õ��:ðd¤������,���src/Composer/Plugin/PreFileDownloadEvent.php`��­²…_`���9-Τ������4���src/Composer/Question/StrictConfirmationQuestion.php��­²…_��'.³è¤������+���src/Composer/Repository/ArrayRepository.php¬��­²…_¬��cð?¤������.���src/Composer/Repository/ArtifactRepository.phpí��­²…_í��q9OS¤������*���src/Composer/Repository/BaseRepository.phpŠ��­²…_Š��äÝ÷¤������.���src/Composer/Repository/ComposerRepository.phpLU��­²…_LU��P] ¤������/���src/Composer/Repository/CompositeRepository.php;��­²…_;��¤¯S¤������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���­²…_…���±Ÿ_¤������0���src/Composer/Repository/FilesystemRepository.phpp��­²…_p��#ù¤������4���src/Composer/Repository/InstalledArrayRepository.php£���­²…_£���/ö~>¤������9���src/Composer/Repository/InstalledFilesystemRepository.php£���­²…_£���V
  35. •_¤������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���­²…_‡���£9p¤������6���src/Composer/Repository/InvalidRepositoryException.phpn���­²…_n���à“똤������-���src/Composer/Repository/PackageRepository.phpj��­²…_j��¥ôò̤������*���src/Composer/Repository/PathRepository.php©��­²…_©��w—+ ¤������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��­²…_I��c6³¤������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��­²…_Ä��:T*ɤ������.���src/Composer/Repository/Pear/ChannelReader.phpí��­²…_í��?ÈYT¤������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��­²…_® ��™ÖÛú¤������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��­²…_& ��òUb¤������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��­²…_q��9=¤������/���src/Composer/Repository/Pear/DependencyInfo.phpq��­²…_q��fºTò¤������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��­²…_…��÷$Li¤������,���src/Composer/Repository/Pear/PackageInfo.php°��­²…_°��Ÿ ¸ ¤������,���src/Composer/Repository/Pear/ReleaseInfo.php’��­²…_’��o“ŠÃ¤������*���src/Composer/Repository/PearRepository.phpª��­²…_ª��)Ÿƒ}¤������.���src/Composer/Repository/PlatformRepository.php;!��­²…_;!��äö9¤������-���src/Composer/Repository/RepositoryFactory.phpb��­²…_b��’{²ý¤������/���src/Composer/Repository/RepositoryInterface.phpÛ��­²…_Û��’âÁ¤������-���src/Composer/Repository/RepositoryManager.phpM ��­²…_M ��<(;Œ¤������7���src/Composer/Repository/RepositorySecurityException.phpo���­²…_o���pÕ«ª¤������/���src/Composer/Repository/Vcs/BitbucketDriver.php‚ ��­²…_‚ ��n¢v>¤������,���src/Composer/Repository/Vcs/FossilDriver.php³��­²…_³��ÐCk¤������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��­²…_ë��œ´½X¤������)���src/Composer/Repository/Vcs/GitDriver.php:��­²…_:��ÀÕ.p¤������,���src/Composer/Repository/Vcs/GitHubDriver.php�4��­²…_�4��ê,ˆä¤������,���src/Composer/Repository/Vcs/GitLabDriver.phpŽ*��­²…_Ž*��½¹²Ð¤������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��­²…_å��@)‰L¤������(���src/Composer/Repository/Vcs/HgDriver.phpB��­²…_B��»ƒî¤������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��­²…_ù ��&½tÙ¤������)���src/Composer/Repository/Vcs/SvnDriver.php¤��­²…_¤�� ¤������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  36. ��­²…_æ
  37. ��eׯ-¤������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��­²…_÷��ÇX[‰¤������)���src/Composer/Repository/VcsRepository.php˜-��­²…_˜-��ø2²¤������1���src/Composer/Repository/VersionCacheInterface.php”���­²…_”���A?Rï¤������3���src/Composer/Repository/WritableArrayRepository.php��­²…_��¾G*¤������7���src/Composer/Repository/WritableRepositoryInterface.php‰��­²…_‰��‘/sï¤������$���src/Composer/Script/CommandEvent.phpW���­²…_W���£VZt¤���������src/Composer/Script/Event.phpº��­²…_º��ò�»¤¤������$���src/Composer/Script/PackageEvent.phpœ���­²…_œ���§ÿÉ ¤������$���src/Composer/Script/ScriptEvents.phpP��­²…_P��‡�¶¤������ ���src/Composer/SelfUpdate/Keys.php���­²…_��� îÊN¤������$���src/Composer/SelfUpdate/Versions.phpH��­²…_H��c lB¤������ ���src/Composer/Util/AuthHelper.phpË��­²…_Ë��>zx–¤���������src/Composer/Util/Bitbucket.php*��­²…_*��,Lšk¤������$���src/Composer/Util/ComposerMirror.php±��­²…_±��­½øØ¤������%���src/Composer/Util/ConfigValidator.php÷��­²…_÷��v•ͤ������"���src/Composer/Util/ErrorHandler.php»��­²…_»��O›rk¤������ ���src/Composer/Util/Filesystem.phpm/��­²…_m/��Çë¡ú¤���������src/Composer/Util/Git.phpä0��­²…_ä0��'‰ïç¤���������src/Composer/Util/GitHub.php| ��­²…_| ��`0tü¤���������src/Composer/Util/GitLab.phpù��­²…_ù��ž7«£¤���������src/Composer/Util/Hg.php¾��­²…_¾��LÓ �¤���������src/Composer/Util/IniHelper.phph��­²…_h��;FP¤������$���src/Composer/Util/NoProxyPattern.php|��­²…_|��¸|ää¤������#���src/Composer/Util/PackageSorter.phpÞ��­²…_Þ��ê×ìY¤���������src/Composer/Util/Perforce.php¸2��­²…_¸2��Ás&}¤���������src/Composer/Util/Platform.phpü��­²…_ü��s­fç¤������%���src/Composer/Util/ProcessExecutor.php$ ��­²…_$ ��¨Nó¤������&���src/Composer/Util/RemoteFilesystem.phpFr��­²…_Fr��¡Ò¤���������src/Composer/Util/Silencer.phpé��­²…_é��“Vjf¤������!���src/Composer/Util/SpdxLicense.php��­²…_��¾7
  38. ñ¤������*���src/Composer/Util/StreamContextFactory.php��­²…_��CÉ…ù¤���������src/Composer/Util/Svn.php,��­²…_,��Ì žÄ¤���������src/Composer/Util/TlsHelper.phpL
  39. ��­²…_L
  40. ��" i¤���������src/Composer/Util/Url.php£��­²…_£��3œÉܤ���������src/Composer/Util/Zip.php³��­²…_³��äŠÎª¤���������src/Composer/XdebugHandler.phpð��­²…_ð��zÓf~¤���������src/bootstrap.php¹��­²…_¹��I}œ¤������%���src/Composer/Autoload/ClassLoader.php¡4��­²…_¡4��Þs…|¤������#���res/composer-repository-schema.jsonð��­²…_ð���GÐà¤���������res/composer-schema.jsonM���­²…_M���_Τ������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json¸ ��­²…_¸ ��Â4DC¤������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsoná£��­²…_á£��Ú¼Ó¤������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��­²…_�$��•�¥v¤������&���vendor/symfony/console/Application.php=X��­²…_=X��� S’¤������*���vendor/symfony/console/Command/Command.phpî"��­²…_î"��x°jÕ¤������.���vendor/symfony/console/Command/HelpCommand.phpØ��­²…_Ø��¦Ú-:¤������.���vendor/symfony/console/Command/ListCommand.phpZ��­²…_Z��»w`¤������(���vendor/symfony/console/ConsoleEvents.phpé���­²…_é���RÛÔe¤������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��­²…_Ð��™Ž5°¤������0���vendor/symfony/console/Descriptor/Descriptor.php���­²…_���¿N•¤������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���­²…_ü���±Qµ¤������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��­²…_Ü ��*û�ɤ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��­²…_¶��·Ô;ݤ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��­²…_¼��òç$¤������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��­²…_��b{<¤������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��­²…_°��!�Ȥ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��­²…_Å��ÒxÛ\¤������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��­²…_��á2é¤������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��­²…_z��³,îL¤������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��­²…_Ô��È÷ L¤������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���­²…_f���¡ABª¤������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���­²…_¦���Ö̽Z¤������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���­²…_¦���Ë×H¤������3���vendor/symfony/console/Exception/LogicException.php’���­²…_’���ÍO\e¤������5���vendor/symfony/console/Exception/RuntimeException.php–���­²…_–���Ùí,6¤������4���vendor/symfony/console/Formatter/OutputFormatter.php6��­²…_6��?=¨¤������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��­²…_Œ��òññÀ¤������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��­²…_F��𦴤������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��­²…_„��÷½G¤������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��­²…_@��G¨ýU¤������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��­²…_y��Ì8ÆÐ¤������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��­²…_w��|¦C¤������.���vendor/symfony/console/Helper/DialogHelper.php��­²…_��¹ÜÃ_¤������1���vendor/symfony/console/Helper/FormatterHelper.phpd��­²…_d��§×,¸¤������(���vendor/symfony/console/Helper/Helper.php«��­²…_«��!�§—¤������1���vendor/symfony/console/Helper/HelperInterface.phpå���­²…_å���Š ¤������+���vendor/symfony/console/Helper/HelperSet.phpÊ��­²…_Ê��áÏW"¤������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��­²…_c��Ìøƒ¤������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��­²…_Ó ��©w‚R¤������-���vendor/symfony/console/Helper/ProgressBar.phpl%��­²…_l%�� díÛ¤������0���vendor/symfony/console/Helper/ProgressHelper.php]��­²…_]��ù»‰X¤������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��­²…_N��ÿ§³l¤������0���vendor/symfony/console/Helper/QuestionHelper.phpl��­²…_l��Ntó¤������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  41. ��­²…_–
  42. ��- ؤ������'���vendor/symfony/console/Helper/Table.phpÄ*��­²…_Ä*��¾™ØT¤������+���vendor/symfony/console/Helper/TableCell.php���­²…_���åV^¤������-���vendor/symfony/console/Helper/TableHelper.php ��­²…_ ��›uô™¤������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���­²…_Ê���az¤������,���vendor/symfony/console/Helper/TableStyle.php
  43. ��­²…_
  44. ��_ÍI"¤������*���vendor/symfony/console/Input/ArgvInput.php��­²…_��×ö†›¤������+���vendor/symfony/console/Input/ArrayInput.php) ��­²…_) ��¥ÑC¤������&���vendor/symfony/console/Input/Input.php£ ��­²…_£ ��f¡?¤������.���vendor/symfony/console/Input/InputArgument.php��­²…_��D £¤������4���vendor/symfony/console/Input/InputAwareInterface.php˜���­²…_˜���­O°¤������0���vendor/symfony/console/Input/InputDefinition.php†��­²…_†��¤U)¤¤������/���vendor/symfony/console/Input/InputInterface.php£��­²…_£��ÆBŒ'¤������,���vendor/symfony/console/Input/InputOption.php ��­²…_ ��\¢Ü=¤������,���vendor/symfony/console/Input/StringInput.phpš��­²…_š��žµ è¤���������vendor/symfony/console/LICENSE)��­²…_)��NUN½¤������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��­²…_0 ��…� ¸¤������0���vendor/symfony/console/Output/BufferedOutput.php_��­²…__��‹ >P¤������/���vendor/symfony/console/Output/ConsoleOutput.php±��­²…_±��nì!f¤������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���­²…_à���‡†ÆÊ¤������,���vendor/symfony/console/Output/NullOutput.phpÏ��­²…_Ï��®˜‹Z¤������(���vendor/symfony/console/Output/Output.php˜ ��­²…_˜ ��0p¤������1���vendor/symfony/console/Output/OutputInterface.php��­²…_���ì&¤������.���vendor/symfony/console/Output/StreamOutput.php���­²…_���Ä’Oç¤������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  45. ��­²…_x
  46. ��W€!¤������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��­²…_è��/Ô�¤������,���vendor/symfony/console/Question/Question.phpÎ ��­²…_Î ��lF¤������ ���vendor/symfony/console/Shell.phpæ��­²…_æ��¼XÒA¤������,���vendor/symfony/console/Style/OutputStyle.php\��­²…_\��wפ¤������/���vendor/symfony/console/Style/StyleInterface.phpÏ��­²…_Ï��&nÅѤ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��­²…_ä��­å (¤������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��­²…_Ï��sž9i¤������/���vendor/symfony/console/Tester/CommandTester.phpª��­²…_ª��¬K z¤������(���vendor/symfony/debug/BufferingLogger.phpt��­²…_t��=�hܤ���������vendor/symfony/debug/Debug.php,��­²…_,��Ë~Ž.¤������)���vendor/symfony/debug/DebugClassLoader.phpµ��­²…_µ��1rEÓ¤������%���vendor/symfony/debug/ErrorHandler.phpH��­²…_H��¹:D#¤������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��­²…_–��i‰æô¤������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��­²…_˜��-
  47. d2¤������1���vendor/symfony/debug/Exception/DummyException.php��­²…_��®+Ãê¤������6���vendor/symfony/debug/Exception/FatalErrorException.php��­²…_��™Ä¤������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��­²…_W��?àèK¤������3���vendor/symfony/debug/Exception/FlattenException.php¼��­²…_¼�� פ������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���­²…_~���ë¨oâ¤������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��­²…_š���ñJÀ¤������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��­²…_˜��nöêØ¤������)���vendor/symfony/debug/ExceptionHandler.php)3��­²…_)3���h5=¤������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��­²…_A��Ϥ¹l¤������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��­²…_��ĹBV¤������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��­²…_x��~ò"¤������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��­²…_O���ž¦*¤���������vendor/symfony/debug/LICENSE)��­²…_)��NUN½¤������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���­²…_i���$ ÿ›¤������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��­²…_¼��pí\¶¤������3���vendor/symfony/filesystem/Exception/IOException.php‡��­²…_‡��€ü#Ѥ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���­²…_¦���jÙwM¤������(���vendor/symfony/filesystem/Filesystem.phpc4��­²…_c4��‹×@þ¤������!���vendor/symfony/filesystem/LICENSE)��­²…_)��NUN½¤������)���vendor/symfony/filesystem/LockHandler.phpö��­²…_ö��ŸZµ1¤������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��­²…_\ ��hˆB¤������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���­²…_���HC€/¤������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��­²…_›��Mþ¤������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��­²…_3��75$·¤������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��­²…_��Ÿ`]¤������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��­²…_ô��Þdè;¤������/���vendor/symfony/finder/Comparator/Comparator.php���­²…_���¾üœµ¤������3���vendor/symfony/finder/Comparator/DateComparator.php#��­²…_#��°Τ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��­²…_|��ITÇͤ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���­²…_„���½¾sœ¤������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��­²…_¬��wR¤������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���­²…_„���Gz-¤������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��­²…_)��x§e¤������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��­²…_º��˜þ˜¤������/���vendor/symfony/finder/Expression/Expression.php��­²…_��i¥:Ť������)���vendor/symfony/finder/Expression/Glob.phpf��­²…_f��DÞcj¤������*���vendor/symfony/finder/Expression/Regex.php��­²…_��ü(ÃϤ������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��­²…_Í��\p4†¤������ ���vendor/symfony/finder/Finder.phpc.��­²…_c.��:ˆ5g¤���������vendor/symfony/finder/Glob.phpL��­²…_L��jÍ9פ������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��­²…_]��ÎoÅÆ¤������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��­²…_x��ôP¤������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��­²…_î��üÍ�q¤������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��­²…_í��nõH¤������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��­²…_#��G?T½¤������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��­²…_Z��(&ø¤������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��­²…_5��ší¤������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��­²…_r��tu¤������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��­²…_Ã��š+µÞ¤������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��­²…_-��ºÎÒ_¤������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��­²…_Ð��‚c¤������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��­²…_ ��ë]í»¤������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��­²…_e��Ÿ’áé¤������3���vendor/symfony/finder/Iterator/SortableIterator.php+��­²…_+��õÝË ¤���������vendor/symfony/finder/LICENSE)��­²…_)��NUN½¤������'���vendor/symfony/finder/Shell/Command.php> ��­²…_> ��_~u ¤������%���vendor/symfony/finder/Shell/Shell.phpr��­²…_r��þpN¤������%���vendor/symfony/finder/SplFileInfo.php��­²…_��þ�íù¤������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��­²…_H ��³�Õݤ������%���vendor/symfony/polyfill-ctype/LICENSE)��­²…_)��´`e0¤������+���vendor/symfony/polyfill-ctype/bootstrap.phpä��­²…_ä��—o£¤������(���vendor/symfony/polyfill-mbstring/LICENSE)��­²…_)��“\ª¤������-���vendor/symfony/polyfill-mbstring/Mbstring.php€G��­²…_€G��ɖз¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷T��­²…_÷T��ß2ª?¤������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��­²…_ã��öy_•¤������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpîU��­²…_îU��`þ8Q¤������.���vendor/symfony/polyfill-mbstring/bootstrap.php)��­²…_)��p¼B¤������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���­²…_f���]ö>T¤������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���­²…_¨���ÐÀ+_¤������3���vendor/symfony/process/Exception/LogicException.php”���­²…_”��� ³ãñ¤������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��­²…_x��¨Ìzy¤������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��­²…_��﫤������5���vendor/symfony/process/Exception/RuntimeException.php˜���­²…_˜���¢Ø:¤������+���vendor/symfony/process/ExecutableFinder.php���­²…_���ûus€¤���������vendor/symfony/process/LICENSE)��­²…_)��NUN½¤������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��­²…_Ï��Î%h¤������%���vendor/symfony/process/PhpProcess.phpü��­²…_ü��‡jûü¤������.���vendor/symfony/process/Pipes/AbstractPipes.php½��­²…_½��憤������/���vendor/symfony/process/Pipes/PipesInterface.phpD��­²…_D��vØî¡¤������*���vendor/symfony/process/Pipes/UnixPipes.php>��­²…_>��ª•ir¤������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��­²…_p ��âU~ɤ������"���vendor/symfony/process/Process.php·R��­²…_·R��Š`Õ¤������)���vendor/symfony/process/ProcessBuilder.phpâ
  48. ��­²…_â
  49. ��†M¶¤������'���vendor/symfony/process/ProcessUtils.phpQ��­²…_Q��b-$m¤���������vendor/seld/jsonlint/LICENSE"��­²…_"��aƒsy¤������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.phpk��­²…_k��Zù¶Ã¤������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.phpU2��­²…_U2��ús.Ƥ������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php#��­²…_#��Úá@,¤������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php%��­²…_%��`a„|¤������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���­²…_>���ÿqŸŸ¤������(���vendor/justinrainbow/json-schema/LICENSE ��­²…_ ��ºç©¤������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��­²…_ñ��fC¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��­²…_¡ ��†wÌl¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  50. ��­²…_�
  51. ��ÍèÓ¯¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��­²…_§ ��›Vؤ������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��­²…_¼��ÿ Qœ¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��­²…_]��VŽU<¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��­²…_ã ��á0;¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��­²…_…��“TœÚ¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��­²…_‡ ��ï›(¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��­²…_Ã��©Å¼x¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��­²…_0 ��×j´˜¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��­²…_��¥wš‡¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��­²…_a�� qä������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��­²…_—��4~¾ ¤������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��­²…_‰��“µ+j¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��­²…_&��4˜©T¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpS"��­²…_S"��¼¾õ:¤������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��­²…_è��{N–¤������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���­²…_I���%|°¤������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���­²…_•���‹àG¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���­²…_l���A!Lפ������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���­²…_l���è2÷þ¤������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���­²…_u���=hç¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���­²…_w���N-ò[¤������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��­²…_Þ��\¸
  52. ¤������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���­²…_o���píÛù¤������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���­²…_…���%…—¤������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���­²…_€���u-#1¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���­²…_j���å>�¤������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���­²…_f���¬¤„þ¤������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��­²…_þ��M�„õ¤������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��­²…_ ��f4÷³¤������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��­²…_œ ��åfO¤������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��­²…_��oŠ+}¤������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���­²…_á���[þA�¤������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��­²…_¥��Ô§Lb¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��­²…_%��5" ¤������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��­²…_,��1•5þ¤������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���­²…_®���ÿ‹Áå¤������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��­²…_ ��£Ÿ)à¤������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��­²…_F��¨IaD¤������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���­²…_ƒ���J€¤������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���­²…_…���íæe¤������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��­²…_v��õÍg¤������%���vendor/composer/spdx-licenses/LICENSE��­²…_��Bhí¤������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��­²…_H��͉T¤���������vendor/composer/semver/LICENSE��­²…_��Bhí¤������)���vendor/composer/semver/src/Comparator.php��­²…_��wlƒï¤������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��­²…_î��Õ­w-¤������4���vendor/composer/semver/src/Constraint/Constraint.php’ ��­²…_’ ��I&â¤������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���­²…_ß���0C,‡¤������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpä��­²…_ä��ïõ‚³¤������9���vendor/composer/semver/src/Constraint/MultiConstraint.php,��­²…_,��0°=¤������%���vendor/composer/semver/src/Semver.php‚��­²…_‚��?nݤ������,���vendor/composer/semver/src/VersionParser.php¬-��­²…_¬-��&\D̤������!���vendor/composer/ca-bundle/LICENSE��­²…_��*!^`¤������*���vendor/composer/ca-bundle/src/CaBundle.phpR��­²…_R��!Ã%�¤������&���vendor/composer/xdebug-handler/LICENSE)��­²…_)��#Ô;^¤������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��­²…_´��*D’�¤������.���vendor/composer/xdebug-handler/src/Process.phpp ��­²…_p ��i,i‘¤������-���vendor/composer/xdebug-handler/src/Status.php
  53. ��­²…_
  54. ��$Ÿv-¤������4���vendor/composer/xdebug-handler/src/XdebugHandler.php#��­²…_#��ñ†B¤���������vendor/psr/log/LICENSE=��­²…_=��p±ŽO¤������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��­²…_;��ñ>3[¤������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���­²…_`��� ˆX1¤������#���vendor/psr/log/Psr/Log/LogLevel.phpû���­²…_û���jðñ8¤������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���­²…_|���$£ˆ¤������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���­²…_§���T½úB¤������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��­²…_È��šx¤������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��­²…_k��£}‰’¤������%���vendor/psr/log/Psr/Log/NullLogger.php ���­²…_ ���ÆDi¯¤������)���vendor/psr/log/Psr/Log/Test/DummyTest.phpp���­²…_p���Τ������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.php ��­²…_ ��$/Ò¤������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��­²…_<��þ(åI¤���������vendor/autoload.php‚���­²…_‚���k–¤������'���vendor/composer/autoload_namespaces.phpd���­²…_d���Z¡¦H¤������!���vendor/composer/autoload_psr4.php÷��­²…_÷��Å*š¤������%���vendor/composer/autoload_classmap.phpd���­²…_d���Z¡¦H¤������"���vendor/composer/autoload_files.php��­²…_��¥� ®¤������!���vendor/composer/autoload_real.phpL��­²…_L��‘£¤������#���vendor/composer/autoload_static.php§
  55. ��­²…_§
  56. ��ôàß=¤���������vendor/composer/ClassLoader.php¶��­²…_¶��ôJ1¤������(���vendor/composer/ca-bundle/res/cacert.pemÜc�­²…_Üc�9ç‹ù¤������ ���bin/composerÊ��­²…_Ê���4K¤���������LICENSE.��­²…_.�� Õ¤������<?php
  57. namespace Composer\Autoload;
  58. use Composer\Config;
  59. use Composer\EventDispatcher\EventDispatcher;
  60. use Composer\Installer\InstallationManager;
  61. use Composer\IO\IOInterface;
  62. use Composer\Package\AliasPackage;
  63. use Composer\Package\PackageInterface;
  64. use Composer\Repository\InstalledRepositoryInterface;
  65. use Composer\Util\Filesystem;
  66. use Composer\Script\ScriptEvents;
  67. use Composer\Util\PackageSorter;
  68. class AutoloadGenerator
  69. {
  70. private $eventDispatcher;
  71. private $io;
  72. private $devMode = false;
  73. private $classMapAuthoritative = false;
  74. private $apcu = false;
  75. private $runScripts = false;
  76. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  77. {
  78. $this->eventDispatcher = $eventDispatcher;
  79. $this->io = $io;
  80. }
  81. public function setDevMode($devMode = true)
  82. {
  83. $this->devMode = (bool) $devMode;
  84. }
  85. public function setClassMapAuthoritative($classMapAuthoritative)
  86. {
  87. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  88. }
  89. public function setApcu($apcu)
  90. {
  91. $this->apcu = (bool) $apcu;
  92. }
  93. public function setRunScripts($runScripts = true)
  94. {
  95. $this->runScripts = (bool) $runScripts;
  96. }
  97. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsrPackages = false, $suffix = '')
  98. {
  99. if ($this->classMapAuthoritative) {
  100. $scanPsrPackages = true;
  101. }
  102. if ($this->runScripts) {
  103. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  104. 'optimize' => (bool) $scanPsrPackages,
  105. ));
  106. }
  107. $filesystem = new Filesystem();
  108. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  109. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  110. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  111. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  112. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  113. $targetDir = $vendorPath.'/'.$targetDir;
  114. $filesystem->ensureDirectoryExists($targetDir);
  115. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  116. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  117. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  118. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  119. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  120. $namespacesFile = <<<EOF
  121. <?php
  122. // autoload_namespaces.php @generated by Composer
  123. \$vendorDir = $vendorPathCode52;
  124. \$baseDir = $appBaseDirCode;
  125. return array(
  126. EOF;
  127. $psr4File = <<<EOF
  128. <?php
  129. // autoload_psr4.php @generated by Composer
  130. \$vendorDir = $vendorPathCode52;
  131. \$baseDir = $appBaseDirCode;
  132. return array(
  133. EOF;
  134. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  135. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  136. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  137. $exportedPaths = array();
  138. foreach ($paths as $path) {
  139. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  140. }
  141. $exportedPrefix = var_export($namespace, true);
  142. $namespacesFile .= " $exportedPrefix => ";
  143. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  144. }
  145. $namespacesFile .= ");\n";
  146. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  147. $exportedPaths = array();
  148. foreach ($paths as $path) {
  149. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  150. }
  151. $exportedPrefix = var_export($namespace, true);
  152. $psr4File .= " $exportedPrefix => ";
  153. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  154. }
  155. $psr4File .= ");\n";
  156. $classmapFile = <<<EOF
  157. <?php
  158. // autoload_classmap.php @generated by Composer
  159. \$vendorDir = $vendorPathCode52;
  160. \$baseDir = $appBaseDirCode;
  161. return array(
  162. EOF;
  163. $targetDirLoader = null;
  164. $mainAutoload = $mainPackage->getAutoload();
  165. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  166. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  167. $prefixes = implode(', ', array_map(function ($prefix) {
  168. return var_export($prefix, true);
  169. }, array_keys($mainAutoload['psr-0'])));
  170. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  171. $targetDirLoader = <<<EOF
  172. public static function autoload(\$class)
  173. {
  174. \$dir = $baseDirFromTargetDirCode . '/';
  175. \$prefixes = array($prefixes);
  176. foreach (\$prefixes as \$prefix) {
  177. if (0 !== strpos(\$class, \$prefix)) {
  178. continue;
  179. }
  180. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  181. if (!\$path = stream_resolve_include_path(\$path)) {
  182. return false;
  183. }
  184. require \$path;
  185. return true;
  186. }
  187. }
  188. EOF;
  189. }
  190. $excluded = null;
  191. if (!empty($autoloads['exclude-from-classmap'])) {
  192. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  193. }
  194. $classMap = array();
  195. $ambiguousClasses = array();
  196. $scannedFiles = array();
  197. foreach ($autoloads['classmap'] as $dir) {
  198. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, null, null, $classMap, $ambiguousClasses, $scannedFiles);
  199. }
  200. if ($scanPsrPackages) {
  201. $namespacesToScan = array();
  202. foreach (array('psr-4', 'psr-0') as $psrType) {
  203. foreach ($autoloads[$psrType] as $namespace => $paths) {
  204. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  205. }
  206. }
  207. krsort($namespacesToScan);
  208. foreach ($namespacesToScan as $namespace => $groups) {
  209. foreach ($groups as $group) {
  210. foreach ($group['paths'] as $dir) {
  211. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  212. if (!is_dir($dir)) {
  213. continue;
  214. }
  215. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespace, $group['type'], $classMap, $ambiguousClasses, $scannedFiles);
  216. }
  217. }
  218. }
  219. }
  220. foreach ($ambiguousClasses as $className => $ambigiousPaths) {
  221. $cleanPath = str_replace(array('$vendorDir . \'', '$baseDir . \'', "',\n"), array($vendorPath, $basePath, ''), $classMap[$className]);
  222. $this->io->writeError(
  223. '<warning>Warning: Ambiguous class resolution, "'.$className.'"'.
  224. ' was found '. (count($ambigiousPaths) + 1) .'x: in "'.$cleanPath.'" and "'. implode('", "', $ambigiousPaths) .'", the first will be used.</warning>'
  225. );
  226. }
  227. ksort($classMap);
  228. foreach ($classMap as $class => $code) {
  229. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  230. }
  231. $classmapFile .= ");\n";
  232. if (!$suffix) {
  233. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  234. $content = file_get_contents($vendorPath.'/autoload.php');
  235. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  236. $suffix = $match[1];
  237. }
  238. }
  239. if (!$suffix) {
  240. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  241. }
  242. }
  243. $this->filePutContentsIfModified($targetDir.'/autoload_namespaces.php', $namespacesFile);
  244. $this->filePutContentsIfModified($targetDir.'/autoload_psr4.php', $psr4File);
  245. $this->filePutContentsIfModified($targetDir.'/autoload_classmap.php', $classmapFile);
  246. $includePathFilePath = $targetDir.'/include_paths.php';
  247. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  248. $this->filePutContentsIfModified($includePathFilePath, $includePathFileContents);
  249. } elseif (file_exists($includePathFilePath)) {
  250. unlink($includePathFilePath);
  251. }
  252. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  253. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  254. $this->filePutContentsIfModified($includeFilesFilePath, $includeFilesFileContents);
  255. } elseif (file_exists($includeFilesFilePath)) {
  256. unlink($includeFilesFilePath);
  257. }
  258. $this->filePutContentsIfModified($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  259. $this->filePutContentsIfModified($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  260. $this->filePutContentsIfModified($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  261. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  262. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  263. if ($this->runScripts) {
  264. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  265. 'optimize' => (bool) $scanPsrPackages,
  266. ));
  267. }
  268. return count($classMap);
  269. }
  270. private function filePutContentsIfModified($path, $content)
  271. {
  272. $currentContent = @file_get_contents($path);
  273. if (!$currentContent || ($currentContent != $content)) {
  274. return file_put_contents($path, $content);
  275. }
  276. return 0;
  277. }
  278. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $excluded, $namespaceFilter, $autoloadType, array $classMap, array &$ambiguousClasses, array &$scannedFiles)
  279. {
  280. foreach ($this->generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, true, $scannedFiles) as $class => $path) {
  281. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  282. if (!isset($classMap[$class])) {
  283. $classMap[$class] = $pathCode;
  284. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  285. $ambiguousClasses[$class][] = $path;
  286. }
  287. }
  288. return $classMap;
  289. }
  290. private function generateClassMap($dir, $excluded, $namespaceFilter, $autoloadType, $showAmbiguousWarning, array &$scannedFiles)
  291. {
  292. return ClassMapGenerator::createMap($dir, $excluded, $showAmbiguousWarning ? $this->io : null, $namespaceFilter, $autoloadType, $scannedFiles);
  293. }
  294. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  295. {
  296. $packageMap = array(array($mainPackage, ''));
  297. foreach ($packages as $package) {
  298. if ($package instanceof AliasPackage) {
  299. continue;
  300. }
  301. $this->validatePackage($package);
  302. $packageMap[] = array(
  303. $package,
  304. $installationManager->getInstallPath($package),
  305. );
  306. }
  307. return $packageMap;
  308. }
  309. protected function validatePackage(PackageInterface $package)
  310. {
  311. $autoload = $package->getAutoload();
  312. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  313. $name = $package->getName();
  314. $package->getTargetDir();
  315. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  316. }
  317. if (!empty($autoload['psr-4'])) {
  318. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  319. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  320. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  321. }
  322. }
  323. }
  324. }
  325. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  326. {
  327. $mainPackageMap = array_shift($packageMap);
  328. if ($filterOutRequireDevPackages) {
  329. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  330. }
  331. $sortedPackageMap = $this->sortPackageMap($packageMap);
  332. $sortedPackageMap[] = $mainPackageMap;
  333. array_unshift($packageMap, $mainPackageMap);
  334. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  335. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  336. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  337. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  338. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  339. krsort($psr0);
  340. krsort($psr4);
  341. return array(
  342. 'psr-0' => $psr0,
  343. 'psr-4' => $psr4,
  344. 'classmap' => $classmap,
  345. 'files' => $files,
  346. 'exclude-from-classmap' => $exclude,
  347. );
  348. }
  349. public function createLoader(array $autoloads)
  350. {
  351. $loader = new ClassLoader();
  352. if (isset($autoloads['psr-0'])) {
  353. foreach ($autoloads['psr-0'] as $namespace => $path) {
  354. $loader->add($namespace, $path);
  355. }
  356. }
  357. if (isset($autoloads['psr-4'])) {
  358. foreach ($autoloads['psr-4'] as $namespace => $path) {
  359. $loader->addPsr4($namespace, $path);
  360. }
  361. }
  362. if (isset($autoloads['classmap'])) {
  363. $excluded = null;
  364. if (!empty($autoloads['exclude-from-classmap'])) {
  365. $excluded = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  366. }
  367. $scannedFiles = array();
  368. foreach ($autoloads['classmap'] as $dir) {
  369. try {
  370. $loader->addClassMap($this->generateClassMap($dir, $excluded, null, null, false, $scannedFiles));
  371. } catch (\RuntimeException $e) {
  372. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  373. }
  374. }
  375. }
  376. return $loader;
  377. }
  378. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  379. {
  380. $includePaths = array();
  381. foreach ($packageMap as $item) {
  382. list($package, $installPath) = $item;
  383. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  384. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  385. }
  386. foreach ($package->getIncludePaths() as $includePath) {
  387. $includePath = trim($includePath, '/');
  388. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  389. }
  390. }
  391. if (!$includePaths) {
  392. return;
  393. }
  394. $includePathsCode = '';
  395. foreach ($includePaths as $path) {
  396. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  397. }
  398. return <<<EOF
  399. <?php
  400. // include_paths.php @generated by Composer
  401. \$vendorDir = $vendorPathCode;
  402. \$baseDir = $appBaseDirCode;
  403. return array(
  404. $includePathsCode);
  405. EOF;
  406. }
  407. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  408. {
  409. $filesCode = '';
  410. foreach ($files as $fileIdentifier => $functionFile) {
  411. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  412. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  413. }
  414. if (!$filesCode) {
  415. return false;
  416. }
  417. return <<<EOF
  418. <?php
  419. // autoload_files.php @generated by Composer
  420. \$vendorDir = $vendorPathCode;
  421. \$baseDir = $appBaseDirCode;
  422. return array(
  423. $filesCode);
  424. EOF;
  425. }
  426. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  427. {
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $path = $basePath . '/' . $path;
  430. }
  431. $path = $filesystem->normalizePath($path);
  432. $baseDir = '';
  433. if (strpos($path.'/', $vendorPath.'/') === 0) {
  434. $path = substr($path, strlen($vendorPath));
  435. $baseDir = '$vendorDir';
  436. if ($path !== false) {
  437. $baseDir .= " . ";
  438. }
  439. } else {
  440. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  441. if (!$filesystem->isAbsolutePath($path)) {
  442. $baseDir = '$baseDir . ';
  443. $path = '/' . $path;
  444. }
  445. }
  446. if (strpos($path, '.phar') !== false) {
  447. $baseDir = "'phar://' . " . $baseDir;
  448. }
  449. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  450. }
  451. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  452. {
  453. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  454. if ("'" === $lastChar || '"' === $lastChar) {
  455. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  456. } else {
  457. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  458. }
  459. return <<<AUTOLOAD
  460. <?php
  461. // autoload.php @generated by Composer
  462. require_once $vendorPathToTargetDirCode;
  463. return ComposerAutoloaderInit$suffix::getLoader();
  464. AUTOLOAD;
  465. }
  466. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  467. {
  468. $file = <<<HEADER
  469. <?php
  470. // autoload_real.php @generated by Composer
  471. class ComposerAutoloaderInit$suffix
  472. {
  473. private static \$loader;
  474. public static function loadClassLoader(\$class)
  475. {
  476. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  477. require __DIR__ . '/ClassLoader.php';
  478. }
  479. }
  480. /**
  481. * @return \Composer\Autoload\ClassLoader
  482. */
  483. public static function getLoader()
  484. {
  485. if (null !== self::\$loader) {
  486. return self::\$loader;
  487. }
  488. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  489. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  490. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  491. HEADER;
  492. if ($useIncludePath) {
  493. $file .= <<<'INCLUDE_PATH'
  494. $includePaths = require __DIR__ . '/include_paths.php';
  495. $includePaths[] = get_include_path();
  496. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  497. INCLUDE_PATH;
  498. }
  499. $file .= <<<STATIC_INIT
  500. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  501. if (\$useStaticLoader) {
  502. require_once __DIR__ . '/autoload_static.php';
  503. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  504. } else {
  505. STATIC_INIT;
  506. if (!$this->classMapAuthoritative) {
  507. $file .= <<<'PSR04'
  508. $map = require __DIR__ . '/autoload_namespaces.php';
  509. foreach ($map as $namespace => $path) {
  510. $loader->set($namespace, $path);
  511. }
  512. $map = require __DIR__ . '/autoload_psr4.php';
  513. foreach ($map as $namespace => $path) {
  514. $loader->setPsr4($namespace, $path);
  515. }
  516. PSR04;
  517. }
  518. if ($useClassMap) {
  519. $file .= <<<'CLASSMAP'
  520. $classMap = require __DIR__ . '/autoload_classmap.php';
  521. if ($classMap) {
  522. $loader->addClassMap($classMap);
  523. }
  524. CLASSMAP;
  525. }
  526. $file .= " }\n\n";
  527. if ($this->classMapAuthoritative) {
  528. $file .= <<<'CLASSMAPAUTHORITATIVE'
  529. $loader->setClassMapAuthoritative(true);
  530. CLASSMAPAUTHORITATIVE;
  531. }
  532. if ($this->apcu) {
  533. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  534. $file .= <<<APCU
  535. \$loader->setApcuPrefix('$apcuPrefix');
  536. APCU;
  537. }
  538. if ($useGlobalIncludePath) {
  539. $file .= <<<'INCLUDEPATH'
  540. $loader->setUseIncludePath(true);
  541. INCLUDEPATH;
  542. }
  543. if ($targetDirLoader) {
  544. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  545. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  546. REGISTER_TARGET_DIR_AUTOLOAD;
  547. }
  548. $file .= <<<REGISTER_LOADER
  549. \$loader->register($prependAutoloader);
  550. REGISTER_LOADER;
  551. if ($useIncludeFiles) {
  552. $file .= <<<INCLUDE_FILES
  553. if (\$useStaticLoader) {
  554. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  555. } else {
  556. \$includeFiles = require __DIR__ . '/autoload_files.php';
  557. }
  558. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  559. composerRequire$suffix(\$fileIdentifier, \$file);
  560. }
  561. INCLUDE_FILES;
  562. }
  563. $file .= <<<METHOD_FOOTER
  564. return \$loader;
  565. }
  566. METHOD_FOOTER;
  567. $file .= $targetDirLoader;
  568. if ($useIncludeFiles) {
  569. return $file . <<<FOOTER
  570. }
  571. function composerRequire$suffix(\$fileIdentifier, \$file)
  572. {
  573. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  574. require \$file;
  575. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  576. }
  577. }
  578. FOOTER;
  579. }
  580. return $file . <<<FOOTER
  581. }
  582. FOOTER;
  583. }
  584. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  585. {
  586. $staticPhpVersion = 50600;
  587. $file = <<<HEADER
  588. <?php
  589. // autoload_static.php @generated by Composer
  590. namespace Composer\Autoload;
  591. class ComposerStaticInit$suffix
  592. {
  593. HEADER;
  594. $loader = new ClassLoader();
  595. $map = require $targetDir . '/autoload_namespaces.php';
  596. foreach ($map as $namespace => $path) {
  597. $loader->set($namespace, $path);
  598. }
  599. $map = require $targetDir . '/autoload_psr4.php';
  600. foreach ($map as $namespace => $path) {
  601. $loader->setPsr4($namespace, $path);
  602. }
  603. $classMap = require $targetDir . '/autoload_classmap.php';
  604. if ($classMap) {
  605. $loader->addClassMap($classMap);
  606. }
  607. $filesystem = new Filesystem();
  608. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  609. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  610. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  611. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  612. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  613. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  614. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  615. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  616. $initializer = '';
  617. $prefix = "\0Composer\Autoload\ClassLoader\0";
  618. $prefixLen = strlen($prefix);
  619. if (file_exists($targetDir . '/autoload_files.php')) {
  620. $maps = array('files' => require $targetDir . '/autoload_files.php');
  621. } else {
  622. $maps = array();
  623. }
  624. foreach ((array) $loader as $prop => $value) {
  625. if ($value && 0 === strpos($prop, $prefix)) {
  626. $maps[substr($prop, $prefixLen)] = $value;
  627. }
  628. }
  629. foreach ($maps as $prop => $value) {
  630. if (count($value) > 32767) {
  631. $staticPhpVersion = 70000;
  632. }
  633. $value = strtr(
  634. var_export($value, true),
  635. array(
  636. $absoluteVendorPathCode => $vendorPathCode,
  637. $absoluteVendorPharPathCode => $vendorPharPathCode,
  638. $absoluteAppBaseDirCode => $appBaseDirCode,
  639. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  640. )
  641. );
  642. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  643. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  644. if ('files' !== $prop) {
  645. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  646. }
  647. }
  648. return $file . <<<INITIALIZER
  649. public static function getInitializer(ClassLoader \$loader)
  650. {
  651. return \Closure::bind(function () use (\$loader) {
  652. $initializer
  653. }, null, ClassLoader::class);
  654. }
  655. }
  656. INITIALIZER;
  657. }
  658. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  659. {
  660. $autoloads = array();
  661. foreach ($packageMap as $item) {
  662. list($package, $installPath) = $item;
  663. $autoload = $package->getAutoload();
  664. if ($this->devMode && $package === $mainPackage) {
  665. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  666. }
  667. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  668. continue;
  669. }
  670. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  671. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  672. }
  673. foreach ($autoload[$type] as $namespace => $paths) {
  674. foreach ((array) $paths as $path) {
  675. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  676. if ($package === $mainPackage) {
  677. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  678. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  679. } else {
  680. $path = $package->getTargetDir() . '/' . $path;
  681. }
  682. }
  683. if ($type === 'exclude-from-classmap') {
  684. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  685. $path = str_replace('\\*\\*', '.+?', $path);
  686. $path = str_replace('\\*', '[^/]+?', $path);
  687. $updir = null;
  688. $path = preg_replace_callback(
  689. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  690. function ($matches) use (&$updir) {
  691. if (isset($matches[1])) {
  692. $updir = str_replace('\\.', '.', $matches[1]);
  693. }
  694. return '';
  695. },
  696. $path
  697. );
  698. if (empty($installPath)) {
  699. $installPath = strtr(getcwd(), '\\', '/');
  700. }
  701. $resolvedPath = realpath($installPath . '/' . $updir);
  702. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path . '($|/)';
  703. continue;
  704. }
  705. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  706. if ($type === 'files') {
  707. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  708. continue;
  709. } elseif ($type === 'classmap') {
  710. $autoloads[] = $relativePath;
  711. continue;
  712. }
  713. $autoloads[$namespace][] = $relativePath;
  714. }
  715. }
  716. }
  717. return $autoloads;
  718. }
  719. protected function getFileIdentifier(PackageInterface $package, $path)
  720. {
  721. return md5($package->getName() . ':' . $path);
  722. }
  723. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  724. {
  725. $packages = array();
  726. $include = array();
  727. $replacedBy = array();
  728. foreach ($packageMap as $item) {
  729. $package = $item[0];
  730. $name = $package->getName();
  731. $packages[$name] = $package;
  732. foreach ($package->getReplaces() as $replace) {
  733. $replacedBy[$replace->getTarget()] = $name;
  734. }
  735. }
  736. $add = function (PackageInterface $package) use (&$add, $packages, &$include, $replacedBy) {
  737. foreach ($package->getRequires() as $link) {
  738. $target = $link->getTarget();
  739. if (isset($replacedBy[$target])) {
  740. $target = $replacedBy[$target];
  741. }
  742. if (!isset($include[$target])) {
  743. $include[$target] = true;
  744. if (isset($packages[$target])) {
  745. $add($packages[$target]);
  746. }
  747. }
  748. }
  749. };
  750. $add($mainPackage);
  751. return array_filter(
  752. $packageMap,
  753. function ($item) use ($include) {
  754. $package = $item[0];
  755. foreach ($package->getNames() as $name) {
  756. if (isset($include[$name])) {
  757. return true;
  758. }
  759. }
  760. return false;
  761. }
  762. );
  763. }
  764. protected function sortPackageMap(array $packageMap)
  765. {
  766. $packages = array();
  767. $paths = array();
  768. foreach ($packageMap as $item) {
  769. list($package, $path) = $item;
  770. $name = $package->getName();
  771. $packages[$name] = $package;
  772. $paths[$name] = $path;
  773. }
  774. $sortedPackages = PackageSorter::sortPackages($packages);
  775. $sortedPackageMap = array();
  776. foreach ($sortedPackages as $package) {
  777. $name = $package->getName();
  778. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  779. }
  780. return $sortedPackageMap;
  781. }
  782. protected function safeCopy($source, $target)
  783. {
  784. if (!file_exists($target) || !file_exists($source) || !$this->filesAreEqual($source, $target)) {
  785. $source = fopen($source, 'r');
  786. $target = fopen($target, 'w+');
  787. stream_copy_to_stream($source, $target);
  788. fclose($source);
  789. fclose($target);
  790. }
  791. }
  792. private function filesAreEqual($a, $b)
  793. {
  794. if (filesize($a) !== filesize($b)) {
  795. return false;
  796. }
  797. $ah = fopen($a, 'rb');
  798. $bh = fopen($b, 'rb');
  799. $result = true;
  800. while (!feof($ah)) {
  801. if (fread($ah, 8192) != fread($bh, 8192)) {
  802. $result = false;
  803. break;
  804. }
  805. }
  806. fclose($ah);
  807. fclose($bh);
  808. return $result;
  809. }
  810. }
  811. <?php
  812. namespace Composer\Autoload;
  813. use Symfony\Component\Finder\Finder;
  814. use Composer\IO\IOInterface;
  815. use Composer\Util\Filesystem;
  816. class ClassMapGenerator
  817. {
  818. public static function dump($dirs, $file)
  819. {
  820. $maps = array();
  821. foreach ($dirs as $dir) {
  822. $maps = array_merge($maps, static::createMap($dir));
  823. }
  824. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  825. }
  826. public static function createMap($path, $excluded = null, IOInterface $io = null, $namespace = null, $autoloadType = null, &$scannedFiles = array())
  827. {
  828. if (is_string($path)) {
  829. $basePath = $path;
  830. if (is_file($path)) {
  831. $path = array(new \SplFileInfo($path));
  832. } elseif (is_dir($path)) {
  833. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  834. } else {
  835. throw new \RuntimeException(
  836. 'Could not scan for classes inside "'.$path.
  837. '" which does not appear to be a file nor a folder'
  838. );
  839. }
  840. } elseif (null !== $autoloadType) {
  841. throw new \RuntimeException('Path must be a string when specifying an autoload type');
  842. }
  843. $map = array();
  844. $filesystem = new Filesystem();
  845. $cwd = realpath(getcwd());
  846. foreach ($path as $file) {
  847. $filePath = $file->getPathname();
  848. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  849. continue;
  850. }
  851. if (!$filesystem->isAbsolutePath($filePath)) {
  852. $filePath = $cwd . '/' . $filePath;
  853. $filePath = $filesystem->normalizePath($filePath);
  854. } else {
  855. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  856. }
  857. $realPath = realpath($filePath);
  858. if (isset($scannedFiles[$realPath])) {
  859. continue;
  860. }
  861. if ($excluded && preg_match($excluded, strtr($realPath, '\\', '/'))) {
  862. continue;
  863. }
  864. if ($excluded && preg_match($excluded, strtr($filePath, '\\', '/'))) {
  865. continue;
  866. }
  867. $classes = self::findClasses($filePath);
  868. if (null !== $autoloadType) {
  869. list($classes, $validClasses) = self::filterByNamespace($classes, $filePath, $namespace, $autoloadType, $basePath, $io);
  870. if ($validClasses) {
  871. $scannedFiles[$realPath] = true;
  872. }
  873. } else {
  874. $scannedFiles[$realPath] = true;
  875. }
  876. foreach ($classes as $class) {
  877. if ( null !== $namespace && '' !== $namespace && 0 !== strpos($class, $namespace)) {
  878. continue;
  879. }
  880. if (!isset($map[$class])) {
  881. $map[$class] = $filePath;
  882. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  883. $io->writeError(
  884. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  885. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  886. );
  887. }
  888. }
  889. }
  890. return $map;
  891. }
  892. private static function filterByNamespace($classes, $filePath, $baseNamespace, $namespaceType, $basePath, $io)
  893. {
  894. $validClasses = array();
  895. $rejectedClasses = array();
  896. $realSubPath = substr($filePath, strlen($basePath) + 1);
  897. $realSubPath = substr($realSubPath, 0, strrpos($realSubPath, '.'));
  898. foreach ($classes as $class) {
  899. if ('' !== $baseNamespace && 0 !== strpos($class, $baseNamespace)) {
  900. continue;
  901. }
  902. if ('psr-0' === $namespaceType) {
  903. $namespaceLength = strrpos($class, '\\');
  904. if (false !== $namespaceLength) {
  905. $namespace = substr($class, 0, $namespaceLength + 1);
  906. $className = substr($class, $namespaceLength + 1);
  907. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $namespace)
  908. . str_replace('_', DIRECTORY_SEPARATOR, $className);
  909. }
  910. else {
  911. $subPath = str_replace('_', DIRECTORY_SEPARATOR, $class);
  912. }
  913. } elseif ('psr-4' === $namespaceType) {
  914. $subNamespace = ('' !== $baseNamespace) ? substr($class, strlen($baseNamespace)) : $class;
  915. $subPath = str_replace('\\', DIRECTORY_SEPARATOR, $subNamespace);
  916. } else {
  917. throw new \RuntimeException("namespaceType must be psr-0 or psr-4, $namespaceType given");
  918. }
  919. if ($subPath === $realSubPath) {
  920. $validClasses[] = $class;
  921. } else {
  922. $rejectedClasses[] = $class;
  923. }
  924. }
  925. if (empty($validClasses)) {
  926. foreach ($rejectedClasses as $class) {
  927. trigger_error(
  928. "Class $class located in ".preg_replace('{^'.preg_quote(getcwd()).'}', '.', $filePath, 1)." does not comply with $namespaceType autoloading standard. It will not autoload anymore in Composer v2.0.",
  929. E_USER_DEPRECATED
  930. );
  931. }
  932. }
  933. return array($classes, $validClasses);
  934. }
  935. private static function findClasses($path)
  936. {
  937. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  938. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  939. $extraTypes .= '|enum';
  940. }
  941. $contents = @php_strip_whitespace($path);
  942. if (!$contents) {
  943. if (!file_exists($path)) {
  944. $message = 'File at "%s" does not exist, check your classmap definitions';
  945. } elseif (!is_readable($path)) {
  946. $message = 'File at "%s" is not readable, check its permissions';
  947. } elseif ('' === trim(file_get_contents($path))) {
  948. return array();
  949. } else {
  950. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  951. }
  952. $error = error_get_last();
  953. if (isset($error['message'])) {
  954. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  955. }
  956. throw new \RuntimeException(sprintf($message, $path));
  957. }
  958. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  959. return array();
  960. }
  961. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  962. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  963. if (substr($contents, 0, 2) !== '<?') {
  964. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  965. if ($replacements === 0) {
  966. return array();
  967. }
  968. }
  969. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  970. $pos = strrpos($contents, '?>');
  971. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  972. $contents = substr($contents, 0, $pos);
  973. }
  974. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  975. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  976. }
  977. preg_match_all('{
  978. (?:
  979. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  980. | \b(?<![\$:>])(?P<ns>namespace) (?P<nsname>\s++[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+(?:\s*+\\\\\s*+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*+)*+)? \s*+ [\{;]
  981. )
  982. }ix', $contents, $matches);
  983. $classes = array();
  984. $namespace = '';
  985. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  986. if (!empty($matches['ns'][$i])) {
  987. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  988. } else {
  989. $name = $matches['name'][$i];
  990. if ($name === 'extends' || $name === 'implements') {
  991. continue;
  992. }
  993. if ($name[0] === ':') {
  994. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  995. } elseif ($matches['type'][$i] === 'enum') {
  996. $name = rtrim($name, ':');
  997. }
  998. $classes[] = ltrim($namespace . $name, '\\');
  999. }
  1000. }
  1001. return $classes;
  1002. }
  1003. }
  1004. <?php
  1005. namespace Composer;
  1006. use Composer\IO\IOInterface;
  1007. use Composer\Util\Filesystem;
  1008. use Composer\Util\Silencer;
  1009. use Symfony\Component\Finder\Finder;
  1010. class Cache
  1011. {
  1012. private static $cacheCollected = false;
  1013. private $io;
  1014. private $root;
  1015. private $enabled = true;
  1016. private $allowList;
  1017. private $filesystem;
  1018. public function __construct(IOInterface $io, $cacheDir, $allowList = 'a-z0-9.', Filesystem $filesystem = null)
  1019. {
  1020. $this->io = $io;
  1021. $this->root = rtrim($cacheDir, '/\\') . '/';
  1022. $this->allowList = $allowList;
  1023. $this->filesystem = $filesystem ?: new Filesystem();
  1024. if (!self::isUsable($cacheDir)) {
  1025. $this->enabled = false;
  1026. return;
  1027. }
  1028. if (
  1029. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  1030. || !is_writable($this->root)
  1031. ) {
  1032. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  1033. $this->enabled = false;
  1034. }
  1035. }
  1036. public static function isUsable($path)
  1037. {
  1038. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  1039. }
  1040. public function isEnabled()
  1041. {
  1042. return $this->enabled;
  1043. }
  1044. public function getRoot()
  1045. {
  1046. return $this->root;
  1047. }
  1048. public function read($file)
  1049. {
  1050. if ($this->enabled) {
  1051. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1052. if (file_exists($this->root . $file)) {
  1053. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1054. return file_get_contents($this->root . $file);
  1055. }
  1056. }
  1057. return false;
  1058. }
  1059. public function write($file, $contents)
  1060. {
  1061. if ($this->enabled) {
  1062. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1063. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  1064. try {
  1065. return file_put_contents($this->root . $file, $contents);
  1066. } catch (\ErrorException $e) {
  1067. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  1068. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  1069. unlink($this->root . $file);
  1070. $message = sprintf(
  1071. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  1072. $this->root . $file,
  1073. $m[1],
  1074. $m[2],
  1075. @disk_free_space($this->root . dirname($file))
  1076. );
  1077. $this->io->writeError($message);
  1078. return false;
  1079. }
  1080. throw $e;
  1081. }
  1082. }
  1083. return false;
  1084. }
  1085. public function copyFrom($file, $source)
  1086. {
  1087. if ($this->enabled) {
  1088. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1089. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  1090. if (!file_exists($source)) {
  1091. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  1092. } elseif ($this->io->isDebug()) {
  1093. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  1094. }
  1095. return copy($source, $this->root . $file);
  1096. }
  1097. return false;
  1098. }
  1099. public function copyTo($file, $target)
  1100. {
  1101. if ($this->enabled) {
  1102. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1103. if (file_exists($this->root . $file)) {
  1104. try {
  1105. touch($this->root . $file, filemtime($this->root . $file), time());
  1106. } catch (\ErrorException $e) {
  1107. Silencer::call('touch', $this->root . $file);
  1108. }
  1109. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1110. return copy($this->root . $file, $target);
  1111. }
  1112. }
  1113. return false;
  1114. }
  1115. public function gcIsNecessary()
  1116. {
  1117. return (!self::$cacheCollected && !mt_rand(0, 50));
  1118. }
  1119. public function remove($file)
  1120. {
  1121. if ($this->enabled) {
  1122. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1123. if (file_exists($this->root . $file)) {
  1124. return $this->filesystem->unlink($this->root . $file);
  1125. }
  1126. }
  1127. return false;
  1128. }
  1129. public function clear()
  1130. {
  1131. if ($this->enabled) {
  1132. $this->filesystem->emptyDirectory($this->root);
  1133. return true;
  1134. }
  1135. return false;
  1136. }
  1137. public function gc($ttl, $maxSize)
  1138. {
  1139. if ($this->enabled) {
  1140. $expire = new \DateTime();
  1141. $expire->modify('-'.$ttl.' seconds');
  1142. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1143. foreach ($finder as $file) {
  1144. $this->filesystem->unlink($file->getPathname());
  1145. }
  1146. $totalSize = $this->filesystem->size($this->root);
  1147. if ($totalSize > $maxSize) {
  1148. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1149. while ($totalSize > $maxSize && $iterator->valid()) {
  1150. $filepath = $iterator->current()->getPathname();
  1151. $totalSize -= $this->filesystem->size($filepath);
  1152. $this->filesystem->unlink($filepath);
  1153. $iterator->next();
  1154. }
  1155. }
  1156. self::$cacheCollected = true;
  1157. return true;
  1158. }
  1159. return false;
  1160. }
  1161. public function sha1($file)
  1162. {
  1163. if ($this->enabled) {
  1164. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1165. if (file_exists($this->root . $file)) {
  1166. return sha1_file($this->root . $file);
  1167. }
  1168. }
  1169. return false;
  1170. }
  1171. public function sha256($file)
  1172. {
  1173. if ($this->enabled) {
  1174. $file = preg_replace('{[^'.$this->allowList.']}i', '-', $file);
  1175. if (file_exists($this->root . $file)) {
  1176. return hash_file('sha256', $this->root . $file);
  1177. }
  1178. }
  1179. return false;
  1180. }
  1181. protected function getFinder()
  1182. {
  1183. return Finder::create()->in($this->root)->files();
  1184. }
  1185. }
  1186. <?php
  1187. namespace Composer\Command;
  1188. use Symfony\Component\Console\Input\InputInterface;
  1189. use Symfony\Component\Console\Output\OutputInterface;
  1190. class AboutCommand extends BaseCommand
  1191. {
  1192. protected function configure()
  1193. {
  1194. $this
  1195. ->setName('about')
  1196. ->setDescription('Shows the short information about Composer.')
  1197. ->setHelp(
  1198. <<<EOT
  1199. <info>php composer.phar about</info>
  1200. EOT
  1201. )
  1202. ;
  1203. }
  1204. protected function execute(InputInterface $input, OutputInterface $output)
  1205. {
  1206. $this->getIO()->write(
  1207. <<<EOT
  1208. <info>Composer - Dependency Manager for PHP</info>
  1209. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1210. See https://getcomposer.org/ for more information.</comment>
  1211. EOT
  1212. );
  1213. return 0;
  1214. }
  1215. }
  1216. <?php
  1217. namespace Composer\Command;
  1218. use Composer\Factory;
  1219. use Composer\IO\IOInterface;
  1220. use Composer\Config;
  1221. use Composer\Composer;
  1222. use Composer\Repository\CompositeRepository;
  1223. use Composer\Repository\RepositoryFactory;
  1224. use Composer\Script\ScriptEvents;
  1225. use Composer\Plugin\CommandEvent;
  1226. use Composer\Plugin\PluginEvents;
  1227. use Composer\Util\Filesystem;
  1228. use Symfony\Component\Console\Input\InputArgument;
  1229. use Symfony\Component\Console\Input\InputInterface;
  1230. use Symfony\Component\Console\Input\InputOption;
  1231. use Symfony\Component\Console\Output\OutputInterface;
  1232. class ArchiveCommand extends BaseCommand
  1233. {
  1234. protected function configure()
  1235. {
  1236. $this
  1237. ->setName('archive')
  1238. ->setDescription('Creates an archive of this composer package.')
  1239. ->setDefinition(array(
  1240. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1241. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1242. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1243. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1244. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1245. .' Note that the format will be appended.'),
  1246. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1247. ))
  1248. ->setHelp(
  1249. <<<EOT
  1250. The <info>archive</info> command creates an archive of the specified format
  1251. containing the files and directories of the Composer project or the specified
  1252. package in the specified version and writes it to the specified directory.
  1253. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1254. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1255. EOT
  1256. )
  1257. ;
  1258. }
  1259. protected function execute(InputInterface $input, OutputInterface $output)
  1260. {
  1261. $composer = $this->getComposer(false);
  1262. $config = null;
  1263. if ($composer) {
  1264. $config = $composer->getConfig();
  1265. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1266. $eventDispatcher = $composer->getEventDispatcher();
  1267. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1268. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1269. }
  1270. if (!$config) {
  1271. $config = Factory::createConfig();
  1272. }
  1273. if (null === $input->getOption('format')) {
  1274. $input->setOption('format', $config->get('archive-format'));
  1275. }
  1276. if (null === $input->getOption('dir')) {
  1277. $input->setOption('dir', $config->get('archive-dir'));
  1278. }
  1279. $returnCode = $this->archive(
  1280. $this->getIO(),
  1281. $config,
  1282. $input->getArgument('package'),
  1283. $input->getArgument('version'),
  1284. $input->getOption('format'),
  1285. $input->getOption('dir'),
  1286. $input->getOption('file'),
  1287. $input->getOption('ignore-filters'),
  1288. $composer
  1289. );
  1290. if (0 === $returnCode && $composer) {
  1291. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1292. }
  1293. return $returnCode;
  1294. }
  1295. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1296. {
  1297. if ($composer) {
  1298. $archiveManager = $composer->getArchiveManager();
  1299. } else {
  1300. $factory = new Factory;
  1301. $downloadManager = $factory->createDownloadManager($io, $config);
  1302. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1303. }
  1304. if ($packageName) {
  1305. $package = $this->selectPackage($io, $packageName, $version);
  1306. if (!$package) {
  1307. return 1;
  1308. }
  1309. } else {
  1310. $package = $this->getComposer()->getPackage();
  1311. }
  1312. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1313. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1314. $fs = new Filesystem;
  1315. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1316. $io->writeError('Created: ', false);
  1317. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1318. return 0;
  1319. }
  1320. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1321. {
  1322. $io->writeError('<info>Searching for the specified package.</info>');
  1323. if ($composer = $this->getComposer(false)) {
  1324. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1325. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1326. } else {
  1327. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1328. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1329. $repo = new CompositeRepository($defaultRepos);
  1330. }
  1331. $packages = $repo->findPackages($packageName, $version);
  1332. if (count($packages) > 1) {
  1333. $package = reset($packages);
  1334. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1335. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1336. return $p->getPrettyString();
  1337. }, $packages)).'.');
  1338. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1339. } elseif ($packages) {
  1340. $package = reset($packages);
  1341. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1342. } else {
  1343. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1344. return false;
  1345. }
  1346. return $package;
  1347. }
  1348. }
  1349. <?php
  1350. namespace Composer\Command;
  1351. use Composer\Composer;
  1352. use Composer\Config;
  1353. use Composer\Console\Application;
  1354. use Composer\Factory;
  1355. use Composer\IO\IOInterface;
  1356. use Composer\IO\NullIO;
  1357. use Composer\Plugin\PreCommandRunEvent;
  1358. use Composer\Plugin\PluginEvents;
  1359. use Symfony\Component\Console\Input\InputInterface;
  1360. use Symfony\Component\Console\Output\OutputInterface;
  1361. use Symfony\Component\Console\Command\Command;
  1362. abstract class BaseCommand extends Command
  1363. {
  1364. private $composer;
  1365. private $io;
  1366. public function getComposer($required = true, $disablePlugins = null)
  1367. {
  1368. if (null === $this->composer) {
  1369. $application = $this->getApplication();
  1370. if ($application instanceof Application) {
  1371. $this->composer = $application->getComposer($required, $disablePlugins);
  1372. } elseif ($required) {
  1373. throw new \RuntimeException(
  1374. 'Could not create a Composer\Composer instance, you must inject '.
  1375. 'one if this command is not used with a Composer\Console\Application instance'
  1376. );
  1377. }
  1378. }
  1379. return $this->composer;
  1380. }
  1381. public function setComposer(Composer $composer)
  1382. {
  1383. $this->composer = $composer;
  1384. }
  1385. public function resetComposer()
  1386. {
  1387. $this->composer = null;
  1388. $this->getApplication()->resetComposer();
  1389. }
  1390. public function isProxyCommand()
  1391. {
  1392. return false;
  1393. }
  1394. public function getIO()
  1395. {
  1396. if (null === $this->io) {
  1397. $application = $this->getApplication();
  1398. if ($application instanceof Application) {
  1399. $this->io = $application->getIO();
  1400. } else {
  1401. $this->io = new NullIO();
  1402. }
  1403. }
  1404. return $this->io;
  1405. }
  1406. public function setIO(IOInterface $io)
  1407. {
  1408. $this->io = $io;
  1409. }
  1410. protected function initialize(InputInterface $input, OutputInterface $output)
  1411. {
  1412. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1413. $composer = $this->getComposer(false, $disablePlugins);
  1414. if (null === $composer) {
  1415. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1416. }
  1417. if ($composer) {
  1418. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1419. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1420. }
  1421. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1422. $input->setOption('no-progress', true);
  1423. }
  1424. parent::initialize($input, $output);
  1425. }
  1426. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1427. {
  1428. $preferSource = false;
  1429. $preferDist = false;
  1430. switch ($config->get('preferred-install')) {
  1431. case 'source':
  1432. $preferSource = true;
  1433. break;
  1434. case 'dist':
  1435. $preferDist = true;
  1436. break;
  1437. case 'auto':
  1438. default:
  1439. break;
  1440. }
  1441. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1442. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1443. $preferDist = $input->getOption('prefer-dist');
  1444. }
  1445. return array($preferSource, $preferDist);
  1446. }
  1447. }
  1448. <?php
  1449. namespace Composer\Command;
  1450. use Composer\DependencyResolver\Pool;
  1451. use Composer\Package\Link;
  1452. use Composer\Package\PackageInterface;
  1453. use Composer\Repository\ArrayRepository;
  1454. use Composer\Repository\CompositeRepository;
  1455. use Composer\Repository\PlatformRepository;
  1456. use Composer\Repository\RepositoryFactory;
  1457. use Composer\Plugin\CommandEvent;
  1458. use Composer\Plugin\PluginEvents;
  1459. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1460. use Composer\Package\Version\VersionParser;
  1461. use Symfony\Component\Console\Helper\Table;
  1462. use Symfony\Component\Console\Input\InputArgument;
  1463. use Symfony\Component\Console\Input\InputInterface;
  1464. use Symfony\Component\Console\Input\InputOption;
  1465. use Symfony\Component\Console\Output\OutputInterface;
  1466. class BaseDependencyCommand extends BaseCommand
  1467. {
  1468. const ARGUMENT_PACKAGE = 'package';
  1469. const ARGUMENT_CONSTRAINT = 'constraint';
  1470. const OPTION_RECURSIVE = 'recursive';
  1471. const OPTION_TREE = 'tree';
  1472. protected $colors;
  1473. protected function configure()
  1474. {
  1475. $this->setDefinition(array(
  1476. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1477. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1478. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1479. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1480. ));
  1481. }
  1482. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1483. {
  1484. $composer = $this->getComposer();
  1485. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1486. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1487. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1488. $repository = new CompositeRepository(array(
  1489. new ArrayRepository(array($composer->getPackage())),
  1490. $composer->getRepositoryManager()->getLocalRepository(),
  1491. new PlatformRepository(array(), $platformOverrides),
  1492. ));
  1493. $pool = new Pool();
  1494. $pool->addRepository($repository);
  1495. list($needle, $textConstraint) = array_pad(
  1496. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1497. 2,
  1498. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1499. );
  1500. $packages = $pool->whatProvides(strtolower($needle));
  1501. if (empty($packages)) {
  1502. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1503. }
  1504. if (!$repository->findPackage($needle, $textConstraint)) {
  1505. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1506. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1507. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1508. }
  1509. }
  1510. $needles = array($needle);
  1511. if ($inverted) {
  1512. foreach ($packages as $package) {
  1513. $needles = array_merge($needles, array_map(function (Link $link) {
  1514. return $link->getTarget();
  1515. }, $package->getReplaces()));
  1516. }
  1517. }
  1518. if ('*' !== $textConstraint) {
  1519. $versionParser = new VersionParser();
  1520. $constraint = $versionParser->parseConstraints($textConstraint);
  1521. } else {
  1522. $constraint = null;
  1523. }
  1524. $renderTree = $input->getOption(self::OPTION_TREE);
  1525. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1526. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1527. if (empty($results)) {
  1528. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1529. $this->getIO()->writeError(sprintf(
  1530. '<info>There is no installed package depending on "%s"%s</info>',
  1531. $needle,
  1532. $extra
  1533. ));
  1534. } elseif ($renderTree) {
  1535. $this->initStyles($output);
  1536. $root = $packages[0];
  1537. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1538. $this->printTree($results);
  1539. } else {
  1540. $this->printTable($output, $results);
  1541. }
  1542. return 0;
  1543. }
  1544. protected function printTable(OutputInterface $output, $results)
  1545. {
  1546. $table = array();
  1547. $doubles = array();
  1548. do {
  1549. $queue = array();
  1550. $rows = array();
  1551. foreach ($results as $result) {
  1552. list($package, $link, $children) = $result;
  1553. $unique = (string) $link;
  1554. if (isset($doubles[$unique])) {
  1555. continue;
  1556. }
  1557. $doubles[$unique] = true;
  1558. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1559. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1560. if ($children) {
  1561. $queue = array_merge($queue, $children);
  1562. }
  1563. }
  1564. $results = $queue;
  1565. $table = array_merge($rows, $table);
  1566. } while (!empty($results));
  1567. $renderer = new Table($output);
  1568. $renderer->setStyle('compact');
  1569. $rendererStyle = $renderer->getStyle();
  1570. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1571. $rendererStyle->setVerticalBorderChars('');
  1572. } else {
  1573. $rendererStyle->setVerticalBorderChar('');
  1574. }
  1575. $rendererStyle->setCellRowContentFormat('%s ');
  1576. $renderer->setRows($table)->render();
  1577. }
  1578. protected function initStyles(OutputInterface $output)
  1579. {
  1580. $this->colors = array(
  1581. 'green',
  1582. 'yellow',
  1583. 'cyan',
  1584. 'magenta',
  1585. 'blue',
  1586. );
  1587. foreach ($this->colors as $color) {
  1588. $style = new OutputFormatterStyle($color);
  1589. $output->getFormatter()->setStyle($color, $style);
  1590. }
  1591. }
  1592. protected function printTree($results, $prefix = '', $level = 1)
  1593. {
  1594. $count = count($results);
  1595. $idx = 0;
  1596. foreach ($results as $result) {
  1597. list($package, $link, $children) = $result;
  1598. $color = $this->colors[$level % count($this->colors)];
  1599. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1600. $isLast = (++$idx == $count);
  1601. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1602. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1603. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1604. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1605. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1606. if ($children) {
  1607. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1608. }
  1609. }
  1610. }
  1611. private function writeTreeLine($line)
  1612. {
  1613. $io = $this->getIO();
  1614. if (!$io->isDecorated()) {
  1615. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1616. }
  1617. $io->write($line);
  1618. }
  1619. }
  1620. <?php
  1621. namespace Composer\Command;
  1622. use Composer\Package\Link;
  1623. use Composer\Package\PackageInterface;
  1624. use Composer\Semver\Constraint\Constraint;
  1625. use Symfony\Component\Console\Helper\Table;
  1626. use Symfony\Component\Console\Input\InputInterface;
  1627. use Symfony\Component\Console\Input\InputOption;
  1628. use Symfony\Component\Console\Output\OutputInterface;
  1629. use Composer\Repository\PlatformRepository;
  1630. class CheckPlatformReqsCommand extends BaseCommand
  1631. {
  1632. protected function configure()
  1633. {
  1634. $this->setName('check-platform-reqs')
  1635. ->setDescription('Check that platform requirements are satisfied.')
  1636. ->setDefinition(array(
  1637. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1638. ))
  1639. ->setHelp(
  1640. <<<EOT
  1641. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1642. Unlike update/install, this command will ignore config.platform settings and check the real platform packages so you can be certain you have the required platform dependencies.
  1643. <info>php composer.phar check-platform-reqs</info>
  1644. EOT
  1645. );
  1646. }
  1647. protected function execute(InputInterface $input, OutputInterface $output)
  1648. {
  1649. $composer = $this->getComposer();
  1650. $requires = $composer->getPackage()->getRequires();
  1651. if ($input->getOption('no-dev')) {
  1652. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1653. } else {
  1654. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1655. if (!$dependencies) {
  1656. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1657. }
  1658. $requires += $composer->getPackage()->getDevRequires();
  1659. }
  1660. foreach ($requires as $require => $link) {
  1661. $requires[$require] = array($link);
  1662. }
  1663. foreach ($dependencies as $package) {
  1664. foreach ($package->getRequires() as $require => $link) {
  1665. $requires[$require][] = $link;
  1666. }
  1667. }
  1668. ksort($requires);
  1669. $platformRepo = new PlatformRepository(array(), array());
  1670. $currentPlatformPackages = $platformRepo->getPackages();
  1671. $currentPlatformPackageMap = array();
  1672. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1673. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1674. }
  1675. $results = array();
  1676. $exitCode = 0;
  1677. foreach ($requires as $require => $links) {
  1678. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1679. if (isset($currentPlatformPackageMap[$require])) {
  1680. $pass = true;
  1681. $version = $currentPlatformPackageMap[$require]->getVersion();
  1682. foreach ($links as $link) {
  1683. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1684. $results[] = array(
  1685. $currentPlatformPackageMap[$require]->getPrettyName(),
  1686. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1687. $link,
  1688. '<error>failed</error>',
  1689. );
  1690. $pass = false;
  1691. $exitCode = max($exitCode, 1);
  1692. }
  1693. }
  1694. if ($pass) {
  1695. $results[] = array(
  1696. $currentPlatformPackageMap[$require]->getPrettyName(),
  1697. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1698. null,
  1699. '<info>success</info>',
  1700. );
  1701. }
  1702. } else {
  1703. $results[] = array(
  1704. $require,
  1705. 'n/a',
  1706. $links[0],
  1707. '<error>missing</error>',
  1708. );
  1709. $exitCode = max($exitCode, 2);
  1710. }
  1711. }
  1712. }
  1713. $this->printTable($output, $results);
  1714. return $exitCode;
  1715. }
  1716. protected function printTable(OutputInterface $output, $results)
  1717. {
  1718. $table = array();
  1719. $rows = array();
  1720. foreach ($results as $result) {
  1721. list($platformPackage, $version, $link, $status) = $result;
  1722. $rows[] = array(
  1723. $platformPackage,
  1724. $version,
  1725. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1726. $status,
  1727. );
  1728. }
  1729. $table = array_merge($rows, $table);
  1730. $renderer = new Table($output);
  1731. $renderer->setStyle('compact');
  1732. $rendererStyle = $renderer->getStyle();
  1733. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  1734. $rendererStyle->setVerticalBorderChars('');
  1735. } else {
  1736. $rendererStyle->setVerticalBorderChar('');
  1737. }
  1738. $rendererStyle->setCellRowContentFormat('%s ');
  1739. $renderer->setRows($table)->render();
  1740. }
  1741. }
  1742. <?php
  1743. namespace Composer\Command;
  1744. use Composer\Cache;
  1745. use Composer\Factory;
  1746. use Symfony\Component\Console\Input\InputInterface;
  1747. use Symfony\Component\Console\Output\OutputInterface;
  1748. class ClearCacheCommand extends BaseCommand
  1749. {
  1750. protected function configure()
  1751. {
  1752. $this
  1753. ->setName('clear-cache')
  1754. ->setAliases(array('clearcache', 'cc'))
  1755. ->setDescription('Clears composer\'s internal package cache.')
  1756. ->setHelp(
  1757. <<<EOT
  1758. The <info>clear-cache</info> deletes all cached packages from composer's
  1759. cache directory.
  1760. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-cc
  1761. EOT
  1762. )
  1763. ;
  1764. }
  1765. protected function execute(InputInterface $input, OutputInterface $output)
  1766. {
  1767. $config = Factory::createConfig();
  1768. $io = $this->getIO();
  1769. $cachePaths = array(
  1770. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1771. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1772. 'cache-files-dir' => $config->get('cache-files-dir'),
  1773. 'cache-dir' => $config->get('cache-dir'),
  1774. );
  1775. foreach ($cachePaths as $key => $cachePath) {
  1776. $cachePath = realpath($cachePath);
  1777. if (!$cachePath) {
  1778. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1779. continue;
  1780. }
  1781. $cache = new Cache($io, $cachePath);
  1782. if (!$cache->isEnabled()) {
  1783. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1784. continue;
  1785. }
  1786. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1787. $cache->clear();
  1788. }
  1789. $io->writeError('<info>All caches cleared.</info>');
  1790. return 0;
  1791. }
  1792. }
  1793. <?php
  1794. namespace Composer\Command;
  1795. use Composer\Util\Platform;
  1796. use Composer\Util\Silencer;
  1797. use Symfony\Component\Console\Input\InputInterface;
  1798. use Symfony\Component\Console\Input\InputArgument;
  1799. use Symfony\Component\Console\Input\InputOption;
  1800. use Symfony\Component\Console\Output\OutputInterface;
  1801. use Composer\Config;
  1802. use Composer\Config\JsonConfigSource;
  1803. use Composer\Factory;
  1804. use Composer\IO\IOInterface;
  1805. use Composer\Json\JsonFile;
  1806. use Composer\Semver\VersionParser;
  1807. use Composer\Package\BasePackage;
  1808. class ConfigCommand extends BaseCommand
  1809. {
  1810. protected $config;
  1811. protected $configFile;
  1812. protected $configSource;
  1813. protected $authConfigFile;
  1814. protected $authConfigSource;
  1815. protected function configure()
  1816. {
  1817. $this
  1818. ->setName('config')
  1819. ->setDescription('Sets config options.')
  1820. ->setDefinition(array(
  1821. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1822. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1823. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1824. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1825. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1826. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1827. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1828. new InputArgument('setting-key', null, 'Setting key'),
  1829. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1830. ))
  1831. ->setHelp(
  1832. <<<EOT
  1833. This command allows you to edit composer config settings and repositories
  1834. in either the local composer.json file or the global config.json file.
  1835. Additionally it lets you edit most properties in the local composer.json.
  1836. To set a config setting:
  1837. <comment>%command.full_name% bin-dir bin/</comment>
  1838. To read a config setting:
  1839. <comment>%command.full_name% bin-dir</comment>
  1840. Outputs: <info>bin</info>
  1841. To edit the global config.json file:
  1842. <comment>%command.full_name% --global</comment>
  1843. To add a repository:
  1844. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1845. To remove a repository (repo is a short alias for repositories):
  1846. <comment>%command.full_name% --unset repo.foo</comment>
  1847. To disable packagist:
  1848. <comment>%command.full_name% repo.packagist false</comment>
  1849. You can alter repositories in the global config.json file by passing in the
  1850. <info>--global</info> option.
  1851. To add or edit suggested packages you can use:
  1852. <comment>%command.full_name% suggest.package reason for the suggestion</comment>
  1853. To add or edit extra properties you can use:
  1854. <comment>%command.full_name% extra.property value</comment>
  1855. To edit the file in an external editor:
  1856. <comment>%command.full_name% --editor</comment>
  1857. To choose your editor you can set the "EDITOR" env variable.
  1858. To get a list of configuration values in the file:
  1859. <comment>%command.full_name% --list</comment>
  1860. You can always pass more than one option. As an example, if you want to edit the
  1861. global config.json file.
  1862. <comment>%command.full_name% --editor --global</comment>
  1863. Read more at https://getcomposer.org/doc/03-cli.md#config
  1864. EOT
  1865. )
  1866. ;
  1867. }
  1868. protected function initialize(InputInterface $input, OutputInterface $output)
  1869. {
  1870. parent::initialize($input, $output);
  1871. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1872. throw new \RuntimeException('--file and --global can not be combined');
  1873. }
  1874. $io = $this->getIO();
  1875. $this->config = Factory::createConfig($io);
  1876. $configFile = $input->getOption('global')
  1877. ? ($this->config->get('home') . '/config.json')
  1878. : ($input->getOption('file') ?: Factory::getComposerFile());
  1879. if (
  1880. ($configFile === 'composer.json' || $configFile === './composer.json')
  1881. && !file_exists($configFile)
  1882. && realpath(getcwd()) === realpath($this->config->get('home'))
  1883. ) {
  1884. file_put_contents($configFile, "{\n}\n");
  1885. }
  1886. $this->configFile = new JsonFile($configFile, null, $io);
  1887. $this->configSource = new JsonConfigSource($this->configFile);
  1888. $authConfigFile = $input->getOption('global')
  1889. ? ($this->config->get('home') . '/auth.json')
  1890. : dirname(realpath($configFile)) . '/auth.json';
  1891. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1892. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1893. if ($input->getOption('global') && !$this->configFile->exists()) {
  1894. touch($this->configFile->getPath());
  1895. $this->configFile->write(array('config' => new \ArrayObject));
  1896. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1897. }
  1898. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1899. touch($this->authConfigFile->getPath());
  1900. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject, 'bearer' => new \ArrayObject));
  1901. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1902. }
  1903. if (!$this->configFile->exists()) {
  1904. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1905. }
  1906. }
  1907. protected function execute(InputInterface $input, OutputInterface $output)
  1908. {
  1909. if ($input->getOption('editor')) {
  1910. $editor = escapeshellcmd(getenv('EDITOR'));
  1911. if (!$editor) {
  1912. if (Platform::isWindows()) {
  1913. $editor = 'notepad';
  1914. } else {
  1915. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1916. if (exec('which '.$candidate)) {
  1917. $editor = $candidate;
  1918. break;
  1919. }
  1920. }
  1921. }
  1922. }
  1923. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1924. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1925. return 0;
  1926. }
  1927. if (!$input->getOption('global')) {
  1928. $this->config->merge($this->configFile->read());
  1929. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1930. }
  1931. if ($input->getOption('list')) {
  1932. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1933. return 0;
  1934. }
  1935. $settingKey = $input->getArgument('setting-key');
  1936. if (!$settingKey) {
  1937. return 0;
  1938. }
  1939. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1940. throw new \RuntimeException('You can not combine a setting value with --unset');
  1941. }
  1942. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1943. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1944. $rawData = $this->configFile->read();
  1945. $data = $this->config->all();
  1946. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1947. if (!isset($matches[1]) || $matches[1] === '') {
  1948. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1949. } else {
  1950. if (!isset($data['repositories'][$matches[1]])) {
  1951. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1952. }
  1953. $value = $data['repositories'][$matches[1]];
  1954. }
  1955. } elseif (strpos($settingKey, '.')) {
  1956. $bits = explode('.', $settingKey);
  1957. if ($bits[0] === 'extra') {
  1958. $data = $rawData;
  1959. } else {
  1960. $data = $data['config'];
  1961. }
  1962. $match = false;
  1963. foreach ($bits as $bit) {
  1964. $key = isset($key) ? $key.'.'.$bit : $bit;
  1965. $match = false;
  1966. if (isset($data[$key])) {
  1967. $match = true;
  1968. $data = $data[$key];
  1969. unset($key);
  1970. }
  1971. }
  1972. if (!$match) {
  1973. throw new \RuntimeException($settingKey.' is not defined.');
  1974. }
  1975. $value = $data;
  1976. } elseif (isset($data['config'][$settingKey])) {
  1977. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1978. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1979. $value = $rawData[$settingKey];
  1980. } else {
  1981. throw new \RuntimeException($settingKey.' is not defined');
  1982. }
  1983. if (is_array($value)) {
  1984. $value = json_encode($value);
  1985. }
  1986. $this->getIO()->write($value, true, IOInterface::QUIET);
  1987. return 0;
  1988. }
  1989. $values = $input->getArgument('setting-value');
  1990. $booleanValidator = function ($val) {
  1991. return in_array($val, array('true', 'false', '1', '0'), true);
  1992. };
  1993. $booleanNormalizer = function ($val) {
  1994. return $val !== 'false' && (bool) $val;
  1995. };
  1996. $uniqueConfigValues = array(
  1997. 'process-timeout' => array('is_numeric', 'intval'),
  1998. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1999. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  2000. 'preferred-install' => array(
  2001. function ($val) {
  2002. return in_array($val, array('auto', 'source', 'dist'), true);
  2003. },
  2004. function ($val) {
  2005. return $val;
  2006. },
  2007. ),
  2008. 'store-auths' => array(
  2009. function ($val) {
  2010. return in_array($val, array('true', 'false', 'prompt'), true);
  2011. },
  2012. function ($val) {
  2013. if ('prompt' === $val) {
  2014. return 'prompt';
  2015. }
  2016. return $val !== 'false' && (bool) $val;
  2017. },
  2018. ),
  2019. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  2020. 'vendor-dir' => array('is_string', function ($val) {
  2021. return $val;
  2022. }),
  2023. 'bin-dir' => array('is_string', function ($val) {
  2024. return $val;
  2025. }),
  2026. 'archive-dir' => array('is_string', function ($val) {
  2027. return $val;
  2028. }),
  2029. 'archive-format' => array('is_string', function ($val) {
  2030. return $val;
  2031. }),
  2032. 'data-dir' => array('is_string', function ($val) {
  2033. return $val;
  2034. }),
  2035. 'cache-dir' => array('is_string', function ($val) {
  2036. return $val;
  2037. }),
  2038. 'cache-files-dir' => array('is_string', function ($val) {
  2039. return $val;
  2040. }),
  2041. 'cache-repo-dir' => array('is_string', function ($val) {
  2042. return $val;
  2043. }),
  2044. 'cache-vcs-dir' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'cache-ttl' => array('is_numeric', 'intval'),
  2048. 'cache-files-ttl' => array('is_numeric', 'intval'),
  2049. 'cache-files-maxsize' => array(
  2050. function ($val) {
  2051. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  2052. },
  2053. function ($val) {
  2054. return $val;
  2055. },
  2056. ),
  2057. 'bin-compat' => array(
  2058. function ($val) {
  2059. return in_array($val, array('auto', 'full'));
  2060. },
  2061. function ($val) {
  2062. return $val;
  2063. },
  2064. ),
  2065. 'discard-changes' => array(
  2066. function ($val) {
  2067. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  2068. },
  2069. function ($val) {
  2070. if ('stash' === $val) {
  2071. return 'stash';
  2072. }
  2073. return $val !== 'false' && (bool) $val;
  2074. },
  2075. ),
  2076. 'autoloader-suffix' => array('is_string', function ($val) {
  2077. return $val === 'null' ? null : $val;
  2078. }),
  2079. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  2080. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  2081. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  2082. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  2083. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  2084. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  2085. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  2086. 'cafile' => array(
  2087. function ($val) {
  2088. return file_exists($val) && is_readable($val);
  2089. },
  2090. function ($val) {
  2091. return $val === 'null' ? null : $val;
  2092. },
  2093. ),
  2094. 'capath' => array(
  2095. function ($val) {
  2096. return is_dir($val) && is_readable($val);
  2097. },
  2098. function ($val) {
  2099. return $val === 'null' ? null : $val;
  2100. },
  2101. ),
  2102. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  2103. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  2104. 'lock' => array($booleanValidator, $booleanNormalizer),
  2105. );
  2106. $multiConfigValues = array(
  2107. 'github-protocols' => array(
  2108. function ($vals) {
  2109. if (!is_array($vals)) {
  2110. return 'array expected';
  2111. }
  2112. foreach ($vals as $val) {
  2113. if (!in_array($val, array('git', 'https', 'ssh'))) {
  2114. return 'valid protocols include: git, https, ssh';
  2115. }
  2116. }
  2117. return true;
  2118. },
  2119. function ($vals) {
  2120. return $vals;
  2121. },
  2122. ),
  2123. 'github-domains' => array(
  2124. function ($vals) {
  2125. if (!is_array($vals)) {
  2126. return 'array expected';
  2127. }
  2128. return true;
  2129. },
  2130. function ($vals) {
  2131. return $vals;
  2132. },
  2133. ),
  2134. 'gitlab-domains' => array(
  2135. function ($vals) {
  2136. if (!is_array($vals)) {
  2137. return 'array expected';
  2138. }
  2139. return true;
  2140. },
  2141. function ($vals) {
  2142. return $vals;
  2143. },
  2144. ),
  2145. );
  2146. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2147. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2148. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2149. }
  2150. $this->configSource->removeConfigSetting($settingKey);
  2151. return 0;
  2152. }
  2153. if (isset($uniqueConfigValues[$settingKey])) {
  2154. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2155. return 0;
  2156. }
  2157. if (isset($multiConfigValues[$settingKey])) {
  2158. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2159. return 0;
  2160. }
  2161. if (preg_match('/^preferred-install\.(.+)/', $settingKey, $matches)) {
  2162. if ($input->getOption('unset')) {
  2163. $this->configSource->removeConfigSetting($settingKey);
  2164. return 0;
  2165. }
  2166. list($validator) = $uniqueConfigValues['preferred-install'];
  2167. if (!$validator($values[0])) {
  2168. throw new \RuntimeException('Invalid value for '.$settingKey.'. Should be one of: auto, source, or dist');
  2169. }
  2170. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2171. return 0;
  2172. }
  2173. $uniqueProps = array(
  2174. 'name' => array('is_string', function ($val) {
  2175. return $val;
  2176. }),
  2177. 'type' => array('is_string', function ($val) {
  2178. return $val;
  2179. }),
  2180. 'description' => array('is_string', function ($val) {
  2181. return $val;
  2182. }),
  2183. 'homepage' => array('is_string', function ($val) {
  2184. return $val;
  2185. }),
  2186. 'version' => array('is_string', function ($val) {
  2187. return $val;
  2188. }),
  2189. 'minimum-stability' => array(
  2190. function ($val) {
  2191. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2192. },
  2193. function ($val) {
  2194. return VersionParser::normalizeStability($val);
  2195. },
  2196. ),
  2197. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2198. );
  2199. $multiProps = array(
  2200. 'keywords' => array(
  2201. function ($vals) {
  2202. if (!is_array($vals)) {
  2203. return 'array expected';
  2204. }
  2205. return true;
  2206. },
  2207. function ($vals) {
  2208. return $vals;
  2209. },
  2210. ),
  2211. 'license' => array(
  2212. function ($vals) {
  2213. if (!is_array($vals)) {
  2214. return 'array expected';
  2215. }
  2216. return true;
  2217. },
  2218. function ($vals) {
  2219. return $vals;
  2220. },
  2221. ),
  2222. );
  2223. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2224. throw new \InvalidArgumentException('The '.$settingKey.' property can not be set in the global config.json file. Use `composer global config` to apply changes to the global composer.json');
  2225. }
  2226. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2227. $this->configSource->removeProperty($settingKey);
  2228. return 0;
  2229. }
  2230. if (isset($uniqueProps[$settingKey])) {
  2231. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2232. return 0;
  2233. }
  2234. if (isset($multiProps[$settingKey])) {
  2235. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2236. return 0;
  2237. }
  2238. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2239. if ($input->getOption('unset')) {
  2240. $this->configSource->removeRepository($matches[1]);
  2241. return 0;
  2242. }
  2243. if (2 === count($values)) {
  2244. $this->configSource->addRepository($matches[1], array(
  2245. 'type' => $values[0],
  2246. 'url' => $values[1],
  2247. ));
  2248. return 0;
  2249. }
  2250. if (1 === count($values)) {
  2251. $value = strtolower($values[0]);
  2252. if (true === $booleanValidator($value)) {
  2253. if (false === $booleanNormalizer($value)) {
  2254. $this->configSource->addRepository($matches[1], false);
  2255. return 0;
  2256. }
  2257. } else {
  2258. $value = JsonFile::parseJson($values[0]);
  2259. $this->configSource->addRepository($matches[1], $value);
  2260. return 0;
  2261. }
  2262. }
  2263. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2264. }
  2265. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2266. if ($input->getOption('unset')) {
  2267. $this->configSource->removeProperty($settingKey);
  2268. return 0;
  2269. }
  2270. $this->configSource->addProperty($settingKey, $values[0]);
  2271. return 0;
  2272. }
  2273. if (preg_match('/^suggest\.(.+)/', $settingKey, $matches)) {
  2274. if ($input->getOption('unset')) {
  2275. $this->configSource->removeProperty($settingKey);
  2276. return 0;
  2277. }
  2278. $this->configSource->addProperty($settingKey, implode(' ', $values));
  2279. return 0;
  2280. }
  2281. if (in_array($settingKey, array('suggest', 'extra'), true) && $input->getOption('unset')) {
  2282. $this->configSource->removeProperty($settingKey);
  2283. return 0;
  2284. }
  2285. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2286. if ($input->getOption('unset')) {
  2287. $this->configSource->removeConfigSetting($settingKey);
  2288. return 0;
  2289. }
  2290. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2291. return 0;
  2292. }
  2293. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2294. $this->configSource->removeConfigSetting($settingKey);
  2295. return 0;
  2296. }
  2297. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|bearer)\.(.+)/', $settingKey, $matches)) {
  2298. if ($input->getOption('unset')) {
  2299. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2300. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2301. return 0;
  2302. }
  2303. if ($matches[1] === 'bitbucket-oauth') {
  2304. if (2 !== count($values)) {
  2305. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2306. }
  2307. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2308. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2309. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token', 'bearer'), true)) {
  2310. if (1 !== count($values)) {
  2311. throw new \RuntimeException('Too many arguments, expected only one token');
  2312. }
  2313. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2314. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2315. } elseif ($matches[1] === 'http-basic') {
  2316. if (2 !== count($values)) {
  2317. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2318. }
  2319. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2320. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2321. }
  2322. return 0;
  2323. }
  2324. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2325. if ($input->getOption('unset')) {
  2326. $this->configSource->removeProperty($settingKey);
  2327. return 0;
  2328. }
  2329. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2330. return 0;
  2331. }
  2332. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2333. }
  2334. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2335. {
  2336. list($validator, $normalizer) = $callbacks;
  2337. if (1 !== count($values)) {
  2338. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2339. }
  2340. if (true !== $validation = $validator($values[0])) {
  2341. throw new \RuntimeException(sprintf(
  2342. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2343. $values[0]
  2344. ));
  2345. }
  2346. $normalizedValue = $normalizer($values[0]);
  2347. if ($key === 'disable-tls') {
  2348. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2349. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2350. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2351. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2352. }
  2353. }
  2354. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2355. }
  2356. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2357. {
  2358. list($validator, $normalizer) = $callbacks;
  2359. if (true !== $validation = $validator($values)) {
  2360. throw new \RuntimeException(sprintf(
  2361. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2362. json_encode($values)
  2363. ));
  2364. }
  2365. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2366. }
  2367. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2368. {
  2369. $origK = $k;
  2370. $io = $this->getIO();
  2371. foreach ($contents as $key => $value) {
  2372. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2373. continue;
  2374. }
  2375. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2376. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2377. $k .= preg_replace('{^config\.}', '', $key . '.');
  2378. $this->listConfiguration($value, $rawVal, $output, $k);
  2379. $k = $origK;
  2380. continue;
  2381. }
  2382. if (is_array($value)) {
  2383. $value = array_map(function ($val) {
  2384. return is_array($val) ? json_encode($val) : $val;
  2385. }, $value);
  2386. $value = '['.implode(', ', $value).']';
  2387. }
  2388. if (is_bool($value)) {
  2389. $value = var_export($value, true);
  2390. }
  2391. if (is_string($rawVal) && $rawVal != $value) {
  2392. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2393. } else {
  2394. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2395. }
  2396. }
  2397. }
  2398. }
  2399. <?php
  2400. namespace Composer\Command;
  2401. use Composer\Config;
  2402. use Composer\Factory;
  2403. use Composer\Installer;
  2404. use Composer\Installer\ProjectInstaller;
  2405. use Composer\Installer\InstallationManager;
  2406. use Composer\Installer\SuggestedPackagesReporter;
  2407. use Composer\IO\IOInterface;
  2408. use Composer\Package\BasePackage;
  2409. use Composer\DependencyResolver\Pool;
  2410. use Composer\DependencyResolver\Operation\InstallOperation;
  2411. use Composer\Package\Version\VersionSelector;
  2412. use Composer\Package\AliasPackage;
  2413. use Composer\Repository\RepositoryFactory;
  2414. use Composer\Repository\CompositeRepository;
  2415. use Composer\Repository\PlatformRepository;
  2416. use Composer\Repository\InstalledFilesystemRepository;
  2417. use Composer\Script\ScriptEvents;
  2418. use Composer\Util\Silencer;
  2419. use Symfony\Component\Console\Input\InputArgument;
  2420. use Symfony\Component\Console\Input\InputInterface;
  2421. use Symfony\Component\Console\Input\InputOption;
  2422. use Symfony\Component\Console\Output\OutputInterface;
  2423. use Symfony\Component\Finder\Finder;
  2424. use Composer\Json\JsonFile;
  2425. use Composer\Config\JsonConfigSource;
  2426. use Composer\Util\Filesystem;
  2427. use Composer\Package\Version\VersionParser;
  2428. use Composer\EventDispatcher\EventDispatcher;
  2429. class CreateProjectCommand extends BaseCommand
  2430. {
  2431. protected $suggestedPackagesReporter;
  2432. protected function configure()
  2433. {
  2434. $this
  2435. ->setName('create-project')
  2436. ->setDescription('Creates new project from a package into given directory.')
  2437. ->setDefinition(array(
  2438. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2439. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2440. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2441. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2442. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2443. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2444. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2445. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2446. new InputOption('add-repository', null, InputOption::VALUE_NONE, 'Add the repository option to the composer.json.'),
  2447. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2448. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2449. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2450. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2451. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2452. new InputOption('no-secure-http', null, InputOption::VALUE_NONE, 'Disable the secure-http config option temporarily while installing the root package. Use at your own risk. Using this flag is a bad idea.'),
  2453. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2454. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2455. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2456. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2457. ))
  2458. ->setHelp(
  2459. <<<EOT
  2460. The <info>create-project</info> command creates a new project from a given
  2461. package into a new directory. If executed without params and in a directory
  2462. with a composer.json file it installs the packages for the current project.
  2463. You can use this command to bootstrap new projects or setup a clean
  2464. version-controlled installation for developers of your project.
  2465. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2466. You can also specify the version with the package name using = or : as separator.
  2467. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2468. To install unstable packages, either specify the version you want, or use the
  2469. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2470. To setup a developer workable version you should create the project using the source
  2471. controlled code by appending the <info>'--prefer-source'</info> flag.
  2472. To install a package from another repository than the default one you
  2473. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2474. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2475. EOT
  2476. )
  2477. ;
  2478. }
  2479. protected function execute(InputInterface $input, OutputInterface $output)
  2480. {
  2481. $config = Factory::createConfig();
  2482. $io = $this->getIO();
  2483. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2484. if ($input->getOption('dev')) {
  2485. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2486. }
  2487. if ($input->getOption('no-custom-installers')) {
  2488. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2489. $input->setOption('no-plugins', true);
  2490. }
  2491. return $this->installProject(
  2492. $io,
  2493. $config,
  2494. $input,
  2495. $input->getArgument('package'),
  2496. $input->getArgument('directory'),
  2497. $input->getArgument('version'),
  2498. $input->getOption('stability'),
  2499. $preferSource,
  2500. $preferDist,
  2501. !$input->getOption('no-dev'),
  2502. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2503. $input->getOption('no-plugins'),
  2504. $input->getOption('no-scripts'),
  2505. $input->getOption('no-progress'),
  2506. $input->getOption('no-install'),
  2507. $input->getOption('ignore-platform-reqs'),
  2508. !$input->getOption('no-secure-http'),
  2509. $input->getOption('add-repository')
  2510. );
  2511. }
  2512. public function installProject(IOInterface $io, Config $config, InputInterface $input, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $noInstall = false, $ignorePlatformReqs = false, $secureHttp = true, $addRepository = false)
  2513. {
  2514. $oldCwd = getcwd();
  2515. $io->loadConfiguration($config);
  2516. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2517. if ($packageName !== null) {
  2518. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2519. } else {
  2520. $installedFromVcs = false;
  2521. }
  2522. $composer = Factory::create($io, null, $disablePlugins);
  2523. if ($repository !== null && $addRepository) {
  2524. if ($composer->getLocker()->isLocked()) {
  2525. $io->writeError('<error>Adding a repository when creating a project that provides a composer.lock file is not supported</error>');
  2526. return false;
  2527. }
  2528. $repoConfig = RepositoryFactory::configFromString($io, $composer->getConfig(), $repository, true);
  2529. $composerJsonRepositoriesConfig = $composer->getConfig()->getRepositories();
  2530. $name = RepositoryFactory::generateRepositoryName(0, $repoConfig, $composerJsonRepositoriesConfig);
  2531. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2532. $configSource->addRepository($name, $repoConfig);
  2533. $composer = Factory::create($io, null, $disablePlugins);
  2534. }
  2535. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2536. $fs = new Filesystem();
  2537. if ($noScripts === false) {
  2538. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2539. }
  2540. $config = $composer->getConfig();
  2541. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2542. if ($noInstall === false) {
  2543. $installer = Installer::create($io, $composer);
  2544. $installer->setPreferSource($preferSource)
  2545. ->setPreferDist($preferDist)
  2546. ->setDevMode($installDevPackages)
  2547. ->setRunScripts(!$noScripts)
  2548. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2549. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2550. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2551. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2552. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2553. if ($disablePlugins) {
  2554. $installer->disablePlugins();
  2555. }
  2556. $status = $installer->run();
  2557. if (0 !== $status) {
  2558. return $status;
  2559. }
  2560. }
  2561. $hasVcs = $installedFromVcs;
  2562. if (
  2563. !$input->getOption('keep-vcs')
  2564. && $installedFromVcs
  2565. && (
  2566. $input->getOption('remove-vcs')
  2567. || !$io->isInteractive()
  2568. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2569. )
  2570. ) {
  2571. $finder = new Finder();
  2572. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2573. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2574. $finder->name($vcsName);
  2575. }
  2576. try {
  2577. $dirs = iterator_to_array($finder);
  2578. unset($finder);
  2579. foreach ($dirs as $dir) {
  2580. if (!$fs->removeDirectory($dir)) {
  2581. throw new \RuntimeException('Could not remove '.$dir);
  2582. }
  2583. }
  2584. } catch (\Exception $e) {
  2585. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2586. }
  2587. $hasVcs = false;
  2588. }
  2589. if (!$hasVcs) {
  2590. $package = $composer->getPackage();
  2591. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2592. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2593. foreach ($package->{'get'.$meta['method']}() as $link) {
  2594. if ($link->getPrettyConstraint() === 'self.version') {
  2595. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2596. }
  2597. }
  2598. }
  2599. }
  2600. if ($noScripts === false) {
  2601. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2602. }
  2603. chdir($oldCwd);
  2604. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2605. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2606. Silencer::call('rmdir', $vendorComposerDir);
  2607. $vendorDir = $config->get('vendor-dir');
  2608. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2609. Silencer::call('rmdir', $vendorDir);
  2610. }
  2611. }
  2612. return 0;
  2613. }
  2614. protected function installRootPackage(IOInterface $io, Config $config, $packageName, $directory = null, $packageVersion = null, $stability = 'stable', $preferSource = false, $preferDist = false, $installDevPackages = false, $repository = null, $disablePlugins = false, $noScripts = false, $noProgress = false, $ignorePlatformReqs = false, $secureHttp = true)
  2615. {
  2616. if (!$secureHttp) {
  2617. $config->merge(array('config' => array('secure-http' => false)));
  2618. }
  2619. $composer = Factory::create($io, $config->all(), $disablePlugins);
  2620. $config = $composer->getConfig();
  2621. $rm = $composer->getRepositoryManager();
  2622. if (null === $repository) {
  2623. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config, $rm));
  2624. } else {
  2625. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true, $rm);
  2626. }
  2627. $parser = new VersionParser();
  2628. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2629. $name = strtolower($requirements[0]['name']);
  2630. if (!$packageVersion && isset($requirements[0]['version'])) {
  2631. $packageVersion = $requirements[0]['version'];
  2632. }
  2633. if (null === $directory) {
  2634. $parts = explode("/", $name, 2);
  2635. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2636. }
  2637. $fs = new Filesystem();
  2638. if (!$fs->isAbsolutePath($directory)) {
  2639. $directory = getcwd() . DIRECTORY_SEPARATOR . $directory;
  2640. }
  2641. $io->writeError('<info>Creating a "' . $packageName . '" project at "' . $fs->findShortestPath(getcwd(), $directory, true) . '"</info>');
  2642. if (file_exists($directory)) {
  2643. if (!is_dir($directory)) {
  2644. throw new \InvalidArgumentException('Cannot create project directory at "'.$directory.'", it exists as a file.');
  2645. } elseif (!$fs->isDirEmpty($directory)) {
  2646. throw new \InvalidArgumentException('Project directory "'.$directory.'" is not empty.');
  2647. }
  2648. }
  2649. if (null === $stability) {
  2650. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2651. $stability = $match[1];
  2652. } else {
  2653. $stability = VersionParser::parseStability($packageVersion);
  2654. }
  2655. }
  2656. $stability = VersionParser::normalizeStability($stability);
  2657. if (!isset(BasePackage::$stabilities[$stability])) {
  2658. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2659. }
  2660. $pool = new Pool($stability);
  2661. $pool->addRepository($sourceRepo);
  2662. $phpVersion = null;
  2663. $prettyPhpVersion = null;
  2664. if (!$ignorePlatformReqs) {
  2665. $platformOverrides = $config->get('platform') ?: array();
  2666. $platform = new PlatformRepository(array(), $platformOverrides);
  2667. $phpPackage = $platform->findPackage('php', '*');
  2668. $phpVersion = $phpPackage->getVersion();
  2669. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2670. }
  2671. $versionSelector = new VersionSelector($pool);
  2672. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2673. if (!$package) {
  2674. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2675. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2676. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2677. }
  2678. throw new \InvalidArgumentException($errorMessage .'.');
  2679. }
  2680. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  2681. @mkdir($directory, 0777, true);
  2682. if ($realDir = realpath($directory)) {
  2683. pcntl_async_signals(true);
  2684. pcntl_signal(SIGINT, function () use ($realDir) {
  2685. $fs = new Filesystem();
  2686. $fs->removeDirectory($realDir);
  2687. exit(130);
  2688. });
  2689. }
  2690. }
  2691. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2692. if ($disablePlugins) {
  2693. $io->writeError('<info>Plugins have been disabled.</info>');
  2694. }
  2695. if ($package instanceof AliasPackage) {
  2696. $package = $package->getAliasOf();
  2697. }
  2698. $dm = $composer->getDownloadManager();
  2699. $dm->setPreferSource($preferSource)
  2700. ->setPreferDist($preferDist)
  2701. ->setOutputProgress(!$noProgress);
  2702. $projectInstaller = new ProjectInstaller($directory, $dm);
  2703. $im = $composer->getInstallationManager();
  2704. $im->addInstaller($projectInstaller);
  2705. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2706. $im->notifyInstalls($io);
  2707. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2708. $installedFromVcs = 'source' === $package->getInstallationSource();
  2709. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2710. chdir($directory);
  2711. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2712. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2713. return $installedFromVcs;
  2714. }
  2715. }
  2716. <?php
  2717. namespace Composer\Command;
  2718. use Symfony\Component\Console\Input\InputInterface;
  2719. use Symfony\Component\Console\Output\OutputInterface;
  2720. class DependsCommand extends BaseDependencyCommand
  2721. {
  2722. protected function configure()
  2723. {
  2724. parent::configure();
  2725. $this
  2726. ->setName('depends')
  2727. ->setAliases(array('why'))
  2728. ->setDescription('Shows which packages cause the given package to be installed.')
  2729. ->setHelp(
  2730. <<<EOT
  2731. Displays detailed information about where a package is referenced.
  2732. <info>php composer.phar depends composer/composer</info>
  2733. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2734. EOT
  2735. )
  2736. ;
  2737. }
  2738. protected function execute(InputInterface $input, OutputInterface $output)
  2739. {
  2740. return parent::doExecute($input, $output, false);
  2741. }
  2742. }
  2743. <?php
  2744. namespace Composer\Command;
  2745. use Composer\Composer;
  2746. use Composer\Factory;
  2747. use Composer\Config;
  2748. use Composer\Downloader\TransportException;
  2749. use Composer\Repository\PlatformRepository;
  2750. use Composer\Plugin\CommandEvent;
  2751. use Composer\Plugin\PluginEvents;
  2752. use Composer\Util\ConfigValidator;
  2753. use Composer\Util\IniHelper;
  2754. use Composer\Util\ProcessExecutor;
  2755. use Composer\Util\RemoteFilesystem;
  2756. use Composer\Util\StreamContextFactory;
  2757. use Composer\SelfUpdate\Keys;
  2758. use Composer\SelfUpdate\Versions;
  2759. use Composer\IO\NullIO;
  2760. use Symfony\Component\Console\Input\InputInterface;
  2761. use Symfony\Component\Console\Output\OutputInterface;
  2762. class DiagnoseCommand extends BaseCommand
  2763. {
  2764. protected $rfs;
  2765. protected $process;
  2766. protected $exitCode = 0;
  2767. protected function configure()
  2768. {
  2769. $this
  2770. ->setName('diagnose')
  2771. ->setDescription('Diagnoses the system to identify common errors.')
  2772. ->setHelp(
  2773. <<<EOT
  2774. The <info>diagnose</info> command checks common errors to help debugging problems.
  2775. The process exit code will be 1 in case of warnings and 2 for errors.
  2776. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2777. EOT
  2778. )
  2779. ;
  2780. }
  2781. protected function execute(InputInterface $input, OutputInterface $output)
  2782. {
  2783. $composer = $this->getComposer(false);
  2784. $io = $this->getIO();
  2785. if ($composer) {
  2786. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2787. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2788. $io->write('Checking composer.json: ', false);
  2789. $this->outputResult($this->checkComposerSchema());
  2790. }
  2791. if ($composer) {
  2792. $config = $composer->getConfig();
  2793. } else {
  2794. $config = Factory::createConfig();
  2795. }
  2796. $config->merge(array('config' => array('secure-http' => false)));
  2797. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2798. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2799. $this->process = new ProcessExecutor($io);
  2800. $io->write('Checking platform settings: ', false);
  2801. $this->outputResult($this->checkPlatform());
  2802. $io->write('Checking git settings: ', false);
  2803. $this->outputResult($this->checkGit());
  2804. $io->write('Checking http connectivity to packagist: ', false);
  2805. $this->outputResult($this->checkHttp('http', $config));
  2806. $io->write('Checking https connectivity to packagist: ', false);
  2807. $this->outputResult($this->checkHttp('https', $config));
  2808. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2809. if (!empty($opts['http']['proxy'])) {
  2810. $io->write('Checking HTTP proxy: ', false);
  2811. $this->outputResult($this->checkHttpProxy());
  2812. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2813. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2814. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2815. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2816. }
  2817. if ($oauth = $config->get('github-oauth')) {
  2818. foreach ($oauth as $domain => $token) {
  2819. $io->write('Checking '.$domain.' oauth access: ', false);
  2820. $this->outputResult($this->checkGithubOauth($domain, $token));
  2821. }
  2822. } else {
  2823. $io->write('Checking github.com rate limit: ', false);
  2824. try {
  2825. $rate = $this->getGithubRateLimit('github.com');
  2826. if (!is_array($rate)) {
  2827. $this->outputResult($rate);
  2828. } elseif (10 > $rate['remaining']) {
  2829. $io->write('<warning>WARNING</warning>');
  2830. $io->write(sprintf(
  2831. '<comment>Github has a rate limit on their API. '
  2832. . 'You currently have <options=bold>%u</options=bold> '
  2833. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2834. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2835. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2836. $rate['remaining'],
  2837. $rate['limit']
  2838. ));
  2839. } else {
  2840. $this->outputResult(true);
  2841. }
  2842. } catch (\Exception $e) {
  2843. if ($e instanceof TransportException && $e->getCode() === 401) {
  2844. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2845. } else {
  2846. $this->outputResult($e);
  2847. }
  2848. }
  2849. }
  2850. $io->write('Checking disk free space: ', false);
  2851. $this->outputResult($this->checkDiskSpace($config));
  2852. if ('phar:' === substr(__FILE__, 0, 5)) {
  2853. $io->write('Checking pubkeys: ', false);
  2854. $this->outputResult($this->checkPubKeys($config));
  2855. $io->write('Checking composer version: ', false);
  2856. $this->outputResult($this->checkVersion($config));
  2857. }
  2858. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2859. $platformOverrides = $config->get('platform') ?: array();
  2860. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2861. $phpPkg = $platformRepo->findPackage('php', '*');
  2862. $phpVersion = $phpPkg->getPrettyVersion();
  2863. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2864. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2865. }
  2866. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2867. if (defined('PHP_BINARY')) {
  2868. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2869. }
  2870. $io->write('OpenSSL version: ' . (defined('OPENSSL_VERSION_TEXT') ? '<comment>'.OPENSSL_VERSION_TEXT.'</comment>' : '<error>missing</error>'));
  2871. return $this->exitCode;
  2872. }
  2873. private function checkComposerSchema()
  2874. {
  2875. $validator = new ConfigValidator($this->getIO());
  2876. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2877. if ($errors || $warnings) {
  2878. $messages = array(
  2879. 'error' => $errors,
  2880. 'warning' => $warnings,
  2881. );
  2882. $output = '';
  2883. foreach ($messages as $style => $msgs) {
  2884. foreach ($msgs as $msg) {
  2885. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2886. }
  2887. }
  2888. return rtrim($output);
  2889. }
  2890. return true;
  2891. }
  2892. private function checkGit()
  2893. {
  2894. $this->process->execute('git config color.ui', $output);
  2895. if (strtolower(trim($output)) === 'always') {
  2896. return '<comment>Your git color.ui setting is set to always, this is known to create issues. Use "git config --global color.ui true" to set it correctly.</comment>';
  2897. }
  2898. return true;
  2899. }
  2900. private function checkHttp($proto, Config $config)
  2901. {
  2902. $result = $this->checkConnectivity();
  2903. if ($result !== true) {
  2904. return $result;
  2905. }
  2906. $disableTls = false;
  2907. $result = array();
  2908. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2909. $disableTls = true;
  2910. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2911. }
  2912. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2913. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2914. }
  2915. try {
  2916. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2917. } catch (TransportException $e) {
  2918. if (false !== strpos($e->getMessage(), 'cafile')) {
  2919. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2920. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2921. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2922. } else {
  2923. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2924. }
  2925. }
  2926. if (count($result) > 0) {
  2927. return $result;
  2928. }
  2929. return true;
  2930. }
  2931. private function checkHttpProxy()
  2932. {
  2933. $result = $this->checkConnectivity();
  2934. if ($result !== true) {
  2935. return $result;
  2936. }
  2937. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2938. try {
  2939. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2940. $hash = reset($json['provider-includes']);
  2941. $hash = $hash['sha256'];
  2942. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2943. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2944. if (hash('sha256', $provider) !== $hash) {
  2945. return 'It seems that your proxy is modifying http traffic on the fly';
  2946. }
  2947. } catch (\Exception $e) {
  2948. return $e;
  2949. }
  2950. return true;
  2951. }
  2952. private function checkHttpProxyFullUriRequestParam()
  2953. {
  2954. $result = $this->checkConnectivity();
  2955. if ($result !== true) {
  2956. return $result;
  2957. }
  2958. $url = 'http://repo.packagist.org/packages.json';
  2959. try {
  2960. $this->rfs->getContents('packagist.org', $url, false);
  2961. } catch (TransportException $e) {
  2962. try {
  2963. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2964. } catch (TransportException $e) {
  2965. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2966. }
  2967. return 'It seems there is a problem with your proxy server, try setting the "HTTP_PROXY_REQUEST_FULLURI" and "HTTPS_PROXY_REQUEST_FULLURI" environment variables to "false"';
  2968. }
  2969. return true;
  2970. }
  2971. private function checkHttpsProxyFullUriRequestParam()
  2972. {
  2973. $result = $this->checkConnectivity();
  2974. if ($result !== true) {
  2975. return $result;
  2976. }
  2977. if (!extension_loaded('openssl')) {
  2978. return 'You need the openssl extension installed for this check';
  2979. }
  2980. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2981. try {
  2982. $this->rfs->getContents('github.com', $url, false);
  2983. } catch (TransportException $e) {
  2984. try {
  2985. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2986. } catch (TransportException $e) {
  2987. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2988. }
  2989. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2990. }
  2991. return true;
  2992. }
  2993. private function checkGithubOauth($domain, $token)
  2994. {
  2995. $result = $this->checkConnectivity();
  2996. if ($result !== true) {
  2997. return $result;
  2998. }
  2999. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3000. try {
  3001. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  3002. return $this->rfs->getContents($domain, $url, false, array(
  3003. 'retry-auth-failure' => false,
  3004. )) ? true : 'Unexpected error';
  3005. } catch (\Exception $e) {
  3006. if ($e instanceof TransportException && $e->getCode() === 401) {
  3007. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  3008. }
  3009. return $e;
  3010. }
  3011. }
  3012. private function getGithubRateLimit($domain, $token = null)
  3013. {
  3014. $result = $this->checkConnectivity();
  3015. if ($result !== true) {
  3016. return $result;
  3017. }
  3018. if ($token) {
  3019. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  3020. }
  3021. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  3022. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  3023. $data = json_decode($json, true);
  3024. return $data['resources']['core'];
  3025. }
  3026. private function checkDiskSpace($config)
  3027. {
  3028. $minSpaceFree = 1024 * 1024;
  3029. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  3030. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  3031. ) {
  3032. return '<error>The disk hosting '.$dir.' is full</error>';
  3033. }
  3034. return true;
  3035. }
  3036. private function checkPubKeys($config)
  3037. {
  3038. $home = $config->get('home');
  3039. $errors = array();
  3040. $io = $this->getIO();
  3041. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  3042. $io->write('');
  3043. }
  3044. if (file_exists($home.'/keys.tags.pub')) {
  3045. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  3046. } else {
  3047. $errors[] = '<error>Missing pubkey for tags verification</error>';
  3048. }
  3049. if (file_exists($home.'/keys.dev.pub')) {
  3050. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  3051. } else {
  3052. $errors[] = '<error>Missing pubkey for dev verification</error>';
  3053. }
  3054. if ($errors) {
  3055. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  3056. }
  3057. return $errors ?: true;
  3058. }
  3059. private function checkVersion($config)
  3060. {
  3061. $result = $this->checkConnectivity();
  3062. if ($result !== true) {
  3063. return $result;
  3064. }
  3065. $versionsUtil = new Versions($config, $this->rfs);
  3066. try {
  3067. $latest = $versionsUtil->getLatest();
  3068. } catch (\Exception $e) {
  3069. return $e;
  3070. }
  3071. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  3072. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  3073. }
  3074. return true;
  3075. }
  3076. private function outputResult($result)
  3077. {
  3078. $io = $this->getIO();
  3079. if (true === $result) {
  3080. $io->write('<info>OK</info>');
  3081. return;
  3082. }
  3083. $hadError = false;
  3084. $hadWarning = false;
  3085. if ($result instanceof \Exception) {
  3086. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  3087. }
  3088. if (!$result) {
  3089. $hadError = true;
  3090. } else {
  3091. if (!is_array($result)) {
  3092. $result = array($result);
  3093. }
  3094. foreach ($result as $message) {
  3095. if (false !== strpos($message, '<error>')) {
  3096. $hadError = true;
  3097. } elseif (false !== strpos($message, '<warning>')) {
  3098. $hadWarning = true;
  3099. }
  3100. }
  3101. }
  3102. if ($hadError) {
  3103. $io->write('<error>FAIL</error>');
  3104. $this->exitCode = max($this->exitCode, 2);
  3105. } elseif ($hadWarning) {
  3106. $io->write('<warning>WARNING</warning>');
  3107. $this->exitCode = max($this->exitCode, 1);
  3108. }
  3109. if ($result) {
  3110. foreach ($result as $message) {
  3111. $io->write($message);
  3112. }
  3113. }
  3114. }
  3115. private function checkPlatform()
  3116. {
  3117. $output = '';
  3118. $out = function ($msg, $style) use (&$output) {
  3119. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  3120. };
  3121. $errors = array();
  3122. $warnings = array();
  3123. $displayIniMessage = false;
  3124. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  3125. $iniMessage .= PHP_EOL.'If you can not modify the ini file, you can also run `php -d option=value` to modify ini values on the fly. You can use -d multiple times.';
  3126. if (!function_exists('json_decode')) {
  3127. $errors['json'] = true;
  3128. }
  3129. if (!extension_loaded('Phar')) {
  3130. $errors['phar'] = true;
  3131. }
  3132. if (!extension_loaded('filter')) {
  3133. $errors['filter'] = true;
  3134. }
  3135. if (!extension_loaded('hash')) {
  3136. $errors['hash'] = true;
  3137. }
  3138. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  3139. $errors['iconv_mbstring'] = true;
  3140. }
  3141. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  3142. $errors['allow_url_fopen'] = true;
  3143. }
  3144. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  3145. $errors['ioncube'] = ioncube_loader_version();
  3146. }
  3147. if (PHP_VERSION_ID < 50302) {
  3148. $errors['php'] = PHP_VERSION;
  3149. }
  3150. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  3151. $warnings['php'] = PHP_VERSION;
  3152. }
  3153. if (!extension_loaded('openssl')) {
  3154. $errors['openssl'] = true;
  3155. }
  3156. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  3157. $warnings['openssl_version'] = true;
  3158. }
  3159. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  3160. $warnings['apc_cli'] = true;
  3161. }
  3162. if (!extension_loaded('zlib')) {
  3163. $warnings['zlib'] = true;
  3164. }
  3165. ob_start();
  3166. phpinfo(INFO_GENERAL);
  3167. $phpinfo = ob_get_clean();
  3168. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3169. $configure = $match[1];
  3170. if (false !== strpos($configure, '--enable-sigchild')) {
  3171. $warnings['sigchild'] = true;
  3172. }
  3173. if (false !== strpos($configure, '--with-curlwrappers')) {
  3174. $warnings['curlwrappers'] = true;
  3175. }
  3176. }
  3177. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3178. $warnings['xdebug_profile'] = true;
  3179. } elseif (extension_loaded('xdebug')) {
  3180. $warnings['xdebug_loaded'] = true;
  3181. }
  3182. if (defined('PHP_WINDOWS_VERSION_BUILD')
  3183. && (version_compare(PHP_VERSION, '7.2.23', '<')
  3184. || (version_compare(PHP_VERSION, '7.3.0', '>=')
  3185. && version_compare(PHP_VERSION, '7.3.10', '<')))) {
  3186. $warnings['onedrive'] = PHP_VERSION;
  3187. }
  3188. if (!empty($errors)) {
  3189. foreach ($errors as $error => $current) {
  3190. switch ($error) {
  3191. case 'json':
  3192. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3193. $text .= "Install it or recompile php without --disable-json";
  3194. break;
  3195. case 'phar':
  3196. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3197. $text .= "Install it or recompile php without --disable-phar";
  3198. break;
  3199. case 'filter':
  3200. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3201. $text .= "Install it or recompile php without --disable-filter";
  3202. break;
  3203. case 'hash':
  3204. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3205. $text .= "Install it or recompile php without --disable-hash";
  3206. break;
  3207. case 'iconv_mbstring':
  3208. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3209. $text .= "Install either of them or recompile php without --disable-iconv";
  3210. break;
  3211. case 'unicode':
  3212. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3213. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3214. $text .= " detect_unicode = Off";
  3215. $displayIniMessage = true;
  3216. break;
  3217. case 'suhosin':
  3218. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3219. $text .= "Add the following to the end of your `php.ini` or suhosin.ini (Example path [for Debian]: /etc/php5/cli/conf.d/suhosin.ini):".PHP_EOL;
  3220. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3221. $displayIniMessage = true;
  3222. break;
  3223. case 'php':
  3224. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3225. break;
  3226. case 'allow_url_fopen':
  3227. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3228. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3229. $text .= " allow_url_fopen = On";
  3230. $displayIniMessage = true;
  3231. break;
  3232. case 'ioncube':
  3233. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3234. $text .= "Upgrade to ionCube 4.0.9 or higher or remove this line (path may be different) from your `php.ini` to disable it:".PHP_EOL;
  3235. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3236. $displayIniMessage = true;
  3237. break;
  3238. case 'openssl':
  3239. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3240. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3241. break;
  3242. }
  3243. $out($text, 'error');
  3244. }
  3245. $output .= PHP_EOL;
  3246. }
  3247. if (!empty($warnings)) {
  3248. foreach ($warnings as $warning => $current) {
  3249. switch ($warning) {
  3250. case 'apc_cli':
  3251. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3252. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3253. $text .= " apc.enable_cli = Off";
  3254. $displayIniMessage = true;
  3255. break;
  3256. case 'zlib':
  3257. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3258. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3259. $displayIniMessage = true;
  3260. break;
  3261. case 'sigchild':
  3262. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3263. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3264. $text .= " https://bugs.php.net/bug.php?id=22999";
  3265. break;
  3266. case 'curlwrappers':
  3267. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3268. $text .= " Recompile it without this flag if possible";
  3269. break;
  3270. case 'php':
  3271. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3272. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3273. break;
  3274. case 'openssl_version':
  3275. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3276. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3277. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3278. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3279. break;
  3280. case 'xdebug_loaded':
  3281. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3282. $text .= " Disabling it when using Composer is recommended.";
  3283. break;
  3284. case 'xdebug_profile':
  3285. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3286. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3287. $text .= " xdebug.profiler_enabled = 0";
  3288. $displayIniMessage = true;
  3289. break;
  3290. case 'onedrive':
  3291. $text = "The Windows OneDrive folder is not supported on PHP versions below 7.2.23 and 7.3.10.".PHP_EOL;
  3292. $text .= "Upgrade your PHP ({$current}) to use this location with Composer.".PHP_EOL;
  3293. break;
  3294. }
  3295. $out($text, 'comment');
  3296. }
  3297. }
  3298. if ($displayIniMessage) {
  3299. $out($iniMessage, 'comment');
  3300. }
  3301. return !$warnings && !$errors ? true : $output;
  3302. }
  3303. private function checkConnectivity()
  3304. {
  3305. if (!ini_get('allow_url_fopen')) {
  3306. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3307. return $result;
  3308. }
  3309. return true;
  3310. }
  3311. }
  3312. <?php
  3313. namespace Composer\Command;
  3314. use Composer\Plugin\CommandEvent;
  3315. use Composer\Plugin\PluginEvents;
  3316. use Symfony\Component\Console\Input\InputInterface;
  3317. use Symfony\Component\Console\Input\InputOption;
  3318. use Symfony\Component\Console\Output\OutputInterface;
  3319. class DumpAutoloadCommand extends BaseCommand
  3320. {
  3321. protected function configure()
  3322. {
  3323. $this
  3324. ->setName('dump-autoload')
  3325. ->setAliases(array('dumpautoload'))
  3326. ->setDescription('Dumps the autoloader.')
  3327. ->setDefinition(array(
  3328. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3329. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3330. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3331. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3332. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3333. ))
  3334. ->setHelp(
  3335. <<<EOT
  3336. <info>php composer.phar dump-autoload</info>
  3337. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3338. EOT
  3339. )
  3340. ;
  3341. }
  3342. protected function execute(InputInterface $input, OutputInterface $output)
  3343. {
  3344. $composer = $this->getComposer();
  3345. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3346. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3347. $installationManager = $composer->getInstallationManager();
  3348. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3349. $package = $composer->getPackage();
  3350. $config = $composer->getConfig();
  3351. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3352. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3353. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3354. if ($authoritative) {
  3355. $this->getIO()->write('<info>Generating optimized autoload files (authoritative)</info>');
  3356. } elseif ($optimize) {
  3357. $this->getIO()->write('<info>Generating optimized autoload files</info>');
  3358. } else {
  3359. $this->getIO()->write('<info>Generating autoload files</info>');
  3360. }
  3361. $generator = $composer->getAutoloadGenerator();
  3362. $generator->setDevMode(!$input->getOption('no-dev'));
  3363. $generator->setClassMapAuthoritative($authoritative);
  3364. $generator->setApcu($apcu);
  3365. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3366. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3367. if ($authoritative) {
  3368. $this->getIO()->write('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3369. } elseif ($optimize) {
  3370. $this->getIO()->write('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3371. } else {
  3372. $this->getIO()->write('<info>Generated autoload files</info>');
  3373. }
  3374. return 0;
  3375. }
  3376. }
  3377. <?php
  3378. namespace Composer\Command;
  3379. use Symfony\Component\Console\Input\InputInterface;
  3380. use Symfony\Component\Console\Input\InputOption;
  3381. use Symfony\Component\Console\Output\OutputInterface;
  3382. use Symfony\Component\Console\Input\InputArgument;
  3383. class ExecCommand extends BaseCommand
  3384. {
  3385. protected function configure()
  3386. {
  3387. $this
  3388. ->setName('exec')
  3389. ->setDescription('Executes a vendored binary/script.')
  3390. ->setDefinition(array(
  3391. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3392. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3393. new InputArgument(
  3394. 'args',
  3395. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3396. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3397. ),
  3398. ))
  3399. ->setHelp(
  3400. <<<EOT
  3401. Executes a vendored binary/script.
  3402. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3403. EOT
  3404. )
  3405. ;
  3406. }
  3407. protected function execute(InputInterface $input, OutputInterface $output)
  3408. {
  3409. $composer = $this->getComposer();
  3410. $binDir = $composer->getConfig()->get('bin-dir');
  3411. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3412. $bins = glob($binDir . '/*');
  3413. $bins = array_merge($bins, array_map(function ($e) {
  3414. return "$e (local)";
  3415. }, $composer->getPackage()->getBinaries()));
  3416. if (!$bins) {
  3417. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3418. }
  3419. $this->getIO()->write(
  3420. <<<EOT
  3421. <comment>Available binaries:</comment>
  3422. EOT
  3423. );
  3424. foreach ($bins as $bin) {
  3425. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3426. continue;
  3427. }
  3428. $previousBin = $bin;
  3429. $bin = basename($bin);
  3430. $this->getIO()->write(
  3431. <<<EOT
  3432. <info>- $bin</info>
  3433. EOT
  3434. );
  3435. }
  3436. return 0;
  3437. }
  3438. $binary = $input->getArgument('binary');
  3439. $dispatcher = $composer->getEventDispatcher();
  3440. $dispatcher->addListener('__exec_command', $binary);
  3441. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3442. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3443. }
  3444. if (getcwd() !== $this->getApplication()->getInitialWorkingDirectory()) {
  3445. try {
  3446. chdir($this->getApplication()->getInitialWorkingDirectory());
  3447. } catch (\Exception $e) {
  3448. throw new \RuntimeException('Could not switch back to working directory "'.$this->getApplication()->getInitialWorkingDirectory().'"', 0, $e);
  3449. }
  3450. }
  3451. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3452. }
  3453. }
  3454. <?php
  3455. namespace Composer\Command;
  3456. use Composer\Package\CompletePackageInterface;
  3457. use Composer\Package\AliasPackage;
  3458. use Composer\Repository\CompositeRepository;
  3459. use Symfony\Component\Console\Input\InputInterface;
  3460. use Symfony\Component\Console\Input\InputOption;
  3461. use Symfony\Component\Console\Output\OutputInterface;
  3462. class FundCommand extends BaseCommand
  3463. {
  3464. protected function configure()
  3465. {
  3466. $this->setName('fund')
  3467. ->setDescription('Discover how to help fund the maintenance of your dependencies.')
  3468. ;
  3469. }
  3470. protected function execute(InputInterface $input, OutputInterface $output)
  3471. {
  3472. $composer = $this->getComposer();
  3473. $repo = $composer->getRepositoryManager()->getLocalRepository();
  3474. $remoteRepos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  3475. $fundings = array();
  3476. foreach ($repo->getPackages() as $package) {
  3477. if ($package instanceof AliasPackage) {
  3478. continue;
  3479. }
  3480. $latest = $remoteRepos->findPackage($package->getName(), 'dev-master');
  3481. if ($latest instanceof CompletePackageInterface && $latest->getFunding()) {
  3482. $fundings = $this->insertFundingData($fundings, $latest);
  3483. continue;
  3484. }
  3485. if ($package instanceof CompletePackageInterface && $package->getFunding()) {
  3486. $fundings = $this->insertFundingData($fundings, $package);
  3487. }
  3488. }
  3489. ksort($fundings);
  3490. $io = $this->getIO();
  3491. if ($fundings) {
  3492. $prev = null;
  3493. $io->write('The following packages were found in your dependencies which publish funding information:');
  3494. foreach ($fundings as $vendor => $links) {
  3495. $io->write('');
  3496. $io->write(sprintf("<comment>%s</comment>", $vendor));
  3497. foreach ($links as $url => $packages) {
  3498. $line = sprintf(' <info>%s</info>', implode(', ', $packages));
  3499. if ($prev !== $line) {
  3500. $io->write($line);
  3501. $prev = $line;
  3502. }
  3503. $io->write(sprintf(' %s', $url));
  3504. }
  3505. }
  3506. $io->write("");
  3507. $io->write("Please consider following these links and sponsoring the work of package authors!");
  3508. $io->write("Thank you!");
  3509. } else {
  3510. $io->write("No funding links were found in your package dependencies. This doesn't mean they don't need your support!");
  3511. }
  3512. return 0;
  3513. }
  3514. private function insertFundingData(array $fundings, CompletePackageInterface $package)
  3515. {
  3516. foreach ($package->getFunding() as $fundingOption) {
  3517. list($vendor, $packageName) = explode('/', $package->getPrettyName());
  3518. if (empty($fundingOption['url'])) {
  3519. continue;
  3520. }
  3521. $url = $fundingOption['url'];
  3522. if (!empty($fundingOption['type']) && $fundingOption['type'] === 'github' && preg_match('{^https://github.com/([^/]+)$}', $url, $match)) {
  3523. $url = 'https://github.com/sponsors/'.$match[1];
  3524. }
  3525. $fundings[$vendor][$url][] = $packageName;
  3526. }
  3527. return $fundings;
  3528. }
  3529. }
  3530. <?php
  3531. namespace Composer\Command;
  3532. use Composer\Factory;
  3533. use Composer\Util\Filesystem;
  3534. use Symfony\Component\Console\Input\InputInterface;
  3535. use Symfony\Component\Console\Input\InputArgument;
  3536. use Symfony\Component\Console\Input\StringInput;
  3537. use Symfony\Component\Console\Output\OutputInterface;
  3538. class GlobalCommand extends BaseCommand
  3539. {
  3540. protected function configure()
  3541. {
  3542. $this
  3543. ->setName('global')
  3544. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3545. ->setDefinition(array(
  3546. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3547. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3548. ))
  3549. ->setHelp(
  3550. <<<EOT
  3551. Use this command as a wrapper to run other Composer commands
  3552. within the global context of COMPOSER_HOME.
  3553. You can use this to install CLI utilities globally, all you need
  3554. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3555. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3556. and /home/<user>/.composer on unix systems.
  3557. If your system uses freedesktop.org standards, then it will first check
  3558. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3559. Note: This path may vary depending on customizations to bin-dir in
  3560. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3561. Read more at https://getcomposer.org/doc/03-cli.md#global
  3562. EOT
  3563. )
  3564. ;
  3565. }
  3566. public function run(InputInterface $input, OutputInterface $output)
  3567. {
  3568. $tokens = preg_split('{\s+}', $input->__toString());
  3569. $args = array();
  3570. foreach ($tokens as $token) {
  3571. if ($token && $token[0] !== '-') {
  3572. $args[] = $token;
  3573. if (count($args) >= 2) {
  3574. break;
  3575. }
  3576. }
  3577. }
  3578. if (count($args) < 2) {
  3579. return parent::run($input, $output);
  3580. }
  3581. if (getenv('COMPOSER')) {
  3582. putenv('COMPOSER');
  3583. unset($_SERVER['COMPOSER']);
  3584. }
  3585. $config = Factory::createConfig();
  3586. $home = $config->get('home');
  3587. if (!is_dir($home)) {
  3588. $fs = new Filesystem();
  3589. $fs->ensureDirectoryExists($home);
  3590. if (!is_dir($home)) {
  3591. throw new \RuntimeException('Could not create home directory');
  3592. }
  3593. }
  3594. try {
  3595. chdir($home);
  3596. } catch (\Exception $e) {
  3597. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3598. }
  3599. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3600. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3601. $this->getApplication()->resetComposer();
  3602. return $this->getApplication()->run($input, $output);
  3603. }
  3604. public function isProxyCommand()
  3605. {
  3606. return true;
  3607. }
  3608. }
  3609. <?php
  3610. namespace Composer\Command;
  3611. use Composer\Package\CompletePackageInterface;
  3612. use Composer\Repository\RepositoryInterface;
  3613. use Composer\Repository\ArrayRepository;
  3614. use Composer\Repository\RepositoryFactory;
  3615. use Composer\Util\Platform;
  3616. use Composer\Util\ProcessExecutor;
  3617. use Symfony\Component\Console\Input\InputArgument;
  3618. use Symfony\Component\Console\Input\InputOption;
  3619. use Symfony\Component\Console\Input\InputInterface;
  3620. use Symfony\Component\Console\Output\OutputInterface;
  3621. class HomeCommand extends BaseCommand
  3622. {
  3623. protected function configure()
  3624. {
  3625. $this
  3626. ->setName('browse')
  3627. ->setAliases(array('home'))
  3628. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3629. ->setDefinition(array(
  3630. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3631. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3632. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3633. ))
  3634. ->setHelp(
  3635. <<<EOT
  3636. The home command opens or shows a package's repository URL or
  3637. homepage in your default browser.
  3638. To open the homepage by default, use -H or --homepage.
  3639. To show instead of open the repository or homepage URL, use -s or --show.
  3640. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3641. EOT
  3642. );
  3643. }
  3644. protected function execute(InputInterface $input, OutputInterface $output)
  3645. {
  3646. $repos = $this->initializeRepos();
  3647. $io = $this->getIO();
  3648. $return = 0;
  3649. $packages = $input->getArgument('packages');
  3650. if (!$packages) {
  3651. $io->writeError('No package specified, opening homepage for the root package');
  3652. $packages = array($this->getComposer()->getPackage()->getName());
  3653. }
  3654. foreach ($packages as $packageName) {
  3655. $handled = false;
  3656. $packageExists = false;
  3657. foreach ($repos as $repo) {
  3658. foreach ($repo->findPackages($packageName) as $package) {
  3659. $packageExists = true;
  3660. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3661. $handled = true;
  3662. break 2;
  3663. }
  3664. }
  3665. }
  3666. if (!$packageExists) {
  3667. $return = 1;
  3668. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3669. }
  3670. if (!$handled) {
  3671. $return = 1;
  3672. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3673. }
  3674. }
  3675. return $return;
  3676. }
  3677. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3678. {
  3679. $support = $package->getSupport();
  3680. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3681. if (!$url || $showHomepage) {
  3682. $url = $package->getHomepage();
  3683. }
  3684. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3685. return false;
  3686. }
  3687. if ($showOnly) {
  3688. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3689. } else {
  3690. $this->openBrowser($url);
  3691. }
  3692. return true;
  3693. }
  3694. private function openBrowser($url)
  3695. {
  3696. $url = ProcessExecutor::escape($url);
  3697. $process = new ProcessExecutor($this->getIO());
  3698. if (Platform::isWindows()) {
  3699. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3700. }
  3701. $linux = $process->execute('which xdg-open', $output);
  3702. $osx = $process->execute('which open', $output);
  3703. if (0 === $linux) {
  3704. $process->execute('xdg-open ' . $url, $output);
  3705. } elseif (0 === $osx) {
  3706. $process->execute('open ' . $url, $output);
  3707. } else {
  3708. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3709. }
  3710. }
  3711. private function initializeRepos()
  3712. {
  3713. $composer = $this->getComposer(false);
  3714. if ($composer) {
  3715. return array_merge(
  3716. array(new ArrayRepository(array($composer->getPackage()))),
  3717. array($composer->getRepositoryManager()->getLocalRepository()),
  3718. $composer->getRepositoryManager()->getRepositories()
  3719. );
  3720. }
  3721. return RepositoryFactory::defaultRepos($this->getIO());
  3722. }
  3723. }
  3724. <?php
  3725. namespace Composer\Command;
  3726. use Composer\DependencyResolver\Pool;
  3727. use Composer\Factory;
  3728. use Composer\Json\JsonFile;
  3729. use Composer\Package\BasePackage;
  3730. use Composer\Package\Package;
  3731. use Composer\Package\Version\VersionParser;
  3732. use Composer\Package\Version\VersionSelector;
  3733. use Composer\Repository\CompositeRepository;
  3734. use Composer\Repository\PlatformRepository;
  3735. use Composer\Repository\RepositoryFactory;
  3736. use Composer\Util\ProcessExecutor;
  3737. use Symfony\Component\Console\Input\ArrayInput;
  3738. use Symfony\Component\Console\Input\InputInterface;
  3739. use Symfony\Component\Console\Input\InputOption;
  3740. use Symfony\Component\Console\Output\OutputInterface;
  3741. use Symfony\Component\Process\ExecutableFinder;
  3742. use Symfony\Component\Process\Process;
  3743. class InitCommand extends BaseCommand
  3744. {
  3745. protected $repos;
  3746. private $gitConfig;
  3747. private $pools;
  3748. protected function configure()
  3749. {
  3750. $this
  3751. ->setName('init')
  3752. ->setDescription('Creates a basic composer.json file in current directory.')
  3753. ->setDefinition(array(
  3754. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3755. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3756. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3757. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3758. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3759. new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3760. new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  3761. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3762. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3763. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3764. ))
  3765. ->setHelp(
  3766. <<<EOT
  3767. The <info>init</info> command creates a basic composer.json file
  3768. in the current directory.
  3769. <info>php composer.phar init</info>
  3770. Read more at https://getcomposer.org/doc/03-cli.md#init
  3771. EOT
  3772. )
  3773. ;
  3774. }
  3775. protected function execute(InputInterface $input, OutputInterface $output)
  3776. {
  3777. $io = $this->getIO();
  3778. $allowList = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3779. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($allowList)));
  3780. if (isset($options['author'])) {
  3781. $options['authors'] = $this->formatAuthors($options['author']);
  3782. unset($options['author']);
  3783. }
  3784. $repositories = $input->getOption('repository');
  3785. if ($repositories) {
  3786. $config = Factory::createConfig($io);
  3787. foreach ($repositories as $repo) {
  3788. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3789. }
  3790. }
  3791. if (isset($options['stability'])) {
  3792. $options['minimum-stability'] = $options['stability'];
  3793. unset($options['stability']);
  3794. }
  3795. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3796. if (array() === $options['require']) {
  3797. $options['require'] = new \stdClass;
  3798. }
  3799. if (isset($options['require-dev'])) {
  3800. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3801. if (array() === $options['require-dev']) {
  3802. $options['require-dev'] = new \stdClass;
  3803. }
  3804. }
  3805. $file = new JsonFile(Factory::getComposerFile());
  3806. $json = $file->encode($options);
  3807. if ($input->isInteractive()) {
  3808. $io->writeError(array('', $json, ''));
  3809. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3810. $io->writeError('<error>Command aborted</error>');
  3811. return 1;
  3812. }
  3813. }
  3814. $file->write($options);
  3815. if ($input->isInteractive() && is_dir('.git')) {
  3816. $ignoreFile = realpath('.gitignore');
  3817. if (false === $ignoreFile) {
  3818. $ignoreFile = realpath('.') . '/.gitignore';
  3819. }
  3820. if (!$this->hasVendorIgnore($ignoreFile)) {
  3821. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3822. if ($io->askConfirmation($question, true)) {
  3823. $this->addVendorIgnore($ignoreFile);
  3824. }
  3825. }
  3826. }
  3827. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3828. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3829. $this->installDependencies($output);
  3830. }
  3831. return 0;
  3832. }
  3833. protected function interact(InputInterface $input, OutputInterface $output)
  3834. {
  3835. $git = $this->getGitConfig();
  3836. $io = $this->getIO();
  3837. $formatter = $this->getHelperSet()->get('formatter');
  3838. $repositories = $input->getOption('repository');
  3839. if ($repositories) {
  3840. $config = Factory::createConfig($io);
  3841. $repos = array(new PlatformRepository);
  3842. $createDefaultPackagistRepo = true;
  3843. foreach ($repositories as $repo) {
  3844. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3845. if (
  3846. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3847. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3848. ) {
  3849. $createDefaultPackagistRepo = false;
  3850. continue;
  3851. }
  3852. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3853. }
  3854. if ($createDefaultPackagistRepo) {
  3855. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3856. 'type' => 'composer',
  3857. 'url' => 'https://repo.packagist.org',
  3858. ));
  3859. }
  3860. $this->repos = new CompositeRepository($repos);
  3861. unset($repos, $config, $repositories);
  3862. }
  3863. $io->writeError(array(
  3864. '',
  3865. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3866. '',
  3867. ));
  3868. $io->writeError(array(
  3869. '',
  3870. 'This command will guide you through creating your composer.json config.',
  3871. '',
  3872. ));
  3873. $cwd = realpath(".");
  3874. if (!$name = $input->getOption('name')) {
  3875. $name = basename($cwd);
  3876. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3877. $name = strtolower($name);
  3878. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3879. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3880. } elseif (isset($git['github.user'])) {
  3881. $name = $git['github.user'] . '/' . $name;
  3882. } elseif (!empty($_SERVER['USERNAME'])) {
  3883. $name = $_SERVER['USERNAME'] . '/' . $name;
  3884. } elseif (!empty($_SERVER['USER'])) {
  3885. $name = $_SERVER['USER'] . '/' . $name;
  3886. } elseif (get_current_user()) {
  3887. $name = get_current_user() . '/' . $name;
  3888. } else {
  3889. $name .= '/' . $name;
  3890. }
  3891. $name = strtolower($name);
  3892. } else {
  3893. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3894. throw new \InvalidArgumentException(
  3895. 'The package name '.$name.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3896. );
  3897. }
  3898. }
  3899. $name = $io->askAndValidate(
  3900. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3901. function ($value) use ($name) {
  3902. if (null === $value) {
  3903. return $name;
  3904. }
  3905. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3906. throw new \InvalidArgumentException(
  3907. 'The package name '.$value.' is invalid, it should be lowercase and have a vendor name, a forward slash, and a package name, matching: [a-z0-9_.-]+/[a-z0-9_.-]+'
  3908. );
  3909. }
  3910. return $value;
  3911. },
  3912. null,
  3913. $name
  3914. );
  3915. $input->setOption('name', $name);
  3916. $description = $input->getOption('description') ?: false;
  3917. $description = $io->ask(
  3918. 'Description [<comment>'.$description.'</comment>]: ',
  3919. $description
  3920. );
  3921. $input->setOption('description', $description);
  3922. if (null === $author = $input->getOption('author')) {
  3923. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3924. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3925. } elseif (isset($git['user.name'])) {
  3926. $author_name = $git['user.name'];
  3927. }
  3928. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3929. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3930. } elseif (isset($git['user.email'])) {
  3931. $author_email = $git['user.email'];
  3932. }
  3933. if (isset($author_name) && isset($author_email)) {
  3934. $author = sprintf('%s <%s>', $author_name, $author_email);
  3935. }
  3936. }
  3937. $self = $this;
  3938. $author = $io->askAndValidate(
  3939. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3940. function ($value) use ($self, $author) {
  3941. if ($value === 'n' || $value === 'no') {
  3942. return;
  3943. }
  3944. $value = $value ?: $author;
  3945. $author = $self->parseAuthorString($value);
  3946. return sprintf('%s <%s>', $author['name'], $author['email']);
  3947. },
  3948. null,
  3949. $author
  3950. );
  3951. $input->setOption('author', $author);
  3952. $minimumStability = $input->getOption('stability') ?: null;
  3953. $minimumStability = $io->askAndValidate(
  3954. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3955. function ($value) use ($minimumStability) {
  3956. if (null === $value) {
  3957. return $minimumStability;
  3958. }
  3959. if (!isset(BasePackage::$stabilities[$value])) {
  3960. throw new \InvalidArgumentException(
  3961. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3962. implode(', ', array_keys(BasePackage::$stabilities))
  3963. );
  3964. }
  3965. return $value;
  3966. },
  3967. null,
  3968. $minimumStability
  3969. );
  3970. $input->setOption('stability', $minimumStability);
  3971. $type = $input->getOption('type') ?: false;
  3972. $type = $io->ask(
  3973. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3974. $type
  3975. );
  3976. $input->setOption('type', $type);
  3977. if (null === $license = $input->getOption('license')) {
  3978. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3979. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3980. }
  3981. }
  3982. $license = $io->ask(
  3983. 'License [<comment>'.$license.'</comment>]: ',
  3984. $license
  3985. );
  3986. $input->setOption('license', $license);
  3987. $io->writeError(array('', 'Define your dependencies.', ''));
  3988. $repos = $this->getRepos();
  3989. $preferredStability = $minimumStability ?: 'stable';
  3990. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3991. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3992. $require = $input->getOption('require');
  3993. $requirements = array();
  3994. if ($require || $io->askConfirmation($question, true)) {
  3995. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3996. }
  3997. $input->setOption('require', $requirements);
  3998. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3999. $requireDev = $input->getOption('require-dev');
  4000. $devRequirements = array();
  4001. if ($requireDev || $io->askConfirmation($question, true)) {
  4002. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  4003. }
  4004. $input->setOption('require-dev', $devRequirements);
  4005. }
  4006. public function parseAuthorString($author)
  4007. {
  4008. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  4009. if ($this->isValidEmail($match['email'])) {
  4010. return array(
  4011. 'name' => trim($match['name']),
  4012. 'email' => $match['email'],
  4013. );
  4014. }
  4015. }
  4016. throw new \InvalidArgumentException(
  4017. 'Invalid author string. Must be in the format: '.
  4018. 'John Smith <john@example.com>'
  4019. );
  4020. }
  4021. protected function findPackages($name)
  4022. {
  4023. return $this->getRepos()->search($name);
  4024. }
  4025. protected function getRepos()
  4026. {
  4027. if (!$this->repos) {
  4028. $this->repos = new CompositeRepository(array_merge(
  4029. array(new PlatformRepository),
  4030. RepositoryFactory::defaultRepos($this->getIO())
  4031. ));
  4032. }
  4033. return $this->repos;
  4034. }
  4035. final protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true, $fixed = false)
  4036. {
  4037. if ($requires) {
  4038. $requires = $this->normalizeRequirements($requires);
  4039. $result = array();
  4040. $io = $this->getIO();
  4041. foreach ($requires as $requirement) {
  4042. if (!isset($requirement['version'])) {
  4043. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, null, null, $fixed);
  4044. $requirement['version'] = $version;
  4045. $requirement['name'] = $name;
  4046. $io->writeError(sprintf(
  4047. 'Using version <info>%s</info> for <info>%s</info>',
  4048. $requirement['version'],
  4049. $requirement['name']
  4050. ));
  4051. } else {
  4052. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev', $fixed);
  4053. $requirement['name'] = $name;
  4054. }
  4055. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  4056. }
  4057. return $result;
  4058. }
  4059. $versionParser = new VersionParser();
  4060. $composer = $this->getComposer(false);
  4061. $installedRepo = $composer ? $composer->getRepositoryManager()->getLocalRepository() : null;
  4062. $existingPackages = array();
  4063. if ($installedRepo) {
  4064. foreach ($installedRepo->getPackages() as $package) {
  4065. $existingPackages[] = $package->getName();
  4066. }
  4067. }
  4068. unset($composer, $installedRepo);
  4069. $io = $this->getIO();
  4070. while (null !== $package = $io->ask('Search for a package: ')) {
  4071. $matches = $this->findPackages($package);
  4072. if (count($matches)) {
  4073. foreach ($matches as $position => $foundPackage) {
  4074. if (in_array($foundPackage['name'], $existingPackages, true)) {
  4075. unset($matches[$position]);
  4076. }
  4077. }
  4078. $matches = array_values($matches);
  4079. $exactMatch = null;
  4080. $choices = array();
  4081. foreach ($matches as $position => $foundPackage) {
  4082. $abandoned = '';
  4083. if (isset($foundPackage['abandoned'])) {
  4084. if (is_string($foundPackage['abandoned'])) {
  4085. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  4086. } else {
  4087. $replacement = 'No replacement was suggested';
  4088. }
  4089. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  4090. }
  4091. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  4092. if ($foundPackage['name'] === $package) {
  4093. $exactMatch = true;
  4094. break;
  4095. }
  4096. }
  4097. if (!$exactMatch) {
  4098. $io->writeError(array(
  4099. '',
  4100. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  4101. '',
  4102. ));
  4103. $io->writeError($choices);
  4104. $io->writeError('');
  4105. $validator = function ($selection) use ($matches, $versionParser) {
  4106. if ('' === $selection) {
  4107. return false;
  4108. }
  4109. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  4110. $package = $matches[(int) $selection];
  4111. return $package['name'];
  4112. }
  4113. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  4114. if (isset($packageMatches['version'])) {
  4115. $versionParser->parseConstraints($packageMatches['version']);
  4116. return $packageMatches['name'].' '.$packageMatches['version'];
  4117. }
  4118. return $packageMatches['name'];
  4119. }
  4120. throw new \Exception('Not a valid selection');
  4121. };
  4122. $package = $io->askAndValidate(
  4123. 'Enter package # to add, or the complete package name if it is not listed: ',
  4124. $validator,
  4125. 3,
  4126. false
  4127. );
  4128. }
  4129. if (false !== $package && false === strpos($package, ' ')) {
  4130. $validator = function ($input) {
  4131. $input = trim($input);
  4132. return $input ?: false;
  4133. };
  4134. $constraint = $io->askAndValidate(
  4135. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  4136. $validator,
  4137. 3,
  4138. false
  4139. );
  4140. if (false === $constraint) {
  4141. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  4142. $io->writeError(sprintf(
  4143. 'Using version <info>%s</info> for <info>%s</info>',
  4144. $constraint,
  4145. $package
  4146. ));
  4147. }
  4148. $package .= ' '.$constraint;
  4149. }
  4150. if (false !== $package) {
  4151. $requires[] = $package;
  4152. $existingPackages[] = substr($package, 0, strpos($package, ' '));
  4153. }
  4154. }
  4155. }
  4156. return $requires;
  4157. }
  4158. protected function formatAuthors($author)
  4159. {
  4160. return array($this->parseAuthorString($author));
  4161. }
  4162. protected function formatRequirements(array $requirements)
  4163. {
  4164. $requires = array();
  4165. $requirements = $this->normalizeRequirements($requirements);
  4166. foreach ($requirements as $requirement) {
  4167. $requires[$requirement['name']] = $requirement['version'];
  4168. }
  4169. return $requires;
  4170. }
  4171. protected function getGitConfig()
  4172. {
  4173. if (null !== $this->gitConfig) {
  4174. return $this->gitConfig;
  4175. }
  4176. $finder = new ExecutableFinder();
  4177. $gitBin = $finder->find('git');
  4178. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  4179. $cmd = new Process(array($gitBin, 'config', '-l'));
  4180. } else {
  4181. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  4182. }
  4183. $cmd->run();
  4184. if ($cmd->isSuccessful()) {
  4185. $this->gitConfig = array();
  4186. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  4187. foreach ($matches as $match) {
  4188. $this->gitConfig[$match[1]] = $match[2];
  4189. }
  4190. return $this->gitConfig;
  4191. }
  4192. return $this->gitConfig = array();
  4193. }
  4194. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  4195. {
  4196. if (!file_exists($ignoreFile)) {
  4197. return false;
  4198. }
  4199. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  4200. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  4201. foreach ($lines as $line) {
  4202. if (preg_match($pattern, $line)) {
  4203. return true;
  4204. }
  4205. }
  4206. return false;
  4207. }
  4208. protected function normalizeRequirements(array $requirements)
  4209. {
  4210. $parser = new VersionParser();
  4211. return $parser->parseNameVersionPairs($requirements);
  4212. }
  4213. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  4214. {
  4215. $contents = "";
  4216. if (file_exists($ignoreFile)) {
  4217. $contents = file_get_contents($ignoreFile);
  4218. if ("\n" !== substr($contents, 0, -1)) {
  4219. $contents .= "\n";
  4220. }
  4221. }
  4222. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  4223. }
  4224. protected function isValidEmail($email)
  4225. {
  4226. if (!function_exists('filter_var')) {
  4227. return true;
  4228. }
  4229. if (PHP_VERSION_ID < 50303) {
  4230. return true;
  4231. }
  4232. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  4233. }
  4234. private function getPool(InputInterface $input, $minimumStability = null)
  4235. {
  4236. $key = $minimumStability ?: 'default';
  4237. if (!isset($this->pools[$key])) {
  4238. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  4239. $pool->addRepository($this->getRepos());
  4240. }
  4241. return $this->pools[$key];
  4242. }
  4243. private function getMinimumStability(InputInterface $input)
  4244. {
  4245. if ($input->hasOption('stability')) {
  4246. return VersionParser::normalizeStability($input->getOption('stability') ?: 'stable');
  4247. }
  4248. $file = Factory::getComposerFile();
  4249. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  4250. if (!empty($composer['minimum-stability'])) {
  4251. return VersionParser::normalizeStability($composer['minimum-stability']);
  4252. }
  4253. }
  4254. return 'stable';
  4255. }
  4256. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null, $fixed = null)
  4257. {
  4258. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  4259. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  4260. if ($ignorePlatformReqs) {
  4261. $phpVersion = null;
  4262. }
  4263. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  4264. if (!$package) {
  4265. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  4266. return array($name, $requiredVersion ?: '*');
  4267. }
  4268. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  4269. throw new \InvalidArgumentException(sprintf(
  4270. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  4271. $name,
  4272. $requiredVersion,
  4273. $phpVersion
  4274. ));
  4275. }
  4276. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  4277. throw new \InvalidArgumentException(sprintf(
  4278. 'Could not find package %s in a version matching %s',
  4279. $name,
  4280. $requiredVersion
  4281. ));
  4282. }
  4283. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4284. throw new \InvalidArgumentException(sprintf(
  4285. 'Could not find package %s in any version matching your PHP version (%s)',
  4286. $name,
  4287. $phpVersion
  4288. ));
  4289. }
  4290. $similar = $this->findSimilar($name);
  4291. if ($similar) {
  4292. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4293. throw new \InvalidArgumentException(sprintf(
  4294. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4295. $name,
  4296. $this->getMinimumStability($input)
  4297. ));
  4298. }
  4299. throw new \InvalidArgumentException(sprintf(
  4300. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4301. $name,
  4302. implode("\n ", $similar)
  4303. ));
  4304. }
  4305. throw new \InvalidArgumentException(sprintf(
  4306. 'Could not find a matching version of package %s. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (%s).',
  4307. $name,
  4308. $this->getMinimumStability($input)
  4309. ));
  4310. }
  4311. return array(
  4312. $package->getPrettyName(),
  4313. $fixed ? $package->getPrettyVersion() : $versionSelector->findRecommendedRequireVersion($package),
  4314. );
  4315. }
  4316. private function findSimilar($package)
  4317. {
  4318. try {
  4319. $results = $this->repos->search($package);
  4320. } catch (\Exception $e) {
  4321. return array();
  4322. }
  4323. $similarPackages = array();
  4324. $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  4325. foreach ($results as $result) {
  4326. if ($installedRepo->findPackage($result['name'], '*')) {
  4327. continue;
  4328. }
  4329. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4330. }
  4331. asort($similarPackages);
  4332. return array_keys(array_slice($similarPackages, 0, 5));
  4333. }
  4334. private function installDependencies($output)
  4335. {
  4336. try {
  4337. $installCommand = $this->getApplication()->find('install');
  4338. $installCommand->run(new ArrayInput(array()), $output);
  4339. } catch (\Exception $e) {
  4340. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4341. }
  4342. }
  4343. private function hasDependencies($options)
  4344. {
  4345. $requires = (array) $options['require'];
  4346. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4347. return !empty($requires) || !empty($devRequires);
  4348. }
  4349. }
  4350. <?php
  4351. namespace Composer\Command;
  4352. use Composer\Installer;
  4353. use Composer\Plugin\CommandEvent;
  4354. use Composer\Plugin\PluginEvents;
  4355. use Symfony\Component\Console\Input\InputInterface;
  4356. use Symfony\Component\Console\Input\InputOption;
  4357. use Symfony\Component\Console\Input\InputArgument;
  4358. use Symfony\Component\Console\Output\OutputInterface;
  4359. class InstallCommand extends BaseCommand
  4360. {
  4361. protected function configure()
  4362. {
  4363. $this
  4364. ->setName('install')
  4365. ->setAliases(array('i'))
  4366. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4367. ->setDefinition(array(
  4368. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4369. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4370. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4371. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4372. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4373. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4374. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4375. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4376. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4377. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4378. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4379. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4380. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4381. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4382. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4383. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4384. ))
  4385. ->setHelp(
  4386. <<<EOT
  4387. The <info>install</info> command reads the composer.lock file from
  4388. the current directory, processes it, and downloads and installs all the
  4389. libraries and dependencies outlined in that file. If the file does not
  4390. exist it will look for composer.json and do the same.
  4391. <info>php composer.phar install</info>
  4392. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4393. EOT
  4394. )
  4395. ;
  4396. }
  4397. protected function execute(InputInterface $input, OutputInterface $output)
  4398. {
  4399. $io = $this->getIO();
  4400. if ($args = $input->getArgument('packages')) {
  4401. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4402. return 1;
  4403. }
  4404. if ($input->getOption('no-custom-installers')) {
  4405. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4406. $input->setOption('no-plugins', true);
  4407. }
  4408. if ($input->getOption('dev')) {
  4409. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4410. }
  4411. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4412. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4413. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4414. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4415. $install = Installer::create($io, $composer);
  4416. $config = $composer->getConfig();
  4417. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4418. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4419. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4420. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4421. $install
  4422. ->setDryRun($input->getOption('dry-run'))
  4423. ->setVerbose($input->getOption('verbose'))
  4424. ->setPreferSource($preferSource)
  4425. ->setPreferDist($preferDist)
  4426. ->setDevMode(!$input->getOption('no-dev'))
  4427. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4428. ->setRunScripts(!$input->getOption('no-scripts'))
  4429. ->setSkipSuggest($input->getOption('no-suggest'))
  4430. ->setOptimizeAutoloader($optimize)
  4431. ->setClassMapAuthoritative($authoritative)
  4432. ->setApcuAutoloader($apcu)
  4433. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4434. ;
  4435. if ($input->getOption('no-plugins')) {
  4436. $install->disablePlugins();
  4437. }
  4438. return $install->run();
  4439. }
  4440. }
  4441. <?php
  4442. namespace Composer\Command;
  4443. use Composer\Json\JsonFile;
  4444. use Composer\Plugin\CommandEvent;
  4445. use Composer\Plugin\PluginEvents;
  4446. use Composer\Package\PackageInterface;
  4447. use Composer\Repository\RepositoryInterface;
  4448. use Symfony\Component\Console\Helper\Table;
  4449. use Symfony\Component\Console\Input\InputInterface;
  4450. use Symfony\Component\Console\Input\InputOption;
  4451. use Symfony\Component\Console\Output\OutputInterface;
  4452. class LicensesCommand extends BaseCommand
  4453. {
  4454. protected function configure()
  4455. {
  4456. $this
  4457. ->setName('licenses')
  4458. ->setDescription('Shows information about licenses of dependencies.')
  4459. ->setDefinition(array(
  4460. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4461. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4462. ))
  4463. ->setHelp(
  4464. <<<EOT
  4465. The license command displays detailed information about the licenses of
  4466. the installed dependencies.
  4467. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4468. EOT
  4469. )
  4470. ;
  4471. }
  4472. protected function execute(InputInterface $input, OutputInterface $output)
  4473. {
  4474. $composer = $this->getComposer();
  4475. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4476. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4477. $root = $composer->getPackage();
  4478. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4479. if ($input->getOption('no-dev')) {
  4480. $packages = $this->filterRequiredPackages($repo, $root);
  4481. } else {
  4482. $packages = $this->appendPackages($repo->getPackages(), array());
  4483. }
  4484. ksort($packages);
  4485. $io = $this->getIO();
  4486. switch ($format = $input->getOption('format')) {
  4487. case 'text':
  4488. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4489. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4490. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4491. $io->write('Dependencies:');
  4492. $io->write('');
  4493. $table = new Table($output);
  4494. $table->setStyle('compact');
  4495. $tableStyle = $table->getStyle();
  4496. if (method_exists($tableStyle, 'setVerticalBorderChars')) {
  4497. $tableStyle->setVerticalBorderChars('');
  4498. } else {
  4499. $tableStyle->setVerticalBorderChar('');
  4500. }
  4501. $tableStyle->setCellRowContentFormat('%s ');
  4502. $table->setHeaders(array('Name', 'Version', 'License'));
  4503. foreach ($packages as $package) {
  4504. $table->addRow(array(
  4505. $package->getPrettyName(),
  4506. $package->getFullPrettyVersion(),
  4507. implode(', ', $package->getLicense()) ?: 'none',
  4508. ));
  4509. }
  4510. $table->render();
  4511. break;
  4512. case 'json':
  4513. $dependencies = array();
  4514. foreach ($packages as $package) {
  4515. $dependencies[$package->getPrettyName()] = array(
  4516. 'version' => $package->getFullPrettyVersion(),
  4517. 'license' => $package->getLicense(),
  4518. );
  4519. }
  4520. $io->write(JsonFile::encode(array(
  4521. 'name' => $root->getPrettyName(),
  4522. 'version' => $root->getFullPrettyVersion(),
  4523. 'license' => $root->getLicense(),
  4524. 'dependencies' => $dependencies,
  4525. )));
  4526. break;
  4527. default:
  4528. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4529. }
  4530. return 0;
  4531. }
  4532. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4533. {
  4534. $requires = array_keys($package->getRequires());
  4535. $packageListNames = array_keys($bucket);
  4536. $packages = array_filter(
  4537. $repo->getPackages(),
  4538. function ($package) use ($requires, $packageListNames) {
  4539. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4540. }
  4541. );
  4542. $bucket = $this->appendPackages($packages, $bucket);
  4543. foreach ($packages as $package) {
  4544. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4545. }
  4546. return $bucket;
  4547. }
  4548. public function appendPackages(array $packages, array $bucket)
  4549. {
  4550. foreach ($packages as $package) {
  4551. $bucket[$package->getName()] = $package;
  4552. }
  4553. return $bucket;
  4554. }
  4555. }
  4556. <?php
  4557. namespace Composer\Command;
  4558. use Symfony\Component\Console\Input\InputInterface;
  4559. use Symfony\Component\Console\Input\InputArgument;
  4560. use Symfony\Component\Console\Input\ArrayInput;
  4561. use Symfony\Component\Console\Input\InputOption;
  4562. use Symfony\Component\Console\Output\OutputInterface;
  4563. class OutdatedCommand extends ShowCommand
  4564. {
  4565. protected function configure()
  4566. {
  4567. $this
  4568. ->setName('outdated')
  4569. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4570. ->setDefinition(array(
  4571. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4572. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4573. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4574. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4575. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4576. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4577. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4578. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  4579. ))
  4580. ->setHelp(
  4581. <<<EOT
  4582. The outdated command is just a proxy for `composer show -l`
  4583. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4584. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4585. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4586. compatibility breaks according to semver, so upgrade when you can but it
  4587. may involve work.
  4588. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4589. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4590. EOT
  4591. )
  4592. ;
  4593. }
  4594. protected function execute(InputInterface $input, OutputInterface $output)
  4595. {
  4596. $args = array(
  4597. 'command' => 'show',
  4598. '--latest' => true,
  4599. );
  4600. if (!$input->getOption('all')) {
  4601. $args['--outdated'] = true;
  4602. }
  4603. if ($input->getOption('direct')) {
  4604. $args['--direct'] = true;
  4605. }
  4606. if ($input->getArgument('package')) {
  4607. $args['package'] = $input->getArgument('package');
  4608. }
  4609. if ($input->getOption('strict')) {
  4610. $args['--strict'] = true;
  4611. }
  4612. if ($input->getOption('minor-only')) {
  4613. $args['--minor-only'] = true;
  4614. }
  4615. $args['--format'] = $input->getOption('format');
  4616. $args['--ignore'] = $input->getOption('ignore');
  4617. $input = new ArrayInput($args);
  4618. return $this->getApplication()->run($input, $output);
  4619. }
  4620. public function isProxyCommand()
  4621. {
  4622. return true;
  4623. }
  4624. }
  4625. <?php
  4626. namespace Composer\Command;
  4627. use Symfony\Component\Console\Input\InputInterface;
  4628. use Symfony\Component\Console\Output\OutputInterface;
  4629. class ProhibitsCommand extends BaseDependencyCommand
  4630. {
  4631. protected function configure()
  4632. {
  4633. parent::configure();
  4634. $this
  4635. ->setName('prohibits')
  4636. ->setAliases(array('why-not'))
  4637. ->setDescription('Shows which packages prevent the given package from being installed.')
  4638. ->setHelp(
  4639. <<<EOT
  4640. Displays detailed information about why a package cannot be installed.
  4641. <info>php composer.phar prohibits composer/composer</info>
  4642. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4643. EOT
  4644. )
  4645. ;
  4646. }
  4647. protected function execute(InputInterface $input, OutputInterface $output)
  4648. {
  4649. return parent::doExecute($input, $output, true);
  4650. }
  4651. }
  4652. <?php
  4653. namespace Composer\Command;
  4654. use Composer\Config\JsonConfigSource;
  4655. use Composer\Installer;
  4656. use Composer\Plugin\CommandEvent;
  4657. use Composer\Plugin\PluginEvents;
  4658. use Composer\Json\JsonFile;
  4659. use Composer\Factory;
  4660. use Symfony\Component\Console\Input\InputInterface;
  4661. use Symfony\Component\Console\Input\InputOption;
  4662. use Symfony\Component\Console\Input\InputArgument;
  4663. use Symfony\Component\Console\Output\OutputInterface;
  4664. use Composer\Package\BasePackage;
  4665. class RemoveCommand extends BaseCommand
  4666. {
  4667. protected function configure()
  4668. {
  4669. $this
  4670. ->setName('remove')
  4671. ->setDescription('Removes a package from the require or require-dev.')
  4672. ->setDefinition(array(
  4673. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4674. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4675. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4676. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4677. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4678. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4679. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4680. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4681. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4682. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4683. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4684. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4685. ))
  4686. ->setHelp(
  4687. <<<EOT
  4688. The <info>remove</info> command removes a package from the current
  4689. list of installed packages
  4690. <info>php composer.phar remove</info>
  4691. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4692. EOT
  4693. )
  4694. ;
  4695. }
  4696. protected function execute(InputInterface $input, OutputInterface $output)
  4697. {
  4698. $packages = $input->getArgument('packages');
  4699. $packages = array_map('strtolower', $packages);
  4700. $file = Factory::getComposerFile();
  4701. $jsonFile = new JsonFile($file);
  4702. $composer = $jsonFile->read();
  4703. $composerBackup = file_get_contents($jsonFile->getPath());
  4704. $json = new JsonConfigSource($jsonFile);
  4705. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4706. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4707. $io = $this->getIO();
  4708. if ($input->getOption('update-with-dependencies')) {
  4709. $io->writeError('<warning>You are using the deprecated option "update-with-dependencies". This is now default behaviour. The --no-update-with-dependencies option can be used to remove a package without its dependencies.</warning>');
  4710. }
  4711. foreach (array('require', 'require-dev') as $linkType) {
  4712. if (isset($composer[$linkType])) {
  4713. foreach ($composer[$linkType] as $name => $version) {
  4714. $composer[$linkType][strtolower($name)] = $name;
  4715. }
  4716. }
  4717. }
  4718. foreach ($packages as $package) {
  4719. if (isset($composer[$type][$package])) {
  4720. $json->removeLink($type, $composer[$type][$package]);
  4721. } elseif (isset($composer[$altType][$package])) {
  4722. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4723. if ($io->isInteractive()) {
  4724. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4725. $json->removeLink($altType, $composer[$altType][$package]);
  4726. }
  4727. }
  4728. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4729. foreach ($matches as $matchedPackage) {
  4730. $json->removeLink($type, $matchedPackage);
  4731. }
  4732. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4733. foreach ($matches as $matchedPackage) {
  4734. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4735. if ($io->isInteractive()) {
  4736. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4737. $json->removeLink($altType, $matchedPackage);
  4738. }
  4739. }
  4740. }
  4741. } else {
  4742. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4743. }
  4744. }
  4745. if ($input->getOption('no-update')) {
  4746. return 0;
  4747. }
  4748. $this->resetComposer();
  4749. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4750. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4751. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4752. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4753. $install = Installer::create($io, $composer);
  4754. $updateDevMode = !$input->getOption('update-no-dev');
  4755. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4756. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4757. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4758. $install
  4759. ->setVerbose($input->getOption('verbose'))
  4760. ->setDevMode($updateDevMode)
  4761. ->setOptimizeAutoloader($optimize)
  4762. ->setClassMapAuthoritative($authoritative)
  4763. ->setApcuAutoloader($apcu)
  4764. ->setUpdate(true)
  4765. ->setUpdateAllowList($packages)
  4766. ->setAllowListTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4767. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4768. ->setRunScripts(!$input->getOption('no-scripts'))
  4769. ;
  4770. $status = $install->run();
  4771. if ($status !== 0) {
  4772. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4773. file_put_contents($jsonFile->getPath(), $composerBackup);
  4774. }
  4775. return $status;
  4776. }
  4777. }
  4778. <?php
  4779. namespace Composer\Command;
  4780. use Symfony\Component\Console\Input\InputInterface;
  4781. use Symfony\Component\Console\Input\InputArgument;
  4782. use Symfony\Component\Console\Input\InputOption;
  4783. use Symfony\Component\Console\Output\OutputInterface;
  4784. use Composer\Factory;
  4785. use Composer\Installer;
  4786. use Composer\Json\JsonFile;
  4787. use Composer\Json\JsonManipulator;
  4788. use Composer\Package\Version\VersionParser;
  4789. use Composer\Plugin\CommandEvent;
  4790. use Composer\Plugin\PluginEvents;
  4791. use Composer\Repository\CompositeRepository;
  4792. use Composer\Repository\PlatformRepository;
  4793. use Composer\IO\IOInterface;
  4794. use Composer\Util\Silencer;
  4795. class RequireCommand extends InitCommand
  4796. {
  4797. private $newlyCreated;
  4798. private $json;
  4799. private $file;
  4800. private $composerBackup;
  4801. protected function configure()
  4802. {
  4803. $this
  4804. ->setName('require')
  4805. ->setDescription('Adds required packages to your composer.json and installs them.')
  4806. ->setDefinition(array(
  4807. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
  4808. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4809. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4810. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4811. new InputOption('fixed', null, InputOption::VALUE_NONE, 'Write fixed version to the composer.json.'),
  4812. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4813. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4814. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4815. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4816. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4817. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4818. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4819. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4820. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4821. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4822. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4823. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4824. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4825. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4826. ))
  4827. ->setHelp(
  4828. <<<EOT
  4829. The require command adds required packages to your composer.json and installs them.
  4830. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4831. matches to require.
  4832. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4833. If you do not want to install the new dependencies immediately you can call it with --no-update
  4834. Read more at https://getcomposer.org/doc/03-cli.md#require
  4835. EOT
  4836. )
  4837. ;
  4838. }
  4839. protected function execute(InputInterface $input, OutputInterface $output)
  4840. {
  4841. if (function_exists('pcntl_async_signals') && function_exists('pcntl_signal')) {
  4842. pcntl_async_signals(true);
  4843. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4844. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4845. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4846. }
  4847. $this->file = Factory::getComposerFile();
  4848. $io = $this->getIO();
  4849. $this->newlyCreated = !file_exists($this->file);
  4850. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4851. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4852. return 1;
  4853. }
  4854. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4855. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4856. return 1;
  4857. }
  4858. if (filesize($this->file) === 0) {
  4859. file_put_contents($this->file, "{\n}\n");
  4860. }
  4861. $this->json = new JsonFile($this->file);
  4862. $this->composerBackup = file_get_contents($this->json->getPath());
  4863. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4864. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4865. return 1;
  4866. }
  4867. if ($input->getOption('fixed') === true) {
  4868. $config = $this->json->read();
  4869. $packageType = empty($config['type']) ? 'library' : $config['type'];
  4870. if ($packageType !== 'project') {
  4871. $io->writeError('<error>"--fixed" option is allowed for "project" package types only to prevent possible misuses.</error>');
  4872. if (empty($config['type'])) {
  4873. $io->writeError('<error>If your package is not library, you should explicitly specify "type" parameter in composer.json.</error>');
  4874. }
  4875. return 1;
  4876. }
  4877. }
  4878. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4879. $repos = $composer->getRepositoryManager()->getRepositories();
  4880. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4881. $this->repos = new CompositeRepository(array_merge(
  4882. array(new PlatformRepository(array(), $platformOverrides)),
  4883. $repos
  4884. ));
  4885. if ($composer->getPackage()->getPreferStable()) {
  4886. $preferredStability = 'stable';
  4887. } else {
  4888. $preferredStability = $composer->getPackage()->getMinimumStability();
  4889. }
  4890. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4891. try {
  4892. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'), $input->getOption('fixed'));
  4893. } catch (\Exception $e) {
  4894. if ($this->newlyCreated) {
  4895. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4896. }
  4897. throw $e;
  4898. }
  4899. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4900. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4901. $requirements = $this->formatRequirements($requirements);
  4902. $versionParser = new VersionParser();
  4903. foreach ($requirements as $package => $constraint) {
  4904. if (strtolower($package) === $composer->getPackage()->getName()) {
  4905. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4906. return 1;
  4907. }
  4908. $versionParser->parseConstraints($constraint);
  4909. }
  4910. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4911. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4912. $composerDefinition = $this->json->read();
  4913. foreach ($requirements as $package => $version) {
  4914. $composerDefinition[$requireKey][$package] = $version;
  4915. unset($composerDefinition[$removeKey][$package]);
  4916. }
  4917. $this->json->write($composerDefinition);
  4918. }
  4919. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4920. if ($input->getOption('no-update')) {
  4921. return 0;
  4922. }
  4923. try {
  4924. return $this->doUpdate($input, $output, $io, $requirements);
  4925. } catch (\Exception $e) {
  4926. $this->revertComposerFile(false);
  4927. throw $e;
  4928. }
  4929. }
  4930. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4931. {
  4932. $this->resetComposer();
  4933. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4934. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4935. $updateDevMode = !$input->getOption('update-no-dev');
  4936. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4937. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4938. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4939. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4940. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4941. $install = Installer::create($io, $composer);
  4942. $install
  4943. ->setVerbose($input->getOption('verbose'))
  4944. ->setPreferSource($input->getOption('prefer-source'))
  4945. ->setPreferDist($input->getOption('prefer-dist'))
  4946. ->setDevMode($updateDevMode)
  4947. ->setRunScripts(!$input->getOption('no-scripts'))
  4948. ->setSkipSuggest($input->getOption('no-suggest'))
  4949. ->setOptimizeAutoloader($optimize)
  4950. ->setClassMapAuthoritative($authoritative)
  4951. ->setApcuAutoloader($apcu)
  4952. ->setUpdate(true)
  4953. ->setUpdateAllowList(array_keys($requirements))
  4954. ->setAllowListTransitiveDependencies($input->getOption('update-with-dependencies'))
  4955. ->setAllowListAllDependencies($input->getOption('update-with-all-dependencies'))
  4956. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4957. ->setPreferStable($input->getOption('prefer-stable'))
  4958. ->setPreferLowest($input->getOption('prefer-lowest'))
  4959. ;
  4960. $status = $install->run();
  4961. if ($status !== 0) {
  4962. $this->revertComposerFile(false);
  4963. }
  4964. return $status;
  4965. }
  4966. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4967. {
  4968. $contents = file_get_contents($json->getPath());
  4969. $manipulator = new JsonManipulator($contents);
  4970. foreach ($new as $package => $constraint) {
  4971. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4972. return false;
  4973. }
  4974. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4975. return false;
  4976. }
  4977. }
  4978. file_put_contents($json->getPath(), $manipulator->getContents());
  4979. return true;
  4980. }
  4981. protected function interact(InputInterface $input, OutputInterface $output)
  4982. {
  4983. return;
  4984. }
  4985. public function revertComposerFile($hardExit = true)
  4986. {
  4987. $io = $this->getIO();
  4988. if ($this->newlyCreated) {
  4989. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4990. unlink($this->json->getPath());
  4991. } else {
  4992. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4993. file_put_contents($this->json->getPath(), $this->composerBackup);
  4994. }
  4995. if ($hardExit) {
  4996. exit(1);
  4997. }
  4998. }
  4999. }
  5000. <?php
  5001. namespace Composer\Command;
  5002. use Composer\Script\Event as ScriptEvent;
  5003. use Composer\Script\ScriptEvents;
  5004. use Composer\Util\ProcessExecutor;
  5005. use Symfony\Component\Console\Input\InputInterface;
  5006. use Symfony\Component\Console\Input\InputOption;
  5007. use Symfony\Component\Console\Input\InputArgument;
  5008. use Symfony\Component\Console\Output\OutputInterface;
  5009. use Symfony\Component\Console\Helper\Table;
  5010. class RunScriptCommand extends BaseCommand
  5011. {
  5012. protected $scriptEvents = array(
  5013. ScriptEvents::PRE_INSTALL_CMD,
  5014. ScriptEvents::POST_INSTALL_CMD,
  5015. ScriptEvents::PRE_UPDATE_CMD,
  5016. ScriptEvents::POST_UPDATE_CMD,
  5017. ScriptEvents::PRE_STATUS_CMD,
  5018. ScriptEvents::POST_STATUS_CMD,
  5019. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  5020. ScriptEvents::POST_CREATE_PROJECT_CMD,
  5021. ScriptEvents::PRE_ARCHIVE_CMD,
  5022. ScriptEvents::POST_ARCHIVE_CMD,
  5023. ScriptEvents::PRE_AUTOLOAD_DUMP,
  5024. ScriptEvents::POST_AUTOLOAD_DUMP,
  5025. );
  5026. protected function configure()
  5027. {
  5028. $this
  5029. ->setName('run-script')
  5030. ->setAliases(array('run'))
  5031. ->setDescription('Runs the scripts defined in composer.json.')
  5032. ->setDefinition(array(
  5033. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  5034. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5035. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  5036. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5037. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5038. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  5039. ))
  5040. ->setHelp(
  5041. <<<EOT
  5042. The <info>run-script</info> command runs scripts defined in composer.json:
  5043. <info>php composer.phar run-script post-update-cmd</info>
  5044. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5045. EOT
  5046. )
  5047. ;
  5048. }
  5049. protected function execute(InputInterface $input, OutputInterface $output)
  5050. {
  5051. if ($input->getOption('list')) {
  5052. return $this->listScripts($output);
  5053. } elseif (!$input->getArgument('script')) {
  5054. throw new \RuntimeException('Missing required argument "script"');
  5055. }
  5056. $script = $input->getArgument('script');
  5057. if (!in_array($script, $this->scriptEvents)) {
  5058. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  5059. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  5060. }
  5061. }
  5062. $composer = $this->getComposer();
  5063. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  5064. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  5065. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  5066. if (!$hasListeners) {
  5067. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  5068. }
  5069. $args = $input->getArgument('args');
  5070. if (null !== $timeout = $input->getOption('timeout')) {
  5071. if (!ctype_digit($timeout)) {
  5072. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  5073. }
  5074. ProcessExecutor::setTimeout((int) $timeout);
  5075. }
  5076. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  5077. }
  5078. protected function listScripts(OutputInterface $output)
  5079. {
  5080. $scripts = $this->getComposer()->getPackage()->getScripts();
  5081. if (!count($scripts)) {
  5082. return 0;
  5083. }
  5084. $io = $this->getIO();
  5085. $io->writeError('<info>scripts:</info>');
  5086. $table = array();
  5087. foreach ($scripts as $name => $script) {
  5088. $description = '';
  5089. try {
  5090. $cmd = $this->getApplication()->find($name);
  5091. if ($cmd instanceof ScriptAliasCommand) {
  5092. $description = $cmd->getDescription();
  5093. }
  5094. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  5095. }
  5096. $table[] = array(' '.$name, $description);
  5097. }
  5098. $renderer = new Table($output);
  5099. $renderer->setStyle('compact');
  5100. $rendererStyle = $renderer->getStyle();
  5101. if (method_exists($rendererStyle, 'setVerticalBorderChars')) {
  5102. $rendererStyle->setVerticalBorderChars('');
  5103. } else {
  5104. $rendererStyle->setVerticalBorderChar('');
  5105. }
  5106. $rendererStyle->setCellRowContentFormat('%s ');
  5107. $renderer->setRows($table)->render();
  5108. return 0;
  5109. }
  5110. }
  5111. <?php
  5112. namespace Composer\Command;
  5113. use Symfony\Component\Console\Input\InputInterface;
  5114. use Symfony\Component\Console\Input\InputOption;
  5115. use Symfony\Component\Console\Input\InputArgument;
  5116. use Symfony\Component\Console\Output\OutputInterface;
  5117. class ScriptAliasCommand extends BaseCommand
  5118. {
  5119. private $script;
  5120. private $description;
  5121. public function __construct($script, $description)
  5122. {
  5123. $this->script = $script;
  5124. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  5125. parent::__construct();
  5126. }
  5127. protected function configure()
  5128. {
  5129. $this
  5130. ->setName($this->script)
  5131. ->setDescription($this->description)
  5132. ->setDefinition(array(
  5133. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  5134. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  5135. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  5136. ))
  5137. ->setHelp(
  5138. <<<EOT
  5139. The <info>run-script</info> command runs scripts defined in composer.json:
  5140. <info>php composer.phar run-script post-update-cmd</info>
  5141. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  5142. EOT
  5143. )
  5144. ;
  5145. }
  5146. protected function execute(InputInterface $input, OutputInterface $output)
  5147. {
  5148. $composer = $this->getComposer();
  5149. $args = $input->getArguments();
  5150. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  5151. }
  5152. }
  5153. <?php
  5154. namespace Composer\Command;
  5155. use Composer\Factory;
  5156. use Symfony\Component\Console\Input\InputInterface;
  5157. use Symfony\Component\Console\Input\InputArgument;
  5158. use Symfony\Component\Console\Input\InputOption;
  5159. use Symfony\Component\Console\Output\OutputInterface;
  5160. use Composer\Repository\CompositeRepository;
  5161. use Composer\Repository\PlatformRepository;
  5162. use Composer\Repository\RepositoryInterface;
  5163. use Composer\Plugin\CommandEvent;
  5164. use Composer\Plugin\PluginEvents;
  5165. class SearchCommand extends BaseCommand
  5166. {
  5167. protected $matches;
  5168. protected $lowMatches = array();
  5169. protected $tokens;
  5170. protected $output;
  5171. protected $onlyName;
  5172. protected function configure()
  5173. {
  5174. $this
  5175. ->setName('search')
  5176. ->setDescription('Searches for packages.')
  5177. ->setDefinition(array(
  5178. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  5179. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  5180. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  5181. ))
  5182. ->setHelp(
  5183. <<<EOT
  5184. The search command searches for packages by its name
  5185. <info>php composer.phar search symfony composer</info>
  5186. Read more at https://getcomposer.org/doc/03-cli.md#search
  5187. EOT
  5188. )
  5189. ;
  5190. }
  5191. protected function execute(InputInterface $input, OutputInterface $output)
  5192. {
  5193. $platformRepo = new PlatformRepository;
  5194. $io = $this->getIO();
  5195. if (!($composer = $this->getComposer(false))) {
  5196. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  5197. }
  5198. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5199. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5200. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5201. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  5202. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5203. $onlyName = $input->getOption('only-name');
  5204. $type = $input->getOption('type') ?: null;
  5205. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  5206. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  5207. foreach ($results as $result) {
  5208. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  5209. }
  5210. return 0;
  5211. }
  5212. }
  5213. <?php
  5214. namespace Composer\Command;
  5215. use Composer\Composer;
  5216. use Composer\Factory;
  5217. use Composer\Config;
  5218. use Composer\Util\Filesystem;
  5219. use Composer\Util\Platform;
  5220. use Composer\SelfUpdate\Keys;
  5221. use Composer\SelfUpdate\Versions;
  5222. use Composer\IO\IOInterface;
  5223. use Composer\Downloader\FilesystemException;
  5224. use Symfony\Component\Console\Input\InputInterface;
  5225. use Symfony\Component\Console\Input\InputOption;
  5226. use Symfony\Component\Console\Input\InputArgument;
  5227. use Symfony\Component\Console\Output\OutputInterface;
  5228. use Symfony\Component\Finder\Finder;
  5229. class SelfUpdateCommand extends BaseCommand
  5230. {
  5231. const HOMEPAGE = 'getcomposer.org';
  5232. const OLD_INSTALL_EXT = '-old.phar';
  5233. protected function configure()
  5234. {
  5235. $this
  5236. ->setName('self-update')
  5237. ->setAliases(array('selfupdate'))
  5238. ->setDescription('Updates composer.phar to the latest version.')
  5239. ->setDefinition(array(
  5240. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  5241. new InputOption('clean-backups', null, InputOption::VALUE_NONE, 'Delete old backups during an update. This makes the current version of composer the only backup available after the update'),
  5242. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  5243. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  5244. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  5245. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  5246. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  5247. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  5248. new InputOption('1', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 1.x versions'),
  5249. new InputOption('2', null, InputOption::VALUE_NONE, 'Force an update to the stable channel, but only use 2.x versions'),
  5250. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  5251. ))
  5252. ->setHelp(
  5253. <<<EOT
  5254. The <info>self-update</info> command checks getcomposer.org for newer
  5255. versions of composer and if found, installs the latest.
  5256. <info>php composer.phar self-update</info>
  5257. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  5258. EOT
  5259. )
  5260. ;
  5261. }
  5262. protected function execute(InputInterface $input, OutputInterface $output)
  5263. {
  5264. $config = Factory::createConfig();
  5265. if ($config->get('disable-tls') === true) {
  5266. $baseUrl = 'http://' . self::HOMEPAGE;
  5267. } else {
  5268. $baseUrl = 'https://' . self::HOMEPAGE;
  5269. }
  5270. $io = $this->getIO();
  5271. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  5272. $versionsUtil = new Versions($config, $remoteFilesystem);
  5273. $requestedChannel = null;
  5274. foreach (Versions::$channels as $channel) {
  5275. if ($input->getOption($channel)) {
  5276. $requestedChannel = $channel;
  5277. $versionsUtil->setChannel($channel);
  5278. break;
  5279. }
  5280. }
  5281. if ($input->getOption('set-channel-only')) {
  5282. return 0;
  5283. }
  5284. $cacheDir = $config->get('cache-dir');
  5285. $rollbackDir = $config->get('data-dir');
  5286. $home = $config->get('home');
  5287. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  5288. if ($input->getOption('update-keys')) {
  5289. return $this->fetchKeys($io, $config);
  5290. }
  5291. if (!file_exists($localFilename)) {
  5292. throw new FilesystemException('Composer update failed: the "'.$localFilename.'" is not accessible');
  5293. }
  5294. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  5295. if (!is_writable($tmpDir)) {
  5296. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  5297. }
  5298. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  5299. $composeUser = posix_getpwuid(posix_geteuid());
  5300. $homeOwner = posix_getpwuid(fileowner($home));
  5301. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  5302. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  5303. }
  5304. }
  5305. if ($input->getOption('rollback')) {
  5306. return $this->rollback($output, $rollbackDir, $localFilename);
  5307. }
  5308. $latest = $versionsUtil->getLatest();
  5309. $latestStable = $versionsUtil->getLatest('stable');
  5310. try {
  5311. $latestPreview = $versionsUtil->getLatest('preview');
  5312. } catch (\UnexpectedValueException $e) {
  5313. $latestPreview = $latestStable;
  5314. }
  5315. $latestVersion = $latest['version'];
  5316. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  5317. $currentMajorVersion = preg_replace('{^(\d+).*}', '$1', Composer::getVersion());
  5318. $updateMajorVersion = preg_replace('{^(\d+).*}', '$1', $updateVersion);
  5319. $previewMajorVersion = preg_replace('{^(\d+).*}', '$1', $latestPreview['version']);
  5320. if ($versionsUtil->getChannel() === 'stable' && !$input->getArgument('version')) {
  5321. if ($currentMajorVersion < $updateMajorVersion) {
  5322. $skippedVersion = $updateVersion;
  5323. $versionsUtil->setChannel($currentMajorVersion);
  5324. $latest = $versionsUtil->getLatest();
  5325. $latestStable = $versionsUtil->getLatest('stable');
  5326. $latestVersion = $latest['version'];
  5327. $updateVersion = $latestVersion;
  5328. $io->writeError('<warning>A new stable major version of Composer is available ('.$skippedVersion.'), run "composer self-update --'.$updateMajorVersion.'" to update to it. See also https://github.com/composer/composer/releases for changelogs.</warning>');
  5329. } elseif ($currentMajorVersion < $previewMajorVersion) {
  5330. $io->writeError('<warning>A preview release of the next major version of Composer is available ('.$latestPreview['version'].'), run "composer self-update --preview" to give it a try. See also https://github.com/composer/composer/releases for changelogs.</warning>');
  5331. }
  5332. }
  5333. if ($requestedChannel && is_numeric($requestedChannel) && substr($latestStable['version'], 0, 1) !== $requestedChannel) {
  5334. $io->writeError('<warning>Warning: You forced the install of '.$latestVersion.' via --'.$requestedChannel.', but '.$latestStable['version'].' is the latest stable version. Updating to it via composer self-update --stable is recommended.</warning>');
  5335. }
  5336. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  5337. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  5338. return 1;
  5339. }
  5340. if (Composer::VERSION === $updateVersion) {
  5341. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5342. if ($input->getOption('clean-backups')) {
  5343. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5344. }
  5345. return 0;
  5346. }
  5347. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5348. $backupFile = sprintf(
  5349. '%s/%s-%s%s',
  5350. $rollbackDir,
  5351. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5352. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5353. self::OLD_INSTALL_EXT
  5354. );
  5355. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5356. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5357. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5358. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5359. $io->writeError(' ', false);
  5360. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5361. $io->writeError('');
  5362. if (!file_exists($tempFilename) || !$signature) {
  5363. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5364. return 1;
  5365. }
  5366. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5367. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5368. } else {
  5369. if (!extension_loaded('openssl')) {
  5370. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5371. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  5372. }
  5373. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5374. if (!file_exists($sigFile)) {
  5375. file_put_contents(
  5376. $home.'/keys.dev.pub',
  5377. <<<DEVPUBKEY
  5378. -----BEGIN PUBLIC KEY-----
  5379. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5380. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5381. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5382. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5383. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5384. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5385. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5386. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5387. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5388. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5389. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5390. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5391. -----END PUBLIC KEY-----
  5392. DEVPUBKEY
  5393. );
  5394. file_put_contents(
  5395. $home.'/keys.tags.pub',
  5396. <<<TAGSPUBKEY
  5397. -----BEGIN PUBLIC KEY-----
  5398. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5399. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5400. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5401. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5402. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5403. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5404. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5405. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5406. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5407. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5408. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5409. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5410. -----END PUBLIC KEY-----
  5411. TAGSPUBKEY
  5412. );
  5413. }
  5414. $pubkeyid = openssl_pkey_get_public($sigFile);
  5415. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5416. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5417. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5418. }
  5419. $signature = json_decode($signature, true);
  5420. $signature = base64_decode($signature['sha384']);
  5421. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5422. if (PHP_VERSION_ID < 80000) {
  5423. openssl_free_key($pubkeyid);
  5424. }
  5425. if (!$verified) {
  5426. throw new \RuntimeException('The phar signature did not match the file you downloaded, this means your public keys are outdated or that the phar file is corrupt/has been modified');
  5427. }
  5428. }
  5429. if ($input->getOption('clean-backups')) {
  5430. $this->cleanBackups($rollbackDir);
  5431. }
  5432. if (!$this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5433. @unlink($tempFilename);
  5434. return 1;
  5435. }
  5436. if (file_exists($backupFile)) {
  5437. $io->writeError(sprintf(
  5438. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5439. Composer::VERSION
  5440. ));
  5441. } else {
  5442. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5443. }
  5444. return 0;
  5445. }
  5446. protected function fetchKeys(IOInterface $io, Config $config)
  5447. {
  5448. if (!$io->isInteractive()) {
  5449. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5450. }
  5451. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5452. $validator = function ($value) {
  5453. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5454. throw new \UnexpectedValueException('Invalid input');
  5455. }
  5456. return trim($value)."\n";
  5457. };
  5458. $devKey = '';
  5459. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5460. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5461. while ($line = $io->ask('')) {
  5462. $devKey .= trim($line)."\n";
  5463. if (trim($line) === '-----END PUBLIC KEY-----') {
  5464. break;
  5465. }
  5466. }
  5467. }
  5468. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5469. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5470. $tagsKey = '';
  5471. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5472. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5473. while ($line = $io->ask('')) {
  5474. $tagsKey .= trim($line)."\n";
  5475. if (trim($line) === '-----END PUBLIC KEY-----') {
  5476. break;
  5477. }
  5478. }
  5479. }
  5480. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5481. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5482. $io->write('Public keys stored in '.$config->get('home'));
  5483. }
  5484. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5485. {
  5486. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5487. if (!$rollbackVersion) {
  5488. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5489. }
  5490. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5491. if (!is_file($oldFile)) {
  5492. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5493. }
  5494. if (!is_readable($oldFile)) {
  5495. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5496. }
  5497. $io = $this->getIO();
  5498. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5499. if (!$this->setLocalPhar($localFilename, $oldFile)) {
  5500. return 1;
  5501. }
  5502. return 0;
  5503. }
  5504. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5505. {
  5506. $io = $this->getIO();
  5507. @chmod($newFilename, fileperms($localFilename));
  5508. if (!$this->validatePhar($newFilename, $error)) {
  5509. $io->writeError('<error>The '.($backupTarget ? 'update' : 'backup').' file is corrupted ('.$error.')</error>');
  5510. if ($backupTarget) {
  5511. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5512. }
  5513. return false;
  5514. }
  5515. if ($backupTarget) {
  5516. @copy($localFilename, $backupTarget);
  5517. }
  5518. try {
  5519. rename($newFilename, $localFilename);
  5520. return true;
  5521. } catch (\Exception $e) {
  5522. if (!is_writable(dirname($localFilename))
  5523. && $io->isInteractive()
  5524. && $this->isWindowsNonAdminUser()) {
  5525. return $this->tryAsWindowsAdmin($localFilename, $newFilename);
  5526. }
  5527. $action = 'Composer '.($backupTarget ? 'update' : 'rollback');
  5528. throw new FilesystemException($action.' failed: "'.$localFilename.'" could not be written.'.PHP_EOL.$e->getMessage());
  5529. }
  5530. }
  5531. protected function cleanBackups($rollbackDir, $except = null)
  5532. {
  5533. $finder = $this->getOldInstallationFinder($rollbackDir);
  5534. $io = $this->getIO();
  5535. $fs = new Filesystem;
  5536. foreach ($finder as $file) {
  5537. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5538. continue;
  5539. }
  5540. $file = (string) $file;
  5541. $io->writeError('<info>Removing: '.$file.'</info>');
  5542. $fs->remove($file);
  5543. }
  5544. }
  5545. protected function getLastBackupVersion($rollbackDir)
  5546. {
  5547. $finder = $this->getOldInstallationFinder($rollbackDir);
  5548. $finder->sortByName();
  5549. $files = iterator_to_array($finder);
  5550. if (count($files)) {
  5551. return basename(end($files), self::OLD_INSTALL_EXT);
  5552. }
  5553. return false;
  5554. }
  5555. protected function getOldInstallationFinder($rollbackDir)
  5556. {
  5557. $finder = Finder::create()
  5558. ->depth(0)
  5559. ->files()
  5560. ->name('*' . self::OLD_INSTALL_EXT)
  5561. ->in($rollbackDir);
  5562. return $finder;
  5563. }
  5564. protected function validatePhar($pharFile, &$error)
  5565. {
  5566. if (ini_get('phar.readonly')) {
  5567. return true;
  5568. }
  5569. try {
  5570. $phar = new \Phar($pharFile);
  5571. unset($phar);
  5572. $result = true;
  5573. } catch (\Exception $e) {
  5574. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5575. throw $e;
  5576. }
  5577. $error = $e->getMessage();
  5578. $result = false;
  5579. }
  5580. return $result;
  5581. }
  5582. protected function isWindowsNonAdminUser()
  5583. {
  5584. if (!Platform::isWindows()) {
  5585. return false;
  5586. }
  5587. exec('fltmc.exe filters', $output, $exitCode);
  5588. return $exitCode !== 0;
  5589. }
  5590. protected function tryAsWindowsAdmin($localFilename, $newFilename)
  5591. {
  5592. $io = $this->getIO();
  5593. $io->writeError('<error>Unable to write "'.$localFilename.'". Access is denied.</error>');
  5594. $helpMessage = 'Please run the self-update command as an Administrator.';
  5595. $question = 'Complete this operation with Administrator privileges [<comment>Y,n</comment>]? ';
  5596. if (!$io->askConfirmation($question, false)) {
  5597. $io->writeError('<warning>Operation cancelled. '.$helpMessage.'</warning>');
  5598. return false;
  5599. }
  5600. $tmpFile = tempnam(sys_get_temp_dir(), '');
  5601. $script = $tmpFile.'.vbs';
  5602. rename($tmpFile, $script);
  5603. $checksum = hash_file('sha256', $newFilename);
  5604. $source = str_replace('/', '\\', $newFilename);
  5605. $destination = str_replace('/', '\\', $localFilename);
  5606. $vbs = <<<EOT
  5607. Set UAC = CreateObject("Shell.Application")
  5608. UAC.ShellExecute "cmd.exe", "/c move /y ""$source"" ""$destination""", "", "runas", 0
  5609. Wscript.Sleep(300)
  5610. EOT;
  5611. file_put_contents($script, $vbs);
  5612. exec('"'.$script.'"');
  5613. @unlink($script);
  5614. if ($result = (hash_file('sha256', $localFilename) === $checksum)) {
  5615. $io->writeError('<info>Operation succeeded.</info>');
  5616. } else {
  5617. $io->writeError('<error>Operation failed (file not written). '.$helpMessage.'</error>');
  5618. };
  5619. return $result;
  5620. }
  5621. }
  5622. <?php
  5623. namespace Composer\Command;
  5624. use Composer\Composer;
  5625. use Composer\DependencyResolver\DefaultPolicy;
  5626. use Composer\DependencyResolver\Pool;
  5627. use Composer\Json\JsonFile;
  5628. use Composer\Package\BasePackage;
  5629. use Composer\Package\CompletePackageInterface;
  5630. use Composer\Package\PackageInterface;
  5631. use Composer\Package\Version\VersionParser;
  5632. use Composer\Package\Version\VersionSelector;
  5633. use Composer\Plugin\CommandEvent;
  5634. use Composer\Plugin\PluginEvents;
  5635. use Composer\Repository\ArrayRepository;
  5636. use Composer\Repository\ComposerRepository;
  5637. use Composer\Repository\CompositeRepository;
  5638. use Composer\Repository\PlatformRepository;
  5639. use Composer\Repository\RepositoryFactory;
  5640. use Composer\Repository\RepositoryInterface;
  5641. use Composer\Semver\Constraint\ConstraintInterface;
  5642. use Composer\Semver\Semver;
  5643. use Composer\Spdx\SpdxLicenses;
  5644. use Composer\Util\Platform;
  5645. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5646. use Symfony\Component\Console\Input\InputArgument;
  5647. use Symfony\Component\Console\Input\InputInterface;
  5648. use Symfony\Component\Console\Input\InputOption;
  5649. use Symfony\Component\Console\Output\OutputInterface;
  5650. use Symfony\Component\Console\Terminal;
  5651. class ShowCommand extends BaseCommand
  5652. {
  5653. protected $versionParser;
  5654. protected $colors;
  5655. private $pool;
  5656. protected function configure()
  5657. {
  5658. $this
  5659. ->setName('show')
  5660. ->setAliases(array('info'))
  5661. ->setDescription('Shows information about packages.')
  5662. ->setDefinition(array(
  5663. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5664. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5665. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5666. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5667. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5668. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5669. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5670. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5671. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5672. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5673. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5674. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5675. new InputOption('ignore', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Ignore specified package(s). Use it with the --outdated option if you don\'t want to be informed about new versions of some packages.'),
  5676. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5677. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5678. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5679. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5680. ))
  5681. ->setHelp(
  5682. <<<EOT
  5683. The show command displays detailed information about a package, or
  5684. lists all packages available.
  5685. Read more at https://getcomposer.org/doc/03-cli.md#show
  5686. EOT
  5687. )
  5688. ;
  5689. }
  5690. protected function execute(InputInterface $input, OutputInterface $output)
  5691. {
  5692. $this->versionParser = new VersionParser;
  5693. if ($input->getOption('tree')) {
  5694. $this->initStyles($output);
  5695. }
  5696. $composer = $this->getComposer(false);
  5697. $io = $this->getIO();
  5698. if ($input->getOption('installed')) {
  5699. $io->writeError('<warning>You are using the deprecated option "installed". Only installed packages are shown by default now. The --all option can be used to show all packages.</warning>');
  5700. }
  5701. if ($input->getOption('outdated')) {
  5702. $input->setOption('latest', true);
  5703. } elseif ($input->getOption('ignore')) {
  5704. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5705. }
  5706. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5707. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5708. return 1;
  5709. }
  5710. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5711. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5712. return 1;
  5713. }
  5714. if ($input->getOption('tree') && $input->getOption('latest')) {
  5715. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5716. return 1;
  5717. }
  5718. if ($input->getOption('tree') && $input->getOption('path')) {
  5719. $io->writeError('The --tree (-t) option is not usable in combination with --path (-P)');
  5720. return 1;
  5721. }
  5722. $format = $input->getOption('format');
  5723. if (!in_array($format, array('text', 'json'))) {
  5724. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5725. return 1;
  5726. }
  5727. $platformOverrides = array();
  5728. if ($composer) {
  5729. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5730. }
  5731. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5732. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5733. if ($input->getOption('self')) {
  5734. $package = $this->getComposer()->getPackage();
  5735. if ($input->getOption('name-only')) {
  5736. $io->write($package->getName());
  5737. return 0;
  5738. }
  5739. $repos = $installedRepo = new ArrayRepository(array($package));
  5740. } elseif ($input->getOption('platform')) {
  5741. $repos = $installedRepo = $platformRepo;
  5742. } elseif ($input->getOption('available')) {
  5743. $installedRepo = $platformRepo;
  5744. if ($composer) {
  5745. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5746. } else {
  5747. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5748. $repos = new CompositeRepository($defaultRepos);
  5749. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5750. }
  5751. } elseif ($input->getOption('all') && $composer) {
  5752. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5753. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5754. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5755. } elseif ($input->getOption('all')) {
  5756. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5757. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5758. $installedRepo = $platformRepo;
  5759. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5760. } else {
  5761. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5762. $rootPkg = $this->getComposer()->getPackage();
  5763. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5764. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5765. }
  5766. }
  5767. if ($composer) {
  5768. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5769. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5770. }
  5771. if ($input->getOption('latest') && null === $composer) {
  5772. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5773. $input->setOption('latest', false);
  5774. }
  5775. $packageFilter = $input->getArgument('package');
  5776. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5777. if (empty($package)) {
  5778. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5779. if (empty($package)) {
  5780. $options = $input->getOptions();
  5781. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5782. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $input->getArgument('package')) && !$input->getOption('platform')) {
  5783. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found, try using --platform (-p) to show platform packages.');
  5784. }
  5785. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5786. }
  5787. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5788. return 1;
  5789. }
  5790. } else {
  5791. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5792. }
  5793. $exitCode = 0;
  5794. if ($input->getOption('tree')) {
  5795. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5796. if ('json' === $format) {
  5797. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5798. } else {
  5799. $this->displayPackageTree(array($arrayTree));
  5800. }
  5801. } else {
  5802. $latestPackage = null;
  5803. if ($input->getOption('latest')) {
  5804. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5805. }
  5806. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5807. $exitCode = 1;
  5808. }
  5809. if ($input->getOption('path')) {
  5810. $io->write($package->getName(), false);
  5811. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5812. return $exitCode;
  5813. }
  5814. if ('json' === $format) {
  5815. $this->printPackageInfoAsJson($package, $versions, $installedRepo, $latestPackage ?: null);
  5816. } else {
  5817. $this->printPackageInfo($package, $versions, $installedRepo, $latestPackage ?: null);
  5818. }
  5819. }
  5820. return $exitCode;
  5821. }
  5822. if ($input->getOption('tree')) {
  5823. $rootRequires = $this->getRootRequires();
  5824. $packages = $installedRepo->getPackages();
  5825. usort($packages, 'strcmp');
  5826. $arrayTree = array();
  5827. foreach ($packages as $package) {
  5828. if (in_array($package->getName(), $rootRequires, true)) {
  5829. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5830. }
  5831. }
  5832. if ('json' === $format) {
  5833. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5834. } else {
  5835. $this->displayPackageTree($arrayTree);
  5836. }
  5837. return 0;
  5838. }
  5839. if ($repos instanceof CompositeRepository) {
  5840. $repos = $repos->getRepositories();
  5841. } elseif (!is_array($repos)) {
  5842. $repos = array($repos);
  5843. }
  5844. $packages = array();
  5845. if (null !== $packageFilter) {
  5846. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5847. }
  5848. $packageListFilter = array();
  5849. if ($input->getOption('direct')) {
  5850. $packageListFilter = $this->getRootRequires();
  5851. }
  5852. if (class_exists('Symfony\Component\Console\Terminal')) {
  5853. $terminal = new Terminal();
  5854. $width = $terminal->getWidth();
  5855. } else {
  5856. list($width) = $this->getApplication()->getTerminalDimensions();
  5857. }
  5858. if (null === $width) {
  5859. $width = PHP_INT_MAX;
  5860. }
  5861. if (Platform::isWindows()) {
  5862. $width--;
  5863. } else {
  5864. $width = max(80, $width);
  5865. }
  5866. if ($input->getOption('path') && null === $composer) {
  5867. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5868. $input->setOption('path', false);
  5869. }
  5870. foreach ($repos as $repo) {
  5871. if ($repo === $platformRepo) {
  5872. $type = 'platform';
  5873. } elseif (
  5874. $repo === $installedRepo
  5875. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5876. ) {
  5877. $type = 'installed';
  5878. } else {
  5879. $type = 'available';
  5880. }
  5881. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5882. foreach ($repo->getProviderNames() as $name) {
  5883. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5884. $packages[$type][$name] = $name;
  5885. }
  5886. }
  5887. } else {
  5888. foreach ($repo->getPackages() as $package) {
  5889. if (!isset($packages[$type][$package->getName()])
  5890. || !is_object($packages[$type][$package->getName()])
  5891. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5892. ) {
  5893. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5894. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5895. $packages[$type][$package->getName()] = $package;
  5896. }
  5897. }
  5898. }
  5899. }
  5900. }
  5901. }
  5902. $showAllTypes = $input->getOption('all');
  5903. $showLatest = $input->getOption('latest');
  5904. $showMinorOnly = $input->getOption('minor-only');
  5905. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5906. $indent = $showAllTypes ? ' ' : '';
  5907. $latestPackages = array();
  5908. $exitCode = 0;
  5909. $viewData = array();
  5910. $viewMetaData = array();
  5911. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5912. if (isset($packages[$type])) {
  5913. ksort($packages[$type]);
  5914. $nameLength = $versionLength = $latestLength = 0;
  5915. if ($showLatest && $showVersion) {
  5916. foreach ($packages[$type] as $package) {
  5917. if (is_object($package)) {
  5918. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5919. if ($latestPackage === false) {
  5920. continue;
  5921. }
  5922. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5923. }
  5924. }
  5925. }
  5926. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5927. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5928. $writeLatest = $writeVersion && $showLatest;
  5929. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5930. $hasOutdatedPackages = false;
  5931. $viewData[$type] = array();
  5932. foreach ($packages[$type] as $package) {
  5933. $packageViewData = array();
  5934. if (is_object($package)) {
  5935. $latestPackage = null;
  5936. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5937. $latestPackage = $latestPackages[$package->getPrettyName()];
  5938. }
  5939. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5940. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5941. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5942. continue;
  5943. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5944. $hasOutdatedPackages = true;
  5945. }
  5946. $packageViewData['name'] = $package->getPrettyName();
  5947. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5948. if ($writeVersion) {
  5949. $packageViewData['version'] = $package->getFullPrettyVersion();
  5950. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5951. }
  5952. if ($writeLatest && $latestPackage) {
  5953. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5954. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5955. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5956. }
  5957. if ($writeDescription) {
  5958. $packageViewData['description'] = $package->getDescription();
  5959. }
  5960. if ($writePath) {
  5961. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5962. }
  5963. if ($latestPackage && $latestPackage->isAbandoned()) {
  5964. $replacement = is_string($latestPackage->getReplacementPackage())
  5965. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5966. : 'No replacement was suggested';
  5967. $packageWarning = sprintf(
  5968. 'Package %s is abandoned, you should avoid using it. %s.',
  5969. $package->getPrettyName(),
  5970. $replacement
  5971. );
  5972. $packageViewData['warning'] = $packageWarning;
  5973. }
  5974. } else {
  5975. $packageViewData['name'] = $package;
  5976. $nameLength = max($nameLength, strlen($package));
  5977. }
  5978. $viewData[$type][] = $packageViewData;
  5979. }
  5980. $viewMetaData[$type] = array(
  5981. 'nameLength' => $nameLength,
  5982. 'versionLength' => $versionLength,
  5983. 'latestLength' => $latestLength,
  5984. );
  5985. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5986. $exitCode = 1;
  5987. break;
  5988. }
  5989. }
  5990. }
  5991. if ('json' === $format) {
  5992. $io->write(JsonFile::encode($viewData));
  5993. } else {
  5994. foreach ($viewData as $type => $packages) {
  5995. $nameLength = $viewMetaData[$type]['nameLength'];
  5996. $versionLength = $viewMetaData[$type]['versionLength'];
  5997. $latestLength = $viewMetaData[$type]['latestLength'];
  5998. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5999. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  6000. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  6001. if ($writeLatest && !$io->isDecorated()) {
  6002. $latestLength += 2;
  6003. }
  6004. if ($showAllTypes) {
  6005. if ('available' === $type) {
  6006. $io->write('<comment>' . $type . '</comment>:');
  6007. } else {
  6008. $io->write('<info>' . $type . '</info>:');
  6009. }
  6010. }
  6011. foreach ($packages as $package) {
  6012. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  6013. if (isset($package['version']) && $writeVersion) {
  6014. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  6015. }
  6016. if (isset($package['latest']) && $writeLatest) {
  6017. $latestVersion = $package['latest'];
  6018. $updateStatus = $package['latest-status'];
  6019. $style = $this->updateStatusToVersionStyle($updateStatus);
  6020. if (!$io->isDecorated()) {
  6021. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  6022. }
  6023. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  6024. }
  6025. if (isset($package['description']) && $writeDescription) {
  6026. $description = strtok($package['description'], "\r\n");
  6027. $remaining = $width - $nameLength - $versionLength - 4;
  6028. if ($writeLatest) {
  6029. $remaining -= $latestLength;
  6030. }
  6031. if (strlen($description) > $remaining) {
  6032. $description = substr($description, 0, $remaining - 3) . '...';
  6033. }
  6034. $io->write(' ' . $description, false);
  6035. }
  6036. if (isset($package['path'])) {
  6037. $io->write(' ' . $package['path'], false);
  6038. }
  6039. $io->write('');
  6040. if (isset($package['warning'])) {
  6041. $io->write('<warning>' . $package['warning'] . '</warning>');
  6042. }
  6043. }
  6044. if ($showAllTypes) {
  6045. $io->write('');
  6046. }
  6047. }
  6048. }
  6049. return $exitCode;
  6050. }
  6051. protected function getRootRequires()
  6052. {
  6053. $rootPackage = $this->getComposer()->getPackage();
  6054. return array_map(
  6055. 'strtolower',
  6056. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  6057. );
  6058. }
  6059. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  6060. {
  6061. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  6062. }
  6063. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  6064. {
  6065. $name = strtolower($name);
  6066. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  6067. $policy = new DefaultPolicy();
  6068. $pool = new Pool('dev');
  6069. $pool->addRepository($repos);
  6070. $matchedPackage = null;
  6071. $versions = array();
  6072. $matches = $pool->whatProvides($name, $constraint);
  6073. foreach ($matches as $index => $package) {
  6074. if ($package->getName() !== $name) {
  6075. unset($matches[$index]);
  6076. continue;
  6077. }
  6078. if (null === $version && $installedRepo->hasPackage($package)) {
  6079. $matchedPackage = $package;
  6080. }
  6081. $versions[$package->getPrettyVersion()] = $package->getVersion();
  6082. $matches[$index] = $package->getId();
  6083. }
  6084. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  6085. $matchedPackage = $pool->literalToPackage($preferred[0]);
  6086. }
  6087. return array($matchedPackage, $versions);
  6088. }
  6089. protected function printPackageInfo(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6090. {
  6091. $io = $this->getIO();
  6092. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  6093. $this->printLinks($package, 'requires');
  6094. $this->printLinks($package, 'devRequires', 'requires (dev)');
  6095. if ($package->getSuggests()) {
  6096. $io->write("\n<info>suggests</info>");
  6097. foreach ($package->getSuggests() as $suggested => $reason) {
  6098. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  6099. }
  6100. }
  6101. $this->printLinks($package, 'provides');
  6102. $this->printLinks($package, 'conflicts');
  6103. $this->printLinks($package, 'replaces');
  6104. }
  6105. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6106. {
  6107. $io = $this->getIO();
  6108. $io->write('<info>name</info> : ' . $package->getPrettyName());
  6109. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  6110. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  6111. $this->printVersions($package, $versions, $installedRepo);
  6112. if ($latestPackage) {
  6113. $style = $this->getVersionStyle($latestPackage, $package);
  6114. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  6115. } else {
  6116. $latestPackage = $package;
  6117. }
  6118. $io->write('<info>type</info> : ' . $package->getType());
  6119. $this->printLicenses($package);
  6120. $io->write('<info>homepage</info> : ' . $package->getHomepage());
  6121. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  6122. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  6123. if ($installedRepo->hasPackage($package)) {
  6124. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  6125. }
  6126. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  6127. if ($latestPackage->isAbandoned()) {
  6128. $replacement = ($latestPackage->getReplacementPackage() !== null)
  6129. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  6130. : null;
  6131. $io->writeError(
  6132. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  6133. );
  6134. }
  6135. if ($package->getSupport()) {
  6136. $io->write("\n<info>support</info>");
  6137. foreach ($package->getSupport() as $type => $value) {
  6138. $io->write('<comment>' . $type . '</comment> : '.$value);
  6139. }
  6140. }
  6141. if ($package->getAutoload()) {
  6142. $io->write("\n<info>autoload</info>");
  6143. foreach ($package->getAutoload() as $type => $autoloads) {
  6144. $io->write('<comment>' . $type . '</comment>');
  6145. if ($type === 'psr-0') {
  6146. foreach ($autoloads as $name => $path) {
  6147. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6148. }
  6149. } elseif ($type === 'psr-4') {
  6150. foreach ($autoloads as $name => $path) {
  6151. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  6152. }
  6153. } elseif ($type === 'classmap') {
  6154. $io->write(implode(', ', $autoloads));
  6155. }
  6156. }
  6157. if ($package->getIncludePaths()) {
  6158. $io->write('<comment>include-path</comment>');
  6159. $io->write(implode(', ', $package->getIncludePaths()));
  6160. }
  6161. }
  6162. }
  6163. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  6164. {
  6165. uasort($versions, 'version_compare');
  6166. $versions = array_keys(array_reverse($versions));
  6167. if ($installedRepo->hasPackage($package)) {
  6168. $installedVersion = $package->getPrettyVersion();
  6169. $key = array_search($installedVersion, $versions);
  6170. if (false !== $key) {
  6171. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  6172. }
  6173. }
  6174. $versions = implode(', ', $versions);
  6175. $this->getIO()->write('<info>versions</info> : ' . $versions);
  6176. }
  6177. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  6178. {
  6179. $title = $title ?: $linkType;
  6180. $io = $this->getIO();
  6181. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  6182. $io->write("\n<info>" . $title . "</info>");
  6183. foreach ($links as $link) {
  6184. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  6185. }
  6186. }
  6187. }
  6188. protected function printLicenses(CompletePackageInterface $package)
  6189. {
  6190. $spdxLicenses = new SpdxLicenses();
  6191. $licenses = $package->getLicense();
  6192. $io = $this->getIO();
  6193. foreach ($licenses as $licenseId) {
  6194. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6195. if (!$license) {
  6196. $out = $licenseId;
  6197. } else {
  6198. if ($license[1] === true) {
  6199. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  6200. } else {
  6201. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  6202. }
  6203. }
  6204. $io->write('<info>license</info> : ' . $out);
  6205. }
  6206. }
  6207. protected function printPackageInfoAsJson(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  6208. {
  6209. $json = array(
  6210. 'name' => $package->getPrettyName(),
  6211. 'description' => $package->getDescription(),
  6212. 'keywords' => $package->getKeywords() ?: array(),
  6213. 'type' => $package->getType(),
  6214. 'homepage' => $package->getHomepage(),
  6215. 'names' => $package->getNames()
  6216. );
  6217. $json = $this->appendVersions($json, $versions);
  6218. $json = $this->appendLicenses($json, $package);
  6219. if ($latestPackage) {
  6220. $json['latest'] = $latestPackage->getPrettyVersion();
  6221. } else {
  6222. $latestPackage = $package;
  6223. }
  6224. if ($package->getSourceType()) {
  6225. $json['source'] = array(
  6226. 'type' => $package->getSourceType(),
  6227. 'url' => $package->getSourceUrl(),
  6228. 'reference' => $package->getSourceReference()
  6229. );
  6230. }
  6231. if ($package->getDistType()) {
  6232. $json['dist'] = array(
  6233. 'type' => $package->getDistType(),
  6234. 'url' => $package->getDistUrl(),
  6235. 'reference' => $package->getDistReference()
  6236. );
  6237. }
  6238. if ($installedRepo->hasPackage($package)) {
  6239. $json['path'] = realpath($this->getComposer()->getInstallationManager()->getInstallPath($package));
  6240. if ($json['path'] === false) {
  6241. unset($json['path']);
  6242. }
  6243. }
  6244. if ($latestPackage->isAbandoned()) {
  6245. $json['replacement'] = $latestPackage->getReplacementPackage();
  6246. }
  6247. if ($package->getSuggests()) {
  6248. $json['suggests'] = $package->getSuggests();
  6249. }
  6250. if ($package->getSupport()) {
  6251. $json['support'] = $package->getSupport();
  6252. }
  6253. $json = $this->appendAutoload($json, $package);
  6254. if ($package->getIncludePaths()) {
  6255. $json['include_path'] = $package->getIncludePaths();
  6256. }
  6257. $json = $this->appendLinks($json, $package);
  6258. $this->getIO()->write(JsonFile::encode($json));
  6259. }
  6260. private function appendVersions($json, array $versions)
  6261. {
  6262. uasort($versions, 'version_compare');
  6263. $versions = array_keys(array_reverse($versions));
  6264. $json['versions'] = $versions;
  6265. return $json;
  6266. }
  6267. private function appendLicenses($json, CompletePackageInterface $package)
  6268. {
  6269. if ($licenses = $package->getLicense()) {
  6270. $spdxLicenses = new SpdxLicenses();
  6271. $json['licenses'] = array_map(function ($licenseId) use ($spdxLicenses) {
  6272. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  6273. if (!$license) {
  6274. return $licenseId;
  6275. }
  6276. return array(
  6277. 'name' => $license[0],
  6278. 'osi' => $licenseId,
  6279. 'url' => $license[2]
  6280. );
  6281. }, $licenses);
  6282. }
  6283. return $json;
  6284. }
  6285. private function appendAutoload($json, CompletePackageInterface $package)
  6286. {
  6287. if ($package->getAutoload()) {
  6288. $autoload = array();
  6289. foreach ($package->getAutoload() as $type => $autoloads) {
  6290. if ($type === 'psr-0' || $type === 'psr-4') {
  6291. $psr = array();
  6292. foreach ($autoloads as $name => $path) {
  6293. if (!$path) {
  6294. $path = '.';
  6295. }
  6296. $psr[$name ?: '*'] = $path;
  6297. }
  6298. $autoload[$type] = $psr;
  6299. } elseif ($type === 'classmap') {
  6300. $autoload['classmap'] = $autoloads;
  6301. }
  6302. }
  6303. $json['autoload'] = $autoload;
  6304. }
  6305. return $json;
  6306. }
  6307. private function appendLinks($json, CompletePackageInterface $package)
  6308. {
  6309. foreach (array('requires', 'devRequires', 'provides', 'conflicts', 'replaces') as $linkType) {
  6310. $json = $this->appendLink($json, $package, $linkType);
  6311. }
  6312. return $json;
  6313. }
  6314. private function appendLink($json, CompletePackageInterface $package, $linkType)
  6315. {
  6316. $links = $package->{'get' . ucfirst($linkType)}();
  6317. if ($links) {
  6318. $json[$linkType] = array();
  6319. foreach ($links as $link) {
  6320. $json[$linkType][$link->getTarget()] = $link->getPrettyConstraint();
  6321. }
  6322. }
  6323. return $json;
  6324. }
  6325. protected function initStyles(OutputInterface $output)
  6326. {
  6327. $this->colors = array(
  6328. 'green',
  6329. 'yellow',
  6330. 'cyan',
  6331. 'magenta',
  6332. 'blue',
  6333. );
  6334. foreach ($this->colors as $color) {
  6335. $style = new OutputFormatterStyle($color);
  6336. $output->getFormatter()->setStyle($color, $style);
  6337. }
  6338. }
  6339. protected function displayPackageTree(array $arrayTree)
  6340. {
  6341. $io = $this->getIO();
  6342. foreach ($arrayTree as $package) {
  6343. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  6344. $io->write(' ' . $package['version'], false);
  6345. $io->write(' ' . strtok($package['description'], "\r\n"));
  6346. if (isset($package['requires'])) {
  6347. $requires = $package['requires'];
  6348. $treeBar = '├';
  6349. $j = 0;
  6350. $total = count($requires);
  6351. foreach ($requires as $require) {
  6352. $requireName = $require['name'];
  6353. $j++;
  6354. if ($j === $total) {
  6355. $treeBar = 'â””';
  6356. }
  6357. $level = 1;
  6358. $color = $this->colors[$level];
  6359. $info = sprintf(
  6360. '%s──<%s>%s</%s> %s',
  6361. $treeBar,
  6362. $color,
  6363. $requireName,
  6364. $color,
  6365. $require['version']
  6366. );
  6367. $this->writeTreeLine($info);
  6368. $treeBar = str_replace('â””', ' ', $treeBar);
  6369. $packagesInTree = array($package['name'], $requireName);
  6370. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  6371. }
  6372. }
  6373. }
  6374. }
  6375. protected function generatePackageTree(
  6376. PackageInterface $package,
  6377. RepositoryInterface $installedRepo,
  6378. RepositoryInterface $distantRepos
  6379. ) {
  6380. $requires = $package->getRequires();
  6381. ksort($requires);
  6382. $children = array();
  6383. foreach ($requires as $requireName => $require) {
  6384. $packagesInTree = array($package->getName(), $requireName);
  6385. $treeChildDesc = array(
  6386. 'name' => $requireName,
  6387. 'version' => $require->getPrettyConstraint(),
  6388. );
  6389. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  6390. if ($deepChildren) {
  6391. $treeChildDesc['requires'] = $deepChildren;
  6392. }
  6393. $children[] = $treeChildDesc;
  6394. }
  6395. $tree = array(
  6396. 'name' => $package->getPrettyName(),
  6397. 'version' => $package->getPrettyVersion(),
  6398. 'description' => $package->getDescription(),
  6399. );
  6400. if ($children) {
  6401. $tree['requires'] = $children;
  6402. }
  6403. return $tree;
  6404. }
  6405. protected function displayTree(
  6406. $package,
  6407. array $packagesInTree,
  6408. $previousTreeBar = '├',
  6409. $level = 1
  6410. ) {
  6411. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  6412. if (isset($package['requires'])) {
  6413. $requires = $package['requires'];
  6414. $treeBar = $previousTreeBar . ' ├';
  6415. $i = 0;
  6416. $total = count($requires);
  6417. foreach ($requires as $require) {
  6418. $currentTree = $packagesInTree;
  6419. $i++;
  6420. if ($i === $total) {
  6421. $treeBar = $previousTreeBar . ' â””';
  6422. }
  6423. $colorIdent = $level % count($this->colors);
  6424. $color = $this->colors[$colorIdent];
  6425. $circularWarn = in_array(
  6426. $require['name'],
  6427. $currentTree,
  6428. true
  6429. ) ? '(circular dependency aborted here)' : '';
  6430. $info = rtrim(sprintf(
  6431. '%s──<%s>%s</%s> %s %s',
  6432. $treeBar,
  6433. $color,
  6434. $require['name'],
  6435. $color,
  6436. $require['version'],
  6437. $circularWarn
  6438. ));
  6439. $this->writeTreeLine($info);
  6440. $treeBar = str_replace('â””', ' ', $treeBar);
  6441. $currentTree[] = $require['name'];
  6442. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  6443. }
  6444. }
  6445. }
  6446. protected function addTree(
  6447. $name,
  6448. $package,
  6449. RepositoryInterface $installedRepo,
  6450. RepositoryInterface $distantRepos,
  6451. array $packagesInTree
  6452. ) {
  6453. $children = array();
  6454. list($package, $versions) = $this->getPackage(
  6455. $installedRepo,
  6456. $distantRepos,
  6457. $name,
  6458. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  6459. );
  6460. if (is_object($package)) {
  6461. $requires = $package->getRequires();
  6462. ksort($requires);
  6463. foreach ($requires as $requireName => $require) {
  6464. $currentTree = $packagesInTree;
  6465. $treeChildDesc = array(
  6466. 'name' => $requireName,
  6467. 'version' => $require->getPrettyConstraint(),
  6468. );
  6469. if (!in_array($requireName, $currentTree, true)) {
  6470. $currentTree[] = $requireName;
  6471. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  6472. if ($deepChildren) {
  6473. $treeChildDesc['requires'] = $deepChildren;
  6474. }
  6475. }
  6476. $children[] = $treeChildDesc;
  6477. }
  6478. }
  6479. return $children;
  6480. }
  6481. private function updateStatusToVersionStyle($updateStatus)
  6482. {
  6483. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  6484. }
  6485. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  6486. {
  6487. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  6488. return 'up-to-date';
  6489. }
  6490. $constraint = $package->getVersion();
  6491. if (0 !== strpos($constraint, 'dev-')) {
  6492. $constraint = '^'.$constraint;
  6493. }
  6494. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  6495. return 'semver-safe-update';
  6496. }
  6497. return 'update-possible';
  6498. }
  6499. private function writeTreeLine($line)
  6500. {
  6501. $io = $this->getIO();
  6502. if (!$io->isDecorated()) {
  6503. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  6504. }
  6505. $io->write($line);
  6506. }
  6507. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  6508. {
  6509. $name = $package->getName();
  6510. $versionSelector = new VersionSelector($this->getPool($composer));
  6511. $stability = $composer->getPackage()->getMinimumStability();
  6512. $flags = $composer->getPackage()->getStabilityFlags();
  6513. if (isset($flags[$name])) {
  6514. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  6515. }
  6516. $bestStability = $stability;
  6517. if ($composer->getPackage()->getPreferStable()) {
  6518. $bestStability = $package->getStability();
  6519. }
  6520. $targetVersion = null;
  6521. if (0 === strpos($package->getVersion(), 'dev-')) {
  6522. $targetVersion = $package->getVersion();
  6523. }
  6524. if ($targetVersion === null && $minorOnly) {
  6525. $targetVersion = '^' . $package->getVersion();
  6526. }
  6527. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  6528. }
  6529. private function getPool(Composer $composer)
  6530. {
  6531. if (!$this->pool) {
  6532. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  6533. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  6534. }
  6535. return $this->pool;
  6536. }
  6537. }
  6538. <?php
  6539. namespace Composer\Command;
  6540. use Symfony\Component\Console\Input\InputInterface;
  6541. use Symfony\Component\Console\Input\InputOption;
  6542. use Symfony\Component\Console\Output\OutputInterface;
  6543. use Composer\Downloader\ChangeReportInterface;
  6544. use Composer\Downloader\DvcsDownloaderInterface;
  6545. use Composer\Downloader\VcsCapableDownloaderInterface;
  6546. use Composer\Package\Dumper\ArrayDumper;
  6547. use Composer\Package\Version\VersionGuesser;
  6548. use Composer\Package\Version\VersionParser;
  6549. use Composer\Plugin\CommandEvent;
  6550. use Composer\Plugin\PluginEvents;
  6551. use Composer\Script\ScriptEvents;
  6552. use Composer\Util\ProcessExecutor;
  6553. class StatusCommand extends BaseCommand
  6554. {
  6555. const EXIT_CODE_ERRORS = 1;
  6556. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6557. const EXIT_CODE_VERSION_CHANGES = 4;
  6558. protected function configure()
  6559. {
  6560. $this
  6561. ->setName('status')
  6562. ->setDescription('Shows a list of locally modified packages.')
  6563. ->setDefinition(array(
  6564. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6565. ))
  6566. ->setHelp(
  6567. <<<EOT
  6568. The status command displays a list of dependencies that have
  6569. been modified locally.
  6570. Read more at https://getcomposer.org/doc/03-cli.md#status
  6571. EOT
  6572. )
  6573. ;
  6574. }
  6575. protected function execute(InputInterface $input, OutputInterface $output)
  6576. {
  6577. $composer = $this->getComposer();
  6578. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6579. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6580. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6581. $exitCode = $this->doExecute($input, $output);
  6582. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6583. return $exitCode;
  6584. }
  6585. private function doExecute(InputInterface $input, OutputInterface $output)
  6586. {
  6587. $composer = $this->getComposer();
  6588. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6589. $dm = $composer->getDownloadManager();
  6590. $im = $composer->getInstallationManager();
  6591. $errors = array();
  6592. $io = $this->getIO();
  6593. $unpushedChanges = array();
  6594. $vcsVersionChanges = array();
  6595. $parser = new VersionParser;
  6596. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6597. $dumper = new ArrayDumper;
  6598. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6599. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6600. $targetDir = $im->getInstallPath($package);
  6601. if ($downloader instanceof ChangeReportInterface) {
  6602. if (is_link($targetDir)) {
  6603. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6604. }
  6605. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6606. $errors[$targetDir] = $changes;
  6607. }
  6608. }
  6609. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6610. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6611. switch ($package->getInstallationSource()) {
  6612. case 'source':
  6613. $previousRef = $package->getSourceReference();
  6614. break;
  6615. case 'dist':
  6616. $previousRef = $package->getDistReference();
  6617. break;
  6618. default:
  6619. $previousRef = null;
  6620. }
  6621. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6622. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6623. $vcsVersionChanges[$targetDir] = array(
  6624. 'previous' => array(
  6625. 'version' => $package->getPrettyVersion(),
  6626. 'ref' => $previousRef,
  6627. ),
  6628. 'current' => array(
  6629. 'version' => $currentVersion['pretty_version'],
  6630. 'ref' => $currentVersion['commit'],
  6631. ),
  6632. );
  6633. }
  6634. }
  6635. }
  6636. if ($downloader instanceof DvcsDownloaderInterface) {
  6637. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6638. $unpushedChanges[$targetDir] = $unpushed;
  6639. }
  6640. }
  6641. }
  6642. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6643. $io->writeError('<info>No local changes</info>');
  6644. return 0;
  6645. }
  6646. if ($errors) {
  6647. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6648. foreach ($errors as $path => $changes) {
  6649. if ($input->getOption('verbose')) {
  6650. $indentedChanges = implode("\n", array_map(function ($line) {
  6651. return ' ' . ltrim($line);
  6652. }, explode("\n", $changes)));
  6653. $io->write('<info>'.$path.'</info>:');
  6654. $io->write($indentedChanges);
  6655. } else {
  6656. $io->write($path);
  6657. }
  6658. }
  6659. }
  6660. if ($unpushedChanges) {
  6661. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6662. foreach ($unpushedChanges as $path => $changes) {
  6663. if ($input->getOption('verbose')) {
  6664. $indentedChanges = implode("\n", array_map(function ($line) {
  6665. return ' ' . ltrim($line);
  6666. }, explode("\n", $changes)));
  6667. $io->write('<info>'.$path.'</info>:');
  6668. $io->write($indentedChanges);
  6669. } else {
  6670. $io->write($path);
  6671. }
  6672. }
  6673. }
  6674. if ($vcsVersionChanges) {
  6675. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6676. foreach ($vcsVersionChanges as $path => $changes) {
  6677. if ($input->getOption('verbose')) {
  6678. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6679. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6680. if ($io->isVeryVerbose()) {
  6681. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6682. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6683. }
  6684. $io->write('<info>'.$path.'</info>:');
  6685. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6686. } else {
  6687. $io->write($path);
  6688. }
  6689. }
  6690. }
  6691. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6692. $io->writeError('Use --verbose (-v) to see a list of files');
  6693. }
  6694. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6695. }
  6696. }
  6697. <?php
  6698. namespace Composer\Command;
  6699. use Composer\Repository\PlatformRepository;
  6700. use Symfony\Component\Console\Input\InputArgument;
  6701. use Symfony\Component\Console\Input\InputInterface;
  6702. use Symfony\Component\Console\Input\InputOption;
  6703. use Symfony\Component\Console\Output\OutputInterface;
  6704. class SuggestsCommand extends BaseCommand
  6705. {
  6706. protected function configure()
  6707. {
  6708. $this
  6709. ->setName('suggests')
  6710. ->setDescription('Shows package suggestions.')
  6711. ->setDefinition(array(
  6712. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6713. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6714. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6715. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6716. ))
  6717. ->setHelp(
  6718. <<<EOT
  6719. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6720. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6721. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6722. EOT
  6723. )
  6724. ;
  6725. }
  6726. protected function execute(InputInterface $input, OutputInterface $output)
  6727. {
  6728. $lock = $this->getComposer()->getLocker()->getLockData();
  6729. if (empty($lock)) {
  6730. throw new \RuntimeException('Lockfile seems to be empty?');
  6731. }
  6732. $packages = $lock['packages'];
  6733. if (!$input->getOption('no-dev')) {
  6734. $packages += $lock['packages-dev'];
  6735. }
  6736. $filter = $input->getArgument('packages');
  6737. $installed = array();
  6738. foreach ($packages as $package) {
  6739. $installed[] = $package['name'];
  6740. if (!empty($package['provide'])) {
  6741. $installed = array_merge($installed, array_keys($package['provide']));
  6742. }
  6743. if (!empty($package['replace'])) {
  6744. $installed = array_merge($installed, array_keys($package['replace']));
  6745. }
  6746. }
  6747. $installed = array_flip($installed);
  6748. ksort($installed);
  6749. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6750. $suggesters = array();
  6751. $suggested = array();
  6752. foreach ($packages as $package) {
  6753. $packageName = $package['name'];
  6754. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6755. continue;
  6756. }
  6757. foreach ($package['suggest'] as $suggestion => $reason) {
  6758. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6759. continue;
  6760. }
  6761. if (!isset($installed[$suggestion])) {
  6762. $suggesters[$packageName][$suggestion] = $reason;
  6763. $suggested[$suggestion][$packageName] = $reason;
  6764. }
  6765. }
  6766. }
  6767. ksort($suggesters);
  6768. ksort($suggested);
  6769. $mode = 0;
  6770. $io = $this->getIO();
  6771. if ($input->getOption('by-package') || $io->isVerbose()) {
  6772. $mode |= 1;
  6773. }
  6774. if ($input->getOption('by-suggestion')) {
  6775. $mode |= 2;
  6776. }
  6777. if ($mode === 0) {
  6778. foreach (array_keys($suggested) as $suggestion) {
  6779. $io->write(sprintf('<info>%s</info>', $suggestion));
  6780. }
  6781. return 0;
  6782. }
  6783. if ($mode & 1) {
  6784. foreach ($suggesters as $suggester => $suggestions) {
  6785. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6786. foreach ($suggestions as $suggestion => $reason) {
  6787. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6788. }
  6789. $io->write('');
  6790. }
  6791. }
  6792. if ($mode & 2) {
  6793. if ($mode & 1) {
  6794. $io->write(str_repeat('-', 78));
  6795. }
  6796. foreach ($suggested as $suggestion => $suggesters) {
  6797. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6798. foreach ($suggesters as $suggester => $reason) {
  6799. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6800. }
  6801. $io->write('');
  6802. }
  6803. }
  6804. return 0;
  6805. }
  6806. }
  6807. <?php
  6808. namespace Composer\Command;
  6809. use Composer\Composer;
  6810. use Composer\Installer;
  6811. use Composer\IO\IOInterface;
  6812. use Composer\Plugin\CommandEvent;
  6813. use Composer\Plugin\PluginEvents;
  6814. use Symfony\Component\Console\Helper\Table;
  6815. use Symfony\Component\Console\Input\InputInterface;
  6816. use Symfony\Component\Console\Input\InputOption;
  6817. use Symfony\Component\Console\Input\InputArgument;
  6818. use Symfony\Component\Console\Output\OutputInterface;
  6819. use Symfony\Component\Console\Question\Question;
  6820. class UpdateCommand extends BaseCommand
  6821. {
  6822. protected function configure()
  6823. {
  6824. $this
  6825. ->setName('update')
  6826. ->setAliases(array('u', 'upgrade'))
  6827. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6828. ->setDefinition(array(
  6829. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6830. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6831. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6832. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6833. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6834. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6835. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6836. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6837. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6838. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6839. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6840. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6841. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of allowed packages to the allow list, except those defined in root package.'),
  6842. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of allowed packages to the allow list, including those defined in root package.'),
  6843. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6844. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6845. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6846. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6847. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6848. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6849. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6850. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6851. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6852. ))
  6853. ->setHelp(
  6854. <<<EOT
  6855. The <info>update</info> command reads the composer.json file from the
  6856. current directory, processes it, and updates, removes or installs all the
  6857. dependencies.
  6858. <info>php composer.phar update</info>
  6859. To limit the update operation to a few packages, you can list the package(s)
  6860. you want to update as such:
  6861. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6862. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6863. from a specific vendor:
  6864. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6865. To select packages names interactively with auto-completion use <info>-i</info>.
  6866. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6867. EOT
  6868. )
  6869. ;
  6870. }
  6871. protected function execute(InputInterface $input, OutputInterface $output)
  6872. {
  6873. $io = $this->getIO();
  6874. if ($input->getOption('no-custom-installers')) {
  6875. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6876. $input->setOption('no-plugins', true);
  6877. }
  6878. if ($input->getOption('dev')) {
  6879. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6880. }
  6881. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6882. $packages = $input->getArgument('packages');
  6883. if ($input->getOption('interactive')) {
  6884. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6885. }
  6886. if ($input->getOption('root-reqs')) {
  6887. $require = array_keys($composer->getPackage()->getRequires());
  6888. if (!$input->getOption('no-dev')) {
  6889. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6890. $require = array_merge($require, $requireDev);
  6891. }
  6892. if (!empty($packages)) {
  6893. $packages = array_intersect($packages, $require);
  6894. } else {
  6895. $packages = $require;
  6896. }
  6897. }
  6898. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6899. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6900. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6901. $install = Installer::create($io, $composer);
  6902. $config = $composer->getConfig();
  6903. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6904. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6905. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6906. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6907. $install
  6908. ->setDryRun($input->getOption('dry-run'))
  6909. ->setVerbose($input->getOption('verbose'))
  6910. ->setPreferSource($preferSource)
  6911. ->setPreferDist($preferDist)
  6912. ->setDevMode(!$input->getOption('no-dev'))
  6913. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6914. ->setRunScripts(!$input->getOption('no-scripts'))
  6915. ->setSkipSuggest($input->getOption('no-suggest'))
  6916. ->setOptimizeAutoloader($optimize)
  6917. ->setClassMapAuthoritative($authoritative)
  6918. ->setApcuAutoloader($apcu)
  6919. ->setUpdate(true)
  6920. ->setUpdateAllowList($input->getOption('lock') ? array('lock') : $packages)
  6921. ->setAllowListTransitiveDependencies($input->getOption('with-dependencies'))
  6922. ->setAllowListAllDependencies($input->getOption('with-all-dependencies'))
  6923. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6924. ->setPreferStable($input->getOption('prefer-stable'))
  6925. ->setPreferLowest($input->getOption('prefer-lowest'))
  6926. ;
  6927. if ($input->getOption('no-plugins')) {
  6928. $install->disablePlugins();
  6929. }
  6930. return $install->run();
  6931. }
  6932. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6933. {
  6934. if (!$input->isInteractive()) {
  6935. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6936. }
  6937. $requires = array_merge(
  6938. $composer->getPackage()->getRequires(),
  6939. $composer->getPackage()->getDevRequires()
  6940. );
  6941. $autocompleterValues = array();
  6942. foreach ($requires as $require) {
  6943. $target = $require->getTarget();
  6944. $autocompleterValues[strtolower($target)] = $target;
  6945. }
  6946. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6947. foreach ($installedPackages as $package) {
  6948. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6949. }
  6950. $helper = $this->getHelper('question');
  6951. $question = new Question('<comment>Enter package name: </comment>', null);
  6952. $io->writeError('<info>Press enter without value to end submission</info>');
  6953. do {
  6954. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6955. $question->setAutocompleterValues($autocompleterValues);
  6956. $addedPackage = $helper->ask($input, $output, $question);
  6957. if (!is_string($addedPackage) || empty($addedPackage)) {
  6958. break;
  6959. }
  6960. $addedPackage = strtolower($addedPackage);
  6961. if (!in_array($addedPackage, $packages)) {
  6962. $packages[] = $addedPackage;
  6963. }
  6964. } while (true);
  6965. $packages = array_filter($packages);
  6966. if (!$packages) {
  6967. throw new \InvalidArgumentException('You must enter minimum one package.');
  6968. }
  6969. $table = new Table($output);
  6970. $table->setHeaders(array('Selected packages'));
  6971. foreach ($packages as $package) {
  6972. $table->addRow(array($package));
  6973. }
  6974. $table->render();
  6975. if ($io->askConfirmation(sprintf(
  6976. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6977. 1 === count($packages) ? '' : 's'
  6978. ), true)) {
  6979. return $packages;
  6980. }
  6981. throw new \RuntimeException('Installation aborted.');
  6982. }
  6983. }
  6984. <?php
  6985. namespace Composer\Command;
  6986. use Composer\Factory;
  6987. use Composer\Package\Loader\ValidatingArrayLoader;
  6988. use Composer\Plugin\CommandEvent;
  6989. use Composer\Plugin\PluginEvents;
  6990. use Composer\Util\ConfigValidator;
  6991. use Symfony\Component\Console\Input\InputArgument;
  6992. use Symfony\Component\Console\Input\InputInterface;
  6993. use Symfony\Component\Console\Input\InputOption;
  6994. use Symfony\Component\Console\Output\OutputInterface;
  6995. class ValidateCommand extends BaseCommand
  6996. {
  6997. protected function configure()
  6998. {
  6999. $this
  7000. ->setName('validate')
  7001. ->setDescription('Validates a composer.json and composer.lock.')
  7002. ->setDefinition(array(
  7003. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  7004. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  7005. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  7006. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  7007. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  7008. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  7009. ))
  7010. ->setHelp(
  7011. <<<EOT
  7012. The validate command validates a given composer.json and composer.lock
  7013. Exit codes in case of errors are:
  7014. 1 validation warning(s), only when --strict is given
  7015. 2 validation error(s)
  7016. 3 file unreadable or missing
  7017. Read more at https://getcomposer.org/doc/03-cli.md#validate
  7018. EOT
  7019. );
  7020. }
  7021. protected function execute(InputInterface $input, OutputInterface $output)
  7022. {
  7023. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  7024. $io = $this->getIO();
  7025. if (!file_exists($file)) {
  7026. $io->writeError('<error>' . $file . ' not found.</error>');
  7027. return 3;
  7028. }
  7029. if (!is_readable($file)) {
  7030. $io->writeError('<error>' . $file . ' is not readable.</error>');
  7031. return 3;
  7032. }
  7033. $validator = new ConfigValidator($io);
  7034. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  7035. $checkPublish = !$input->getOption('no-check-publish');
  7036. $checkLock = !$input->getOption('no-check-lock');
  7037. $isStrict = $input->getOption('strict');
  7038. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7039. $lockErrors = array();
  7040. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  7041. $locker = $composer->getLocker();
  7042. if ($locker->isLocked() && !$locker->isFresh()) {
  7043. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update` or `composer update <package name>`.';
  7044. }
  7045. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true);
  7046. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7047. if ($input->getOption('with-dependencies')) {
  7048. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  7049. foreach ($localRepo->getPackages() as $package) {
  7050. $path = $composer->getInstallationManager()->getInstallPath($package);
  7051. $file = $path . '/composer.json';
  7052. if (is_dir($path) && file_exists($file)) {
  7053. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  7054. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  7055. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  7056. $exitCode = max($depCode, $exitCode);
  7057. }
  7058. }
  7059. }
  7060. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  7061. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  7062. $exitCode = max($eventCode, $exitCode);
  7063. return $exitCode;
  7064. }
  7065. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false)
  7066. {
  7067. $doPrintSchemaUrl = false;
  7068. if ($errors) {
  7069. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  7070. } elseif ($publishErrors) {
  7071. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  7072. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  7073. $doPrintSchemaUrl = $printSchemaUrl;
  7074. } elseif ($warnings) {
  7075. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  7076. $doPrintSchemaUrl = $printSchemaUrl;
  7077. } else {
  7078. $io->write('<info>' . $name . ' is valid</info>');
  7079. }
  7080. if ($doPrintSchemaUrl) {
  7081. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  7082. }
  7083. $extraWarnings = array();
  7084. if ($checkPublish) {
  7085. $errors = array_merge($errors, $publishErrors);
  7086. } else {
  7087. $extraWarnings = array_merge($extraWarnings, $publishErrors);
  7088. }
  7089. if ($checkLock) {
  7090. $errors = array_merge($errors, $lockErrors);
  7091. } else {
  7092. $extraWarnings = array_merge($extraWarnings, $lockErrors);
  7093. }
  7094. $messages = array(
  7095. 'error' => $errors,
  7096. 'warning' => array_merge($warnings, $extraWarnings),
  7097. );
  7098. foreach ($messages as $style => $msgs) {
  7099. foreach ($msgs as $msg) {
  7100. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  7101. }
  7102. }
  7103. }
  7104. }
  7105. <?php
  7106. namespace Composer;
  7107. use Composer\Package\RootPackageInterface;
  7108. use Composer\Package\Locker;
  7109. use Composer\Repository\RepositoryManager;
  7110. use Composer\Installer\InstallationManager;
  7111. use Composer\Plugin\PluginManager;
  7112. use Composer\Downloader\DownloadManager;
  7113. use Composer\EventDispatcher\EventDispatcher;
  7114. use Composer\Autoload\AutoloadGenerator;
  7115. use Composer\Package\Archiver\ArchiveManager;
  7116. class Composer
  7117. {
  7118. const VERSION = '1.10.15';
  7119. const BRANCH_ALIAS_VERSION = '';
  7120. const RELEASE_DATE = '2020-10-13 15:59:09';
  7121. const SOURCE_VERSION = '';
  7122. const RUNTIME_API_VERSION = '1.0.0';
  7123. public static function getVersion()
  7124. {
  7125. if (self::VERSION === '@package_version'.'@') {
  7126. return self::SOURCE_VERSION;
  7127. }
  7128. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  7129. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  7130. }
  7131. return self::VERSION;
  7132. }
  7133. private $package;
  7134. private $locker;
  7135. private $repositoryManager;
  7136. private $downloadManager;
  7137. private $installationManager;
  7138. private $pluginManager;
  7139. private $config;
  7140. private $eventDispatcher;
  7141. private $autoloadGenerator;
  7142. private $archiveManager;
  7143. public function setPackage(RootPackageInterface $package)
  7144. {
  7145. $this->package = $package;
  7146. }
  7147. public function getPackage()
  7148. {
  7149. return $this->package;
  7150. }
  7151. public function setConfig(Config $config)
  7152. {
  7153. $this->config = $config;
  7154. }
  7155. public function getConfig()
  7156. {
  7157. return $this->config;
  7158. }
  7159. public function setLocker(Locker $locker)
  7160. {
  7161. $this->locker = $locker;
  7162. }
  7163. public function getLocker()
  7164. {
  7165. return $this->locker;
  7166. }
  7167. public function setRepositoryManager(RepositoryManager $manager)
  7168. {
  7169. $this->repositoryManager = $manager;
  7170. }
  7171. public function getRepositoryManager()
  7172. {
  7173. return $this->repositoryManager;
  7174. }
  7175. public function setDownloadManager(DownloadManager $manager)
  7176. {
  7177. $this->downloadManager = $manager;
  7178. }
  7179. public function getDownloadManager()
  7180. {
  7181. return $this->downloadManager;
  7182. }
  7183. public function setArchiveManager(ArchiveManager $manager)
  7184. {
  7185. $this->archiveManager = $manager;
  7186. }
  7187. public function getArchiveManager()
  7188. {
  7189. return $this->archiveManager;
  7190. }
  7191. public function setInstallationManager(InstallationManager $manager)
  7192. {
  7193. $this->installationManager = $manager;
  7194. }
  7195. public function getInstallationManager()
  7196. {
  7197. return $this->installationManager;
  7198. }
  7199. public function setPluginManager(PluginManager $manager)
  7200. {
  7201. $this->pluginManager = $manager;
  7202. }
  7203. public function getPluginManager()
  7204. {
  7205. return $this->pluginManager;
  7206. }
  7207. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  7208. {
  7209. $this->eventDispatcher = $eventDispatcher;
  7210. }
  7211. public function getEventDispatcher()
  7212. {
  7213. return $this->eventDispatcher;
  7214. }
  7215. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  7216. {
  7217. $this->autoloadGenerator = $autoloadGenerator;
  7218. }
  7219. public function getAutoloadGenerator()
  7220. {
  7221. return $this->autoloadGenerator;
  7222. }
  7223. }
  7224. <?php
  7225. namespace Composer;
  7226. use Composer\Config\ConfigSourceInterface;
  7227. use Composer\Downloader\TransportException;
  7228. use Composer\IO\IOInterface;
  7229. use Composer\Util\Platform;
  7230. use Composer\Util\ProcessExecutor;
  7231. class Config
  7232. {
  7233. const RELATIVE_PATHS = 1;
  7234. public static $defaultConfig = array(
  7235. 'process-timeout' => 300,
  7236. 'use-include-path' => false,
  7237. 'preferred-install' => 'auto',
  7238. 'notify-on-install' => true,
  7239. 'github-protocols' => array('https', 'ssh', 'git'),
  7240. 'vendor-dir' => 'vendor',
  7241. 'bin-dir' => '{$vendor-dir}/bin',
  7242. 'cache-dir' => '{$home}/cache',
  7243. 'data-dir' => '{$home}',
  7244. 'cache-files-dir' => '{$cache-dir}/files',
  7245. 'cache-repo-dir' => '{$cache-dir}/repo',
  7246. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  7247. 'cache-ttl' => 15552000,
  7248. 'cache-files-ttl' => null,
  7249. 'cache-files-maxsize' => '300MiB',
  7250. 'bin-compat' => 'auto',
  7251. 'discard-changes' => false,
  7252. 'autoloader-suffix' => null,
  7253. 'sort-packages' => false,
  7254. 'optimize-autoloader' => false,
  7255. 'classmap-authoritative' => false,
  7256. 'apcu-autoloader' => false,
  7257. 'prepend-autoloader' => true,
  7258. 'github-domains' => array('github.com'),
  7259. 'bitbucket-expose-hostname' => true,
  7260. 'disable-tls' => false,
  7261. 'secure-http' => true,
  7262. 'cafile' => null,
  7263. 'capath' => null,
  7264. 'github-expose-hostname' => true,
  7265. 'gitlab-domains' => array('gitlab.com'),
  7266. 'store-auths' => 'prompt',
  7267. 'platform' => array(),
  7268. 'archive-format' => 'tar',
  7269. 'archive-dir' => '.',
  7270. 'htaccess-protect' => true,
  7271. 'use-github-api' => true,
  7272. 'lock' => true,
  7273. );
  7274. public static $defaultRepositories = array(
  7275. 'packagist.org' => array(
  7276. 'type' => 'composer',
  7277. 'url' => 'https?://repo.packagist.org',
  7278. 'allow_ssl_downgrade' => true,
  7279. ),
  7280. );
  7281. private $config;
  7282. private $baseDir;
  7283. private $repositories;
  7284. private $configSource;
  7285. private $authConfigSource;
  7286. private $useEnvironment;
  7287. private $warnedHosts = array();
  7288. public function __construct($useEnvironment = true, $baseDir = null)
  7289. {
  7290. $this->config = static::$defaultConfig;
  7291. $this->repositories = static::$defaultRepositories;
  7292. $this->useEnvironment = (bool) $useEnvironment;
  7293. $this->baseDir = $baseDir;
  7294. }
  7295. public function setConfigSource(ConfigSourceInterface $source)
  7296. {
  7297. $this->configSource = $source;
  7298. }
  7299. public function getConfigSource()
  7300. {
  7301. return $this->configSource;
  7302. }
  7303. public function setAuthConfigSource(ConfigSourceInterface $source)
  7304. {
  7305. $this->authConfigSource = $source;
  7306. }
  7307. public function getAuthConfigSource()
  7308. {
  7309. return $this->authConfigSource;
  7310. }
  7311. public function merge($config)
  7312. {
  7313. if (!empty($config['config']) && is_array($config['config'])) {
  7314. foreach ($config['config'] as $key => $val) {
  7315. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic', 'bearer')) && isset($this->config[$key])) {
  7316. $this->config[$key] = array_merge($this->config[$key], $val);
  7317. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  7318. if (is_array($val) || is_array($this->config[$key])) {
  7319. if (is_string($val)) {
  7320. $val = array('*' => $val);
  7321. }
  7322. if (is_string($this->config[$key])) {
  7323. $this->config[$key] = array('*' => $this->config[$key]);
  7324. }
  7325. $this->config[$key] = array_merge($this->config[$key], $val);
  7326. if (isset($this->config[$key]['*'])) {
  7327. $wildcard = $this->config[$key]['*'];
  7328. unset($this->config[$key]['*']);
  7329. $this->config[$key]['*'] = $wildcard;
  7330. }
  7331. } else {
  7332. $this->config[$key] = $val;
  7333. }
  7334. } else {
  7335. $this->config[$key] = $val;
  7336. }
  7337. }
  7338. }
  7339. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  7340. $this->repositories = array_reverse($this->repositories, true);
  7341. $newRepos = array_reverse($config['repositories'], true);
  7342. foreach ($newRepos as $name => $repository) {
  7343. if (false === $repository) {
  7344. $this->disableRepoByName($name);
  7345. continue;
  7346. }
  7347. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  7348. $this->disableRepoByName(key($repository));
  7349. continue;
  7350. }
  7351. if (is_int($name)) {
  7352. $this->repositories[] = $repository;
  7353. } else {
  7354. if ($name === 'packagist') {
  7355. $this->repositories[$name . '.org'] = $repository;
  7356. } else {
  7357. $this->repositories[$name] = $repository;
  7358. }
  7359. }
  7360. }
  7361. $this->repositories = array_reverse($this->repositories, true);
  7362. }
  7363. }
  7364. public function getRepositories()
  7365. {
  7366. return $this->repositories;
  7367. }
  7368. public function get($key, $flags = 0)
  7369. {
  7370. switch ($key) {
  7371. case 'vendor-dir':
  7372. case 'bin-dir':
  7373. case 'process-timeout':
  7374. case 'data-dir':
  7375. case 'cache-dir':
  7376. case 'cache-files-dir':
  7377. case 'cache-repo-dir':
  7378. case 'cache-vcs-dir':
  7379. case 'cafile':
  7380. case 'capath':
  7381. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  7382. $val = $this->getComposerEnv($env);
  7383. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  7384. $val = Platform::expandPath($val);
  7385. if (substr($key, -4) !== '-dir') {
  7386. return $val;
  7387. }
  7388. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  7389. case 'htaccess-protect':
  7390. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  7391. if (false === $value) {
  7392. $value = $this->config[$key];
  7393. }
  7394. return $value !== 'false' && (bool) $value;
  7395. case 'cache-ttl':
  7396. return (int) $this->config[$key];
  7397. case 'cache-files-maxsize':
  7398. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  7399. throw new \RuntimeException(
  7400. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  7401. );
  7402. }
  7403. $size = $matches[1];
  7404. if (isset($matches[2])) {
  7405. switch (strtolower($matches[2])) {
  7406. case 'g':
  7407. $size *= 1024;
  7408. case 'm':
  7409. $size *= 1024;
  7410. case 'k':
  7411. $size *= 1024;
  7412. break;
  7413. }
  7414. }
  7415. return $size;
  7416. case 'cache-files-ttl':
  7417. if (isset($this->config[$key])) {
  7418. return (int) $this->config[$key];
  7419. }
  7420. return (int) $this->config['cache-ttl'];
  7421. case 'home':
  7422. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  7423. return rtrim($this->process($val, $flags), '/\\');
  7424. case 'bin-compat':
  7425. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  7426. if (!in_array($value, array('auto', 'full'))) {
  7427. throw new \RuntimeException(
  7428. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  7429. );
  7430. }
  7431. return $value;
  7432. case 'discard-changes':
  7433. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  7434. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  7435. throw new \RuntimeException(
  7436. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  7437. );
  7438. }
  7439. if ('stash' === $env) {
  7440. return 'stash';
  7441. }
  7442. return $env !== 'false' && (bool) $env;
  7443. }
  7444. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  7445. throw new \RuntimeException(
  7446. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  7447. );
  7448. }
  7449. return $this->config[$key];
  7450. case 'github-protocols':
  7451. $protos = $this->config['github-protocols'];
  7452. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  7453. unset($protos[$index]);
  7454. }
  7455. if (reset($protos) === 'http') {
  7456. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  7457. }
  7458. return $protos;
  7459. case 'disable-tls':
  7460. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7461. case 'secure-http':
  7462. if ($this->get('disable-tls') === true) {
  7463. return false;
  7464. }
  7465. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7466. case 'use-github-api':
  7467. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7468. case 'lock':
  7469. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  7470. default:
  7471. if (!isset($this->config[$key])) {
  7472. return null;
  7473. }
  7474. return $this->process($this->config[$key], $flags);
  7475. }
  7476. }
  7477. public function all($flags = 0)
  7478. {
  7479. $all = array(
  7480. 'repositories' => $this->getRepositories(),
  7481. );
  7482. foreach (array_keys($this->config) as $key) {
  7483. $all['config'][$key] = $this->get($key, $flags);
  7484. }
  7485. return $all;
  7486. }
  7487. public function raw()
  7488. {
  7489. return array(
  7490. 'repositories' => $this->getRepositories(),
  7491. 'config' => $this->config,
  7492. );
  7493. }
  7494. public function has($key)
  7495. {
  7496. return array_key_exists($key, $this->config);
  7497. }
  7498. private function process($value, $flags)
  7499. {
  7500. $config = $this;
  7501. if (!is_string($value)) {
  7502. return $value;
  7503. }
  7504. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  7505. return $config->get($match[1], $flags);
  7506. }, $value);
  7507. }
  7508. private function realpath($path)
  7509. {
  7510. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  7511. return $path;
  7512. }
  7513. return $this->baseDir . '/' . $path;
  7514. }
  7515. private function getComposerEnv($var)
  7516. {
  7517. if ($this->useEnvironment) {
  7518. return getenv($var);
  7519. }
  7520. return false;
  7521. }
  7522. private function disableRepoByName($name)
  7523. {
  7524. if (isset($this->repositories[$name])) {
  7525. unset($this->repositories[$name]);
  7526. } elseif ($name === 'packagist') {
  7527. unset($this->repositories['packagist.org']);
  7528. }
  7529. }
  7530. public function prohibitUrlByConfig($url, IOInterface $io = null)
  7531. {
  7532. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  7533. return;
  7534. }
  7535. $scheme = parse_url($url, PHP_URL_SCHEME);
  7536. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  7537. if ($this->get('secure-http')) {
  7538. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  7539. } elseif ($io) {
  7540. $host = parse_url($url, PHP_URL_HOST);
  7541. if (!isset($this->warnedHosts[$host])) {
  7542. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  7543. }
  7544. $this->warnedHosts[$host] = true;
  7545. }
  7546. }
  7547. }
  7548. public static function disableProcessTimeout()
  7549. {
  7550. ProcessExecutor::setTimeout(0);
  7551. }
  7552. }
  7553. <?php
  7554. namespace Composer\Config;
  7555. interface ConfigSourceInterface
  7556. {
  7557. public function addRepository($name, $config);
  7558. public function removeRepository($name);
  7559. public function addConfigSetting($name, $value);
  7560. public function removeConfigSetting($name);
  7561. public function addProperty($name, $value);
  7562. public function removeProperty($name);
  7563. public function addLink($type, $name, $value);
  7564. public function removeLink($type, $name);
  7565. public function getName();
  7566. }
  7567. <?php
  7568. namespace Composer\Config;
  7569. use Composer\Json\JsonFile;
  7570. use Composer\Json\JsonManipulator;
  7571. use Composer\Util\Silencer;
  7572. class JsonConfigSource implements ConfigSourceInterface
  7573. {
  7574. private $file;
  7575. private $authConfig;
  7576. public function __construct(JsonFile $file, $authConfig = false)
  7577. {
  7578. $this->file = $file;
  7579. $this->authConfig = $authConfig;
  7580. }
  7581. public function getName()
  7582. {
  7583. return $this->file->getPath();
  7584. }
  7585. public function addRepository($name, $config)
  7586. {
  7587. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7588. if (isset($config['repositories'])) {
  7589. foreach ($config['repositories'] as $index => $val) {
  7590. if ($index === $repo) {
  7591. continue;
  7592. }
  7593. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7594. unset($config['repositories'][$index]);
  7595. $config['repositories']['packagist.org'] = false;
  7596. break;
  7597. }
  7598. }
  7599. }
  7600. $config['repositories'][$repo] = $repoConfig;
  7601. });
  7602. }
  7603. public function removeRepository($name)
  7604. {
  7605. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7606. unset($config['repositories'][$repo]);
  7607. });
  7608. }
  7609. public function addConfigSetting($name, $value)
  7610. {
  7611. $authConfig = $this->authConfig;
  7612. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7613. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7614. list($key, $host) = explode('.', $key, 2);
  7615. if ($authConfig) {
  7616. $config[$key][$host] = $val;
  7617. } else {
  7618. $config['config'][$key][$host] = $val;
  7619. }
  7620. } else {
  7621. $config['config'][$key] = $val;
  7622. }
  7623. });
  7624. }
  7625. public function removeConfigSetting($name)
  7626. {
  7627. $authConfig = $this->authConfig;
  7628. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7629. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|bearer|http-basic|platform)\.}', $key)) {
  7630. list($key, $host) = explode('.', $key, 2);
  7631. if ($authConfig) {
  7632. unset($config[$key][$host]);
  7633. } else {
  7634. unset($config['config'][$key][$host]);
  7635. }
  7636. } else {
  7637. unset($config['config'][$key]);
  7638. }
  7639. });
  7640. }
  7641. public function addProperty($name, $value)
  7642. {
  7643. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7644. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7645. $bits = explode('.', $key);
  7646. $last = array_pop($bits);
  7647. $arr = &$config[reset($bits)];
  7648. foreach ($bits as $bit) {
  7649. if (!isset($arr[$bit])) {
  7650. $arr[$bit] = array();
  7651. }
  7652. $arr = &$arr[$bit];
  7653. }
  7654. $arr[$last] = $val;
  7655. } else {
  7656. $config[$key] = $val;
  7657. }
  7658. });
  7659. }
  7660. public function removeProperty($name)
  7661. {
  7662. $authConfig = $this->authConfig;
  7663. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7664. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7665. $bits = explode('.', $key);
  7666. $last = array_pop($bits);
  7667. $arr = &$config[reset($bits)];
  7668. foreach ($bits as $bit) {
  7669. if (!isset($arr[$bit])) {
  7670. return;
  7671. }
  7672. $arr = &$arr[$bit];
  7673. }
  7674. unset($arr[$last]);
  7675. } else {
  7676. unset($config[$key]);
  7677. }
  7678. });
  7679. }
  7680. public function addLink($type, $name, $value)
  7681. {
  7682. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7683. $config[$type][$name] = $value;
  7684. });
  7685. }
  7686. public function removeLink($type, $name)
  7687. {
  7688. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7689. unset($config[$type][$name]);
  7690. if (0 === count($config[$type])) {
  7691. unset($config[$type]);
  7692. }
  7693. });
  7694. }
  7695. protected function manipulateJson($method, $args, $fallback)
  7696. {
  7697. $args = func_get_args();
  7698. array_shift($args);
  7699. $fallback = array_pop($args);
  7700. if ($this->file->exists()) {
  7701. if (!is_writable($this->file->getPath())) {
  7702. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7703. }
  7704. if (!is_readable($this->file->getPath())) {
  7705. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7706. }
  7707. $contents = file_get_contents($this->file->getPath());
  7708. } elseif ($this->authConfig) {
  7709. $contents = "{\n}\n";
  7710. } else {
  7711. $contents = "{\n \"config\": {\n }\n}\n";
  7712. }
  7713. $manipulator = new JsonManipulator($contents);
  7714. $newFile = !$this->file->exists();
  7715. if ($this->authConfig && $method === 'addConfigSetting') {
  7716. $method = 'addSubNode';
  7717. list($mainNode, $name) = explode('.', $args[0], 2);
  7718. $args = array($mainNode, $name, $args[1]);
  7719. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7720. $method = 'removeSubNode';
  7721. list($mainNode, $name) = explode('.', $args[0], 2);
  7722. $args = array($mainNode, $name);
  7723. }
  7724. if (call_user_func_array(array($manipulator, $method), $args)) {
  7725. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7726. } else {
  7727. $config = $this->file->read();
  7728. $this->arrayUnshiftRef($args, $config);
  7729. call_user_func_array($fallback, $args);
  7730. foreach (array('require', 'require-dev', 'conflict', 'provide', 'replace', 'suggest', 'config', 'autoload', 'autoload-dev') as $linkType) {
  7731. if (isset($config[$linkType]) && $config[$linkType] === array()) {
  7732. $config[$linkType] = new \stdClass;
  7733. }
  7734. }
  7735. $this->file->write($config);
  7736. }
  7737. if ($newFile) {
  7738. Silencer::call('chmod', $this->file->getPath(), 0600);
  7739. }
  7740. }
  7741. private function arrayUnshiftRef(&$array, &$value)
  7742. {
  7743. $return = array_unshift($array, '');
  7744. $array[0] = &$value;
  7745. return $return;
  7746. }
  7747. }
  7748. <?php
  7749. namespace Composer\Console;
  7750. use Composer\IO\NullIO;
  7751. use Composer\Util\Platform;
  7752. use Composer\Util\Silencer;
  7753. use Symfony\Component\Console\Application as BaseApplication;
  7754. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7755. use Symfony\Component\Console\Helper\HelperSet;
  7756. use Symfony\Component\Console\Helper\QuestionHelper;
  7757. use Symfony\Component\Console\Input\InputInterface;
  7758. use Symfony\Component\Console\Input\InputOption;
  7759. use Symfony\Component\Console\Output\OutputInterface;
  7760. use Composer\Command;
  7761. use Composer\Composer;
  7762. use Composer\Factory;
  7763. use Composer\IO\IOInterface;
  7764. use Composer\IO\ConsoleIO;
  7765. use Composer\Json\JsonValidationException;
  7766. use Composer\Util\ErrorHandler;
  7767. use Composer\EventDispatcher\ScriptExecutionException;
  7768. use Composer\Exception\NoSslException;
  7769. class Application extends BaseApplication
  7770. {
  7771. protected $composer;
  7772. protected $io;
  7773. private static $logo = ' ______
  7774. / ____/___ ____ ___ ____ ____ ________ _____
  7775. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7776. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7777. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7778. /_/
  7779. ';
  7780. private $hasPluginCommands = false;
  7781. private $disablePluginsByDefault = false;
  7782. private $initialWorkingDirectory = '';
  7783. public function __construct()
  7784. {
  7785. static $shutdownRegistered = false;
  7786. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7787. ini_set('xdebug.show_exception_trace', false);
  7788. ini_set('xdebug.scream', false);
  7789. }
  7790. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7791. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7792. }
  7793. if (!$shutdownRegistered) {
  7794. $shutdownRegistered = true;
  7795. register_shutdown_function(function () {
  7796. $lastError = error_get_last();
  7797. if ($lastError && $lastError['message'] &&
  7798. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7799. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7800. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7801. }
  7802. });
  7803. }
  7804. $this->io = new NullIO();
  7805. $this->initialWorkingDirectory = getcwd();
  7806. parent::__construct('Composer', Composer::getVersion());
  7807. }
  7808. public function run(InputInterface $input = null, OutputInterface $output = null)
  7809. {
  7810. if (null === $output) {
  7811. $output = Factory::createOutput();
  7812. }
  7813. return parent::run($input, $output);
  7814. }
  7815. public function doRun(InputInterface $input, OutputInterface $output)
  7816. {
  7817. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7818. if (getenv('COMPOSER_NO_INTERACTION')) {
  7819. $input->setInteractive(false);
  7820. }
  7821. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7822. new QuestionHelper(),
  7823. )));
  7824. ErrorHandler::register($io);
  7825. if ($input->hasParameterOption('--no-cache')) {
  7826. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7827. $_SERVER['COMPOSER_CACHE_DIR'] = Platform::isWindows() ? 'nul' : '/dev/null';
  7828. putenv('COMPOSER_CACHE_DIR='.$_SERVER['COMPOSER_CACHE_DIR']);
  7829. }
  7830. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7831. $oldWorkingDir = getcwd();
  7832. chdir($newWorkDir);
  7833. $this->initialWorkingDirectory = $newWorkDir;
  7834. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7835. }
  7836. $commandName = '';
  7837. if ($name = $this->getCommandName($input)) {
  7838. try {
  7839. $commandName = $this->find($name)->getName();
  7840. } catch (CommandNotFoundException $e) {
  7841. $commandName = false;
  7842. } catch (\InvalidArgumentException $e) {
  7843. }
  7844. }
  7845. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project', 'outdated'), true) && !file_exists(Factory::getComposerFile())) {
  7846. $dir = dirname(getcwd());
  7847. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7848. while (dirname($dir) !== $dir && $dir !== $home) {
  7849. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7850. if ($io->askConfirmation('<info>No composer.json in current directory, do you want to use the one at '.$dir.'?</info> [<comment>Y,n</comment>]? ', true)) {
  7851. $oldWorkingDir = getcwd();
  7852. chdir($dir);
  7853. }
  7854. break;
  7855. }
  7856. $dir = dirname($dir);
  7857. }
  7858. }
  7859. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7860. try {
  7861. foreach ($this->getPluginCommands() as $command) {
  7862. if ($this->has($command->getName())) {
  7863. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7864. } else {
  7865. $this->add($command);
  7866. }
  7867. }
  7868. } catch (NoSslException $e) {
  7869. }
  7870. $this->hasPluginCommands = true;
  7871. }
  7872. $isProxyCommand = false;
  7873. if ($name = $this->getCommandName($input)) {
  7874. try {
  7875. $command = $this->find($name);
  7876. $commandName = $command->getName();
  7877. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7878. } catch (\InvalidArgumentException $e) {
  7879. }
  7880. }
  7881. if (!$isProxyCommand) {
  7882. $io->writeError(sprintf(
  7883. 'Running %s (%s) with %s on %s',
  7884. Composer::getVersion(),
  7885. Composer::RELEASE_DATE,
  7886. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7887. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7888. ), true, IOInterface::DEBUG);
  7889. if (PHP_VERSION_ID < 50302) {
  7890. $io->writeError('<warning>Composer only officially supports PHP 5.3.2 and above, you will most likely encounter problems with your PHP '.PHP_VERSION.', upgrading is strongly recommended.</warning>');
  7891. }
  7892. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7893. $io->writeError('<warning>You are running composer with Xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7894. }
  7895. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7896. $io->writeError(sprintf('<warning>Warning: This development build of composer is over 60 days old. It is recommended to update it by running "%s self-update" to get the latest version.</warning>', $_SERVER['PHP_SELF']));
  7897. }
  7898. if (
  7899. !Platform::isWindows()
  7900. && function_exists('exec')
  7901. && !getenv('COMPOSER_ALLOW_SUPERUSER')
  7902. && (ini_get('open_basedir') || !file_exists('/.dockerenv'))
  7903. ) {
  7904. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7905. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7906. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7907. }
  7908. if ($uid = (int) getenv('SUDO_UID')) {
  7909. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7910. }
  7911. }
  7912. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7913. }
  7914. Silencer::call(function () use ($io) {
  7915. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7916. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7917. $io->writeError(sprintf('<error>PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini</error>', sys_get_temp_dir()));
  7918. }
  7919. });
  7920. $file = Factory::getComposerFile();
  7921. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7922. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7923. foreach ($composer['scripts'] as $script => $dummy) {
  7924. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7925. if ($this->has($script)) {
  7926. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7927. } else {
  7928. $description = null;
  7929. if (isset($composer['scripts-descriptions'][$script])) {
  7930. $description = $composer['scripts-descriptions'][$script];
  7931. }
  7932. $this->add(new Command\ScriptAliasCommand($script, $description));
  7933. }
  7934. }
  7935. }
  7936. }
  7937. }
  7938. }
  7939. try {
  7940. if ($input->hasParameterOption('--profile')) {
  7941. $startTime = microtime(true);
  7942. $this->io->enableDebugging($startTime);
  7943. }
  7944. $result = parent::doRun($input, $output);
  7945. if (isset($oldWorkingDir)) {
  7946. chdir($oldWorkingDir);
  7947. }
  7948. if (isset($startTime)) {
  7949. $io->writeError('<info>Memory usage: '.round(memory_get_usage() / 1024 / 1024, 2).'MiB (peak: '.round(memory_get_peak_usage() / 1024 / 1024, 2).'MiB), time: '.round(microtime(true) - $startTime, 2).'s');
  7950. }
  7951. restore_error_handler();
  7952. return $result;
  7953. } catch (ScriptExecutionException $e) {
  7954. return $e->getCode();
  7955. } catch (\Exception $e) {
  7956. $this->hintCommonErrors($e);
  7957. restore_error_handler();
  7958. throw $e;
  7959. }
  7960. }
  7961. private function getNewWorkingDir(InputInterface $input)
  7962. {
  7963. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7964. if (false !== $workingDir && !is_dir($workingDir)) {
  7965. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7966. }
  7967. return $workingDir;
  7968. }
  7969. private function hintCommonErrors($exception)
  7970. {
  7971. $io = $this->getIO();
  7972. Silencer::suppress();
  7973. try {
  7974. $composer = $this->getComposer(false, true);
  7975. if ($composer) {
  7976. $config = $composer->getConfig();
  7977. $minSpaceFree = 1024 * 1024;
  7978. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7979. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7980. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7981. ) {
  7982. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7983. }
  7984. }
  7985. } catch (\Exception $e) {
  7986. }
  7987. Silencer::restore();
  7988. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7989. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7990. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#-the-system-cannot-find-the-path-specified-windows- for details</error>', true, IOInterface::QUIET);
  7991. }
  7992. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7993. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7994. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7995. }
  7996. }
  7997. public function getComposer($required = true, $disablePlugins = null)
  7998. {
  7999. if (null === $disablePlugins) {
  8000. $disablePlugins = $this->disablePluginsByDefault;
  8001. }
  8002. if (null === $this->composer) {
  8003. try {
  8004. $this->composer = Factory::create($this->io, null, $disablePlugins);
  8005. } catch (\InvalidArgumentException $e) {
  8006. if ($required) {
  8007. $this->io->writeError($e->getMessage());
  8008. exit(1);
  8009. }
  8010. } catch (JsonValidationException $e) {
  8011. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  8012. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  8013. throw new JsonValidationException($message);
  8014. }
  8015. }
  8016. return $this->composer;
  8017. }
  8018. public function resetComposer()
  8019. {
  8020. $this->composer = null;
  8021. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  8022. $this->getIO()->resetAuthentications();
  8023. }
  8024. }
  8025. public function getIO()
  8026. {
  8027. return $this->io;
  8028. }
  8029. public function getHelp()
  8030. {
  8031. return self::$logo . parent::getHelp();
  8032. }
  8033. protected function getDefaultCommands()
  8034. {
  8035. $commands = array_merge(parent::getDefaultCommands(), array(
  8036. new Command\AboutCommand(),
  8037. new Command\ConfigCommand(),
  8038. new Command\DependsCommand(),
  8039. new Command\ProhibitsCommand(),
  8040. new Command\InitCommand(),
  8041. new Command\InstallCommand(),
  8042. new Command\CreateProjectCommand(),
  8043. new Command\UpdateCommand(),
  8044. new Command\SearchCommand(),
  8045. new Command\ValidateCommand(),
  8046. new Command\ShowCommand(),
  8047. new Command\SuggestsCommand(),
  8048. new Command\RequireCommand(),
  8049. new Command\DumpAutoloadCommand(),
  8050. new Command\StatusCommand(),
  8051. new Command\ArchiveCommand(),
  8052. new Command\DiagnoseCommand(),
  8053. new Command\RunScriptCommand(),
  8054. new Command\LicensesCommand(),
  8055. new Command\GlobalCommand(),
  8056. new Command\ClearCacheCommand(),
  8057. new Command\RemoveCommand(),
  8058. new Command\HomeCommand(),
  8059. new Command\ExecCommand(),
  8060. new Command\OutdatedCommand(),
  8061. new Command\CheckPlatformReqsCommand(),
  8062. new Command\FundCommand(),
  8063. ));
  8064. if ('phar:' === substr(__FILE__, 0, 5)) {
  8065. $commands[] = new Command\SelfUpdateCommand();
  8066. }
  8067. return $commands;
  8068. }
  8069. public function getLongVersion()
  8070. {
  8071. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  8072. return sprintf(
  8073. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  8074. $this->getName(),
  8075. Composer::BRANCH_ALIAS_VERSION,
  8076. $this->getVersion(),
  8077. Composer::RELEASE_DATE
  8078. );
  8079. }
  8080. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  8081. }
  8082. protected function getDefaultInputDefinition()
  8083. {
  8084. $definition = parent::getDefaultInputDefinition();
  8085. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  8086. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  8087. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  8088. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  8089. return $definition;
  8090. }
  8091. private function getPluginCommands()
  8092. {
  8093. $commands = array();
  8094. $composer = $this->getComposer(false, false);
  8095. if (null === $composer) {
  8096. $composer = Factory::createGlobal($this->io, false);
  8097. }
  8098. if (null !== $composer) {
  8099. $pm = $composer->getPluginManager();
  8100. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  8101. $newCommands = $capability->getCommands();
  8102. if (!is_array($newCommands)) {
  8103. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  8104. }
  8105. foreach ($newCommands as $command) {
  8106. if (!$command instanceof Command\BaseCommand) {
  8107. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  8108. }
  8109. }
  8110. $commands = array_merge($commands, $newCommands);
  8111. }
  8112. }
  8113. return $commands;
  8114. }
  8115. public function getInitialWorkingDirectory()
  8116. {
  8117. return $this->initialWorkingDirectory;
  8118. }
  8119. }
  8120. <?php
  8121. namespace Composer\Console;
  8122. use Symfony\Component\Console\Formatter\OutputFormatter;
  8123. class HtmlOutputFormatter extends OutputFormatter
  8124. {
  8125. private static $availableForegroundColors = array(
  8126. 30 => 'black',
  8127. 31 => 'red',
  8128. 32 => 'green',
  8129. 33 => 'yellow',
  8130. 34 => 'blue',
  8131. 35 => 'magenta',
  8132. 36 => 'cyan',
  8133. 37 => 'white',
  8134. );
  8135. private static $availableBackgroundColors = array(
  8136. 40 => 'black',
  8137. 41 => 'red',
  8138. 42 => 'green',
  8139. 43 => 'yellow',
  8140. 44 => 'blue',
  8141. 45 => 'magenta',
  8142. 46 => 'cyan',
  8143. 47 => 'white',
  8144. );
  8145. private static $availableOptions = array(
  8146. 1 => 'bold',
  8147. 4 => 'underscore',
  8148. );
  8149. public function __construct(array $styles = array())
  8150. {
  8151. parent::__construct(true, $styles);
  8152. }
  8153. public function format($message)
  8154. {
  8155. $formatted = parent::format($message);
  8156. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  8157. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  8158. }
  8159. private function formatHtml($matches)
  8160. {
  8161. $out = '<span style="';
  8162. foreach (explode(';', $matches[1]) as $code) {
  8163. if (isset(self::$availableForegroundColors[$code])) {
  8164. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  8165. } elseif (isset(self::$availableBackgroundColors[$code])) {
  8166. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  8167. } elseif (isset(self::$availableOptions[$code])) {
  8168. switch (self::$availableOptions[$code]) {
  8169. case 'bold':
  8170. $out .= 'font-weight:bold;';
  8171. break;
  8172. case 'underscore':
  8173. $out .= 'text-decoration:underline;';
  8174. break;
  8175. }
  8176. }
  8177. }
  8178. return $out.'">'.$matches[2].'</span>';
  8179. }
  8180. }
  8181. <?php
  8182. namespace Composer\DependencyResolver;
  8183. class Decisions implements \Iterator, \Countable
  8184. {
  8185. const DECISION_LITERAL = 0;
  8186. const DECISION_REASON = 1;
  8187. protected $pool;
  8188. protected $decisionMap;
  8189. protected $decisionQueue = array();
  8190. public function __construct($pool)
  8191. {
  8192. $this->pool = $pool;
  8193. $this->decisionMap = array();
  8194. }
  8195. public function decide($literal, $level, $why)
  8196. {
  8197. $this->addDecision($literal, $level);
  8198. $this->decisionQueue[] = array(
  8199. self::DECISION_LITERAL => $literal,
  8200. self::DECISION_REASON => $why,
  8201. );
  8202. }
  8203. public function satisfy($literal)
  8204. {
  8205. $packageId = abs($literal);
  8206. return (
  8207. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  8208. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  8209. );
  8210. }
  8211. public function conflict($literal)
  8212. {
  8213. $packageId = abs($literal);
  8214. return (
  8215. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  8216. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  8217. );
  8218. }
  8219. public function decided($literalOrPackageId)
  8220. {
  8221. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  8222. }
  8223. public function undecided($literalOrPackageId)
  8224. {
  8225. return empty($this->decisionMap[abs($literalOrPackageId)]);
  8226. }
  8227. public function decidedInstall($literalOrPackageId)
  8228. {
  8229. $packageId = abs($literalOrPackageId);
  8230. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  8231. }
  8232. public function decisionLevel($literalOrPackageId)
  8233. {
  8234. $packageId = abs($literalOrPackageId);
  8235. if (isset($this->decisionMap[$packageId])) {
  8236. return abs($this->decisionMap[$packageId]);
  8237. }
  8238. return 0;
  8239. }
  8240. public function decisionRule($literalOrPackageId)
  8241. {
  8242. $packageId = abs($literalOrPackageId);
  8243. foreach ($this->decisionQueue as $i => $decision) {
  8244. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  8245. return $decision[self::DECISION_REASON];
  8246. }
  8247. }
  8248. return null;
  8249. }
  8250. public function atOffset($queueOffset)
  8251. {
  8252. return $this->decisionQueue[$queueOffset];
  8253. }
  8254. public function validOffset($queueOffset)
  8255. {
  8256. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  8257. }
  8258. public function lastReason()
  8259. {
  8260. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  8261. }
  8262. public function lastLiteral()
  8263. {
  8264. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  8265. }
  8266. public function reset()
  8267. {
  8268. while ($decision = array_pop($this->decisionQueue)) {
  8269. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8270. }
  8271. }
  8272. public function resetToOffset($offset)
  8273. {
  8274. while (count($this->decisionQueue) > $offset + 1) {
  8275. $decision = array_pop($this->decisionQueue);
  8276. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  8277. }
  8278. }
  8279. public function revertLast()
  8280. {
  8281. $this->decisionMap[abs($this->lastLiteral())] = 0;
  8282. array_pop($this->decisionQueue);
  8283. }
  8284. public function count()
  8285. {
  8286. return count($this->decisionQueue);
  8287. }
  8288. public function rewind()
  8289. {
  8290. end($this->decisionQueue);
  8291. }
  8292. public function current()
  8293. {
  8294. return current($this->decisionQueue);
  8295. }
  8296. public function key()
  8297. {
  8298. return key($this->decisionQueue);
  8299. }
  8300. public function next()
  8301. {
  8302. return prev($this->decisionQueue);
  8303. }
  8304. public function valid()
  8305. {
  8306. return false !== current($this->decisionQueue);
  8307. }
  8308. public function isEmpty()
  8309. {
  8310. return count($this->decisionQueue) === 0;
  8311. }
  8312. protected function addDecision($literal, $level)
  8313. {
  8314. $packageId = abs($literal);
  8315. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  8316. if ($previousDecision != 0) {
  8317. $literalString = $this->pool->literalToPrettyString($literal, array());
  8318. $package = $this->pool->literalToPackage($literal);
  8319. throw new SolverBugException(
  8320. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  8321. );
  8322. }
  8323. if ($literal > 0) {
  8324. $this->decisionMap[$packageId] = $level;
  8325. } else {
  8326. $this->decisionMap[$packageId] = -$level;
  8327. }
  8328. }
  8329. public function __toString()
  8330. {
  8331. $decisionMap = $this->decisionMap;
  8332. ksort($decisionMap);
  8333. $str = '[';
  8334. foreach ($decisionMap as $packageId => $level) {
  8335. $str .= $packageId.':'.$level.',';
  8336. }
  8337. $str .= ']';
  8338. return $str;
  8339. }
  8340. }
  8341. <?php
  8342. namespace Composer\DependencyResolver;
  8343. use Composer\Package\PackageInterface;
  8344. use Composer\Package\AliasPackage;
  8345. use Composer\Package\BasePackage;
  8346. use Composer\Semver\Constraint\Constraint;
  8347. class DefaultPolicy implements PolicyInterface
  8348. {
  8349. private $preferStable;
  8350. private $preferLowest;
  8351. public function __construct($preferStable = false, $preferLowest = false)
  8352. {
  8353. $this->preferStable = $preferStable;
  8354. $this->preferLowest = $preferLowest;
  8355. }
  8356. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  8357. {
  8358. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  8359. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  8360. }
  8361. $constraint = new Constraint($operator, $b->getVersion());
  8362. $version = new Constraint('==', $a->getVersion());
  8363. return $constraint->matchSpecific($version, true);
  8364. }
  8365. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  8366. {
  8367. $packages = array();
  8368. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  8369. if ($candidate !== $package) {
  8370. $packages[] = $candidate;
  8371. }
  8372. }
  8373. return $packages;
  8374. }
  8375. public function getPriority(Pool $pool, PackageInterface $package)
  8376. {
  8377. return $pool->getPriority($package->getRepository());
  8378. }
  8379. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  8380. {
  8381. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  8382. foreach ($packages as &$literals) {
  8383. $policy = $this;
  8384. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8385. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  8386. });
  8387. }
  8388. foreach ($packages as &$literals) {
  8389. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  8390. $literals = $this->pruneToBestVersion($pool, $literals);
  8391. $literals = $this->pruneRemoteAliases($pool, $literals);
  8392. }
  8393. $selected = call_user_func_array('array_merge', array_values($packages));
  8394. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  8395. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  8396. });
  8397. return $selected;
  8398. }
  8399. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  8400. {
  8401. $packages = array();
  8402. foreach ($literals as $literal) {
  8403. $packageName = $pool->literalToPackage($literal)->getName();
  8404. if (!isset($packages[$packageName])) {
  8405. $packages[$packageName] = array();
  8406. }
  8407. if (isset($installedMap[abs($literal)])) {
  8408. array_unshift($packages[$packageName], $literal);
  8409. } else {
  8410. $packages[$packageName][] = $literal;
  8411. }
  8412. }
  8413. return $packages;
  8414. }
  8415. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  8416. {
  8417. if ($a->getRepository() === $b->getRepository()) {
  8418. if ($a->getName() === $b->getName()) {
  8419. $aAliased = $a instanceof AliasPackage;
  8420. $bAliased = $b instanceof AliasPackage;
  8421. if ($aAliased && !$bAliased) {
  8422. return -1;
  8423. }
  8424. if (!$aAliased && $bAliased) {
  8425. return 1;
  8426. }
  8427. }
  8428. if (!$ignoreReplace) {
  8429. if ($this->replaces($a, $b)) {
  8430. return 1;
  8431. }
  8432. if ($this->replaces($b, $a)) {
  8433. return -1;
  8434. }
  8435. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  8436. $requiredVendor = substr($requiredPackage, 0, $pos);
  8437. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  8438. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  8439. if ($bIsSameVendor !== $aIsSameVendor) {
  8440. return $aIsSameVendor ? -1 : 1;
  8441. }
  8442. }
  8443. }
  8444. if ($a->id === $b->id) {
  8445. return 0;
  8446. }
  8447. return ($a->id < $b->id) ? -1 : 1;
  8448. }
  8449. if (isset($installedMap[$a->id])) {
  8450. return -1;
  8451. }
  8452. if (isset($installedMap[$b->id])) {
  8453. return 1;
  8454. }
  8455. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  8456. }
  8457. protected function replaces(PackageInterface $source, PackageInterface $target)
  8458. {
  8459. foreach ($source->getReplaces() as $link) {
  8460. if ($link->getTarget() === $target->getName()
  8461. ) {
  8462. return true;
  8463. }
  8464. }
  8465. return false;
  8466. }
  8467. protected function pruneToBestVersion(Pool $pool, $literals)
  8468. {
  8469. $operator = $this->preferLowest ? '<' : '>';
  8470. $bestLiterals = array($literals[0]);
  8471. $bestPackage = $pool->literalToPackage($literals[0]);
  8472. foreach ($literals as $i => $literal) {
  8473. if (0 === $i) {
  8474. continue;
  8475. }
  8476. $package = $pool->literalToPackage($literal);
  8477. if ($this->versionCompare($package, $bestPackage, $operator)) {
  8478. $bestPackage = $package;
  8479. $bestLiterals = array($literal);
  8480. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  8481. $bestLiterals[] = $literal;
  8482. }
  8483. }
  8484. return $bestLiterals;
  8485. }
  8486. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  8487. {
  8488. $selected = array();
  8489. $priority = null;
  8490. foreach ($literals as $literal) {
  8491. $package = $pool->literalToPackage($literal);
  8492. if (isset($installedMap[$package->id])) {
  8493. $selected[] = $literal;
  8494. continue;
  8495. }
  8496. if (null === $priority) {
  8497. $priority = $this->getPriority($pool, $package);
  8498. }
  8499. if ($this->getPriority($pool, $package) != $priority) {
  8500. break;
  8501. }
  8502. $selected[] = $literal;
  8503. }
  8504. return $selected;
  8505. }
  8506. protected function pruneRemoteAliases(Pool $pool, array $literals)
  8507. {
  8508. $hasLocalAlias = false;
  8509. foreach ($literals as $literal) {
  8510. $package = $pool->literalToPackage($literal);
  8511. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8512. $hasLocalAlias = true;
  8513. break;
  8514. }
  8515. }
  8516. if (!$hasLocalAlias) {
  8517. return $literals;
  8518. }
  8519. $selected = array();
  8520. foreach ($literals as $literal) {
  8521. $package = $pool->literalToPackage($literal);
  8522. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  8523. $selected[] = $literal;
  8524. }
  8525. }
  8526. return $selected;
  8527. }
  8528. }
  8529. <?php
  8530. namespace Composer\DependencyResolver;
  8531. use Composer\Package\PackageInterface;
  8532. use Composer\Package\Link;
  8533. class GenericRule extends Rule
  8534. {
  8535. protected $literals;
  8536. public function __construct(array $literals, $reason, $reasonData, $job = null)
  8537. {
  8538. parent::__construct($reason, $reasonData, $job);
  8539. sort($literals);
  8540. $this->literals = $literals;
  8541. }
  8542. public function getLiterals()
  8543. {
  8544. return $this->literals;
  8545. }
  8546. public function getHash()
  8547. {
  8548. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  8549. return $data['hash'];
  8550. }
  8551. public function equals(Rule $rule)
  8552. {
  8553. return $this->literals === $rule->getLiterals();
  8554. }
  8555. public function isAssertion()
  8556. {
  8557. return 1 === count($this->literals);
  8558. }
  8559. public function __toString()
  8560. {
  8561. $result = $this->isDisabled() ? 'disabled(' : '(';
  8562. foreach ($this->literals as $i => $literal) {
  8563. if ($i != 0) {
  8564. $result .= '|';
  8565. }
  8566. $result .= $literal;
  8567. }
  8568. $result .= ')';
  8569. return $result;
  8570. }
  8571. }
  8572. <?php
  8573. namespace Composer\DependencyResolver\Operation;
  8574. use Composer\Package\PackageInterface;
  8575. class InstallOperation extends SolverOperation
  8576. {
  8577. protected $package;
  8578. public function __construct(PackageInterface $package, $reason = null)
  8579. {
  8580. parent::__construct($reason);
  8581. $this->package = $package;
  8582. }
  8583. public function getPackage()
  8584. {
  8585. return $this->package;
  8586. }
  8587. public function getJobType()
  8588. {
  8589. return 'install';
  8590. }
  8591. public function __toString()
  8592. {
  8593. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8594. }
  8595. }
  8596. <?php
  8597. namespace Composer\DependencyResolver\Operation;
  8598. use Composer\Package\AliasPackage;
  8599. use Composer\Package\PackageInterface;
  8600. class MarkAliasInstalledOperation extends SolverOperation
  8601. {
  8602. protected $package;
  8603. public function __construct(AliasPackage $package, $reason = null)
  8604. {
  8605. parent::__construct($reason);
  8606. $this->package = $package;
  8607. }
  8608. public function getPackage()
  8609. {
  8610. return $this->package;
  8611. }
  8612. public function getJobType()
  8613. {
  8614. return 'markAliasInstalled';
  8615. }
  8616. public function __toString()
  8617. {
  8618. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8619. }
  8620. }
  8621. <?php
  8622. namespace Composer\DependencyResolver\Operation;
  8623. use Composer\Package\AliasPackage;
  8624. use Composer\Package\PackageInterface;
  8625. class MarkAliasUninstalledOperation extends SolverOperation
  8626. {
  8627. protected $package;
  8628. public function __construct(AliasPackage $package, $reason = null)
  8629. {
  8630. parent::__construct($reason);
  8631. $this->package = $package;
  8632. }
  8633. public function getPackage()
  8634. {
  8635. return $this->package;
  8636. }
  8637. public function getJobType()
  8638. {
  8639. return 'markAliasUninstalled';
  8640. }
  8641. public function __toString()
  8642. {
  8643. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8644. }
  8645. }
  8646. <?php
  8647. namespace Composer\DependencyResolver\Operation;
  8648. interface OperationInterface
  8649. {
  8650. public function getJobType();
  8651. public function getReason();
  8652. public function __toString();
  8653. }
  8654. <?php
  8655. namespace Composer\DependencyResolver\Operation;
  8656. use Composer\Package\PackageInterface;
  8657. abstract class SolverOperation implements OperationInterface
  8658. {
  8659. protected $reason;
  8660. public function __construct($reason = null)
  8661. {
  8662. $this->reason = $reason;
  8663. }
  8664. public function getReason()
  8665. {
  8666. return $this->reason;
  8667. }
  8668. protected function formatVersion(PackageInterface $package)
  8669. {
  8670. return $package->getFullPrettyVersion();
  8671. }
  8672. }
  8673. <?php
  8674. namespace Composer\DependencyResolver\Operation;
  8675. use Composer\Package\PackageInterface;
  8676. class UninstallOperation extends SolverOperation
  8677. {
  8678. protected $package;
  8679. public function __construct(PackageInterface $package, $reason = null)
  8680. {
  8681. parent::__construct($reason);
  8682. $this->package = $package;
  8683. }
  8684. public function getPackage()
  8685. {
  8686. return $this->package;
  8687. }
  8688. public function getJobType()
  8689. {
  8690. return 'uninstall';
  8691. }
  8692. public function __toString()
  8693. {
  8694. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8695. }
  8696. }
  8697. <?php
  8698. namespace Composer\DependencyResolver\Operation;
  8699. use Composer\Package\PackageInterface;
  8700. use Composer\Package\Version\VersionParser;
  8701. class UpdateOperation extends SolverOperation
  8702. {
  8703. protected $initialPackage;
  8704. protected $targetPackage;
  8705. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8706. {
  8707. parent::__construct($reason);
  8708. $this->initialPackage = $initial;
  8709. $this->targetPackage = $target;
  8710. }
  8711. public function getInitialPackage()
  8712. {
  8713. return $this->initialPackage;
  8714. }
  8715. public function getTargetPackage()
  8716. {
  8717. return $this->targetPackage;
  8718. }
  8719. public function getJobType()
  8720. {
  8721. return 'update';
  8722. }
  8723. public function __toString()
  8724. {
  8725. $actionName = VersionParser::isUpgrade($this->initialPackage->getVersion(), $this->targetPackage->getVersion()) ? 'Updating' : 'Downgrading';
  8726. return $actionName.' '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8727. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8728. }
  8729. }
  8730. <?php
  8731. namespace Composer\DependencyResolver;
  8732. use Composer\Package\PackageInterface;
  8733. interface PolicyInterface
  8734. {
  8735. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8736. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8737. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8738. }
  8739. <?php
  8740. namespace Composer\DependencyResolver;
  8741. use Composer\Package\BasePackage;
  8742. use Composer\Package\AliasPackage;
  8743. use Composer\Package\Version\VersionParser;
  8744. use Composer\Semver\Constraint\ConstraintInterface;
  8745. use Composer\Semver\Constraint\Constraint;
  8746. use Composer\Semver\Constraint\EmptyConstraint;
  8747. use Composer\Repository\RepositoryInterface;
  8748. use Composer\Repository\CompositeRepository;
  8749. use Composer\Repository\ComposerRepository;
  8750. use Composer\Repository\InstalledRepositoryInterface;
  8751. use Composer\Repository\PlatformRepository;
  8752. use Composer\Package\PackageInterface;
  8753. class Pool implements \Countable
  8754. {
  8755. const MATCH_NAME = -1;
  8756. const MATCH_NONE = 0;
  8757. const MATCH = 1;
  8758. const MATCH_PROVIDE = 2;
  8759. const MATCH_REPLACE = 3;
  8760. const MATCH_FILTERED = 4;
  8761. protected $repositories = array();
  8762. protected $providerRepos = array();
  8763. protected $packages = array();
  8764. protected $packageByName = array();
  8765. protected $packageByExactName = array();
  8766. protected $acceptableStabilities;
  8767. protected $stabilityFlags;
  8768. protected $versionParser;
  8769. protected $providerCache = array();
  8770. protected $filterRequires;
  8771. protected $whitelist = null;
  8772. protected $id = 1;
  8773. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8774. {
  8775. $this->versionParser = new VersionParser;
  8776. $this->acceptableStabilities = array();
  8777. foreach (BasePackage::$stabilities as $stability => $value) {
  8778. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8779. $this->acceptableStabilities[$stability] = $value;
  8780. }
  8781. }
  8782. $this->stabilityFlags = $stabilityFlags;
  8783. $this->filterRequires = $filterRequires;
  8784. foreach ($filterRequires as $name => $constraint) {
  8785. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8786. unset($this->filterRequires[$name]);
  8787. }
  8788. }
  8789. }
  8790. public function setAllowList($allowList)
  8791. {
  8792. $this->setWhitelist($allowList);
  8793. }
  8794. public function setWhitelist($whitelist)
  8795. {
  8796. $this->whitelist = $whitelist;
  8797. $this->providerCache = array();
  8798. }
  8799. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8800. {
  8801. if ($repo instanceof CompositeRepository) {
  8802. $repos = $repo->getRepositories();
  8803. } else {
  8804. $repos = array($repo);
  8805. }
  8806. foreach ($repos as $repo) {
  8807. $this->repositories[] = $repo;
  8808. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8809. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8810. $this->providerRepos[] = $repo;
  8811. $repo->setRootAliases($rootAliases);
  8812. $repo->resetPackageIds();
  8813. } else {
  8814. foreach ($repo->getPackages() as $package) {
  8815. $names = $package->getNames();
  8816. $stability = $package->getStability();
  8817. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8818. $package->setId($this->id++);
  8819. $this->packages[] = $package;
  8820. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8821. foreach ($names as $provided) {
  8822. $this->packageByName[$provided][] = $package;
  8823. }
  8824. $name = $package->getName();
  8825. if (isset($rootAliases[$name][$package->getVersion()])) {
  8826. $alias = $rootAliases[$name][$package->getVersion()];
  8827. if ($package instanceof AliasPackage) {
  8828. $package = $package->getAliasOf();
  8829. }
  8830. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8831. $aliasPackage->setRootPackageAlias(true);
  8832. $aliasPackage->setId($this->id++);
  8833. $package->getRepository()->addPackage($aliasPackage);
  8834. $this->packages[] = $aliasPackage;
  8835. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8836. foreach ($aliasPackage->getNames() as $name) {
  8837. $this->packageByName[$name][] = $aliasPackage;
  8838. }
  8839. }
  8840. }
  8841. }
  8842. }
  8843. }
  8844. }
  8845. public function getPriority(RepositoryInterface $repo)
  8846. {
  8847. $priority = array_search($repo, $this->repositories, true);
  8848. if (false === $priority) {
  8849. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8850. }
  8851. return -$priority;
  8852. }
  8853. public function packageById($id)
  8854. {
  8855. return $this->packages[$id - 1];
  8856. }
  8857. public function count()
  8858. {
  8859. return count($this->packages);
  8860. }
  8861. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8862. {
  8863. if ($bypassFilters) {
  8864. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8865. }
  8866. $key = ((int) $mustMatchName).$constraint;
  8867. if (isset($this->providerCache[$name][$key])) {
  8868. return $this->providerCache[$name][$key];
  8869. }
  8870. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8871. }
  8872. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8873. {
  8874. $candidates = array();
  8875. foreach ($this->providerRepos as $repo) {
  8876. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8877. $candidates[] = $candidate;
  8878. if ($candidate->id < 1) {
  8879. $candidate->setId($this->id++);
  8880. $this->packages[$this->id - 2] = $candidate;
  8881. }
  8882. }
  8883. }
  8884. if ($mustMatchName) {
  8885. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8886. return $candidate->getName() == $name;
  8887. });
  8888. if (isset($this->packageByExactName[$name])) {
  8889. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8890. }
  8891. } elseif (isset($this->packageByName[$name])) {
  8892. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8893. }
  8894. $matches = $provideMatches = array();
  8895. $nameMatch = false;
  8896. foreach ($candidates as $candidate) {
  8897. $aliasOfCandidate = null;
  8898. if ($candidate instanceof AliasPackage) {
  8899. $aliasOfCandidate = $candidate->getAliasOf();
  8900. }
  8901. if ($this->whitelist !== null && !$bypassFilters && (
  8902. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8903. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8904. )) {
  8905. continue;
  8906. }
  8907. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8908. case self::MATCH_NONE:
  8909. break;
  8910. case self::MATCH_NAME:
  8911. $nameMatch = true;
  8912. break;
  8913. case self::MATCH:
  8914. $nameMatch = true;
  8915. $matches[] = $candidate;
  8916. break;
  8917. case self::MATCH_PROVIDE:
  8918. $provideMatches[] = $candidate;
  8919. break;
  8920. case self::MATCH_REPLACE:
  8921. $matches[] = $candidate;
  8922. break;
  8923. case self::MATCH_FILTERED:
  8924. break;
  8925. default:
  8926. throw new \UnexpectedValueException('Unexpected match type');
  8927. }
  8928. }
  8929. if ($nameMatch) {
  8930. return $matches;
  8931. }
  8932. return array_merge($matches, $provideMatches);
  8933. }
  8934. public function literalToPackage($literal)
  8935. {
  8936. $packageId = abs($literal);
  8937. return $this->packageById($packageId);
  8938. }
  8939. public function literalToPrettyString($literal, $installedMap)
  8940. {
  8941. $package = $this->literalToPackage($literal);
  8942. if (isset($installedMap[$package->id])) {
  8943. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8944. } else {
  8945. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8946. }
  8947. return $prefix.' '.$package->getPrettyString();
  8948. }
  8949. public function isPackageAcceptable($name, $stability)
  8950. {
  8951. foreach ((array) $name as $n) {
  8952. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8953. return true;
  8954. }
  8955. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8956. return true;
  8957. }
  8958. }
  8959. return false;
  8960. }
  8961. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8962. {
  8963. $candidateName = $candidate->getName();
  8964. $candidateVersion = $candidate->getVersion();
  8965. $isDev = $candidate->getStability() === 'dev';
  8966. $isAlias = $candidate instanceof AliasPackage;
  8967. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8968. $requireFilter = $this->filterRequires[$name];
  8969. } else {
  8970. $requireFilter = new EmptyConstraint;
  8971. }
  8972. if ($candidateName === $name) {
  8973. $pkgConstraint = new Constraint('==', $candidateVersion);
  8974. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8975. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8976. }
  8977. return self::MATCH_NAME;
  8978. }
  8979. $provides = $candidate->getProvides();
  8980. $replaces = $candidate->getReplaces();
  8981. if (isset($replaces[0]) || isset($provides[0])) {
  8982. foreach ($provides as $link) {
  8983. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8984. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8985. }
  8986. }
  8987. foreach ($replaces as $link) {
  8988. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8989. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8990. }
  8991. }
  8992. return self::MATCH_NONE;
  8993. }
  8994. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8995. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8996. }
  8997. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8998. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8999. }
  9000. return self::MATCH_NONE;
  9001. }
  9002. }
  9003. <?php
  9004. namespace Composer\DependencyResolver;
  9005. use Composer\Package\CompletePackageInterface;
  9006. class Problem
  9007. {
  9008. protected $reasonSeen;
  9009. protected $reasons = array();
  9010. protected $section = 0;
  9011. protected $pool;
  9012. public function __construct(Pool $pool)
  9013. {
  9014. $this->pool = $pool;
  9015. }
  9016. public function addRule(Rule $rule)
  9017. {
  9018. $this->addReason(spl_object_hash($rule), array(
  9019. 'rule' => $rule,
  9020. 'job' => $rule->getJob(),
  9021. ));
  9022. }
  9023. public function getReasons()
  9024. {
  9025. return $this->reasons;
  9026. }
  9027. public function getPrettyString(array $installedMap = array())
  9028. {
  9029. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  9030. if (count($reasons) === 1) {
  9031. reset($reasons);
  9032. $reason = current($reasons);
  9033. $job = $reason['job'];
  9034. $packageName = $job['packageName'];
  9035. $constraint = $job['constraint'];
  9036. if (isset($constraint)) {
  9037. $packages = $this->pool->whatProvides($packageName, $constraint);
  9038. } else {
  9039. $packages = array();
  9040. }
  9041. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  9042. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  9043. $version = phpversion();
  9044. $available = $this->pool->whatProvides($packageName);
  9045. if (count($available)) {
  9046. $firstAvailable = reset($available);
  9047. $version = $firstAvailable->getPrettyVersion();
  9048. $extra = $firstAvailable->getExtra();
  9049. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  9050. $version .= '; ' . $firstAvailable->getDescription();
  9051. }
  9052. }
  9053. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  9054. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  9055. return $msg . 'your HHVM version does not satisfy that requirement.';
  9056. }
  9057. if ($packageName === 'hhvm') {
  9058. return $msg . 'you are running this with PHP and not HHVM.';
  9059. }
  9060. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  9061. }
  9062. if (0 === stripos($packageName, 'ext-')) {
  9063. if (false !== strpos($packageName, ' ')) {
  9064. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  9065. }
  9066. $ext = substr($packageName, 4);
  9067. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9068. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  9069. }
  9070. if (0 === stripos($packageName, 'lib-')) {
  9071. if (strtolower($packageName) === 'lib-icu') {
  9072. $error = extension_loaded('intl') ? 'has the wrong version installed, try upgrading the intl extension.' : 'is missing from your system, make sure the intl extension is loaded.';
  9073. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  9074. }
  9075. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' has the wrong version installed or is missing from your system, make sure to load the extension providing it.';
  9076. }
  9077. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  9078. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  9079. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  9080. }
  9081. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  9082. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  9083. }
  9084. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  9085. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  9086. }
  9087. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  9088. }
  9089. }
  9090. $messages = array();
  9091. foreach ($reasons as $reason) {
  9092. $rule = $reason['rule'];
  9093. $job = $reason['job'];
  9094. if ($job) {
  9095. $messages[] = $this->jobToText($job);
  9096. } elseif ($rule) {
  9097. if ($rule instanceof Rule) {
  9098. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  9099. }
  9100. }
  9101. }
  9102. return "\n - ".implode("\n - ", $messages);
  9103. }
  9104. protected function addReason($id, $reason)
  9105. {
  9106. if (!isset($this->reasonSeen[$id])) {
  9107. $this->reasonSeen[$id] = true;
  9108. $this->reasons[$this->section][] = $reason;
  9109. }
  9110. }
  9111. public function nextSection()
  9112. {
  9113. $this->section++;
  9114. }
  9115. protected function jobToText($job)
  9116. {
  9117. $packageName = $job['packageName'];
  9118. $constraint = $job['constraint'];
  9119. switch ($job['cmd']) {
  9120. case 'install':
  9121. $packages = $this->pool->whatProvides($packageName, $constraint);
  9122. if (!$packages) {
  9123. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  9124. }
  9125. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  9126. case 'update':
  9127. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  9128. case 'remove':
  9129. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  9130. }
  9131. if (isset($constraint)) {
  9132. $packages = $this->pool->whatProvides($packageName, $constraint);
  9133. } else {
  9134. $packages = array();
  9135. }
  9136. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  9137. }
  9138. protected function getPackageList($packages)
  9139. {
  9140. $prepared = array();
  9141. foreach ($packages as $package) {
  9142. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9143. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9144. }
  9145. foreach ($prepared as $name => $package) {
  9146. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9147. }
  9148. return implode(', ', $prepared);
  9149. }
  9150. protected function constraintToText($constraint)
  9151. {
  9152. return $constraint ? ' '.$constraint->getPrettyString() : '';
  9153. }
  9154. }
  9155. <?php
  9156. namespace Composer\DependencyResolver;
  9157. use Composer\Semver\Constraint\ConstraintInterface;
  9158. class Request
  9159. {
  9160. protected $jobs;
  9161. public function __construct()
  9162. {
  9163. $this->jobs = array();
  9164. }
  9165. public function install($packageName, ConstraintInterface $constraint = null)
  9166. {
  9167. $this->addJob($packageName, 'install', $constraint);
  9168. }
  9169. public function update($packageName, ConstraintInterface $constraint = null)
  9170. {
  9171. $this->addJob($packageName, 'update', $constraint);
  9172. }
  9173. public function remove($packageName, ConstraintInterface $constraint = null)
  9174. {
  9175. $this->addJob($packageName, 'remove', $constraint);
  9176. }
  9177. public function fix($packageName, ConstraintInterface $constraint = null)
  9178. {
  9179. $this->addJob($packageName, 'install', $constraint, true);
  9180. }
  9181. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  9182. {
  9183. $packageName = strtolower($packageName);
  9184. $this->jobs[] = array(
  9185. 'cmd' => $cmd,
  9186. 'packageName' => $packageName,
  9187. 'constraint' => $constraint,
  9188. 'fixed' => $fixed,
  9189. );
  9190. }
  9191. public function updateAll()
  9192. {
  9193. $this->jobs[] = array('cmd' => 'update-all');
  9194. }
  9195. public function getJobs()
  9196. {
  9197. return $this->jobs;
  9198. }
  9199. }
  9200. <?php
  9201. namespace Composer\DependencyResolver;
  9202. use Composer\Package\CompletePackage;
  9203. use Composer\Package\Link;
  9204. use Composer\Package\PackageInterface;
  9205. abstract class Rule
  9206. {
  9207. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  9208. const RULE_JOB_INSTALL = 2;
  9209. const RULE_JOB_REMOVE = 3;
  9210. const RULE_PACKAGE_CONFLICT = 6;
  9211. const RULE_PACKAGE_REQUIRES = 7;
  9212. const RULE_PACKAGE_OBSOLETES = 8;
  9213. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  9214. const RULE_PACKAGE_SAME_NAME = 10;
  9215. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  9216. const RULE_LEARNED = 12;
  9217. const RULE_PACKAGE_ALIAS = 13;
  9218. const BITFIELD_TYPE = 0;
  9219. const BITFIELD_REASON = 8;
  9220. const BITFIELD_DISABLED = 16;
  9221. protected $bitfield;
  9222. protected $job;
  9223. protected $reasonData;
  9224. public function __construct($reason, $reasonData, $job = null)
  9225. {
  9226. $this->reasonData = $reasonData;
  9227. if ($job) {
  9228. $this->job = $job;
  9229. }
  9230. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  9231. ($reason << self::BITFIELD_REASON) |
  9232. (255 << self::BITFIELD_TYPE);
  9233. }
  9234. abstract public function getLiterals();
  9235. abstract public function getHash();
  9236. public function getJob()
  9237. {
  9238. return $this->job;
  9239. }
  9240. abstract public function equals(Rule $rule);
  9241. public function getReason()
  9242. {
  9243. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  9244. }
  9245. public function getReasonData()
  9246. {
  9247. return $this->reasonData;
  9248. }
  9249. public function getRequiredPackage()
  9250. {
  9251. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  9252. return $this->reasonData;
  9253. }
  9254. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  9255. return $this->reasonData->getTarget();
  9256. }
  9257. }
  9258. public function setType($type)
  9259. {
  9260. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  9261. }
  9262. public function getType()
  9263. {
  9264. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  9265. }
  9266. public function disable()
  9267. {
  9268. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  9269. }
  9270. public function enable()
  9271. {
  9272. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  9273. }
  9274. public function isDisabled()
  9275. {
  9276. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9277. }
  9278. public function isEnabled()
  9279. {
  9280. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  9281. }
  9282. abstract public function isAssertion();
  9283. public function getPrettyString(Pool $pool, array $installedMap = array())
  9284. {
  9285. $literals = $this->getLiterals();
  9286. $ruleText = '';
  9287. foreach ($literals as $i => $literal) {
  9288. if ($i != 0) {
  9289. $ruleText .= '|';
  9290. }
  9291. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  9292. }
  9293. switch ($this->getReason()) {
  9294. case self::RULE_INTERNAL_ALLOW_UPDATE:
  9295. return $ruleText;
  9296. case self::RULE_JOB_INSTALL:
  9297. return "Install command rule ($ruleText)";
  9298. case self::RULE_JOB_REMOVE:
  9299. return "Remove command rule ($ruleText)";
  9300. case self::RULE_PACKAGE_CONFLICT:
  9301. $package1 = $pool->literalToPackage($literals[0]);
  9302. $package2 = $pool->literalToPackage($literals[1]);
  9303. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  9304. case self::RULE_PACKAGE_REQUIRES:
  9305. $sourceLiteral = array_shift($literals);
  9306. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  9307. $requires = array();
  9308. foreach ($literals as $literal) {
  9309. $requires[] = $pool->literalToPackage($literal);
  9310. }
  9311. $text = $this->reasonData->getPrettyString($sourcePackage);
  9312. if ($requires) {
  9313. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  9314. } else {
  9315. $targetName = $this->reasonData->getTarget();
  9316. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  9317. if (defined('HHVM_VERSION')) {
  9318. return $text . ' -> your HHVM version does not satisfy that requirement.';
  9319. }
  9320. $packages = $pool->whatProvides($targetName);
  9321. $package = count($packages) ? current($packages) : phpversion();
  9322. if ($targetName === 'hhvm') {
  9323. if ($package instanceof CompletePackage) {
  9324. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9325. } else {
  9326. return $text . ' -> you are running this with PHP and not HHVM.';
  9327. }
  9328. }
  9329. if (!($package instanceof CompletePackage)) {
  9330. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  9331. }
  9332. $extra = $package->getExtra();
  9333. if (!empty($extra['config.platform'])) {
  9334. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9335. } else {
  9336. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  9337. }
  9338. return $text;
  9339. }
  9340. if (0 === strpos($targetName, 'ext-')) {
  9341. $ext = substr($targetName, 4);
  9342. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  9343. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  9344. }
  9345. if (0 === strpos($targetName, 'lib-')) {
  9346. $lib = substr($targetName, 4);
  9347. return $text . ' -> the requested linked library '.$lib.' has the wrong version installed or is missing from your system, make sure to have the extension providing it.';
  9348. }
  9349. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  9350. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  9351. }
  9352. return $text . ' -> no matching package found.';
  9353. }
  9354. return $text;
  9355. case self::RULE_PACKAGE_OBSOLETES:
  9356. return $ruleText;
  9357. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  9358. return $ruleText;
  9359. case self::RULE_PACKAGE_SAME_NAME:
  9360. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  9361. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  9362. return $ruleText;
  9363. case self::RULE_LEARNED:
  9364. return 'Conclusion: '.$ruleText;
  9365. case self::RULE_PACKAGE_ALIAS:
  9366. return $ruleText;
  9367. default:
  9368. return '('.$ruleText.')';
  9369. }
  9370. }
  9371. protected function formatPackagesUnique($pool, array $packages)
  9372. {
  9373. $prepared = array();
  9374. foreach ($packages as $package) {
  9375. if (!is_object($package)) {
  9376. $package = $pool->literalToPackage($package);
  9377. }
  9378. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  9379. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  9380. }
  9381. foreach ($prepared as $name => $package) {
  9382. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  9383. }
  9384. return implode(', ', $prepared);
  9385. }
  9386. }
  9387. <?php
  9388. namespace Composer\DependencyResolver;
  9389. use Composer\Package\PackageInterface;
  9390. use Composer\Package\Link;
  9391. class Rule2Literals extends Rule
  9392. {
  9393. protected $literal1;
  9394. protected $literal2;
  9395. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  9396. {
  9397. parent::__construct($reason, $reasonData, $job);
  9398. if ($literal1 < $literal2) {
  9399. $this->literal1 = $literal1;
  9400. $this->literal2 = $literal2;
  9401. } else {
  9402. $this->literal1 = $literal2;
  9403. $this->literal2 = $literal1;
  9404. }
  9405. }
  9406. public function getLiterals()
  9407. {
  9408. return array($this->literal1, $this->literal2);
  9409. }
  9410. public function getHash()
  9411. {
  9412. return $this->literal1.','.$this->literal2;
  9413. }
  9414. public function equals(Rule $rule)
  9415. {
  9416. if ($rule instanceof self) {
  9417. if ($this->literal1 !== $rule->literal1) {
  9418. return false;
  9419. }
  9420. if ($this->literal2 !== $rule->literal2) {
  9421. return false;
  9422. }
  9423. return true;
  9424. }
  9425. $literals = $rule->getLiterals();
  9426. if (2 != count($literals)) {
  9427. return false;
  9428. }
  9429. if ($this->literal1 !== $literals[0]) {
  9430. return false;
  9431. }
  9432. if ($this->literal2 !== $literals[1]) {
  9433. return false;
  9434. }
  9435. return true;
  9436. }
  9437. public function isAssertion()
  9438. {
  9439. return false;
  9440. }
  9441. public function __toString()
  9442. {
  9443. $result = $this->isDisabled() ? 'disabled(' : '(';
  9444. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  9445. return $result;
  9446. }
  9447. }
  9448. <?php
  9449. namespace Composer\DependencyResolver;
  9450. class RuleSet implements \IteratorAggregate, \Countable
  9451. {
  9452. const TYPE_PACKAGE = 0;
  9453. const TYPE_JOB = 1;
  9454. const TYPE_LEARNED = 4;
  9455. public $ruleById;
  9456. protected static $types = array(
  9457. 255 => 'UNKNOWN',
  9458. self::TYPE_PACKAGE => 'PACKAGE',
  9459. self::TYPE_JOB => 'JOB',
  9460. self::TYPE_LEARNED => 'LEARNED',
  9461. );
  9462. protected $rules;
  9463. protected $nextRuleId;
  9464. protected $rulesByHash;
  9465. public function __construct()
  9466. {
  9467. $this->nextRuleId = 0;
  9468. foreach ($this->getTypes() as $type) {
  9469. $this->rules[$type] = array();
  9470. }
  9471. $this->rulesByHash = array();
  9472. }
  9473. public function add(Rule $rule, $type)
  9474. {
  9475. if (!isset(self::$types[$type])) {
  9476. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  9477. }
  9478. $hash = $rule->getHash();
  9479. if (isset($this->rulesByHash[$hash])) {
  9480. $potentialDuplicates = $this->rulesByHash[$hash];
  9481. if (is_array($potentialDuplicates)) {
  9482. foreach ($potentialDuplicates as $potentialDuplicate) {
  9483. if ($rule->equals($potentialDuplicate)) {
  9484. return;
  9485. }
  9486. }
  9487. } else {
  9488. if ($rule->equals($potentialDuplicates)) {
  9489. return;
  9490. }
  9491. }
  9492. }
  9493. if (!isset($this->rules[$type])) {
  9494. $this->rules[$type] = array();
  9495. }
  9496. $this->rules[$type][] = $rule;
  9497. $this->ruleById[$this->nextRuleId] = $rule;
  9498. $rule->setType($type);
  9499. $this->nextRuleId++;
  9500. if (!isset($this->rulesByHash[$hash])) {
  9501. $this->rulesByHash[$hash] = $rule;
  9502. } elseif (is_array($this->rulesByHash[$hash])) {
  9503. $this->rulesByHash[$hash][] = $rule;
  9504. } else {
  9505. $originalRule = $this->rulesByHash[$hash];
  9506. $this->rulesByHash[$hash] = array($originalRule, $rule);
  9507. }
  9508. }
  9509. public function count()
  9510. {
  9511. return $this->nextRuleId;
  9512. }
  9513. public function ruleById($id)
  9514. {
  9515. return $this->ruleById[$id];
  9516. }
  9517. public function getRules()
  9518. {
  9519. return $this->rules;
  9520. }
  9521. public function getIterator()
  9522. {
  9523. return new RuleSetIterator($this->getRules());
  9524. }
  9525. public function getIteratorFor($types)
  9526. {
  9527. if (!is_array($types)) {
  9528. $types = array($types);
  9529. }
  9530. $allRules = $this->getRules();
  9531. $rules = array();
  9532. foreach ($types as $type) {
  9533. $rules[$type] = $allRules[$type];
  9534. }
  9535. return new RuleSetIterator($rules);
  9536. }
  9537. public function getIteratorWithout($types)
  9538. {
  9539. if (!is_array($types)) {
  9540. $types = array($types);
  9541. }
  9542. $rules = $this->getRules();
  9543. foreach ($types as $type) {
  9544. unset($rules[$type]);
  9545. }
  9546. return new RuleSetIterator($rules);
  9547. }
  9548. public function getTypes()
  9549. {
  9550. $types = self::$types;
  9551. unset($types[255]);
  9552. return array_keys($types);
  9553. }
  9554. public function getPrettyString(Pool $pool = null)
  9555. {
  9556. $string = "\n";
  9557. foreach ($this->rules as $type => $rules) {
  9558. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  9559. foreach ($rules as $rule) {
  9560. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  9561. }
  9562. $string .= "\n\n";
  9563. }
  9564. return $string;
  9565. }
  9566. public function __toString()
  9567. {
  9568. return $this->getPrettyString(null);
  9569. }
  9570. }
  9571. <?php
  9572. namespace Composer\DependencyResolver;
  9573. use Composer\Package\PackageInterface;
  9574. use Composer\Package\AliasPackage;
  9575. use Composer\Repository\PlatformRepository;
  9576. class RuleSetGenerator
  9577. {
  9578. protected $policy;
  9579. protected $pool;
  9580. protected $rules;
  9581. protected $jobs;
  9582. protected $installedMap;
  9583. protected $allowListedMap;
  9584. protected $addedMap;
  9585. protected $conflictAddedMap;
  9586. protected $addedPackages;
  9587. protected $addedPackagesByNames;
  9588. public function __construct(PolicyInterface $policy, Pool $pool)
  9589. {
  9590. $this->policy = $policy;
  9591. $this->pool = $pool;
  9592. }
  9593. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9594. {
  9595. $literals = array(-$package->id);
  9596. foreach ($providers as $provider) {
  9597. if ($provider === $package) {
  9598. return null;
  9599. }
  9600. $literals[] = $provider->id;
  9601. }
  9602. return new GenericRule($literals, $reason, $reasonData);
  9603. }
  9604. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9605. {
  9606. $literals = array();
  9607. foreach ($packages as $package) {
  9608. $literals[] = $package->id;
  9609. }
  9610. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9611. }
  9612. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9613. {
  9614. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9615. }
  9616. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9617. {
  9618. if ($issuer === $provider) {
  9619. return null;
  9620. }
  9621. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9622. }
  9623. private function addRule($type, Rule $newRule = null)
  9624. {
  9625. if (!$newRule) {
  9626. return;
  9627. }
  9628. $this->rules->add($newRule, $type);
  9629. }
  9630. protected function allowListFromPackage(PackageInterface $package)
  9631. {
  9632. $this->whitelistFromPackage($package);
  9633. }
  9634. protected function whitelistFromPackage(PackageInterface $package)
  9635. {
  9636. $workQueue = new \SplQueue;
  9637. $workQueue->enqueue($package);
  9638. while (!$workQueue->isEmpty()) {
  9639. $package = $workQueue->dequeue();
  9640. if (isset($this->allowListedMap[$package->id])) {
  9641. continue;
  9642. }
  9643. $this->allowListedMap[$package->id] = true;
  9644. foreach ($package->getRequires() as $link) {
  9645. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9646. foreach ($possibleRequires as $require) {
  9647. $workQueue->enqueue($require);
  9648. }
  9649. }
  9650. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9651. foreach ($obsoleteProviders as $provider) {
  9652. if ($provider === $package) {
  9653. continue;
  9654. }
  9655. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9656. $workQueue->enqueue($provider);
  9657. }
  9658. }
  9659. }
  9660. }
  9661. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9662. {
  9663. $workQueue = new \SplQueue;
  9664. $workQueue->enqueue($package);
  9665. while (!$workQueue->isEmpty()) {
  9666. $package = $workQueue->dequeue();
  9667. if (isset($this->addedMap[$package->id])) {
  9668. continue;
  9669. }
  9670. $this->addedMap[$package->id] = true;
  9671. $this->addedPackages[] = $package;
  9672. foreach ($package->getNames() as $name) {
  9673. $this->addedPackagesByNames[$name][] = $package;
  9674. }
  9675. foreach ($package->getRequires() as $link) {
  9676. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9677. continue;
  9678. }
  9679. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9680. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9681. foreach ($possibleRequires as $require) {
  9682. $workQueue->enqueue($require);
  9683. }
  9684. }
  9685. $packageName = $package->getName();
  9686. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9687. foreach ($obsoleteProviders as $provider) {
  9688. if ($provider === $package) {
  9689. continue;
  9690. }
  9691. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9692. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9693. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9694. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9695. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9696. }
  9697. }
  9698. }
  9699. }
  9700. protected function addConflictRules($ignorePlatformReqs = false)
  9701. {
  9702. foreach ($this->addedPackages as $package) {
  9703. foreach ($package->getConflicts() as $link) {
  9704. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9705. continue;
  9706. }
  9707. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9708. continue;
  9709. }
  9710. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9711. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9712. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9713. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9714. }
  9715. }
  9716. }
  9717. $isInstalled = isset($this->installedMap[$package->id]);
  9718. foreach ($package->getReplaces() as $link) {
  9719. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9720. continue;
  9721. }
  9722. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9723. if ($provider === $package) {
  9724. continue;
  9725. }
  9726. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9727. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9728. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9729. }
  9730. }
  9731. }
  9732. }
  9733. }
  9734. protected function obsoleteImpossibleForAlias($package, $provider)
  9735. {
  9736. $packageIsAlias = $package instanceof AliasPackage;
  9737. $providerIsAlias = $provider instanceof AliasPackage;
  9738. $impossible = (
  9739. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9740. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9741. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9742. );
  9743. return $impossible;
  9744. }
  9745. protected function allowListFromJobs()
  9746. {
  9747. $this->whitelistFromJobs();
  9748. }
  9749. protected function whitelistFromJobs()
  9750. {
  9751. foreach ($this->jobs as $job) {
  9752. switch ($job['cmd']) {
  9753. case 'install':
  9754. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9755. foreach ($packages as $package) {
  9756. $this->allowListFromPackage($package);
  9757. }
  9758. break;
  9759. }
  9760. }
  9761. }
  9762. protected function addRulesForJobs($ignorePlatformReqs)
  9763. {
  9764. foreach ($this->jobs as $job) {
  9765. switch ($job['cmd']) {
  9766. case 'install':
  9767. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9768. break;
  9769. }
  9770. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9771. if ($packages) {
  9772. foreach ($packages as $package) {
  9773. if (!isset($this->installedMap[$package->id])) {
  9774. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9775. }
  9776. }
  9777. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9778. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9779. }
  9780. break;
  9781. case 'remove':
  9782. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9783. foreach ($packages as $package) {
  9784. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9785. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9786. }
  9787. break;
  9788. }
  9789. }
  9790. }
  9791. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9792. {
  9793. $this->jobs = $jobs;
  9794. $this->rules = new RuleSet;
  9795. $this->installedMap = $installedMap;
  9796. $this->allowListedMap = array();
  9797. foreach ($this->installedMap as $package) {
  9798. $this->allowListFromPackage($package);
  9799. }
  9800. $this->allowListFromJobs();
  9801. $this->pool->setAllowList($this->allowListedMap);
  9802. $this->addedMap = array();
  9803. $this->conflictAddedMap = array();
  9804. $this->addedPackages = array();
  9805. $this->addedPackagesByNames = array();
  9806. foreach ($this->installedMap as $package) {
  9807. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9808. }
  9809. $this->addRulesForJobs($ignorePlatformReqs);
  9810. $this->addConflictRules($ignorePlatformReqs);
  9811. $this->addedPackages = $this->addedPackagesByNames = null;
  9812. return $this->rules;
  9813. }
  9814. }
  9815. <?php
  9816. namespace Composer\DependencyResolver;
  9817. class RuleSetIterator implements \Iterator
  9818. {
  9819. protected $rules;
  9820. protected $types;
  9821. protected $currentOffset;
  9822. protected $currentType;
  9823. protected $currentTypeOffset;
  9824. public function __construct(array $rules)
  9825. {
  9826. $this->rules = $rules;
  9827. $this->types = array_keys($rules);
  9828. sort($this->types);
  9829. $this->rewind();
  9830. }
  9831. public function current()
  9832. {
  9833. return $this->rules[$this->currentType][$this->currentOffset];
  9834. }
  9835. public function key()
  9836. {
  9837. return $this->currentType;
  9838. }
  9839. public function next()
  9840. {
  9841. $this->currentOffset++;
  9842. if (!isset($this->rules[$this->currentType])) {
  9843. return;
  9844. }
  9845. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9846. $this->currentOffset = 0;
  9847. do {
  9848. $this->currentTypeOffset++;
  9849. if (!isset($this->types[$this->currentTypeOffset])) {
  9850. $this->currentType = -1;
  9851. break;
  9852. }
  9853. $this->currentType = $this->types[$this->currentTypeOffset];
  9854. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9855. }
  9856. }
  9857. public function rewind()
  9858. {
  9859. $this->currentOffset = 0;
  9860. $this->currentTypeOffset = -1;
  9861. $this->currentType = -1;
  9862. do {
  9863. $this->currentTypeOffset++;
  9864. if (!isset($this->types[$this->currentTypeOffset])) {
  9865. $this->currentType = -1;
  9866. break;
  9867. }
  9868. $this->currentType = $this->types[$this->currentTypeOffset];
  9869. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9870. }
  9871. public function valid()
  9872. {
  9873. return isset($this->rules[$this->currentType])
  9874. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9875. }
  9876. }
  9877. <?php
  9878. namespace Composer\DependencyResolver;
  9879. class RuleWatchChain extends \SplDoublyLinkedList
  9880. {
  9881. protected $offset = 0;
  9882. public function seek($offset)
  9883. {
  9884. $this->rewind();
  9885. for ($i = 0; $i < $offset; $i++, $this->next());
  9886. }
  9887. public function remove()
  9888. {
  9889. $offset = $this->key();
  9890. $this->offsetUnset($offset);
  9891. $this->seek($offset);
  9892. }
  9893. }
  9894. <?php
  9895. namespace Composer\DependencyResolver;
  9896. class RuleWatchGraph
  9897. {
  9898. protected $watchChains = array();
  9899. public function insert(RuleWatchNode $node)
  9900. {
  9901. if ($node->getRule()->isAssertion()) {
  9902. return;
  9903. }
  9904. foreach (array($node->watch1, $node->watch2) as $literal) {
  9905. if (!isset($this->watchChains[$literal])) {
  9906. $this->watchChains[$literal] = new RuleWatchChain;
  9907. }
  9908. $this->watchChains[$literal]->unshift($node);
  9909. }
  9910. }
  9911. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9912. {
  9913. $literal = -$decidedLiteral;
  9914. if (!isset($this->watchChains[$literal])) {
  9915. return null;
  9916. }
  9917. $chain = $this->watchChains[$literal];
  9918. $chain->rewind();
  9919. while ($chain->valid()) {
  9920. $node = $chain->current();
  9921. $otherWatch = $node->getOtherWatch($literal);
  9922. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9923. $ruleLiterals = $node->getRule()->getLiterals();
  9924. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9925. return $literal !== $ruleLiteral &&
  9926. $otherWatch !== $ruleLiteral &&
  9927. !$decisions->conflict($ruleLiteral);
  9928. });
  9929. if ($alternativeLiterals) {
  9930. reset($alternativeLiterals);
  9931. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9932. continue;
  9933. }
  9934. if ($decisions->conflict($otherWatch)) {
  9935. return $node->getRule();
  9936. }
  9937. $decisions->decide($otherWatch, $level, $node->getRule());
  9938. }
  9939. $chain->next();
  9940. }
  9941. return null;
  9942. }
  9943. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9944. {
  9945. if (!isset($this->watchChains[$toLiteral])) {
  9946. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9947. }
  9948. $node->moveWatch($fromLiteral, $toLiteral);
  9949. $this->watchChains[$fromLiteral]->remove();
  9950. $this->watchChains[$toLiteral]->unshift($node);
  9951. }
  9952. }
  9953. <?php
  9954. namespace Composer\DependencyResolver;
  9955. class RuleWatchNode
  9956. {
  9957. public $watch1;
  9958. public $watch2;
  9959. protected $rule;
  9960. public function __construct($rule)
  9961. {
  9962. $this->rule = $rule;
  9963. $literals = $rule->getLiterals();
  9964. $literalCount = count($literals);
  9965. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9966. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9967. }
  9968. public function watch2OnHighest(Decisions $decisions)
  9969. {
  9970. $literals = $this->rule->getLiterals();
  9971. if (count($literals) < 3) {
  9972. return;
  9973. }
  9974. $watchLevel = 0;
  9975. foreach ($literals as $literal) {
  9976. $level = $decisions->decisionLevel($literal);
  9977. if ($level > $watchLevel) {
  9978. $this->watch2 = $literal;
  9979. $watchLevel = $level;
  9980. }
  9981. }
  9982. }
  9983. public function getRule()
  9984. {
  9985. return $this->rule;
  9986. }
  9987. public function getOtherWatch($literal)
  9988. {
  9989. if ($this->watch1 == $literal) {
  9990. return $this->watch2;
  9991. }
  9992. return $this->watch1;
  9993. }
  9994. public function moveWatch($from, $to)
  9995. {
  9996. if ($this->watch1 == $from) {
  9997. $this->watch1 = $to;
  9998. } else {
  9999. $this->watch2 = $to;
  10000. }
  10001. }
  10002. }
  10003. <?php
  10004. namespace Composer\DependencyResolver;
  10005. use Composer\IO\IOInterface;
  10006. use Composer\Repository\RepositoryInterface;
  10007. use Composer\Repository\PlatformRepository;
  10008. class Solver
  10009. {
  10010. const BRANCH_LITERALS = 0;
  10011. const BRANCH_LEVEL = 1;
  10012. protected $policy;
  10013. protected $pool;
  10014. protected $installed;
  10015. protected $rules;
  10016. protected $ruleSetGenerator;
  10017. protected $jobs;
  10018. protected $updateMap = array();
  10019. protected $watchGraph;
  10020. protected $decisions;
  10021. protected $installedMap;
  10022. protected $propagateIndex;
  10023. protected $branches = array();
  10024. protected $problems = array();
  10025. protected $learnedPool = array();
  10026. protected $learnedWhy = array();
  10027. public $testFlagLearnedPositiveLiteral = false;
  10028. protected $io;
  10029. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  10030. {
  10031. $this->io = $io;
  10032. $this->policy = $policy;
  10033. $this->pool = $pool;
  10034. $this->installed = $installed;
  10035. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  10036. }
  10037. public function getRuleSetSize()
  10038. {
  10039. return count($this->rules);
  10040. }
  10041. private function makeAssertionRuleDecisions()
  10042. {
  10043. $decisionStart = count($this->decisions) - 1;
  10044. $rulesCount = count($this->rules);
  10045. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  10046. $rule = $this->rules->ruleById[$ruleIndex];
  10047. if (!$rule->isAssertion() || $rule->isDisabled()) {
  10048. continue;
  10049. }
  10050. $literals = $rule->getLiterals();
  10051. $literal = $literals[0];
  10052. if (!$this->decisions->decided($literal)) {
  10053. $this->decisions->decide($literal, 1, $rule);
  10054. continue;
  10055. }
  10056. if ($this->decisions->satisfy($literal)) {
  10057. continue;
  10058. }
  10059. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  10060. $rule->disable();
  10061. continue;
  10062. }
  10063. $conflict = $this->decisions->decisionRule($literal);
  10064. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  10065. $problem = new Problem($this->pool);
  10066. $problem->addRule($rule);
  10067. $problem->addRule($conflict);
  10068. $this->disableProblem($rule);
  10069. $this->problems[] = $problem;
  10070. continue;
  10071. }
  10072. $problem = new Problem($this->pool);
  10073. $problem->addRule($rule);
  10074. $problem->addRule($conflict);
  10075. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  10076. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  10077. continue;
  10078. }
  10079. $assertRuleLiterals = $assertRule->getLiterals();
  10080. $assertRuleLiteral = $assertRuleLiterals[0];
  10081. if (abs($literal) !== abs($assertRuleLiteral)) {
  10082. continue;
  10083. }
  10084. $problem->addRule($assertRule);
  10085. $this->disableProblem($assertRule);
  10086. }
  10087. $this->problems[] = $problem;
  10088. $this->decisions->resetToOffset($decisionStart);
  10089. $ruleIndex = -1;
  10090. }
  10091. }
  10092. protected function setupInstalledMap()
  10093. {
  10094. $this->installedMap = array();
  10095. foreach ($this->installed->getPackages() as $package) {
  10096. $this->installedMap[$package->id] = $package;
  10097. }
  10098. }
  10099. protected function checkForRootRequireProblems($ignorePlatformReqs)
  10100. {
  10101. foreach ($this->jobs as $job) {
  10102. switch ($job['cmd']) {
  10103. case 'update':
  10104. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  10105. foreach ($packages as $package) {
  10106. if (isset($this->installedMap[$package->id])) {
  10107. $this->updateMap[$package->id] = true;
  10108. }
  10109. }
  10110. break;
  10111. case 'update-all':
  10112. foreach ($this->installedMap as $package) {
  10113. $this->updateMap[$package->id] = true;
  10114. }
  10115. break;
  10116. case 'install':
  10117. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  10118. break;
  10119. }
  10120. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  10121. $problem = new Problem($this->pool);
  10122. $problem->addRule(new GenericRule(array(), null, null, $job));
  10123. $this->problems[] = $problem;
  10124. }
  10125. break;
  10126. }
  10127. }
  10128. }
  10129. public function solve(Request $request, $ignorePlatformReqs = false)
  10130. {
  10131. $this->jobs = $request->getJobs();
  10132. $this->setupInstalledMap();
  10133. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  10134. $this->checkForRootRequireProblems($ignorePlatformReqs);
  10135. $this->decisions = new Decisions($this->pool);
  10136. $this->watchGraph = new RuleWatchGraph;
  10137. foreach ($this->rules as $rule) {
  10138. $this->watchGraph->insert(new RuleWatchNode($rule));
  10139. }
  10140. $this->makeAssertionRuleDecisions();
  10141. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  10142. $before = microtime(true);
  10143. $this->runSat(true);
  10144. $this->io->writeError('', true, IOInterface::DEBUG);
  10145. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  10146. foreach ($this->installedMap as $packageId => $void) {
  10147. if ($this->decisions->undecided($packageId)) {
  10148. $this->decisions->decide(-$packageId, 1, null);
  10149. }
  10150. }
  10151. if ($this->problems) {
  10152. throw new SolverProblemsException($this->problems, $this->installedMap);
  10153. }
  10154. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  10155. return $transaction->getOperations();
  10156. }
  10157. protected function propagate($level)
  10158. {
  10159. while ($this->decisions->validOffset($this->propagateIndex)) {
  10160. $decision = $this->decisions->atOffset($this->propagateIndex);
  10161. $conflict = $this->watchGraph->propagateLiteral(
  10162. $decision[Decisions::DECISION_LITERAL],
  10163. $level,
  10164. $this->decisions
  10165. );
  10166. $this->propagateIndex++;
  10167. if ($conflict) {
  10168. return $conflict;
  10169. }
  10170. }
  10171. return null;
  10172. }
  10173. private function revert($level)
  10174. {
  10175. while (!$this->decisions->isEmpty()) {
  10176. $literal = $this->decisions->lastLiteral();
  10177. if ($this->decisions->undecided($literal)) {
  10178. break;
  10179. }
  10180. $decisionLevel = $this->decisions->decisionLevel($literal);
  10181. if ($decisionLevel <= $level) {
  10182. break;
  10183. }
  10184. $this->decisions->revertLast();
  10185. $this->propagateIndex = count($this->decisions);
  10186. }
  10187. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  10188. array_pop($this->branches);
  10189. }
  10190. }
  10191. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  10192. {
  10193. $level++;
  10194. $this->decisions->decide($literal, $level, $rule);
  10195. while (true) {
  10196. $rule = $this->propagate($level);
  10197. if (!$rule) {
  10198. break;
  10199. }
  10200. if ($level == 1) {
  10201. return $this->analyzeUnsolvable($rule, $disableRules);
  10202. }
  10203. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  10204. if ($newLevel <= 0 || $newLevel >= $level) {
  10205. throw new SolverBugException(
  10206. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  10207. );
  10208. } elseif (!$newRule) {
  10209. throw new SolverBugException(
  10210. "No rule was learned from analyzing $rule at level $level."
  10211. );
  10212. }
  10213. $level = $newLevel;
  10214. $this->revert($level);
  10215. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  10216. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  10217. $ruleNode = new RuleWatchNode($newRule);
  10218. $ruleNode->watch2OnHighest($this->decisions);
  10219. $this->watchGraph->insert($ruleNode);
  10220. $this->decisions->decide($learnLiteral, $level, $newRule);
  10221. }
  10222. return $level;
  10223. }
  10224. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  10225. {
  10226. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  10227. $selectedLiteral = array_shift($literals);
  10228. if (count($literals)) {
  10229. $this->branches[] = array($literals, $level);
  10230. }
  10231. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  10232. }
  10233. protected function analyze($level, Rule $rule)
  10234. {
  10235. $analyzedRule = $rule;
  10236. $ruleLevel = 1;
  10237. $num = 0;
  10238. $l1num = 0;
  10239. $seen = array();
  10240. $learnedLiterals = array(null);
  10241. $decisionId = count($this->decisions);
  10242. $this->learnedPool[] = array();
  10243. while (true) {
  10244. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  10245. foreach ($rule->getLiterals() as $literal) {
  10246. if ($this->decisions->satisfy($literal)) {
  10247. continue;
  10248. }
  10249. if (isset($seen[abs($literal)])) {
  10250. continue;
  10251. }
  10252. $seen[abs($literal)] = true;
  10253. $l = $this->decisions->decisionLevel($literal);
  10254. if (1 === $l) {
  10255. $l1num++;
  10256. } elseif ($level === $l) {
  10257. $num++;
  10258. } else {
  10259. $learnedLiterals[] = $literal;
  10260. if ($l > $ruleLevel) {
  10261. $ruleLevel = $l;
  10262. }
  10263. }
  10264. }
  10265. $l1retry = true;
  10266. while ($l1retry) {
  10267. $l1retry = false;
  10268. if (!$num && !--$l1num) {
  10269. break 2;
  10270. }
  10271. while (true) {
  10272. if ($decisionId <= 0) {
  10273. throw new SolverBugException(
  10274. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  10275. );
  10276. }
  10277. $decisionId--;
  10278. $decision = $this->decisions->atOffset($decisionId);
  10279. $literal = $decision[Decisions::DECISION_LITERAL];
  10280. if (isset($seen[abs($literal)])) {
  10281. break;
  10282. }
  10283. }
  10284. unset($seen[abs($literal)]);
  10285. if ($num && 0 === --$num) {
  10286. if ($literal < 0) {
  10287. $this->testFlagLearnedPositiveLiteral = true;
  10288. }
  10289. $learnedLiterals[0] = -$literal;
  10290. if (!$l1num) {
  10291. break 2;
  10292. }
  10293. foreach ($learnedLiterals as $i => $learnedLiteral) {
  10294. if ($i !== 0) {
  10295. unset($seen[abs($learnedLiteral)]);
  10296. }
  10297. }
  10298. $l1num++;
  10299. $l1retry = true;
  10300. }
  10301. }
  10302. $decision = $this->decisions->atOffset($decisionId);
  10303. $rule = $decision[Decisions::DECISION_REASON];
  10304. }
  10305. $why = count($this->learnedPool) - 1;
  10306. if (!$learnedLiterals[0]) {
  10307. throw new SolverBugException(
  10308. "Did not find a learnable literal in analyzed rule $analyzedRule."
  10309. );
  10310. }
  10311. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  10312. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  10313. }
  10314. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  10315. {
  10316. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  10317. $why = spl_object_hash($conflictRule);
  10318. $learnedWhy = $this->learnedWhy[$why];
  10319. $problemRules = $this->learnedPool[$learnedWhy];
  10320. foreach ($problemRules as $problemRule) {
  10321. $this->analyzeUnsolvableRule($problem, $problemRule);
  10322. }
  10323. return;
  10324. }
  10325. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  10326. return;
  10327. }
  10328. $problem->nextSection();
  10329. $problem->addRule($conflictRule);
  10330. }
  10331. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  10332. {
  10333. $problem = new Problem($this->pool);
  10334. $problem->addRule($conflictRule);
  10335. $this->analyzeUnsolvableRule($problem, $conflictRule);
  10336. $this->problems[] = $problem;
  10337. $seen = array();
  10338. $literals = $conflictRule->getLiterals();
  10339. foreach ($literals as $literal) {
  10340. if ($this->decisions->satisfy($literal)) {
  10341. continue;
  10342. }
  10343. $seen[abs($literal)] = true;
  10344. }
  10345. foreach ($this->decisions as $decision) {
  10346. $literal = $decision[Decisions::DECISION_LITERAL];
  10347. if (!isset($seen[abs($literal)])) {
  10348. continue;
  10349. }
  10350. $why = $decision[Decisions::DECISION_REASON];
  10351. $problem->addRule($why);
  10352. $this->analyzeUnsolvableRule($problem, $why);
  10353. $literals = $why->getLiterals();
  10354. foreach ($literals as $literal) {
  10355. if ($this->decisions->satisfy($literal)) {
  10356. continue;
  10357. }
  10358. $seen[abs($literal)] = true;
  10359. }
  10360. }
  10361. if ($disableRules) {
  10362. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  10363. $this->disableProblem($reason['rule']);
  10364. }
  10365. $this->resetSolver();
  10366. return 1;
  10367. }
  10368. return 0;
  10369. }
  10370. private function disableProblem(Rule $why)
  10371. {
  10372. $job = $why->getJob();
  10373. if (!$job) {
  10374. $why->disable();
  10375. return;
  10376. }
  10377. foreach ($this->rules as $rule) {
  10378. if ($job === $rule->getJob()) {
  10379. $rule->disable();
  10380. }
  10381. }
  10382. }
  10383. private function resetSolver()
  10384. {
  10385. $this->decisions->reset();
  10386. $this->propagateIndex = 0;
  10387. $this->branches = array();
  10388. $this->enableDisableLearnedRules();
  10389. $this->makeAssertionRuleDecisions();
  10390. }
  10391. private function enableDisableLearnedRules()
  10392. {
  10393. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  10394. $why = $this->learnedWhy[spl_object_hash($rule)];
  10395. $problemRules = $this->learnedPool[$why];
  10396. $foundDisabled = false;
  10397. foreach ($problemRules as $problemRule) {
  10398. if ($problemRule->isDisabled()) {
  10399. $foundDisabled = true;
  10400. break;
  10401. }
  10402. }
  10403. if ($foundDisabled && $rule->isEnabled()) {
  10404. $rule->disable();
  10405. } elseif (!$foundDisabled && $rule->isDisabled()) {
  10406. $rule->enable();
  10407. }
  10408. }
  10409. }
  10410. private function runSat($disableRules = true)
  10411. {
  10412. $this->propagateIndex = 0;
  10413. $decisionQueue = array();
  10414. $disableRules = array();
  10415. $level = 1;
  10416. $systemLevel = $level + 1;
  10417. while (true) {
  10418. if (1 === $level) {
  10419. $conflictRule = $this->propagate($level);
  10420. if (null !== $conflictRule) {
  10421. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  10422. continue;
  10423. }
  10424. return;
  10425. }
  10426. }
  10427. if ($level < $systemLevel) {
  10428. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  10429. foreach ($iterator as $rule) {
  10430. if ($rule->isEnabled()) {
  10431. $decisionQueue = array();
  10432. $noneSatisfied = true;
  10433. foreach ($rule->getLiterals() as $literal) {
  10434. if ($this->decisions->satisfy($literal)) {
  10435. $noneSatisfied = false;
  10436. break;
  10437. }
  10438. if ($literal > 0 && $this->decisions->undecided($literal)) {
  10439. $decisionQueue[] = $literal;
  10440. }
  10441. }
  10442. if ($noneSatisfied && count($decisionQueue)) {
  10443. if (count($this->installed) != count($this->updateMap)) {
  10444. $prunedQueue = array();
  10445. foreach ($decisionQueue as $literal) {
  10446. if (isset($this->installedMap[abs($literal)])) {
  10447. $prunedQueue[] = $literal;
  10448. if (isset($this->updateMap[abs($literal)])) {
  10449. $prunedQueue = $decisionQueue;
  10450. break;
  10451. }
  10452. }
  10453. }
  10454. $decisionQueue = $prunedQueue;
  10455. }
  10456. }
  10457. if ($noneSatisfied && count($decisionQueue)) {
  10458. $oLevel = $level;
  10459. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10460. if (0 === $level) {
  10461. return;
  10462. }
  10463. if ($level <= $oLevel) {
  10464. break;
  10465. }
  10466. }
  10467. }
  10468. }
  10469. $systemLevel = $level + 1;
  10470. $iterator->next();
  10471. if ($iterator->valid()) {
  10472. continue;
  10473. }
  10474. }
  10475. if ($level < $systemLevel) {
  10476. $systemLevel = $level;
  10477. }
  10478. $rulesCount = count($this->rules);
  10479. $pass = 1;
  10480. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  10481. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  10482. if ($i == $rulesCount) {
  10483. if (1 === $pass) {
  10484. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  10485. } else {
  10486. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  10487. }
  10488. $i = 0;
  10489. $pass++;
  10490. }
  10491. $rule = $this->rules->ruleById[$i];
  10492. $literals = $rule->getLiterals();
  10493. if ($rule->isDisabled()) {
  10494. continue;
  10495. }
  10496. $decisionQueue = array();
  10497. foreach ($literals as $literal) {
  10498. if ($literal <= 0) {
  10499. if (!$this->decisions->decidedInstall($literal)) {
  10500. continue 2;
  10501. }
  10502. } else {
  10503. if ($this->decisions->decidedInstall($literal)) {
  10504. continue 2;
  10505. }
  10506. if ($this->decisions->undecided($literal)) {
  10507. $decisionQueue[] = $literal;
  10508. }
  10509. }
  10510. }
  10511. if (count($decisionQueue) < 2) {
  10512. continue;
  10513. }
  10514. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  10515. if (0 === $level) {
  10516. return;
  10517. }
  10518. $rulesCount = count($this->rules);
  10519. $n = -1;
  10520. }
  10521. if ($level < $systemLevel) {
  10522. continue;
  10523. }
  10524. if (count($this->branches)) {
  10525. $lastLiteral = null;
  10526. $lastLevel = null;
  10527. $lastBranchIndex = 0;
  10528. $lastBranchOffset = 0;
  10529. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  10530. list($literals, $l) = $this->branches[$i];
  10531. foreach ($literals as $offset => $literal) {
  10532. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  10533. $lastLiteral = $literal;
  10534. $lastBranchIndex = $i;
  10535. $lastBranchOffset = $offset;
  10536. $lastLevel = $l;
  10537. }
  10538. }
  10539. }
  10540. if ($lastLiteral) {
  10541. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  10542. $level = $lastLevel;
  10543. $this->revert($level);
  10544. $why = $this->decisions->lastReason();
  10545. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  10546. if ($level == 0) {
  10547. return;
  10548. }
  10549. continue;
  10550. }
  10551. }
  10552. break;
  10553. }
  10554. }
  10555. }
  10556. <?php
  10557. namespace Composer\DependencyResolver;
  10558. class SolverBugException extends \RuntimeException
  10559. {
  10560. public function __construct($message)
  10561. {
  10562. parent::__construct(
  10563. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  10564. "Please report the command you ran, the exact error you received, and your composer.json on https://github.com/composer/composer/issues - thank you!\n"
  10565. );
  10566. }
  10567. }
  10568. <?php
  10569. namespace Composer\DependencyResolver;
  10570. use Composer\Util\IniHelper;
  10571. class SolverProblemsException extends \RuntimeException
  10572. {
  10573. protected $problems;
  10574. protected $installedMap;
  10575. public function __construct(array $problems, array $installedMap)
  10576. {
  10577. $this->problems = $problems;
  10578. $this->installedMap = $installedMap;
  10579. parent::__construct($this->createMessage(), 2);
  10580. }
  10581. protected function createMessage()
  10582. {
  10583. $text = "\n";
  10584. $hasExtensionProblems = false;
  10585. foreach ($this->problems as $i => $problem) {
  10586. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10587. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10588. $hasExtensionProblems = true;
  10589. }
  10590. }
  10591. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10592. $text .= "\nPotential causes:\n - A typo in the package name\n - The package is not available in a stable-enough version according to your minimum-stability setting\n see <https://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.\n - It's a private package and you forgot to add a custom repository to find it\n\nRead <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.";
  10593. }
  10594. if ($hasExtensionProblems) {
  10595. $text .= $this->createExtensionHint();
  10596. }
  10597. return $text;
  10598. }
  10599. public function getProblems()
  10600. {
  10601. return $this->problems;
  10602. }
  10603. private function createExtensionHint()
  10604. {
  10605. $paths = IniHelper::getAll();
  10606. if (count($paths) === 1 && empty($paths[0])) {
  10607. return '';
  10608. }
  10609. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10610. $text .= implode("\n - ", $paths);
  10611. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10612. return $text;
  10613. }
  10614. private function hasExtensionProblems(array $reasonSets)
  10615. {
  10616. foreach ($reasonSets as $reasonSet) {
  10617. foreach ($reasonSet as $reason) {
  10618. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10619. return true;
  10620. }
  10621. }
  10622. }
  10623. return false;
  10624. }
  10625. }
  10626. <?php
  10627. namespace Composer\DependencyResolver;
  10628. use Composer\Package\AliasPackage;
  10629. class Transaction
  10630. {
  10631. protected $policy;
  10632. protected $pool;
  10633. protected $installedMap;
  10634. protected $decisions;
  10635. protected $transaction;
  10636. public function __construct($policy, $pool, $installedMap, $decisions)
  10637. {
  10638. $this->policy = $policy;
  10639. $this->pool = $pool;
  10640. $this->installedMap = $installedMap;
  10641. $this->decisions = $decisions;
  10642. $this->transaction = array();
  10643. }
  10644. public function getOperations()
  10645. {
  10646. $installMeansUpdateMap = $this->findUpdates();
  10647. $updateMap = array();
  10648. $installMap = array();
  10649. $uninstallMap = array();
  10650. foreach ($this->decisions as $i => $decision) {
  10651. $literal = $decision[Decisions::DECISION_LITERAL];
  10652. $reason = $decision[Decisions::DECISION_REASON];
  10653. $package = $this->pool->literalToPackage($literal);
  10654. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10655. continue;
  10656. }
  10657. if ($literal > 0) {
  10658. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10659. $source = $installMeansUpdateMap[abs($literal)];
  10660. $updateMap[$package->id] = array(
  10661. 'package' => $package,
  10662. 'source' => $source,
  10663. 'reason' => $reason,
  10664. );
  10665. unset($installMeansUpdateMap[abs($literal)]);
  10666. $ignoreRemove[$source->id] = true;
  10667. } else {
  10668. $installMap[$package->id] = array(
  10669. 'package' => $package,
  10670. 'reason' => $reason,
  10671. );
  10672. }
  10673. }
  10674. }
  10675. foreach ($this->decisions as $i => $decision) {
  10676. $literal = $decision[Decisions::DECISION_LITERAL];
  10677. $reason = $decision[Decisions::DECISION_REASON];
  10678. $package = $this->pool->literalToPackage($literal);
  10679. if ($literal <= 0 &&
  10680. isset($this->installedMap[$package->id]) &&
  10681. !isset($ignoreRemove[$package->id])) {
  10682. $uninstallMap[$package->id] = array(
  10683. 'package' => $package,
  10684. 'reason' => $reason,
  10685. );
  10686. }
  10687. }
  10688. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10689. return $this->transaction;
  10690. }
  10691. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10692. {
  10693. $queue = array_map(
  10694. function ($operation) {
  10695. return $operation['package'];
  10696. },
  10697. $this->findRootPackages($installMap, $updateMap)
  10698. );
  10699. $visited = array();
  10700. while (!empty($queue)) {
  10701. $package = array_pop($queue);
  10702. $packageId = $package->id;
  10703. if (!isset($visited[$packageId])) {
  10704. $queue[] = $package;
  10705. if ($package instanceof AliasPackage) {
  10706. $queue[] = $package->getAliasOf();
  10707. } else {
  10708. foreach ($package->getRequires() as $link) {
  10709. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10710. foreach ($possibleRequires as $require) {
  10711. $queue[] = $require;
  10712. }
  10713. }
  10714. }
  10715. $visited[$package->id] = true;
  10716. } else {
  10717. if (isset($installMap[$packageId])) {
  10718. $this->install(
  10719. $installMap[$packageId]['package'],
  10720. $installMap[$packageId]['reason']
  10721. );
  10722. unset($installMap[$packageId]);
  10723. }
  10724. if (isset($updateMap[$packageId])) {
  10725. $this->update(
  10726. $updateMap[$packageId]['source'],
  10727. $updateMap[$packageId]['package'],
  10728. $updateMap[$packageId]['reason']
  10729. );
  10730. unset($updateMap[$packageId]);
  10731. }
  10732. }
  10733. }
  10734. foreach ($uninstallMap as $uninstall) {
  10735. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10736. }
  10737. }
  10738. protected function findRootPackages($installMap, $updateMap)
  10739. {
  10740. $packages = $installMap + $updateMap;
  10741. $roots = $packages;
  10742. foreach ($packages as $packageId => $operation) {
  10743. $package = $operation['package'];
  10744. if (!isset($roots[$packageId])) {
  10745. continue;
  10746. }
  10747. foreach ($package->getRequires() as $link) {
  10748. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10749. foreach ($possibleRequires as $require) {
  10750. if ($require !== $package) {
  10751. unset($roots[$require->id]);
  10752. }
  10753. }
  10754. }
  10755. }
  10756. return $roots;
  10757. }
  10758. protected function findUpdates()
  10759. {
  10760. $installMeansUpdateMap = array();
  10761. foreach ($this->decisions as $i => $decision) {
  10762. $literal = $decision[Decisions::DECISION_LITERAL];
  10763. $package = $this->pool->literalToPackage($literal);
  10764. if ($package instanceof AliasPackage) {
  10765. continue;
  10766. }
  10767. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10768. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10769. $literals = array($package->id);
  10770. foreach ($updates as $update) {
  10771. $literals[] = $update->id;
  10772. }
  10773. foreach ($literals as $updateLiteral) {
  10774. if ($updateLiteral !== $literal) {
  10775. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10776. }
  10777. }
  10778. }
  10779. }
  10780. return $installMeansUpdateMap;
  10781. }
  10782. protected function install($package, $reason)
  10783. {
  10784. if ($package instanceof AliasPackage) {
  10785. return $this->markAliasInstalled($package, $reason);
  10786. }
  10787. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10788. }
  10789. protected function update($from, $to, $reason)
  10790. {
  10791. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10792. }
  10793. protected function uninstall($package, $reason)
  10794. {
  10795. if ($package instanceof AliasPackage) {
  10796. return $this->markAliasUninstalled($package, $reason);
  10797. }
  10798. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10799. }
  10800. protected function markAliasInstalled($package, $reason)
  10801. {
  10802. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10803. }
  10804. protected function markAliasUninstalled($package, $reason)
  10805. {
  10806. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10807. }
  10808. }
  10809. <?php
  10810. namespace Composer\Downloader;
  10811. use Composer\Package\PackageInterface;
  10812. use Symfony\Component\Finder\Finder;
  10813. use Composer\IO\IOInterface;
  10814. abstract class ArchiveDownloader extends FileDownloader
  10815. {
  10816. public function download(PackageInterface $package, $path, $output = true)
  10817. {
  10818. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10819. $retries = 3;
  10820. while ($retries--) {
  10821. $fileName = parent::download($package, $path, $output);
  10822. if ($output) {
  10823. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10824. }
  10825. try {
  10826. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10827. try {
  10828. $this->extract($fileName, $temporaryDir);
  10829. } catch (\Exception $e) {
  10830. parent::clearLastCacheWrite($package);
  10831. throw $e;
  10832. }
  10833. $this->filesystem->unlink($fileName);
  10834. $contentDir = $this->getFolderContent($temporaryDir);
  10835. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10836. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10837. }
  10838. foreach ($contentDir as $file) {
  10839. $file = (string) $file;
  10840. $this->filesystem->rename($file, $path . '/' . basename($file));
  10841. }
  10842. $this->filesystem->removeDirectory($temporaryDir);
  10843. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10844. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10845. }
  10846. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10847. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10848. }
  10849. } catch (\Exception $e) {
  10850. $this->filesystem->removeDirectory($path);
  10851. $this->filesystem->removeDirectory($temporaryDir);
  10852. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10853. $this->io->writeError('');
  10854. if ($this->io->isDebug()) {
  10855. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10856. } else {
  10857. $this->io->writeError(' Invalid zip file, retrying...');
  10858. }
  10859. usleep(500000);
  10860. continue;
  10861. }
  10862. throw $e;
  10863. }
  10864. break;
  10865. }
  10866. }
  10867. protected function getFileName(PackageInterface $package, $path)
  10868. {
  10869. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10870. }
  10871. abstract protected function extract($file, $path);
  10872. private function getFolderContent($dir)
  10873. {
  10874. $finder = Finder::create()
  10875. ->ignoreVCS(false)
  10876. ->ignoreDotFiles(false)
  10877. ->notName('.DS_Store')
  10878. ->depth(0)
  10879. ->in($dir);
  10880. return iterator_to_array($finder);
  10881. }
  10882. }
  10883. <?php
  10884. namespace Composer\Downloader;
  10885. use Composer\Package\PackageInterface;
  10886. interface ChangeReportInterface
  10887. {
  10888. public function getLocalChanges(PackageInterface $package, $path);
  10889. }
  10890. <?php
  10891. namespace Composer\Downloader;
  10892. use Composer\Package\PackageInterface;
  10893. use Composer\IO\IOInterface;
  10894. use Composer\Util\Filesystem;
  10895. class DownloadManager
  10896. {
  10897. private $io;
  10898. private $preferDist = false;
  10899. private $preferSource = false;
  10900. private $packagePreferences = array();
  10901. private $filesystem;
  10902. private $downloaders = array();
  10903. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10904. {
  10905. $this->io = $io;
  10906. $this->preferSource = $preferSource;
  10907. $this->filesystem = $filesystem ?: new Filesystem();
  10908. }
  10909. public function setPreferSource($preferSource)
  10910. {
  10911. $this->preferSource = $preferSource;
  10912. return $this;
  10913. }
  10914. public function setPreferDist($preferDist)
  10915. {
  10916. $this->preferDist = $preferDist;
  10917. return $this;
  10918. }
  10919. public function setPreferences(array $preferences)
  10920. {
  10921. $this->packagePreferences = $preferences;
  10922. return $this;
  10923. }
  10924. public function setOutputProgress($outputProgress)
  10925. {
  10926. foreach ($this->downloaders as $downloader) {
  10927. $downloader->setOutputProgress($outputProgress);
  10928. }
  10929. return $this;
  10930. }
  10931. public function setDownloader($type, DownloaderInterface $downloader)
  10932. {
  10933. $type = strtolower($type);
  10934. $this->downloaders[$type] = $downloader;
  10935. return $this;
  10936. }
  10937. public function getDownloader($type)
  10938. {
  10939. $type = strtolower($type);
  10940. if (!isset($this->downloaders[$type])) {
  10941. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10942. }
  10943. return $this->downloaders[$type];
  10944. }
  10945. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10946. {
  10947. $installationSource = $package->getInstallationSource();
  10948. if ('metapackage' === $package->getType()) {
  10949. return;
  10950. }
  10951. if ('dist' === $installationSource) {
  10952. $downloader = $this->getDownloader($package->getDistType());
  10953. } elseif ('source' === $installationSource) {
  10954. $downloader = $this->getDownloader($package->getSourceType());
  10955. } else {
  10956. throw new \InvalidArgumentException(
  10957. 'Package '.$package.' seems not been installed properly'
  10958. );
  10959. }
  10960. if ($installationSource !== $downloader->getInstallationSource()) {
  10961. throw new \LogicException(sprintf(
  10962. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10963. get_class($downloader),
  10964. $downloader->getInstallationSource(),
  10965. $installationSource,
  10966. $package
  10967. ));
  10968. }
  10969. return $downloader;
  10970. }
  10971. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10972. {
  10973. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10974. $sourceType = $package->getSourceType();
  10975. $distType = $package->getDistType();
  10976. $sources = array();
  10977. if ($sourceType) {
  10978. $sources[] = 'source';
  10979. }
  10980. if ($distType) {
  10981. $sources[] = 'dist';
  10982. }
  10983. if (empty($sources)) {
  10984. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10985. }
  10986. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10987. $sources = array_reverse($sources);
  10988. }
  10989. $this->filesystem->ensureDirectoryExists($targetDir);
  10990. foreach ($sources as $i => $source) {
  10991. if (isset($e)) {
  10992. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10993. }
  10994. $package->setInstallationSource($source);
  10995. try {
  10996. $downloader = $this->getDownloaderForInstalledPackage($package);
  10997. if ($downloader) {
  10998. $downloader->download($package, $targetDir);
  10999. }
  11000. break;
  11001. } catch (\RuntimeException $e) {
  11002. if ($i === count($sources) - 1) {
  11003. throw $e;
  11004. }
  11005. $this->io->writeError(
  11006. ' <warning>Failed to download '.
  11007. $package->getPrettyName().
  11008. ' from ' . $source . ': '.
  11009. $e->getMessage().'</warning>'
  11010. );
  11011. }
  11012. }
  11013. }
  11014. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  11015. {
  11016. $downloader = $this->getDownloaderForInstalledPackage($initial);
  11017. if (!$downloader) {
  11018. return;
  11019. }
  11020. $installationSource = $initial->getInstallationSource();
  11021. if ('dist' === $installationSource) {
  11022. $initialType = $initial->getDistType();
  11023. $targetType = $target->getDistType();
  11024. } else {
  11025. $initialType = $initial->getSourceType();
  11026. $targetType = $target->getSourceType();
  11027. }
  11028. if ($target->isDev() && 'dist' === $installationSource) {
  11029. $downloader->remove($initial, $targetDir);
  11030. $this->download($target, $targetDir);
  11031. return;
  11032. }
  11033. if ($initialType === $targetType) {
  11034. $target->setInstallationSource($installationSource);
  11035. try {
  11036. $downloader->update($initial, $target, $targetDir);
  11037. return;
  11038. } catch (\RuntimeException $e) {
  11039. if (!$this->io->isInteractive()) {
  11040. throw $e;
  11041. }
  11042. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  11043. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  11044. throw $e;
  11045. }
  11046. }
  11047. }
  11048. $downloader->remove($initial, $targetDir);
  11049. $this->download($target, $targetDir, 'source' === $installationSource);
  11050. }
  11051. public function remove(PackageInterface $package, $targetDir)
  11052. {
  11053. $downloader = $this->getDownloaderForInstalledPackage($package);
  11054. if ($downloader) {
  11055. $downloader->remove($package, $targetDir);
  11056. }
  11057. }
  11058. protected function resolvePackageInstallPreference(PackageInterface $package)
  11059. {
  11060. foreach ($this->packagePreferences as $pattern => $preference) {
  11061. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  11062. if (preg_match($pattern, $package->getName())) {
  11063. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  11064. return 'dist';
  11065. }
  11066. return 'source';
  11067. }
  11068. }
  11069. return $package->isDev() ? 'source' : 'dist';
  11070. }
  11071. }
  11072. <?php
  11073. namespace Composer\Downloader;
  11074. use Composer\Package\PackageInterface;
  11075. interface DownloaderInterface
  11076. {
  11077. public function getInstallationSource();
  11078. public function download(PackageInterface $package, $path);
  11079. public function update(PackageInterface $initial, PackageInterface $target, $path);
  11080. public function remove(PackageInterface $package, $path);
  11081. public function setOutputProgress($outputProgress);
  11082. }
  11083. <?php
  11084. namespace Composer\Downloader;
  11085. use Composer\Package\PackageInterface;
  11086. interface DvcsDownloaderInterface
  11087. {
  11088. public function getUnpushedChanges(PackageInterface $package, $path);
  11089. }
  11090. <?php
  11091. namespace Composer\Downloader;
  11092. use Composer\Config;
  11093. use Composer\Cache;
  11094. use Composer\Factory;
  11095. use Composer\IO\IOInterface;
  11096. use Composer\IO\NullIO;
  11097. use Composer\Package\Comparer\Comparer;
  11098. use Composer\Package\PackageInterface;
  11099. use Composer\Package\Version\VersionParser;
  11100. use Composer\Plugin\PluginEvents;
  11101. use Composer\Plugin\PreFileDownloadEvent;
  11102. use Composer\EventDispatcher\EventDispatcher;
  11103. use Composer\Util\Filesystem;
  11104. use Composer\Util\RemoteFilesystem;
  11105. use Composer\Util\Url as UrlUtil;
  11106. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  11107. {
  11108. protected $io;
  11109. protected $config;
  11110. protected $rfs;
  11111. protected $filesystem;
  11112. protected $cache;
  11113. protected $outputProgress = true;
  11114. private $lastCacheWrites = array();
  11115. private $eventDispatcher;
  11116. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  11117. {
  11118. $this->io = $io;
  11119. $this->config = $config;
  11120. $this->eventDispatcher = $eventDispatcher;
  11121. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  11122. $this->filesystem = $filesystem ?: new Filesystem();
  11123. $this->cache = $cache;
  11124. if ($this->cache && $this->cache->gcIsNecessary()) {
  11125. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  11126. }
  11127. }
  11128. public function getInstallationSource()
  11129. {
  11130. return 'dist';
  11131. }
  11132. public function download(PackageInterface $package, $path, $output = true)
  11133. {
  11134. if (!$package->getDistUrl()) {
  11135. throw new \InvalidArgumentException('The given package is missing url information');
  11136. }
  11137. if ($output) {
  11138. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11139. }
  11140. $urls = $package->getDistUrls();
  11141. while ($url = array_shift($urls)) {
  11142. try {
  11143. $fileName = $this->doDownload($package, $path, $url);
  11144. break;
  11145. } catch (\Exception $e) {
  11146. if ($this->io->isDebug()) {
  11147. $this->io->writeError('');
  11148. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  11149. } elseif (count($urls)) {
  11150. $this->io->writeError('');
  11151. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  11152. }
  11153. if (!count($urls)) {
  11154. throw $e;
  11155. }
  11156. }
  11157. }
  11158. if ($output) {
  11159. $this->io->writeError('');
  11160. }
  11161. return $fileName;
  11162. }
  11163. protected function doDownload(PackageInterface $package, $path, $url)
  11164. {
  11165. $this->filesystem->emptyDirectory($path);
  11166. $fileName = $this->getFileName($package, $path);
  11167. $processedUrl = $this->processUrl($package, $url);
  11168. $origin = RemoteFilesystem::getOrigin($processedUrl);
  11169. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  11170. if ($this->eventDispatcher) {
  11171. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  11172. }
  11173. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  11174. try {
  11175. $checksum = $package->getDistSha1Checksum();
  11176. $cacheKey = $this->getCacheKey($package, $processedUrl);
  11177. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  11178. $this->io->writeError('Loading from cache', false);
  11179. } else {
  11180. if (!$this->outputProgress) {
  11181. $this->io->writeError('Downloading', false);
  11182. }
  11183. $retries = 3;
  11184. while ($retries--) {
  11185. try {
  11186. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  11187. break;
  11188. } catch (TransportException $e) {
  11189. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  11190. throw $e;
  11191. }
  11192. $this->io->writeError('');
  11193. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  11194. usleep(500000);
  11195. }
  11196. }
  11197. if (!$this->outputProgress) {
  11198. $this->io->writeError(' (<comment>100%</comment>)', false);
  11199. }
  11200. if ($this->cache) {
  11201. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  11202. $this->cache->copyFrom($cacheKey, $fileName);
  11203. }
  11204. }
  11205. if (!file_exists($fileName)) {
  11206. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  11207. .' directory is writable and you have internet connectivity');
  11208. }
  11209. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  11210. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  11211. }
  11212. } catch (\Exception $e) {
  11213. $this->filesystem->removeDirectory($path);
  11214. $this->clearLastCacheWrite($package);
  11215. throw $e;
  11216. }
  11217. return $fileName;
  11218. }
  11219. public function setOutputProgress($outputProgress)
  11220. {
  11221. $this->outputProgress = $outputProgress;
  11222. return $this;
  11223. }
  11224. protected function clearLastCacheWrite(PackageInterface $package)
  11225. {
  11226. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  11227. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  11228. unset($this->lastCacheWrites[$package->getName()]);
  11229. }
  11230. }
  11231. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11232. {
  11233. $name = $target->getName();
  11234. $from = $initial->getFullPrettyVersion();
  11235. $to = $target->getFullPrettyVersion();
  11236. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  11237. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  11238. $this->remove($initial, $path, false);
  11239. $this->download($target, $path, false);
  11240. $this->io->writeError('');
  11241. }
  11242. public function remove(PackageInterface $package, $path, $output = true)
  11243. {
  11244. if ($output) {
  11245. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11246. }
  11247. if (!$this->filesystem->removeDirectory($path)) {
  11248. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  11249. }
  11250. }
  11251. protected function getFileName(PackageInterface $package, $path)
  11252. {
  11253. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11254. }
  11255. protected function processUrl(PackageInterface $package, $url)
  11256. {
  11257. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  11258. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  11259. }
  11260. if ($package->getDistReference()) {
  11261. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  11262. }
  11263. return $url;
  11264. }
  11265. private function getCacheKey(PackageInterface $package, $processedUrl)
  11266. {
  11267. $cacheKey = sha1($processedUrl);
  11268. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  11269. }
  11270. public function getLocalChanges(PackageInterface $package, $targetDir)
  11271. {
  11272. $prevIO = $this->io;
  11273. $prevProgress = $this->outputProgress;
  11274. $this->io = new NullIO;
  11275. $this->io->loadConfiguration($this->config);
  11276. $this->outputProgress = false;
  11277. $e = null;
  11278. try {
  11279. $this->download($package, $targetDir.'_compare', false);
  11280. $comparer = new Comparer();
  11281. $comparer->setSource($targetDir.'_compare');
  11282. $comparer->setUpdate($targetDir);
  11283. $comparer->doCompare();
  11284. $output = $comparer->getChanged(true, true);
  11285. $this->filesystem->removeDirectory($targetDir.'_compare');
  11286. } catch (\Exception $e) {
  11287. }
  11288. $this->io = $prevIO;
  11289. $this->outputProgress = $prevProgress;
  11290. if ($e) {
  11291. throw $e;
  11292. }
  11293. return trim($output);
  11294. }
  11295. }
  11296. <?php
  11297. namespace Composer\Downloader;
  11298. class FilesystemException extends \Exception
  11299. {
  11300. public function __construct($message = '', $code = 0, \Exception $previous = null)
  11301. {
  11302. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  11303. }
  11304. }
  11305. <?php
  11306. namespace Composer\Downloader;
  11307. use Composer\Package\PackageInterface;
  11308. use Composer\Util\ProcessExecutor;
  11309. class FossilDownloader extends VcsDownloader
  11310. {
  11311. public function doDownload(PackageInterface $package, $path, $url)
  11312. {
  11313. $this->config->prohibitUrlByConfig($url, $this->io);
  11314. $url = ProcessExecutor::escape($url);
  11315. $ref = ProcessExecutor::escape($package->getSourceReference());
  11316. $repoFile = $path . '.fossil';
  11317. $this->io->writeError("Cloning ".$package->getSourceReference());
  11318. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  11319. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  11320. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11321. }
  11322. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  11323. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11324. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11325. }
  11326. $command = sprintf('fossil update %s', $ref);
  11327. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11328. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11329. }
  11330. }
  11331. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11332. {
  11333. $this->config->prohibitUrlByConfig($url, $this->io);
  11334. $url = ProcessExecutor::escape($url);
  11335. $ref = ProcessExecutor::escape($target->getSourceReference());
  11336. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11337. if (!$this->hasMetadataRepository($path)) {
  11338. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11339. }
  11340. $command = sprintf('fossil pull && fossil up %s', $ref);
  11341. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11342. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11343. }
  11344. }
  11345. public function getLocalChanges(PackageInterface $package, $path)
  11346. {
  11347. if (!$this->hasMetadataRepository($path)) {
  11348. return null;
  11349. }
  11350. $this->process->execute('fossil changes', $output, realpath($path));
  11351. return trim($output) ?: null;
  11352. }
  11353. protected function getCommitLogs($fromReference, $toReference, $path)
  11354. {
  11355. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  11356. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11357. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11358. }
  11359. $log = '';
  11360. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  11361. foreach ($this->process->splitLines($output) as $line) {
  11362. if (preg_match($match, $line)) {
  11363. break;
  11364. }
  11365. $log .= $line;
  11366. }
  11367. return $log;
  11368. }
  11369. protected function hasMetadataRepository($path)
  11370. {
  11371. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  11372. }
  11373. }
  11374. <?php
  11375. namespace Composer\Downloader;
  11376. use Composer\Config;
  11377. use Composer\IO\IOInterface;
  11378. use Composer\Package\PackageInterface;
  11379. use Composer\Util\Filesystem;
  11380. use Composer\Util\Git as GitUtil;
  11381. use Composer\Util\Platform;
  11382. use Composer\Util\ProcessExecutor;
  11383. use Composer\Cache;
  11384. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  11385. {
  11386. private $hasStashedChanges = false;
  11387. private $hasDiscardedChanges = false;
  11388. private $gitUtil;
  11389. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11390. {
  11391. parent::__construct($io, $config, $process, $fs);
  11392. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  11393. }
  11394. public function doDownload(PackageInterface $package, $path, $url)
  11395. {
  11396. GitUtil::cleanEnv();
  11397. $path = $this->normalizePath($path);
  11398. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  11399. $ref = $package->getSourceReference();
  11400. $flag = Platform::isWindows() ? '/D ' : '';
  11401. $gitVersion = GitUtil::getVersion($this->process);
  11402. $msg = "Cloning ".$this->getShortHash($ref);
  11403. $command = 'git clone --no-checkout %url% %path% && cd '.$flag.'%path% && git remote add composer %url% && git fetch composer && git remote set-url origin %sanitizedUrl% && git remote set-url composer %sanitizedUrl%';
  11404. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  11405. $this->io->writeError('', true, IOInterface::DEBUG);
  11406. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  11407. try {
  11408. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  11409. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  11410. }
  11411. if (is_dir($cachePath)) {
  11412. $command =
  11413. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  11414. . '&& cd '.$flag.'%path% '
  11415. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  11416. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  11417. }
  11418. } catch (\RuntimeException $e) {
  11419. if (0 === strpos(get_class($e), 'PHPUnit')) {
  11420. throw $e;
  11421. }
  11422. }
  11423. }
  11424. $this->io->writeError($msg);
  11425. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  11426. return str_replace(
  11427. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  11428. array(
  11429. ProcessExecutor::escape($url),
  11430. ProcessExecutor::escape($path),
  11431. ProcessExecutor::escape($cachePath),
  11432. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  11433. ),
  11434. $command
  11435. );
  11436. };
  11437. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  11438. if ($url !== $package->getSourceUrl()) {
  11439. $this->updateOriginUrl($path, $package->getSourceUrl());
  11440. } else {
  11441. $this->setPushUrl($path, $url);
  11442. }
  11443. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  11444. if ($package->getDistReference() === $package->getSourceReference()) {
  11445. $package->setDistReference($newRef);
  11446. }
  11447. $package->setSourceReference($newRef);
  11448. }
  11449. }
  11450. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11451. {
  11452. GitUtil::cleanEnv();
  11453. if (!$this->hasMetadataRepository($path)) {
  11454. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11455. }
  11456. $updateOriginUrl = false;
  11457. if (
  11458. 0 === $this->process->execute('git remote -v', $output, $path)
  11459. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  11460. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  11461. ) {
  11462. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  11463. $updateOriginUrl = true;
  11464. }
  11465. }
  11466. $ref = $target->getSourceReference();
  11467. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  11468. $command = '(git remote set-url composer %s && git rev-parse --quiet --verify %s || (git fetch composer && git fetch --tags composer)) && git remote set-url composer %s';
  11469. $commandCallable = function ($url) use ($command, $ref) {
  11470. return sprintf(
  11471. $command,
  11472. ProcessExecutor::escape($url),
  11473. ProcessExecutor::escape($ref.'^{commit}'),
  11474. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  11475. );
  11476. };
  11477. $this->gitUtil->runCommand($commandCallable, $url, $path);
  11478. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  11479. if ($target->getDistReference() === $target->getSourceReference()) {
  11480. $target->setDistReference($newRef);
  11481. }
  11482. $target->setSourceReference($newRef);
  11483. }
  11484. if ($updateOriginUrl) {
  11485. $this->updateOriginUrl($path, $target->getSourceUrl());
  11486. }
  11487. }
  11488. public function getLocalChanges(PackageInterface $package, $path)
  11489. {
  11490. GitUtil::cleanEnv();
  11491. if (!$this->hasMetadataRepository($path)) {
  11492. return;
  11493. }
  11494. $command = 'git status --porcelain --untracked-files=no';
  11495. if (0 !== $this->process->execute($command, $output, $path)) {
  11496. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11497. }
  11498. return trim($output) ?: null;
  11499. }
  11500. public function getUnpushedChanges(PackageInterface $package, $path)
  11501. {
  11502. GitUtil::cleanEnv();
  11503. $path = $this->normalizePath($path);
  11504. if (!$this->hasMetadataRepository($path)) {
  11505. return;
  11506. }
  11507. $command = 'git show-ref --head -d';
  11508. if (0 !== $this->process->execute($command, $output, $path)) {
  11509. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11510. }
  11511. $refs = trim($output);
  11512. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  11513. return;
  11514. }
  11515. $headRef = $match[1];
  11516. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  11517. return;
  11518. }
  11519. $branch = $matches[1][0];
  11520. $unpushedChanges = null;
  11521. for ($i = 0; $i <= 1; $i++) {
  11522. foreach ($matches[1] as $candidate) {
  11523. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  11524. $branch = $candidate;
  11525. $remoteBranch = $match[1];
  11526. break;
  11527. }
  11528. }
  11529. if (!isset($remoteBranch)) {
  11530. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  11531. } else {
  11532. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  11533. if (0 !== $this->process->execute($command, $output, $path)) {
  11534. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11535. }
  11536. $unpushedChanges = trim($output) ?: null;
  11537. }
  11538. if ($unpushedChanges && $i === 0) {
  11539. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  11540. }
  11541. if (!$unpushedChanges) {
  11542. break;
  11543. }
  11544. }
  11545. return $unpushedChanges;
  11546. }
  11547. protected function cleanChanges(PackageInterface $package, $path, $update)
  11548. {
  11549. GitUtil::cleanEnv();
  11550. $path = $this->normalizePath($path);
  11551. $unpushed = $this->getUnpushedChanges($package, $path);
  11552. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  11553. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  11554. }
  11555. if (!$changes = $this->getLocalChanges($package, $path)) {
  11556. return;
  11557. }
  11558. if (!$this->io->isInteractive()) {
  11559. $discardChanges = $this->config->get('discard-changes');
  11560. if (true === $discardChanges) {
  11561. return $this->discardChanges($path);
  11562. }
  11563. if ('stash' === $discardChanges) {
  11564. if (!$update) {
  11565. return parent::cleanChanges($package, $path, $update);
  11566. }
  11567. return $this->stashChanges($path);
  11568. }
  11569. return parent::cleanChanges($package, $path, $update);
  11570. }
  11571. $changes = array_map(function ($elem) {
  11572. return ' '.$elem;
  11573. }, preg_split('{\s*\r?\n\s*}', $changes));
  11574. $this->io->writeError(' <error>The package has modified files:</error>');
  11575. $this->io->writeError(array_slice($changes, 0, 10));
  11576. if (count($changes) > 10) {
  11577. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  11578. }
  11579. while (true) {
  11580. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  11581. case 'y':
  11582. $this->discardChanges($path);
  11583. break 2;
  11584. case 's':
  11585. if (!$update) {
  11586. goto help;
  11587. }
  11588. $this->stashChanges($path);
  11589. break 2;
  11590. case 'n':
  11591. throw new \RuntimeException('Update aborted');
  11592. case 'v':
  11593. $this->io->writeError($changes);
  11594. break;
  11595. case 'd':
  11596. $this->viewDiff($path);
  11597. break;
  11598. case '?':
  11599. default:
  11600. help:
  11601. $this->io->writeError(array(
  11602. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11603. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11604. ' v - view modified files',
  11605. ' d - view local modifications (diff)',
  11606. ));
  11607. if ($update) {
  11608. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11609. }
  11610. $this->io->writeError(' ? - print help');
  11611. break;
  11612. }
  11613. }
  11614. }
  11615. protected function reapplyChanges($path)
  11616. {
  11617. $path = $this->normalizePath($path);
  11618. if ($this->hasStashedChanges) {
  11619. $this->hasStashedChanges = false;
  11620. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11621. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11622. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11623. }
  11624. }
  11625. $this->hasDiscardedChanges = false;
  11626. }
  11627. protected function updateToCommit($path, $reference, $branch, $date)
  11628. {
  11629. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11630. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11631. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11632. $branches = null;
  11633. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11634. $branches = $output;
  11635. }
  11636. $gitRef = $reference;
  11637. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11638. && $branches
  11639. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11640. ) {
  11641. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11642. if (0 === $this->process->execute($command, $output, $path)) {
  11643. return;
  11644. }
  11645. }
  11646. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11647. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11648. $branch = 'v' . $branch;
  11649. }
  11650. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11651. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11652. if (0 === $this->process->execute($command, $output, $path)
  11653. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11654. ) {
  11655. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11656. if (0 === $this->process->execute($command, $output, $path)) {
  11657. return;
  11658. }
  11659. }
  11660. }
  11661. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11662. if (0 === $this->process->execute($command, $output, $path)) {
  11663. return;
  11664. }
  11665. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11666. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11667. }
  11668. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11669. }
  11670. protected function updateOriginUrl($path, $url)
  11671. {
  11672. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11673. $this->setPushUrl($path, $url);
  11674. }
  11675. protected function setPushUrl($path, $url)
  11676. {
  11677. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11678. $protocols = $this->config->get('github-protocols');
  11679. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11680. if (!in_array('ssh', $protocols, true)) {
  11681. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11682. }
  11683. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11684. $this->process->execute($cmd, $ignoredOutput, $path);
  11685. }
  11686. }
  11687. protected function getCommitLogs($fromReference, $toReference, $path)
  11688. {
  11689. $path = $this->normalizePath($path);
  11690. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"'.GitUtil::getNoShowSignatureFlag($this->process), ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11691. if (0 !== $this->process->execute($command, $output, $path)) {
  11692. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11693. }
  11694. return $output;
  11695. }
  11696. protected function discardChanges($path)
  11697. {
  11698. $path = $this->normalizePath($path);
  11699. if (0 !== $this->process->execute('git clean -df && git reset --hard', $output, $path)) {
  11700. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11701. }
  11702. $this->hasDiscardedChanges = true;
  11703. }
  11704. protected function stashChanges($path)
  11705. {
  11706. $path = $this->normalizePath($path);
  11707. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11708. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11709. }
  11710. $this->hasStashedChanges = true;
  11711. }
  11712. protected function viewDiff($path)
  11713. {
  11714. $path = $this->normalizePath($path);
  11715. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11716. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11717. }
  11718. $this->io->writeError($output);
  11719. }
  11720. protected function normalizePath($path)
  11721. {
  11722. if (Platform::isWindows() && strlen($path) > 0) {
  11723. $basePath = $path;
  11724. $removed = array();
  11725. while (!is_dir($basePath) && $basePath !== '\\') {
  11726. array_unshift($removed, basename($basePath));
  11727. $basePath = dirname($basePath);
  11728. }
  11729. if ($basePath === '\\') {
  11730. return $path;
  11731. }
  11732. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11733. }
  11734. return $path;
  11735. }
  11736. protected function hasMetadataRepository($path)
  11737. {
  11738. $path = $this->normalizePath($path);
  11739. return is_dir($path.'/.git');
  11740. }
  11741. protected function getShortHash($reference)
  11742. {
  11743. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11744. return substr($reference, 0, 10);
  11745. }
  11746. return $reference;
  11747. }
  11748. }
  11749. <?php
  11750. namespace Composer\Downloader;
  11751. use Composer\Config;
  11752. use Composer\Cache;
  11753. use Composer\EventDispatcher\EventDispatcher;
  11754. use Composer\Package\PackageInterface;
  11755. use Composer\Util\Platform;
  11756. use Composer\Util\ProcessExecutor;
  11757. use Composer\Util\RemoteFilesystem;
  11758. use Composer\IO\IOInterface;
  11759. class GzipDownloader extends ArchiveDownloader
  11760. {
  11761. protected $process;
  11762. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11763. {
  11764. $this->process = $process ?: new ProcessExecutor($io);
  11765. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11766. }
  11767. protected function extract($file, $path)
  11768. {
  11769. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11770. if (!Platform::isWindows()) {
  11771. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11772. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11773. return;
  11774. }
  11775. if (extension_loaded('zlib')) {
  11776. $this->extractUsingExt($file, $targetFilepath);
  11777. return;
  11778. }
  11779. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11780. throw new \RuntimeException($processError);
  11781. }
  11782. $this->extractUsingExt($file, $targetFilepath);
  11783. }
  11784. protected function getFileName(PackageInterface $package, $path)
  11785. {
  11786. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11787. }
  11788. private function extractUsingExt($file, $targetFilepath)
  11789. {
  11790. $archiveFile = gzopen($file, 'rb');
  11791. $targetFile = fopen($targetFilepath, 'wb');
  11792. while ($string = gzread($archiveFile, 4096)) {
  11793. fwrite($targetFile, $string, Platform::strlen($string));
  11794. }
  11795. gzclose($archiveFile);
  11796. fclose($targetFile);
  11797. }
  11798. }
  11799. <?php
  11800. namespace Composer\Downloader;
  11801. use Composer\Package\PackageInterface;
  11802. use Composer\Util\ProcessExecutor;
  11803. use Composer\Util\Hg as HgUtils;
  11804. class HgDownloader extends VcsDownloader
  11805. {
  11806. public function doDownload(PackageInterface $package, $path, $url)
  11807. {
  11808. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11809. $cloneCommand = function ($url) use ($path) {
  11810. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11811. };
  11812. $hgUtils->runCommand($cloneCommand, $url, $path);
  11813. $ref = ProcessExecutor::escape($package->getSourceReference());
  11814. $command = sprintf('hg up %s', $ref);
  11815. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11816. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11817. }
  11818. }
  11819. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11820. {
  11821. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11822. $ref = $target->getSourceReference();
  11823. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11824. if (!$this->hasMetadataRepository($path)) {
  11825. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11826. }
  11827. $command = function ($url) use ($ref) {
  11828. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11829. };
  11830. $hgUtils->runCommand($command, $url, $path);
  11831. }
  11832. public function getLocalChanges(PackageInterface $package, $path)
  11833. {
  11834. if (!is_dir($path.'/.hg')) {
  11835. return null;
  11836. }
  11837. $this->process->execute('hg st', $output, realpath($path));
  11838. return trim($output) ?: null;
  11839. }
  11840. protected function getCommitLogs($fromReference, $toReference, $path)
  11841. {
  11842. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11843. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11844. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11845. }
  11846. return $output;
  11847. }
  11848. protected function hasMetadataRepository($path)
  11849. {
  11850. return is_dir($path . '/.hg');
  11851. }
  11852. }
  11853. <?php
  11854. namespace Composer\Downloader;
  11855. use Composer\Package\Archiver\ArchivableFilesFinder;
  11856. use Composer\Package\Dumper\ArrayDumper;
  11857. use Composer\Package\PackageInterface;
  11858. use Composer\Package\Version\VersionGuesser;
  11859. use Composer\Package\Version\VersionParser;
  11860. use Composer\Util\Platform;
  11861. use Composer\Util\ProcessExecutor;
  11862. use Composer\Util\Filesystem as ComposerFilesystem;
  11863. use Symfony\Component\Filesystem\Exception\IOException;
  11864. use Symfony\Component\Filesystem\Filesystem;
  11865. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11866. {
  11867. const STRATEGY_SYMLINK = 10;
  11868. const STRATEGY_MIRROR = 20;
  11869. public function download(PackageInterface $package, $path, $output = true)
  11870. {
  11871. $url = $package->getDistUrl();
  11872. $realUrl = realpath($url);
  11873. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11874. throw new \RuntimeException(sprintf(
  11875. 'Source path "%s" is not found for package %s',
  11876. $url,
  11877. $package->getName()
  11878. ));
  11879. }
  11880. if (realpath($path) === $realUrl) {
  11881. if ($output) {
  11882. $this->io->writeError(sprintf(
  11883. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11884. $package->getName(),
  11885. $package->getFullPrettyVersion()
  11886. ));
  11887. }
  11888. return;
  11889. }
  11890. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11891. throw new \RuntimeException(sprintf(
  11892. 'Package %s cannot install to "%s" inside its source at "%s"',
  11893. $package->getName(),
  11894. realpath($path),
  11895. $realUrl
  11896. ));
  11897. }
  11898. $transportOptions = $package->getTransportOptions() + array('symlink' => null, 'relative' => true);
  11899. $currentStrategy = self::STRATEGY_SYMLINK;
  11900. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11901. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11902. if ($mirrorPathRepos) {
  11903. $currentStrategy = self::STRATEGY_MIRROR;
  11904. }
  11905. if (true === $transportOptions['symlink']) {
  11906. $currentStrategy = self::STRATEGY_SYMLINK;
  11907. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11908. } elseif (false === $transportOptions['symlink']) {
  11909. $currentStrategy = self::STRATEGY_MIRROR;
  11910. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11911. }
  11912. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11913. $currentStrategy = self::STRATEGY_MIRROR;
  11914. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11915. }
  11916. $fileSystem = new Filesystem();
  11917. $this->filesystem->removeDirectory($path);
  11918. if ($output) {
  11919. $this->io->writeError(sprintf(
  11920. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11921. $package->getName(),
  11922. $package->getFullPrettyVersion()
  11923. ), false);
  11924. }
  11925. $isFallback = false;
  11926. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11927. try {
  11928. if (Platform::isWindows()) {
  11929. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11930. $this->filesystem->junction($realUrl, $path);
  11931. } else {
  11932. $absolutePath = $path;
  11933. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11934. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11935. }
  11936. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11937. $path = rtrim($path, "/");
  11938. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11939. if ($transportOptions['relative']) {
  11940. $fileSystem->symlink($shortestPath, $path);
  11941. } else {
  11942. $fileSystem->symlink($realUrl, $path);
  11943. }
  11944. }
  11945. } catch (IOException $e) {
  11946. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11947. $this->io->writeError('');
  11948. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11949. $currentStrategy = self::STRATEGY_MIRROR;
  11950. $isFallback = true;
  11951. } else {
  11952. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11953. }
  11954. }
  11955. }
  11956. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11957. $fs = new ComposerFilesystem();
  11958. $realUrl = $fs->normalizePath($realUrl);
  11959. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11960. $iterator = new ArchivableFilesFinder($realUrl, array());
  11961. $fileSystem->mirror($realUrl, $path, $iterator);
  11962. }
  11963. $this->io->writeError('');
  11964. }
  11965. public function remove(PackageInterface $package, $path, $output = true)
  11966. {
  11967. $realUrl = realpath($package->getDistUrl());
  11968. if (realpath($path) === $realUrl) {
  11969. if ($output) {
  11970. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11971. }
  11972. return;
  11973. }
  11974. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11975. if ($output) {
  11976. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11977. }
  11978. if (!$this->filesystem->removeJunction($path)) {
  11979. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11980. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11981. }
  11982. } else {
  11983. parent::remove($package, $path, $output);
  11984. }
  11985. }
  11986. public function getVcsReference(PackageInterface $package, $path)
  11987. {
  11988. $parser = new VersionParser;
  11989. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11990. $dumper = new ArrayDumper;
  11991. $packageConfig = $dumper->dump($package);
  11992. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11993. return $packageVersion['commit'];
  11994. }
  11995. }
  11996. private function safeJunctions()
  11997. {
  11998. return function_exists('proc_open') &&
  11999. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  12000. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  12001. }
  12002. }
  12003. <?php
  12004. namespace Composer\Downloader;
  12005. use Composer\Util\Filesystem;
  12006. class PearPackageExtractor
  12007. {
  12008. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  12009. private $filesystem;
  12010. private $file;
  12011. public function __construct($file)
  12012. {
  12013. if (!is_file($file)) {
  12014. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  12015. }
  12016. $this->filesystem = new Filesystem();
  12017. $this->file = $file;
  12018. }
  12019. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  12020. {
  12021. $extractionPath = $target.'/tarball';
  12022. try {
  12023. $archive = new \PharData($this->file);
  12024. $archive->extractTo($extractionPath, null, true);
  12025. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  12026. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  12027. }
  12028. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  12029. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  12030. $this->filesystem->removeDirectory($extractionPath);
  12031. } catch (\Exception $exception) {
  12032. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  12033. }
  12034. }
  12035. private function copyFiles($files, $source, $target, $roles, $vars)
  12036. {
  12037. foreach ($files as $file) {
  12038. $from = $this->combine($source, $file['from']);
  12039. $to = $this->combine($target, $roles[$file['role']]);
  12040. $to = $this->combine($to, $file['to']);
  12041. $tasks = $file['tasks'];
  12042. $this->copyFile($from, $to, $tasks, $vars);
  12043. }
  12044. }
  12045. private function copyFile($from, $to, $tasks, $vars)
  12046. {
  12047. if (!is_file($from)) {
  12048. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  12049. }
  12050. $this->filesystem->ensureDirectoryExists(dirname($to));
  12051. if (0 == count($tasks)) {
  12052. $copied = copy($from, $to);
  12053. } else {
  12054. $content = file_get_contents($from);
  12055. $replacements = array();
  12056. foreach ($tasks as $task) {
  12057. $pattern = $task['from'];
  12058. $varName = $task['to'];
  12059. if (isset($vars[$varName])) {
  12060. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  12061. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  12062. } else {
  12063. $replacements[$pattern] = $vars[$varName];
  12064. }
  12065. }
  12066. }
  12067. $content = strtr($content, $replacements);
  12068. $copied = file_put_contents($to, $content);
  12069. }
  12070. if (false === $copied) {
  12071. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  12072. }
  12073. }
  12074. private function buildCopyActions($source, array $roles, $vars)
  12075. {
  12076. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  12077. if (false === $package) {
  12078. throw new \RuntimeException('Package definition file is not valid.');
  12079. }
  12080. $packageSchemaVersion = $package['version'];
  12081. if ('1.0' == $packageSchemaVersion) {
  12082. $children = $package->release->filelist->children();
  12083. $packageName = (string) $package->name;
  12084. $packageVersion = (string) $package->release->version;
  12085. $sourceDir = $packageName . '-' . $packageVersion;
  12086. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  12087. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  12088. $children = $package->contents->children();
  12089. $packageName = (string) $package->name;
  12090. $packageVersion = (string) $package->version->release;
  12091. $sourceDir = $packageName . '-' . $packageVersion;
  12092. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  12093. $namespaces = $package->getNamespaces();
  12094. $package->registerXPathNamespace('ns', $namespaces['']);
  12095. $releaseNodes = $package->xpath('ns:phprelease');
  12096. $this->applyRelease($result, $releaseNodes, $vars);
  12097. } else {
  12098. throw new \RuntimeException('Unsupported schema version of package definition file.');
  12099. }
  12100. return $result;
  12101. }
  12102. private function applyRelease(&$actions, $releaseNodes, $vars)
  12103. {
  12104. foreach ($releaseNodes as $releaseNode) {
  12105. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  12106. if ($requiredOs && $vars['os'] != $requiredOs) {
  12107. continue;
  12108. }
  12109. if ($releaseNode->filelist) {
  12110. foreach ($releaseNode->filelist->children() as $action) {
  12111. if ('install' == $action->getName()) {
  12112. $name = (string) $action['name'];
  12113. $as = (string) $action['as'];
  12114. if (isset($actions[$name])) {
  12115. $actions[$name]['to'] = $as;
  12116. }
  12117. } elseif ('ignore' == $action->getName()) {
  12118. $name = (string) $action['name'];
  12119. unset($actions[$name]);
  12120. } else {
  12121. }
  12122. }
  12123. }
  12124. break;
  12125. }
  12126. }
  12127. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  12128. {
  12129. $result = array();
  12130. foreach ($children as $child) {
  12131. if ($child->getName() == 'dir') {
  12132. $dirSource = $this->combine($source, (string) $child['name']);
  12133. $dirTarget = $child['baseinstalldir'] ?: $target;
  12134. $dirRole = $child['role'] ?: $role;
  12135. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12136. $result = array_merge($result, $dirFiles);
  12137. } elseif ($child->getName() == 'file') {
  12138. $fileRole = (string) $child['role'] ?: $role;
  12139. if (isset($targetRoles[$fileRole])) {
  12140. $fileName = (string) ($child['name'] ?: $child[0]);
  12141. $fileSource = $this->combine($source, $fileName);
  12142. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  12143. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12144. $fileTarget = $packageName . '/' . $fileTarget;
  12145. }
  12146. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  12147. }
  12148. }
  12149. }
  12150. return $result;
  12151. }
  12152. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  12153. {
  12154. $result = array();
  12155. foreach ($children as $child) {
  12156. if ('dir' == $child->getName()) {
  12157. $dirSource = $this->combine($source, $child['name']);
  12158. $dirTarget = $child['baseinstalldir'] ?: $target;
  12159. $dirRole = $child['role'] ?: $role;
  12160. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  12161. $result = array_merge($result, $dirFiles);
  12162. } elseif ('file' == $child->getName()) {
  12163. $fileRole = (string) $child['role'] ?: $role;
  12164. if (isset($targetRoles[$fileRole])) {
  12165. $fileSource = $this->combine($source, (string) $child['name']);
  12166. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  12167. $fileTasks = array();
  12168. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  12169. if ('replace' == $taskNode->getName()) {
  12170. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  12171. }
  12172. }
  12173. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  12174. $fileTarget = $packageName . '/' . $fileTarget;
  12175. }
  12176. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  12177. }
  12178. }
  12179. }
  12180. return $result;
  12181. }
  12182. private function combine($left, $right)
  12183. {
  12184. return rtrim($left, '/') . '/' . ltrim($right, '/');
  12185. }
  12186. }
  12187. <?php
  12188. namespace Composer\Downloader;
  12189. use Composer\Package\PackageInterface;
  12190. use Composer\Repository\VcsRepository;
  12191. use Composer\Util\Perforce;
  12192. class PerforceDownloader extends VcsDownloader
  12193. {
  12194. protected $perforce;
  12195. public function doDownload(PackageInterface $package, $path, $url)
  12196. {
  12197. $ref = $package->getSourceReference();
  12198. $label = $this->getLabelFromSourceReference($ref);
  12199. $this->io->writeError('Cloning ' . $ref);
  12200. $this->initPerforce($package, $path, $url);
  12201. $this->perforce->setStream($ref);
  12202. $this->perforce->p4Login();
  12203. $this->perforce->writeP4ClientSpec();
  12204. $this->perforce->connectClient();
  12205. $this->perforce->syncCodeBase($label);
  12206. $this->perforce->cleanupClientSpec();
  12207. }
  12208. private function getLabelFromSourceReference($ref)
  12209. {
  12210. $pos = strpos($ref, '@');
  12211. if (false !== $pos) {
  12212. return substr($ref, $pos + 1);
  12213. }
  12214. return null;
  12215. }
  12216. public function initPerforce(PackageInterface $package, $path, $url)
  12217. {
  12218. if (!empty($this->perforce)) {
  12219. $this->perforce->initializePath($path);
  12220. return;
  12221. }
  12222. $repository = $package->getRepository();
  12223. $repoConfig = null;
  12224. if ($repository instanceof VcsRepository) {
  12225. $repoConfig = $this->getRepoConfig($repository);
  12226. }
  12227. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  12228. }
  12229. private function getRepoConfig(VcsRepository $repository)
  12230. {
  12231. return $repository->getRepoConfig();
  12232. }
  12233. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12234. {
  12235. $this->doDownload($target, $path, $url);
  12236. }
  12237. public function getLocalChanges(PackageInterface $package, $path)
  12238. {
  12239. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  12240. }
  12241. protected function getCommitLogs($fromReference, $toReference, $path)
  12242. {
  12243. return $this->perforce->getCommitLogs($fromReference, $toReference);
  12244. }
  12245. public function setPerforce($perforce)
  12246. {
  12247. $this->perforce = $perforce;
  12248. }
  12249. protected function hasMetadataRepository($path)
  12250. {
  12251. return true;
  12252. }
  12253. }
  12254. <?php
  12255. namespace Composer\Downloader;
  12256. class PharDownloader extends ArchiveDownloader
  12257. {
  12258. protected function extract($file, $path)
  12259. {
  12260. $archive = new \Phar($file);
  12261. $archive->extractTo($path, null, true);
  12262. }
  12263. }
  12264. <?php
  12265. namespace Composer\Downloader;
  12266. use Composer\Config;
  12267. use Composer\Cache;
  12268. use Composer\EventDispatcher\EventDispatcher;
  12269. use Composer\Util\IniHelper;
  12270. use Composer\Util\Platform;
  12271. use Composer\Util\ProcessExecutor;
  12272. use Composer\Util\RemoteFilesystem;
  12273. use Composer\IO\IOInterface;
  12274. use RarArchive;
  12275. class RarDownloader extends ArchiveDownloader
  12276. {
  12277. protected $process;
  12278. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12279. {
  12280. $this->process = $process ?: new ProcessExecutor($io);
  12281. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12282. }
  12283. protected function extract($file, $path)
  12284. {
  12285. $processError = null;
  12286. if (!Platform::isWindows()) {
  12287. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  12288. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12289. return;
  12290. }
  12291. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12292. }
  12293. if (!class_exists('RarArchive')) {
  12294. $iniMessage = IniHelper::getMessage();
  12295. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  12296. . $iniMessage . "\n" . $processError;
  12297. if (!Platform::isWindows()) {
  12298. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  12299. }
  12300. throw new \RuntimeException($error);
  12301. }
  12302. $rarArchive = RarArchive::open($file);
  12303. if (false === $rarArchive) {
  12304. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  12305. }
  12306. $entries = $rarArchive->getEntries();
  12307. if (false === $entries) {
  12308. throw new \RuntimeException('Could not retrieve RAR archive entries');
  12309. }
  12310. foreach ($entries as $entry) {
  12311. if (false === $entry->extract($path)) {
  12312. throw new \RuntimeException('Could not extract entry');
  12313. }
  12314. }
  12315. $rarArchive->close();
  12316. }
  12317. }
  12318. <?php
  12319. namespace Composer\Downloader;
  12320. use Composer\Package\PackageInterface;
  12321. use Composer\Util\Svn as SvnUtil;
  12322. use Composer\Repository\VcsRepository;
  12323. use Composer\Util\ProcessExecutor;
  12324. class SvnDownloader extends VcsDownloader
  12325. {
  12326. protected $cacheCredentials = true;
  12327. public function doDownload(PackageInterface $package, $path, $url)
  12328. {
  12329. SvnUtil::cleanEnv();
  12330. $ref = $package->getSourceReference();
  12331. $repo = $package->getRepository();
  12332. if ($repo instanceof VcsRepository) {
  12333. $repoConfig = $repo->getRepoConfig();
  12334. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  12335. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  12336. }
  12337. }
  12338. $this->io->writeError(" Checking out ".$package->getSourceReference());
  12339. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  12340. }
  12341. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  12342. {
  12343. SvnUtil::cleanEnv();
  12344. $ref = $target->getSourceReference();
  12345. if (!$this->hasMetadataRepository($path)) {
  12346. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  12347. }
  12348. $util = new SvnUtil($url, $this->io, $this->config);
  12349. $flags = "";
  12350. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  12351. $flags .= ' --ignore-ancestry';
  12352. }
  12353. $this->io->writeError(" Checking out " . $ref);
  12354. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  12355. }
  12356. public function getLocalChanges(PackageInterface $package, $path)
  12357. {
  12358. if (!$this->hasMetadataRepository($path)) {
  12359. return null;
  12360. }
  12361. $this->process->execute('svn status --ignore-externals', $output, $path);
  12362. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  12363. }
  12364. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  12365. {
  12366. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12367. $util->setCacheCredentials($this->cacheCredentials);
  12368. try {
  12369. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  12370. } catch (\RuntimeException $e) {
  12371. throw new \RuntimeException(
  12372. 'Package could not be downloaded, '.$e->getMessage()
  12373. );
  12374. }
  12375. }
  12376. protected function cleanChanges(PackageInterface $package, $path, $update)
  12377. {
  12378. if (!$changes = $this->getLocalChanges($package, $path)) {
  12379. return;
  12380. }
  12381. if (!$this->io->isInteractive()) {
  12382. if (true === $this->config->get('discard-changes')) {
  12383. return $this->discardChanges($path);
  12384. }
  12385. return parent::cleanChanges($package, $path, $update);
  12386. }
  12387. $changes = array_map(function ($elem) {
  12388. return ' '.$elem;
  12389. }, preg_split('{\s*\r?\n\s*}', $changes));
  12390. $countChanges = count($changes);
  12391. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  12392. $this->io->writeError(array_slice($changes, 0, 10));
  12393. if ($countChanges > 10) {
  12394. $remainingChanges = $countChanges - 10;
  12395. $this->io->writeError(
  12396. sprintf(
  12397. ' <info>'.$remainingChanges.' more file%s modified, choose "v" to view the full list</info>',
  12398. $remainingChanges === 1 ? '' : 's'
  12399. )
  12400. );
  12401. }
  12402. while (true) {
  12403. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  12404. case 'y':
  12405. $this->discardChanges($path);
  12406. break 2;
  12407. case 'n':
  12408. throw new \RuntimeException('Update aborted');
  12409. case 'v':
  12410. $this->io->writeError($changes);
  12411. break;
  12412. case '?':
  12413. default:
  12414. $this->io->writeError(array(
  12415. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  12416. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  12417. ' v - view modified files',
  12418. ' ? - print help',
  12419. ));
  12420. break;
  12421. }
  12422. }
  12423. }
  12424. protected function getCommitLogs($fromReference, $toReference, $path)
  12425. {
  12426. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  12427. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  12428. if (0 !== $this->process->execute($command, $output, $path)) {
  12429. throw new \RuntimeException(
  12430. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  12431. );
  12432. }
  12433. $urlPattern = '#<url>(.*)</url>#';
  12434. if (preg_match($urlPattern, $output, $matches)) {
  12435. $baseUrl = $matches[1];
  12436. } else {
  12437. throw new \RuntimeException(
  12438. 'Unable to determine svn url for path '. $path
  12439. );
  12440. }
  12441. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  12442. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  12443. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  12444. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  12445. $util->setCacheCredentials($this->cacheCredentials);
  12446. try {
  12447. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  12448. } catch (\RuntimeException $e) {
  12449. throw new \RuntimeException(
  12450. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  12451. );
  12452. }
  12453. }
  12454. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  12455. }
  12456. protected function discardChanges($path)
  12457. {
  12458. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  12459. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  12460. }
  12461. }
  12462. protected function hasMetadataRepository($path)
  12463. {
  12464. return is_dir($path.'/.svn');
  12465. }
  12466. }
  12467. <?php
  12468. namespace Composer\Downloader;
  12469. class TarDownloader extends ArchiveDownloader
  12470. {
  12471. protected function extract($file, $path)
  12472. {
  12473. $archive = new \PharData($file);
  12474. $archive->extractTo($path, null, true);
  12475. }
  12476. }
  12477. <?php
  12478. namespace Composer\Downloader;
  12479. class TransportException extends \RuntimeException
  12480. {
  12481. protected $headers;
  12482. protected $response;
  12483. protected $statusCode;
  12484. public function setHeaders($headers)
  12485. {
  12486. $this->headers = $headers;
  12487. }
  12488. public function getHeaders()
  12489. {
  12490. return $this->headers;
  12491. }
  12492. public function setResponse($response)
  12493. {
  12494. $this->response = $response;
  12495. }
  12496. public function getResponse()
  12497. {
  12498. return $this->response;
  12499. }
  12500. public function setStatusCode($statusCode)
  12501. {
  12502. $this->statusCode = $statusCode;
  12503. }
  12504. public function getStatusCode()
  12505. {
  12506. return $this->statusCode;
  12507. }
  12508. }
  12509. <?php
  12510. namespace Composer\Downloader;
  12511. use Composer\Package\PackageInterface;
  12512. interface VcsCapableDownloaderInterface
  12513. {
  12514. public function getVcsReference(PackageInterface $package, $path);
  12515. }
  12516. <?php
  12517. namespace Composer\Downloader;
  12518. use Composer\Config;
  12519. use Composer\Package\Dumper\ArrayDumper;
  12520. use Composer\Package\PackageInterface;
  12521. use Composer\Package\Version\VersionGuesser;
  12522. use Composer\Package\Version\VersionParser;
  12523. use Composer\Util\ProcessExecutor;
  12524. use Composer\IO\IOInterface;
  12525. use Composer\Util\Filesystem;
  12526. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  12527. {
  12528. protected $io;
  12529. protected $config;
  12530. protected $process;
  12531. protected $filesystem;
  12532. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  12533. {
  12534. $this->io = $io;
  12535. $this->config = $config;
  12536. $this->process = $process ?: new ProcessExecutor($io);
  12537. $this->filesystem = $fs ?: new Filesystem($this->process);
  12538. }
  12539. public function getInstallationSource()
  12540. {
  12541. return 'source';
  12542. }
  12543. public function download(PackageInterface $package, $path)
  12544. {
  12545. if (!$package->getSourceReference()) {
  12546. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  12547. }
  12548. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  12549. $this->filesystem->emptyDirectory($path);
  12550. $urls = $package->getSourceUrls();
  12551. while ($url = array_shift($urls)) {
  12552. try {
  12553. if (Filesystem::isLocalPath($url)) {
  12554. $needle = 'file://';
  12555. $isFileProtocol = false;
  12556. if (0 === strpos($url, $needle)) {
  12557. $url = substr($url, strlen($needle));
  12558. $isFileProtocol = true;
  12559. }
  12560. if (false !== strpos($url, '%')) {
  12561. $url = rawurldecode($url);
  12562. }
  12563. $url = realpath($url);
  12564. if ($isFileProtocol) {
  12565. $url = $needle . $url;
  12566. }
  12567. }
  12568. $this->doDownload($package, $path, $url);
  12569. break;
  12570. } catch (\Exception $e) {
  12571. if ($e instanceof \PHPUnit_Framework_Exception) {
  12572. throw $e;
  12573. }
  12574. if ($this->io->isDebug()) {
  12575. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  12576. } elseif (count($urls)) {
  12577. $this->io->writeError(' Failed, trying the next URL');
  12578. }
  12579. if (!count($urls)) {
  12580. throw $e;
  12581. }
  12582. }
  12583. }
  12584. }
  12585. public function update(PackageInterface $initial, PackageInterface $target, $path)
  12586. {
  12587. if (!$target->getSourceReference()) {
  12588. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  12589. }
  12590. $name = $target->getName();
  12591. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12592. if ($target->getSourceType() === 'svn') {
  12593. $from = $initial->getSourceReference();
  12594. $to = $target->getSourceReference();
  12595. } else {
  12596. $from = substr($initial->getSourceReference(), 0, 7);
  12597. $to = substr($target->getSourceReference(), 0, 7);
  12598. }
  12599. $name .= ' '.$initial->getPrettyVersion();
  12600. } else {
  12601. $from = $initial->getFullPrettyVersion();
  12602. $to = $target->getFullPrettyVersion();
  12603. }
  12604. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12605. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12606. $this->cleanChanges($initial, $path, true);
  12607. $urls = $target->getSourceUrls();
  12608. $exception = null;
  12609. while ($url = array_shift($urls)) {
  12610. try {
  12611. if (Filesystem::isLocalPath($url)) {
  12612. $url = realpath($url);
  12613. }
  12614. $this->doUpdate($initial, $target, $path, $url);
  12615. $exception = null;
  12616. break;
  12617. } catch (\Exception $exception) {
  12618. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12619. throw $exception;
  12620. }
  12621. if ($this->io->isDebug()) {
  12622. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12623. } elseif (count($urls)) {
  12624. $this->io->writeError(' Failed, trying the next URL');
  12625. }
  12626. }
  12627. }
  12628. $this->reapplyChanges($path);
  12629. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12630. $message = 'Pulling in changes:';
  12631. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12632. if (!trim($logs)) {
  12633. $message = 'Rolling back changes:';
  12634. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12635. }
  12636. if (trim($logs)) {
  12637. $logs = implode("\n", array_map(function ($line) {
  12638. return ' ' . $line;
  12639. }, explode("\n", $logs)));
  12640. $logs = str_replace('<', '\<', $logs);
  12641. $this->io->writeError(' '.$message);
  12642. $this->io->writeError($logs);
  12643. }
  12644. }
  12645. if (!$urls && $exception) {
  12646. throw $exception;
  12647. }
  12648. }
  12649. public function remove(PackageInterface $package, $path)
  12650. {
  12651. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12652. $this->cleanChanges($package, $path, false);
  12653. if (!$this->filesystem->removeDirectory($path)) {
  12654. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12655. }
  12656. }
  12657. public function setOutputProgress($outputProgress)
  12658. {
  12659. return $this;
  12660. }
  12661. public function getVcsReference(PackageInterface $package, $path)
  12662. {
  12663. $parser = new VersionParser;
  12664. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12665. $dumper = new ArrayDumper;
  12666. $packageConfig = $dumper->dump($package);
  12667. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12668. return $packageVersion['commit'];
  12669. }
  12670. }
  12671. protected function cleanChanges(PackageInterface $package, $path, $update)
  12672. {
  12673. if (null !== $this->getLocalChanges($package, $path)) {
  12674. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12675. }
  12676. }
  12677. protected function reapplyChanges($path)
  12678. {
  12679. }
  12680. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12681. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12682. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12683. abstract protected function hasMetadataRepository($path);
  12684. }
  12685. <?php
  12686. namespace Composer\Downloader;
  12687. use Composer\Config;
  12688. use Composer\Cache;
  12689. use Composer\EventDispatcher\EventDispatcher;
  12690. use Composer\Package\PackageInterface;
  12691. use Composer\Util\ProcessExecutor;
  12692. use Composer\Util\RemoteFilesystem;
  12693. use Composer\IO\IOInterface;
  12694. class XzDownloader extends ArchiveDownloader
  12695. {
  12696. protected $process;
  12697. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12698. {
  12699. $this->process = $process ?: new ProcessExecutor($io);
  12700. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12701. }
  12702. protected function extract($file, $path)
  12703. {
  12704. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12705. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12706. return;
  12707. }
  12708. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12709. throw new \RuntimeException($processError);
  12710. }
  12711. protected function getFileName(PackageInterface $package, $path)
  12712. {
  12713. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12714. }
  12715. }
  12716. <?php
  12717. namespace Composer\Downloader;
  12718. use Composer\Config;
  12719. use Composer\Cache;
  12720. use Composer\EventDispatcher\EventDispatcher;
  12721. use Composer\Package\PackageInterface;
  12722. use Composer\Util\IniHelper;
  12723. use Composer\Util\Platform;
  12724. use Composer\Util\ProcessExecutor;
  12725. use Composer\Util\RemoteFilesystem;
  12726. use Composer\IO\IOInterface;
  12727. use Symfony\Component\Process\ExecutableFinder;
  12728. use ZipArchive;
  12729. class ZipDownloader extends ArchiveDownloader
  12730. {
  12731. protected static $hasSystemUnzip;
  12732. private static $hasZipArchive;
  12733. private static $isWindows;
  12734. protected $process;
  12735. private $zipArchiveObject;
  12736. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12737. {
  12738. $this->process = $process ?: new ProcessExecutor($io);
  12739. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12740. }
  12741. public function download(PackageInterface $package, $path, $output = true)
  12742. {
  12743. if (null === self::$hasSystemUnzip) {
  12744. $finder = new ExecutableFinder;
  12745. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12746. }
  12747. if (null === self::$hasZipArchive) {
  12748. self::$hasZipArchive = class_exists('ZipArchive');
  12749. }
  12750. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12751. $iniMessage = IniHelper::getMessage();
  12752. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12753. throw new \RuntimeException($error);
  12754. }
  12755. if (null === self::$isWindows) {
  12756. self::$isWindows = Platform::isWindows();
  12757. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12758. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12759. $this->io->writeError("<warning>This may cause invalid reports of corrupted archives. Besides, any UNIX permissions (e.g. executable) defined in the archives will be lost.</warning>");
  12760. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12761. }
  12762. }
  12763. return parent::download($package, $path, $output);
  12764. }
  12765. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12766. {
  12767. if (!self::$hasZipArchive) {
  12768. $isLastChance = true;
  12769. }
  12770. if (!self::$hasSystemUnzip && !$isLastChance) {
  12771. return $this->extractWithZipArchive($file, $path, true);
  12772. }
  12773. $processError = null;
  12774. $overwrite = $isLastChance ? '-o' : '';
  12775. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12776. try {
  12777. if (0 === $exitCode = $this->process->execute($command, $ignoredOutput)) {
  12778. return true;
  12779. }
  12780. $processError = new \RuntimeException('Failed to execute ('.$exitCode.') '.$command."\n\n".$this->process->getErrorOutput());
  12781. } catch (\Exception $e) {
  12782. $processError = $e;
  12783. }
  12784. if ($isLastChance) {
  12785. throw $processError;
  12786. }
  12787. $this->io->writeError(' '.$processError->getMessage());
  12788. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12789. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12790. return $this->extractWithZipArchive($file, $path, true);
  12791. }
  12792. protected function extractWithZipArchive($file, $path, $isLastChance)
  12793. {
  12794. if (!self::$hasSystemUnzip) {
  12795. $isLastChance = true;
  12796. }
  12797. if (!self::$hasZipArchive && !$isLastChance) {
  12798. return $this->extractWithSystemUnzip($file, $path, true);
  12799. }
  12800. $processError = null;
  12801. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12802. try {
  12803. if (true === ($retval = $zipArchive->open($file))) {
  12804. $extractResult = $zipArchive->extractTo($path);
  12805. if (true === $extractResult) {
  12806. $zipArchive->close();
  12807. return true;
  12808. }
  12809. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12810. } else {
  12811. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12812. }
  12813. } catch (\ErrorException $e) {
  12814. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12815. } catch (\Exception $e) {
  12816. $processError = $e;
  12817. }
  12818. if ($isLastChance) {
  12819. throw $processError;
  12820. }
  12821. $this->io->writeError(' '.$processError->getMessage());
  12822. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12823. return $this->extractWithSystemUnzip($file, $path, true);
  12824. }
  12825. public function extract($file, $path)
  12826. {
  12827. if (self::$isWindows) {
  12828. $this->extractWithZipArchive($file, $path, false);
  12829. } else {
  12830. $this->extractWithSystemUnzip($file, $path, false);
  12831. }
  12832. }
  12833. protected function getErrorMessage($retval, $file)
  12834. {
  12835. switch ($retval) {
  12836. case ZipArchive::ER_EXISTS:
  12837. return sprintf("File '%s' already exists.", $file);
  12838. case ZipArchive::ER_INCONS:
  12839. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12840. case ZipArchive::ER_INVAL:
  12841. return sprintf("Invalid argument (%s)", $file);
  12842. case ZipArchive::ER_MEMORY:
  12843. return sprintf("Malloc failure (%s)", $file);
  12844. case ZipArchive::ER_NOENT:
  12845. return sprintf("No such zip file: '%s'", $file);
  12846. case ZipArchive::ER_NOZIP:
  12847. return sprintf("'%s' is not a zip archive.", $file);
  12848. case ZipArchive::ER_OPEN:
  12849. return sprintf("Can't open zip file: %s", $file);
  12850. case ZipArchive::ER_READ:
  12851. return sprintf("Zip read error (%s)", $file);
  12852. case ZipArchive::ER_SEEK:
  12853. return sprintf("Zip seek error (%s)", $file);
  12854. default:
  12855. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12856. }
  12857. }
  12858. }
  12859. <?php
  12860. namespace Composer\EventDispatcher;
  12861. class Event
  12862. {
  12863. protected $name;
  12864. protected $args;
  12865. protected $flags;
  12866. private $propagationStopped = false;
  12867. public function __construct($name, array $args = array(), array $flags = array())
  12868. {
  12869. $this->name = $name;
  12870. $this->args = $args;
  12871. $this->flags = $flags;
  12872. }
  12873. public function getName()
  12874. {
  12875. return $this->name;
  12876. }
  12877. public function getArguments()
  12878. {
  12879. return $this->args;
  12880. }
  12881. public function getFlags()
  12882. {
  12883. return $this->flags;
  12884. }
  12885. public function isPropagationStopped()
  12886. {
  12887. return $this->propagationStopped;
  12888. }
  12889. public function stopPropagation()
  12890. {
  12891. $this->propagationStopped = true;
  12892. }
  12893. }
  12894. <?php
  12895. namespace Composer\EventDispatcher;
  12896. use Composer\DependencyResolver\PolicyInterface;
  12897. use Composer\DependencyResolver\Pool;
  12898. use Composer\DependencyResolver\Request;
  12899. use Composer\Installer\InstallerEvent;
  12900. use Composer\IO\IOInterface;
  12901. use Composer\Composer;
  12902. use Composer\DependencyResolver\Operation\OperationInterface;
  12903. use Composer\Repository\CompositeRepository;
  12904. use Composer\Script;
  12905. use Composer\Installer\PackageEvent;
  12906. use Composer\Installer\BinaryInstaller;
  12907. use Composer\Util\ProcessExecutor;
  12908. use Composer\Script\Event as ScriptEvent;
  12909. use Symfony\Component\Process\PhpExecutableFinder;
  12910. class EventDispatcher
  12911. {
  12912. protected $composer;
  12913. protected $io;
  12914. protected $loader;
  12915. protected $process;
  12916. protected $listeners;
  12917. private $eventStack;
  12918. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12919. {
  12920. $this->composer = $composer;
  12921. $this->io = $io;
  12922. $this->process = $process ?: new ProcessExecutor($io);
  12923. $this->eventStack = array();
  12924. }
  12925. public function dispatch($eventName, Event $event = null)
  12926. {
  12927. if (null === $event) {
  12928. $event = new Event($eventName);
  12929. }
  12930. return $this->doDispatch($event);
  12931. }
  12932. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12933. {
  12934. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12935. }
  12936. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12937. {
  12938. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12939. }
  12940. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12941. {
  12942. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12943. }
  12944. protected function doDispatch(Event $event)
  12945. {
  12946. $listeners = $this->getListeners($event);
  12947. $this->pushEvent($event);
  12948. $return = 0;
  12949. foreach ($listeners as $callable) {
  12950. $this->ensureBinDirIsInPath();
  12951. if (!is_string($callable)) {
  12952. if (!is_callable($callable)) {
  12953. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12954. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12955. }
  12956. $event = $this->checkListenerExpectedEvent($callable, $event);
  12957. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12958. } elseif ($this->isComposerScript($callable)) {
  12959. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12960. $script = explode(' ', substr($callable, 1));
  12961. $scriptName = $script[0];
  12962. unset($script[0]);
  12963. $args = array_merge($script, $event->getArguments());
  12964. $flags = $event->getFlags();
  12965. if (substr($callable, 0, 10) === '@composer ') {
  12966. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12967. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12968. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12969. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12970. }
  12971. } else {
  12972. if (!$this->getListeners(new Event($scriptName))) {
  12973. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12974. }
  12975. try {
  12976. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12977. $scriptEvent->setOriginatingEvent($event);
  12978. $return = $this->dispatch($scriptName, $scriptEvent);
  12979. } catch (ScriptExecutionException $e) {
  12980. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12981. throw $e;
  12982. }
  12983. }
  12984. } elseif ($this->isPhpScript($callable)) {
  12985. $className = substr($callable, 0, strpos($callable, '::'));
  12986. $methodName = substr($callable, strpos($callable, '::') + 2);
  12987. if (!class_exists($className)) {
  12988. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12989. continue;
  12990. }
  12991. if (!is_callable($callable)) {
  12992. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12993. continue;
  12994. }
  12995. try {
  12996. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12997. } catch (\Exception $e) {
  12998. $message = "Script %s handling the %s event terminated with an exception";
  12999. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  13000. throw $e;
  13001. }
  13002. } else {
  13003. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  13004. $exec = $callable . ($args === '' ? '' : ' '.$args);
  13005. if ($this->io->isVerbose()) {
  13006. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  13007. } else {
  13008. $this->io->writeError(sprintf('> %s', $exec));
  13009. }
  13010. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  13011. if ($possibleLocalBinaries) {
  13012. foreach ($possibleLocalBinaries as $localExec) {
  13013. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  13014. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  13015. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  13016. break;
  13017. }
  13018. }
  13019. }
  13020. if (substr($exec, 0, 8) === '@putenv ') {
  13021. putenv(substr($exec, 8));
  13022. continue;
  13023. } elseif (substr($exec, 0, 5) === '@php ') {
  13024. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  13025. } else {
  13026. $finder = new PhpExecutableFinder();
  13027. $phpPath = $finder->find(false);
  13028. if ($phpPath) {
  13029. $_SERVER['PHP_BINARY'] = $phpPath;
  13030. putenv('PHP_BINARY=' . $_SERVER['PHP_BINARY']);
  13031. }
  13032. }
  13033. if (substr($exec, 0, 9) === 'composer ') {
  13034. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($exec, 8);
  13035. }
  13036. if (0 !== ($exitCode = $this->process->execute($exec))) {
  13037. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  13038. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  13039. }
  13040. }
  13041. if ($event->isPropagationStopped()) {
  13042. break;
  13043. }
  13044. }
  13045. $this->popEvent();
  13046. return $return;
  13047. }
  13048. protected function getPhpExecCommand()
  13049. {
  13050. $finder = new PhpExecutableFinder();
  13051. $phpPath = $finder->find(false);
  13052. if (!$phpPath) {
  13053. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  13054. }
  13055. $phpArgs = $finder->findArguments();
  13056. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  13057. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  13058. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  13059. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  13060. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  13061. }
  13062. protected function executeEventPhpScript($className, $methodName, Event $event)
  13063. {
  13064. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  13065. if ($this->io->isVerbose()) {
  13066. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  13067. } else {
  13068. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  13069. }
  13070. return $className::$methodName($event);
  13071. }
  13072. protected function checkListenerExpectedEvent($target, Event $event)
  13073. {
  13074. if (in_array($event->getName(), array(
  13075. 'init',
  13076. 'command',
  13077. 'pre-file-download',
  13078. ), true)) {
  13079. return $event;
  13080. }
  13081. try {
  13082. $reflected = new \ReflectionParameter($target, 0);
  13083. } catch (\Exception $e) {
  13084. return $event;
  13085. }
  13086. $expected = null;
  13087. $isClass = false;
  13088. if (\PHP_VERSION_ID >= 70000) {
  13089. $reflectionType = $reflected->getType();
  13090. if ($reflectionType) {
  13091. $expected = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  13092. $isClass = !$reflectionType->isBuiltin();
  13093. }
  13094. } else {
  13095. $expected = $reflected->getClass() ? $reflected->getClass()->getName() : null;
  13096. $isClass = null !== $expected;
  13097. }
  13098. if (!$isClass) {
  13099. return $event;
  13100. }
  13101. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  13102. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13103. $event = new \Composer\Script\CommandEvent(
  13104. $event->getName(),
  13105. $event->getComposer(),
  13106. $event->getIO(),
  13107. $event->isDevMode(),
  13108. $event->getArguments()
  13109. );
  13110. }
  13111. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  13112. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13113. $event = new \Composer\Script\PackageEvent(
  13114. $event->getName(),
  13115. $event->getComposer(),
  13116. $event->getIO(),
  13117. $event->isDevMode(),
  13118. $event->getPolicy(),
  13119. $event->getPool(),
  13120. $event->getInstalledRepo(),
  13121. $event->getRequest(),
  13122. $event->getOperations(),
  13123. $event->getOperation()
  13124. );
  13125. }
  13126. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  13127. trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
  13128. $event = new \Composer\Script\Event(
  13129. $event->getName(),
  13130. $event->getComposer(),
  13131. $event->getIO(),
  13132. $event->isDevMode(),
  13133. $event->getArguments(),
  13134. $event->getFlags()
  13135. );
  13136. }
  13137. return $event;
  13138. }
  13139. private function serializeCallback($cb)
  13140. {
  13141. if (is_array($cb) && count($cb) === 2) {
  13142. if (is_object($cb[0])) {
  13143. $cb[0] = get_class($cb[0]);
  13144. }
  13145. if (is_string($cb[0]) && is_string($cb[1])) {
  13146. $cb = implode('::', $cb);
  13147. }
  13148. }
  13149. if (is_string($cb)) {
  13150. return $cb;
  13151. }
  13152. return var_export($cb, true);
  13153. }
  13154. public function addListener($eventName, $listener, $priority = 0)
  13155. {
  13156. $this->listeners[$eventName][$priority][] = $listener;
  13157. }
  13158. public function addSubscriber(EventSubscriberInterface $subscriber)
  13159. {
  13160. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  13161. if (is_string($params)) {
  13162. $this->addListener($eventName, array($subscriber, $params));
  13163. } elseif (is_string($params[0])) {
  13164. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  13165. } else {
  13166. foreach ($params as $listener) {
  13167. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  13168. }
  13169. }
  13170. }
  13171. }
  13172. protected function getListeners(Event $event)
  13173. {
  13174. $scriptListeners = $this->getScriptListeners($event);
  13175. if (!isset($this->listeners[$event->getName()][0])) {
  13176. $this->listeners[$event->getName()][0] = array();
  13177. }
  13178. krsort($this->listeners[$event->getName()]);
  13179. $listeners = $this->listeners;
  13180. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  13181. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  13182. }
  13183. public function hasEventListeners(Event $event)
  13184. {
  13185. $listeners = $this->getListeners($event);
  13186. return count($listeners) > 0;
  13187. }
  13188. protected function getScriptListeners(Event $event)
  13189. {
  13190. $package = $this->composer->getPackage();
  13191. $scripts = $package->getScripts();
  13192. if (empty($scripts[$event->getName()])) {
  13193. return array();
  13194. }
  13195. if ($this->loader) {
  13196. $this->loader->unregister();
  13197. }
  13198. $generator = $this->composer->getAutoloadGenerator();
  13199. if ($event instanceof ScriptEvent) {
  13200. $generator->setDevMode($event->isDevMode());
  13201. }
  13202. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  13203. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  13204. $map = $generator->parseAutoloads($packageMap, $package);
  13205. $this->loader = $generator->createLoader($map);
  13206. $this->loader->register();
  13207. return $scripts[$event->getName()];
  13208. }
  13209. protected function isPhpScript($callable)
  13210. {
  13211. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  13212. }
  13213. protected function isComposerScript($callable)
  13214. {
  13215. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5) && '@putenv ' !== substr($callable, 0, 8);
  13216. }
  13217. protected function pushEvent(Event $event)
  13218. {
  13219. $eventName = $event->getName();
  13220. if (in_array($eventName, $this->eventStack)) {
  13221. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  13222. }
  13223. return array_push($this->eventStack, $eventName);
  13224. }
  13225. protected function popEvent()
  13226. {
  13227. return array_pop($this->eventStack);
  13228. }
  13229. private function ensureBinDirIsInPath()
  13230. {
  13231. $pathStr = 'PATH';
  13232. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  13233. $pathStr = 'Path';
  13234. }
  13235. $binDir = $this->composer->getConfig()->get('bin-dir');
  13236. if (is_dir($binDir)) {
  13237. $binDir = realpath($binDir);
  13238. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  13239. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  13240. putenv($pathStr.'='.$_SERVER[$pathStr]);
  13241. }
  13242. }
  13243. }
  13244. }
  13245. <?php
  13246. namespace Composer\EventDispatcher;
  13247. interface EventSubscriberInterface
  13248. {
  13249. public static function getSubscribedEvents();
  13250. }
  13251. <?php
  13252. namespace Composer\EventDispatcher;
  13253. class ScriptExecutionException extends \RuntimeException
  13254. {
  13255. }
  13256. <?php
  13257. namespace Composer\Exception;
  13258. class NoSslException extends \RuntimeException
  13259. {
  13260. }
  13261. <?php
  13262. namespace Composer;
  13263. use Composer\Config\JsonConfigSource;
  13264. use Composer\Json\JsonFile;
  13265. use Composer\IO\IOInterface;
  13266. use Composer\Package\Archiver;
  13267. use Composer\Package\Version\VersionGuesser;
  13268. use Composer\Repository\RepositoryManager;
  13269. use Composer\Repository\RepositoryFactory;
  13270. use Composer\Repository\WritableRepositoryInterface;
  13271. use Composer\Util\Filesystem;
  13272. use Composer\Util\Platform;
  13273. use Composer\Util\ProcessExecutor;
  13274. use Composer\Util\RemoteFilesystem;
  13275. use Composer\Util\Silencer;
  13276. use Composer\Plugin\PluginEvents;
  13277. use Composer\EventDispatcher\Event;
  13278. use Seld\JsonLint\DuplicateKeyException;
  13279. use Symfony\Component\Console\Formatter\OutputFormatter;
  13280. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  13281. use Symfony\Component\Console\Output\ConsoleOutput;
  13282. use Composer\EventDispatcher\EventDispatcher;
  13283. use Composer\Autoload\AutoloadGenerator;
  13284. use Composer\Package\Version\VersionParser;
  13285. use Composer\Downloader\TransportException;
  13286. use Seld\JsonLint\JsonParser;
  13287. class Factory
  13288. {
  13289. protected static function getHomeDir()
  13290. {
  13291. $home = getenv('COMPOSER_HOME');
  13292. if ($home) {
  13293. return $home;
  13294. }
  13295. if (Platform::isWindows()) {
  13296. if (!getenv('APPDATA')) {
  13297. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13298. }
  13299. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  13300. }
  13301. $userDir = self::getUserDir();
  13302. if (is_dir($userDir . '/.composer')) {
  13303. return $userDir . '/.composer';
  13304. }
  13305. if (self::useXdg()) {
  13306. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  13307. return $xdgConfig . '/composer';
  13308. }
  13309. return $userDir . '/.composer';
  13310. }
  13311. protected static function getCacheDir($home)
  13312. {
  13313. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  13314. if ($cacheDir) {
  13315. return $cacheDir;
  13316. }
  13317. $homeEnv = getenv('COMPOSER_HOME');
  13318. if ($homeEnv) {
  13319. return $homeEnv . '/cache';
  13320. }
  13321. if (Platform::isWindows()) {
  13322. if ($cacheDir = getenv('LOCALAPPDATA')) {
  13323. $cacheDir .= '/Composer';
  13324. } else {
  13325. $cacheDir = $home . '/cache';
  13326. }
  13327. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  13328. }
  13329. $userDir = self::getUserDir();
  13330. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  13331. return $home . '/cache';
  13332. }
  13333. if (self::useXdg()) {
  13334. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  13335. return $xdgCache . '/composer';
  13336. }
  13337. return $home . '/cache';
  13338. }
  13339. protected static function getDataDir($home)
  13340. {
  13341. $homeEnv = getenv('COMPOSER_HOME');
  13342. if ($homeEnv) {
  13343. return $homeEnv;
  13344. }
  13345. if (Platform::isWindows()) {
  13346. return strtr($home, '\\', '/');
  13347. }
  13348. $userDir = self::getUserDir();
  13349. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  13350. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  13351. return $xdgData . '/composer';
  13352. }
  13353. return $home;
  13354. }
  13355. public static function createConfig(IOInterface $io = null, $cwd = null)
  13356. {
  13357. $cwd = $cwd ?: getcwd();
  13358. $config = new Config(true, $cwd);
  13359. $home = self::getHomeDir();
  13360. $config->merge(array('config' => array(
  13361. 'home' => $home,
  13362. 'cache-dir' => self::getCacheDir($home),
  13363. 'data-dir' => self::getDataDir($home),
  13364. )));
  13365. $file = new JsonFile($config->get('home').'/config.json');
  13366. if ($file->exists()) {
  13367. if ($io && $io->isDebug()) {
  13368. $io->writeError('Loading config file ' . $file->getPath());
  13369. }
  13370. $config->merge($file->read());
  13371. }
  13372. $config->setConfigSource(new JsonConfigSource($file));
  13373. $htaccessProtect = (bool) $config->get('htaccess-protect');
  13374. if ($htaccessProtect) {
  13375. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  13376. foreach ($dirs as $dir) {
  13377. if (!file_exists($dir . '/.htaccess')) {
  13378. if (!is_dir($dir)) {
  13379. Silencer::call('mkdir', $dir, 0777, true);
  13380. }
  13381. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  13382. }
  13383. }
  13384. }
  13385. $file = new JsonFile($config->get('home').'/auth.json');
  13386. if ($file->exists()) {
  13387. if ($io && $io->isDebug()) {
  13388. $io->writeError('Loading config file ' . $file->getPath());
  13389. }
  13390. $config->merge(array('config' => $file->read()));
  13391. }
  13392. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  13393. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  13394. $authData = json_decode($composerAuthEnv, true);
  13395. if (null === $authData) {
  13396. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  13397. }
  13398. if ($io && $io->isDebug()) {
  13399. $io->writeError('Loading auth config from COMPOSER_AUTH');
  13400. }
  13401. $config->merge(array('config' => $authData));
  13402. }
  13403. return $config;
  13404. }
  13405. public static function getComposerFile()
  13406. {
  13407. return trim(getenv('COMPOSER')) ?: './composer.json';
  13408. }
  13409. public static function createAdditionalStyles()
  13410. {
  13411. return array(
  13412. 'highlight' => new OutputFormatterStyle('red'),
  13413. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  13414. );
  13415. }
  13416. public static function createOutput()
  13417. {
  13418. $styles = self::createAdditionalStyles();
  13419. $formatter = new OutputFormatter(false, $styles);
  13420. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  13421. }
  13422. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  13423. {
  13424. return RepositoryFactory::defaultRepos($io, $config, $rm);
  13425. }
  13426. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  13427. {
  13428. $cwd = $cwd ?: getcwd();
  13429. if (null === $localConfig) {
  13430. $localConfig = static::getComposerFile();
  13431. }
  13432. if (is_string($localConfig)) {
  13433. $composerFile = $localConfig;
  13434. $file = new JsonFile($localConfig, null, $io);
  13435. if (!$file->exists()) {
  13436. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  13437. $message = 'Composer could not find a composer.json file in '.$cwd;
  13438. } else {
  13439. $message = 'Composer could not find the config file: '.$localConfig;
  13440. }
  13441. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  13442. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  13443. }
  13444. $file->validateSchema(JsonFile::LAX_SCHEMA);
  13445. $jsonParser = new JsonParser;
  13446. try {
  13447. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  13448. } catch (DuplicateKeyException $e) {
  13449. $details = $e->getDetails();
  13450. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  13451. }
  13452. $localConfig = $file->read();
  13453. }
  13454. $config = static::createConfig($io, $cwd);
  13455. $config->merge($localConfig);
  13456. if (isset($composerFile)) {
  13457. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  13458. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  13459. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  13460. if ($localAuthFile->exists()) {
  13461. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  13462. $config->merge(array('config' => $localAuthFile->read()));
  13463. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  13464. }
  13465. }
  13466. $vendorDir = $config->get('vendor-dir');
  13467. $composer = new Composer();
  13468. $composer->setConfig($config);
  13469. if ($fullLoad) {
  13470. $io->loadConfiguration($config);
  13471. }
  13472. $rfs = self::createRemoteFilesystem($io, $config);
  13473. $dispatcher = new EventDispatcher($composer, $io);
  13474. $composer->setEventDispatcher($dispatcher);
  13475. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  13476. $composer->setRepositoryManager($rm);
  13477. $this->addLocalRepository($io, $rm, $vendorDir);
  13478. if (!$fullLoad && !isset($localConfig['version'])) {
  13479. $localConfig['version'] = '1.0.0';
  13480. }
  13481. $parser = new VersionParser;
  13482. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  13483. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  13484. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  13485. $composer->setPackage($package);
  13486. $im = $this->createInstallationManager();
  13487. $composer->setInstallationManager($im);
  13488. if ($fullLoad) {
  13489. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  13490. $composer->setDownloadManager($dm);
  13491. $generator = new AutoloadGenerator($dispatcher, $io);
  13492. $composer->setAutoloadGenerator($generator);
  13493. $am = $this->createArchiveManager($config, $dm);
  13494. $composer->setArchiveManager($am);
  13495. }
  13496. $this->createDefaultInstallers($im, $composer, $io);
  13497. if ($fullLoad) {
  13498. $globalComposer = null;
  13499. if (realpath($config->get('home')) !== $cwd) {
  13500. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  13501. }
  13502. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  13503. $composer->setPluginManager($pm);
  13504. $pm->loadInstalledPlugins();
  13505. }
  13506. if ($fullLoad && isset($composerFile)) {
  13507. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  13508. ? substr($composerFile, 0, -4).'lock'
  13509. : $composerFile . '.lock';
  13510. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  13511. $composer->setLocker($locker);
  13512. }
  13513. if ($fullLoad) {
  13514. $initEvent = new Event(PluginEvents::INIT);
  13515. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  13516. if ($rm->getLocalRepository()) {
  13517. $this->purgePackages($rm->getLocalRepository(), $im);
  13518. }
  13519. }
  13520. return $composer;
  13521. }
  13522. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  13523. {
  13524. $factory = new static();
  13525. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  13526. }
  13527. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  13528. {
  13529. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  13530. }
  13531. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  13532. {
  13533. $composer = null;
  13534. try {
  13535. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  13536. } catch (\Exception $e) {
  13537. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  13538. }
  13539. return $composer;
  13540. }
  13541. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  13542. {
  13543. $cache = null;
  13544. if ($config->get('cache-files-ttl') > 0) {
  13545. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  13546. }
  13547. $dm = new Downloader\DownloadManager($io);
  13548. switch ($preferred = $config->get('preferred-install')) {
  13549. case 'dist':
  13550. $dm->setPreferDist(true);
  13551. break;
  13552. case 'source':
  13553. $dm->setPreferSource(true);
  13554. break;
  13555. case 'auto':
  13556. default:
  13557. break;
  13558. }
  13559. if (is_array($preferred)) {
  13560. $dm->setPreferences($preferred);
  13561. }
  13562. $executor = new ProcessExecutor($io);
  13563. $fs = new Filesystem($executor);
  13564. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  13565. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  13566. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  13567. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  13568. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  13569. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13570. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13571. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13572. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13573. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  13574. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13575. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13576. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  13577. return $dm;
  13578. }
  13579. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  13580. {
  13581. if (null === $dm) {
  13582. $io = new IO\NullIO();
  13583. $io->loadConfiguration($config);
  13584. $dm = $this->createDownloadManager($io, $config);
  13585. }
  13586. $am = new Archiver\ArchiveManager($dm);
  13587. $am->addArchiver(new Archiver\ZipArchiver);
  13588. $am->addArchiver(new Archiver\PharArchiver);
  13589. return $am;
  13590. }
  13591. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  13592. {
  13593. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  13594. }
  13595. protected function createInstallationManager()
  13596. {
  13597. return new Installer\InstallationManager();
  13598. }
  13599. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  13600. {
  13601. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  13602. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  13603. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  13604. $im->addInstaller(new Installer\MetapackageInstaller($io));
  13605. }
  13606. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  13607. {
  13608. foreach ($repo->getPackages() as $package) {
  13609. if (!$im->isPackageInstalled($repo, $package)) {
  13610. $repo->removePackage($package);
  13611. }
  13612. }
  13613. }
  13614. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13615. {
  13616. $factory = new static();
  13617. return $factory->createComposer($io, $config, $disablePlugins);
  13618. }
  13619. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13620. {
  13621. static $warned = false;
  13622. $disableTls = false;
  13623. if (isset($_SERVER['argv']) && in_array('disable-tls', $_SERVER['argv']) && (in_array('conf', $_SERVER['argv']) || in_array('config', $_SERVER['argv']))) {
  13624. $warned = true;
  13625. $disableTls = !extension_loaded('openssl');
  13626. } elseif ($config && $config->get('disable-tls') === true) {
  13627. if (!$warned) {
  13628. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13629. }
  13630. $warned = true;
  13631. $disableTls = true;
  13632. } elseif (!extension_loaded('openssl')) {
  13633. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13634. . 'If you can not enable the openssl extension, you can disable this error, at your own risk, by setting the \'disable-tls\' option to true.');
  13635. }
  13636. $remoteFilesystemOptions = array();
  13637. if ($disableTls === false) {
  13638. if ($config && $config->get('cafile')) {
  13639. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13640. }
  13641. if ($config && $config->get('capath')) {
  13642. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13643. }
  13644. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13645. }
  13646. try {
  13647. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13648. } catch (TransportException $e) {
  13649. if (false !== strpos($e->getMessage(), 'cafile')) {
  13650. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13651. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13652. if (PHP_VERSION_ID < 50600) {
  13653. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13654. }
  13655. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13656. }
  13657. throw $e;
  13658. }
  13659. return $remoteFilesystem;
  13660. }
  13661. private static function useXdg()
  13662. {
  13663. foreach (array_keys($_SERVER) as $key) {
  13664. if (substr($key, 0, 4) === 'XDG_') {
  13665. return true;
  13666. }
  13667. }
  13668. return false;
  13669. }
  13670. private static function getUserDir()
  13671. {
  13672. $home = getenv('HOME');
  13673. if (!$home) {
  13674. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13675. }
  13676. return rtrim(strtr($home, '\\', '/'), '/');
  13677. }
  13678. }
  13679. <?php
  13680. namespace Composer\IO;
  13681. use Composer\Config;
  13682. use Composer\Util\ProcessExecutor;
  13683. use Psr\Log\LoggerInterface;
  13684. use Psr\Log\LogLevel;
  13685. abstract class BaseIO implements IOInterface, LoggerInterface
  13686. {
  13687. protected $authentications = array();
  13688. public function getAuthentications()
  13689. {
  13690. return $this->authentications;
  13691. }
  13692. public function resetAuthentications()
  13693. {
  13694. $this->authentications = array();
  13695. }
  13696. public function hasAuthentication($repositoryName)
  13697. {
  13698. return isset($this->authentications[$repositoryName]);
  13699. }
  13700. public function getAuthentication($repositoryName)
  13701. {
  13702. if (isset($this->authentications[$repositoryName])) {
  13703. return $this->authentications[$repositoryName];
  13704. }
  13705. return array('username' => null, 'password' => null);
  13706. }
  13707. public function setAuthentication($repositoryName, $username, $password = null)
  13708. {
  13709. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13710. }
  13711. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13712. {
  13713. $this->write($messages, $newline, $verbosity);
  13714. }
  13715. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13716. {
  13717. $this->writeError($messages, $newline, $verbosity);
  13718. }
  13719. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13720. {
  13721. if ($this->hasAuthentication($repositoryName)) {
  13722. $auth = $this->getAuthentication($repositoryName);
  13723. if ($auth['username'] === $username && $auth['password'] === $password) {
  13724. return;
  13725. }
  13726. $this->writeError(
  13727. sprintf(
  13728. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13729. $repositoryName
  13730. )
  13731. );
  13732. }
  13733. $this->setAuthentication($repositoryName, $username, $password);
  13734. }
  13735. public function loadConfiguration(Config $config)
  13736. {
  13737. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13738. $githubOauth = $config->get('github-oauth') ?: array();
  13739. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13740. $gitlabToken = $config->get('gitlab-token') ?: array();
  13741. $httpBasic = $config->get('http-basic') ?: array();
  13742. $bearerToken = $config->get('bearer') ?: array();
  13743. foreach ($bitbucketOauth as $domain => $cred) {
  13744. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13745. }
  13746. foreach ($githubOauth as $domain => $token) {
  13747. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13748. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13749. }
  13750. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13751. }
  13752. foreach ($gitlabOauth as $domain => $token) {
  13753. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13754. }
  13755. foreach ($gitlabToken as $domain => $token) {
  13756. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13757. }
  13758. foreach ($httpBasic as $domain => $cred) {
  13759. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13760. }
  13761. foreach ($bearerToken as $domain => $token) {
  13762. $this->checkAndSetAuthentication($domain, $token, 'bearer');
  13763. }
  13764. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13765. }
  13766. public function emergency($message, array $context = array())
  13767. {
  13768. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13769. }
  13770. public function alert($message, array $context = array())
  13771. {
  13772. return $this->log(LogLevel::ALERT, $message, $context);
  13773. }
  13774. public function critical($message, array $context = array())
  13775. {
  13776. return $this->log(LogLevel::CRITICAL, $message, $context);
  13777. }
  13778. public function error($message, array $context = array())
  13779. {
  13780. return $this->log(LogLevel::ERROR, $message, $context);
  13781. }
  13782. public function warning($message, array $context = array())
  13783. {
  13784. return $this->log(LogLevel::WARNING, $message, $context);
  13785. }
  13786. public function notice($message, array $context = array())
  13787. {
  13788. return $this->log(LogLevel::NOTICE, $message, $context);
  13789. }
  13790. public function info($message, array $context = array())
  13791. {
  13792. return $this->log(LogLevel::INFO, $message, $context);
  13793. }
  13794. public function debug($message, array $context = array())
  13795. {
  13796. return $this->log(LogLevel::DEBUG, $message, $context);
  13797. }
  13798. public function log($level, $message, array $context = array())
  13799. {
  13800. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13801. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13802. } elseif ($level === LogLevel::WARNING) {
  13803. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13804. } elseif ($level === LogLevel::NOTICE) {
  13805. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13806. } elseif ($level === LogLevel::INFO) {
  13807. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13808. } else {
  13809. $this->writeError($message, true, self::DEBUG);
  13810. }
  13811. }
  13812. }
  13813. <?php
  13814. namespace Composer\IO;
  13815. use Symfony\Component\Console\Helper\QuestionHelper;
  13816. use Symfony\Component\Console\Output\StreamOutput;
  13817. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13818. use Symfony\Component\Console\Input\StreamableInputInterface;
  13819. use Symfony\Component\Console\Input\StringInput;
  13820. use Symfony\Component\Console\Helper\HelperSet;
  13821. class BufferIO extends ConsoleIO
  13822. {
  13823. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13824. {
  13825. $input = new StringInput($input);
  13826. $input->setInteractive(false);
  13827. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13828. parent::__construct($input, $output, new HelperSet(array(
  13829. new QuestionHelper(),
  13830. )));
  13831. }
  13832. public function getOutput()
  13833. {
  13834. fseek($this->output->getStream(), 0);
  13835. $output = stream_get_contents($this->output->getStream());
  13836. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13837. $pre = strip_tags($matches[1]);
  13838. if (strlen($pre) === strlen($matches[2])) {
  13839. return '';
  13840. }
  13841. return rtrim($matches[1])."\n";
  13842. }, $output);
  13843. return $output;
  13844. }
  13845. public function setUserInputs(array $inputs)
  13846. {
  13847. if (!$this->input instanceof StreamableInputInterface) {
  13848. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13849. }
  13850. $this->input->setStream($this->createStream($inputs));
  13851. $this->input->setInteractive(true);
  13852. }
  13853. private function createStream(array $inputs)
  13854. {
  13855. $stream = fopen('php://memory', 'r+', false);
  13856. foreach ($inputs as $input) {
  13857. fwrite($stream, $input.PHP_EOL);
  13858. }
  13859. rewind($stream);
  13860. return $stream;
  13861. }
  13862. }
  13863. <?php
  13864. namespace Composer\IO;
  13865. use Composer\Question\StrictConfirmationQuestion;
  13866. use Symfony\Component\Console\Helper\HelperSet;
  13867. use Symfony\Component\Console\Input\InputInterface;
  13868. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13869. use Symfony\Component\Console\Output\OutputInterface;
  13870. use Symfony\Component\Console\Question\ChoiceQuestion;
  13871. use Symfony\Component\Console\Question\Question;
  13872. class ConsoleIO extends BaseIO
  13873. {
  13874. protected $input;
  13875. protected $output;
  13876. protected $helperSet;
  13877. protected $lastMessage;
  13878. protected $lastMessageErr;
  13879. private $startTime;
  13880. private $verbosityMap;
  13881. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13882. {
  13883. $this->input = $input;
  13884. $this->output = $output;
  13885. $this->helperSet = $helperSet;
  13886. $this->verbosityMap = array(
  13887. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13888. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13889. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13890. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13891. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13892. );
  13893. }
  13894. public function enableDebugging($startTime)
  13895. {
  13896. $this->startTime = $startTime;
  13897. }
  13898. public function isInteractive()
  13899. {
  13900. return $this->input->isInteractive();
  13901. }
  13902. public function isDecorated()
  13903. {
  13904. return $this->output->isDecorated();
  13905. }
  13906. public function isVerbose()
  13907. {
  13908. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13909. }
  13910. public function isVeryVerbose()
  13911. {
  13912. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13913. }
  13914. public function isDebug()
  13915. {
  13916. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13917. }
  13918. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13919. {
  13920. $this->doWrite($messages, $newline, false, $verbosity);
  13921. }
  13922. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13923. {
  13924. $this->doWrite($messages, $newline, true, $verbosity);
  13925. }
  13926. public function writeRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13927. {
  13928. $this->doWrite($messages, $newline, false, $verbosity, true);
  13929. }
  13930. public function writeErrorRaw($messages, $newline = true, $verbosity = self::NORMAL)
  13931. {
  13932. $this->doWrite($messages, $newline, true, $verbosity, true);
  13933. }
  13934. private function doWrite($messages, $newline, $stderr, $verbosity, $raw = false)
  13935. {
  13936. $sfVerbosity = $this->verbosityMap[$verbosity];
  13937. if ($sfVerbosity > $this->output->getVerbosity()) {
  13938. return;
  13939. }
  13940. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13941. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13942. }
  13943. if ($raw) {
  13944. if ($sfVerbosity === OutputInterface::OUTPUT_NORMAL) {
  13945. $sfVerbosity = OutputInterface::OUTPUT_RAW;
  13946. } else {
  13947. $sfVerbosity |= OutputInterface::OUTPUT_RAW;
  13948. }
  13949. }
  13950. if (null !== $this->startTime) {
  13951. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13952. $timeSpent = microtime(true) - $this->startTime;
  13953. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13954. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13955. }, (array) $messages);
  13956. }
  13957. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13958. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13959. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13960. return;
  13961. }
  13962. $this->output->write($messages, $newline, $sfVerbosity);
  13963. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13964. }
  13965. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13966. {
  13967. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13968. }
  13969. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13970. {
  13971. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13972. }
  13973. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13974. {
  13975. $messages = implode($newline ? "\n" : '', (array) $messages);
  13976. if (!isset($size)) {
  13977. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13978. }
  13979. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13980. $this->doWrite($messages, false, $stderr, $verbosity);
  13981. $fill = $size - strlen(strip_tags($messages));
  13982. if ($fill > 0) {
  13983. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13984. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13985. }
  13986. if ($newline) {
  13987. $this->doWrite('', true, $stderr, $verbosity);
  13988. }
  13989. if ($stderr) {
  13990. $this->lastMessageErr = $messages;
  13991. } else {
  13992. $this->lastMessage = $messages;
  13993. }
  13994. }
  13995. public function ask($question, $default = null)
  13996. {
  13997. $helper = $this->helperSet->get('question');
  13998. $question = new Question($question, $default);
  13999. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14000. }
  14001. public function askConfirmation($question, $default = true)
  14002. {
  14003. $helper = $this->helperSet->get('question');
  14004. $question = new StrictConfirmationQuestion($question, $default);
  14005. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14006. }
  14007. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  14008. {
  14009. $helper = $this->helperSet->get('question');
  14010. $question = new Question($question, $default);
  14011. $question->setValidator($validator);
  14012. $question->setMaxAttempts($attempts);
  14013. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14014. }
  14015. public function askAndHideAnswer($question)
  14016. {
  14017. $helper = $this->helperSet->get('question');
  14018. $question = new Question($question);
  14019. $question->setHidden(true);
  14020. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  14021. }
  14022. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14023. {
  14024. $helper = $this->helperSet->get('question');
  14025. $question = new ChoiceQuestion($question, $choices, $default);
  14026. $question->setMaxAttempts($attempts ?: null);
  14027. $question->setErrorMessage($errorMessage);
  14028. $question->setMultiselect($multiselect);
  14029. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  14030. if (!is_array($result)) {
  14031. return (string) array_search($result, $choices, true);
  14032. }
  14033. $results = array();
  14034. foreach ($choices as $index => $choice) {
  14035. if (in_array($choice, $result, true)) {
  14036. $results[] = (string) $index;
  14037. }
  14038. }
  14039. return $results;
  14040. }
  14041. private function getErrorOutput()
  14042. {
  14043. if ($this->output instanceof ConsoleOutputInterface) {
  14044. return $this->output->getErrorOutput();
  14045. }
  14046. return $this->output;
  14047. }
  14048. }
  14049. <?php
  14050. namespace Composer\IO;
  14051. use Composer\Config;
  14052. interface IOInterface
  14053. {
  14054. const QUIET = 1;
  14055. const NORMAL = 2;
  14056. const VERBOSE = 4;
  14057. const VERY_VERBOSE = 8;
  14058. const DEBUG = 16;
  14059. public function isInteractive();
  14060. public function isVerbose();
  14061. public function isVeryVerbose();
  14062. public function isDebug();
  14063. public function isDecorated();
  14064. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  14065. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  14066. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14067. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  14068. public function ask($question, $default = null);
  14069. public function askConfirmation($question, $default = true);
  14070. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  14071. public function askAndHideAnswer($question);
  14072. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  14073. public function getAuthentications();
  14074. public function hasAuthentication($repositoryName);
  14075. public function getAuthentication($repositoryName);
  14076. public function setAuthentication($repositoryName, $username, $password = null);
  14077. public function loadConfiguration(Config $config);
  14078. }
  14079. <?php
  14080. namespace Composer\IO;
  14081. class NullIO extends BaseIO
  14082. {
  14083. public function isInteractive()
  14084. {
  14085. return false;
  14086. }
  14087. public function isVerbose()
  14088. {
  14089. return false;
  14090. }
  14091. public function isVeryVerbose()
  14092. {
  14093. return false;
  14094. }
  14095. public function isDebug()
  14096. {
  14097. return false;
  14098. }
  14099. public function isDecorated()
  14100. {
  14101. return false;
  14102. }
  14103. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  14104. {
  14105. }
  14106. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  14107. {
  14108. }
  14109. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14110. {
  14111. }
  14112. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  14113. {
  14114. }
  14115. public function ask($question, $default = null)
  14116. {
  14117. return $default;
  14118. }
  14119. public function askConfirmation($question, $default = true)
  14120. {
  14121. return $default;
  14122. }
  14123. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  14124. {
  14125. return $default;
  14126. }
  14127. public function askAndHideAnswer($question)
  14128. {
  14129. return null;
  14130. }
  14131. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  14132. {
  14133. return $default;
  14134. }
  14135. }
  14136. <?php
  14137. namespace Composer;
  14138. use Composer\Autoload\AutoloadGenerator;
  14139. use Composer\DependencyResolver\DefaultPolicy;
  14140. use Composer\DependencyResolver\Operation\UpdateOperation;
  14141. use Composer\DependencyResolver\Operation\InstallOperation;
  14142. use Composer\DependencyResolver\Operation\UninstallOperation;
  14143. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14144. use Composer\DependencyResolver\Operation\OperationInterface;
  14145. use Composer\DependencyResolver\PolicyInterface;
  14146. use Composer\DependencyResolver\Pool;
  14147. use Composer\DependencyResolver\Request;
  14148. use Composer\DependencyResolver\Rule;
  14149. use Composer\DependencyResolver\Solver;
  14150. use Composer\DependencyResolver\SolverProblemsException;
  14151. use Composer\Downloader\DownloadManager;
  14152. use Composer\EventDispatcher\EventDispatcher;
  14153. use Composer\Installer\InstallationManager;
  14154. use Composer\Installer\InstallerEvents;
  14155. use Composer\Installer\NoopInstaller;
  14156. use Composer\Installer\SuggestedPackagesReporter;
  14157. use Composer\IO\IOInterface;
  14158. use Composer\Package\AliasPackage;
  14159. use Composer\Package\BasePackage;
  14160. use Composer\Package\CompletePackage;
  14161. use Composer\Package\CompletePackageInterface;
  14162. use Composer\Package\Link;
  14163. use Composer\Package\Loader\ArrayLoader;
  14164. use Composer\Package\Dumper\ArrayDumper;
  14165. use Composer\Semver\Constraint\Constraint;
  14166. use Composer\Package\Locker;
  14167. use Composer\Package\PackageInterface;
  14168. use Composer\Package\RootPackageInterface;
  14169. use Composer\Repository\CompositeRepository;
  14170. use Composer\Repository\InstalledArrayRepository;
  14171. use Composer\Repository\PlatformRepository;
  14172. use Composer\Repository\RepositoryInterface;
  14173. use Composer\Repository\RepositoryManager;
  14174. use Composer\Repository\WritableRepositoryInterface;
  14175. use Composer\Script\ScriptEvents;
  14176. class Installer
  14177. {
  14178. protected $io;
  14179. protected $config;
  14180. protected $package;
  14181. protected $downloadManager;
  14182. protected $repositoryManager;
  14183. protected $locker;
  14184. protected $installationManager;
  14185. protected $eventDispatcher;
  14186. protected $autoloadGenerator;
  14187. protected $preferSource = false;
  14188. protected $preferDist = false;
  14189. protected $optimizeAutoloader = false;
  14190. protected $classMapAuthoritative = false;
  14191. protected $apcuAutoloader = false;
  14192. protected $devMode = false;
  14193. protected $dryRun = false;
  14194. protected $verbose = false;
  14195. protected $update = false;
  14196. protected $dumpAutoloader = true;
  14197. protected $runScripts = true;
  14198. protected $ignorePlatformReqs = false;
  14199. protected $preferStable = false;
  14200. protected $preferLowest = false;
  14201. protected $skipSuggest = false;
  14202. protected $writeLock;
  14203. protected $executeOperations = true;
  14204. protected $updateWhitelist = null;
  14205. protected $whitelistDependencies = false;
  14206. protected $whitelistAllDependencies = false;
  14207. protected $suggestedPackagesReporter;
  14208. protected $additionalInstalledRepository;
  14209. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  14210. {
  14211. $this->io = $io;
  14212. $this->config = $config;
  14213. $this->package = $package;
  14214. $this->downloadManager = $downloadManager;
  14215. $this->repositoryManager = $repositoryManager;
  14216. $this->locker = $locker;
  14217. $this->installationManager = $installationManager;
  14218. $this->eventDispatcher = $eventDispatcher;
  14219. $this->autoloadGenerator = $autoloadGenerator;
  14220. $this->writeLock = $config->get('lock');
  14221. }
  14222. public function run()
  14223. {
  14224. gc_collect_cycles();
  14225. gc_disable();
  14226. if (!$this->update && !$this->locker->isLocked()) {
  14227. $this->update = true;
  14228. }
  14229. if ($this->dryRun) {
  14230. $this->verbose = true;
  14231. $this->runScripts = false;
  14232. $this->executeOperations = false;
  14233. $this->writeLock = false;
  14234. $this->dumpAutoloader = false;
  14235. $this->installationManager->addInstaller(new NoopInstaller);
  14236. $this->mockLocalRepositories($this->repositoryManager);
  14237. }
  14238. if ($this->runScripts) {
  14239. $_SERVER['COMPOSER_DEV_MODE'] = $this->devMode ? '1' : '0';
  14240. putenv('COMPOSER_DEV_MODE='.$_SERVER['COMPOSER_DEV_MODE']);
  14241. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  14242. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14243. }
  14244. $this->downloadManager->setPreferSource($this->preferSource);
  14245. $this->downloadManager->setPreferDist($this->preferDist);
  14246. $localRepo = $this->repositoryManager->getLocalRepository();
  14247. if ($this->update) {
  14248. $platformOverrides = $this->config->get('platform') ?: array();
  14249. } else {
  14250. $platformOverrides = $this->locker->getPlatformOverrides();
  14251. }
  14252. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  14253. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14254. $aliases = $this->getRootAliases();
  14255. $this->aliasPlatformPackages($platformRepo, $aliases);
  14256. if (!$this->suggestedPackagesReporter) {
  14257. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  14258. }
  14259. try {
  14260. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  14261. if ($res !== 0) {
  14262. return $res;
  14263. }
  14264. } catch (\Exception $e) {
  14265. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14266. $this->installationManager->notifyInstalls($this->io);
  14267. }
  14268. throw $e;
  14269. }
  14270. if ($this->executeOperations && $this->config->get('notify-on-install')) {
  14271. $this->installationManager->notifyInstalls($this->io);
  14272. }
  14273. if ($this->devMode && !$this->skipSuggest) {
  14274. $this->suggestedPackagesReporter->output($installedRepo);
  14275. }
  14276. foreach ($localRepo->getPackages() as $package) {
  14277. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  14278. continue;
  14279. }
  14280. $replacement = is_string($package->getReplacementPackage())
  14281. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  14282. : 'No replacement was suggested';
  14283. $this->io->writeError(
  14284. sprintf(
  14285. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  14286. $package->getPrettyName(),
  14287. $replacement
  14288. )
  14289. );
  14290. }
  14291. if ($this->update && $this->writeLock) {
  14292. $localRepo->reload();
  14293. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  14294. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  14295. $updatedLock = $this->locker->setLockData(
  14296. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  14297. $devPackages,
  14298. $platformReqs,
  14299. $platformDevReqs,
  14300. $aliases,
  14301. $this->package->getMinimumStability(),
  14302. $this->package->getStabilityFlags(),
  14303. $this->preferStable || $this->package->getPreferStable(),
  14304. $this->preferLowest,
  14305. $this->config->get('platform') ?: array()
  14306. );
  14307. if ($updatedLock) {
  14308. $this->io->writeError('<info>Writing lock file</info>');
  14309. }
  14310. }
  14311. if ($this->dumpAutoloader) {
  14312. if ($this->optimizeAutoloader) {
  14313. $this->io->writeError('<info>Generating optimized autoload files</info>');
  14314. } else {
  14315. $this->io->writeError('<info>Generating autoload files</info>');
  14316. }
  14317. $this->autoloadGenerator->setDevMode($this->devMode);
  14318. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  14319. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  14320. $this->autoloadGenerator->setRunScripts($this->runScripts);
  14321. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  14322. }
  14323. if ($this->executeOperations) {
  14324. foreach ($localRepo->getPackages() as $package) {
  14325. $this->installationManager->ensureBinariesPresence($package);
  14326. }
  14327. }
  14328. $fundingCount = 0;
  14329. foreach ($localRepo->getPackages() as $package) {
  14330. if ($package instanceof CompletePackageInterface && !$package instanceof AliasPackage && $package->getFunding()) {
  14331. $fundingCount++;
  14332. }
  14333. }
  14334. if ($fundingCount) {
  14335. $this->io->writeError(array(
  14336. sprintf(
  14337. "<info>%d package%s you are using %s looking for funding.</info>",
  14338. $fundingCount,
  14339. 1 === $fundingCount ? '' : 's',
  14340. 1 === $fundingCount ? 'is' : 'are'
  14341. ),
  14342. '<info>Use the `composer fund` command to find out more!</info>',
  14343. ));
  14344. }
  14345. if ($this->runScripts) {
  14346. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  14347. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  14348. }
  14349. if (!defined('HHVM_VERSION')) {
  14350. gc_enable();
  14351. }
  14352. return 0;
  14353. }
  14354. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  14355. {
  14356. $lockedRepository = null;
  14357. $repositories = null;
  14358. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  14359. try {
  14360. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  14361. } catch (\RuntimeException $e) {
  14362. if ($this->package->getDevRequires()) {
  14363. throw $e;
  14364. }
  14365. $lockedRepository = $this->locker->getLockedRepository();
  14366. }
  14367. }
  14368. $this->allowListUpdateDependencies(
  14369. $lockedRepository ?: $localRepo,
  14370. $this->package->getRequires(),
  14371. $this->package->getDevRequires()
  14372. );
  14373. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  14374. $policy = $this->createPolicy();
  14375. $pool = $this->createPool($this->update ? null : $lockedRepository);
  14376. $pool->addRepository($installedRepo, $aliases);
  14377. if ($this->update) {
  14378. $repositories = $this->repositoryManager->getRepositories();
  14379. foreach ($repositories as $repository) {
  14380. $pool->addRepository($repository, $aliases);
  14381. }
  14382. }
  14383. if ($lockedRepository) {
  14384. $pool->addRepository($lockedRepository, $aliases);
  14385. }
  14386. $request = $this->createRequest($this->package, $platformRepo);
  14387. if ($this->update) {
  14388. $removedUnstablePackages = array();
  14389. foreach ($localRepo->getPackages() as $package) {
  14390. if (
  14391. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  14392. && $this->installationManager->isPackageInstalled($localRepo, $package)
  14393. ) {
  14394. $removedUnstablePackages[$package->getName()] = true;
  14395. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  14396. }
  14397. }
  14398. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  14399. $request->updateAll();
  14400. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14401. foreach ($links as $link) {
  14402. $request->install($link->getTarget(), $link->getConstraint());
  14403. }
  14404. if ($this->updateWhitelist) {
  14405. $currentPackages = $this->getCurrentPackages($installedRepo);
  14406. $candidates = array();
  14407. foreach ($links as $link) {
  14408. $candidates[$link->getTarget()] = true;
  14409. $rootRequires[$link->getTarget()] = $link;
  14410. }
  14411. foreach ($currentPackages as $package) {
  14412. $candidates[$package->getName()] = true;
  14413. }
  14414. foreach ($candidates as $candidate => $dummy) {
  14415. foreach ($currentPackages as $curPackage) {
  14416. if ($curPackage->getName() === $candidate) {
  14417. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  14418. $constraint = new Constraint('=', $curPackage->getVersion());
  14419. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  14420. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  14421. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  14422. $request->install($curPackage->getName(), $constraint);
  14423. }
  14424. break;
  14425. }
  14426. }
  14427. }
  14428. }
  14429. } else {
  14430. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  14431. if (!$this->locker->isFresh()) {
  14432. $this->io->writeError('<warning>Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.</warning>', true, IOInterface::QUIET);
  14433. }
  14434. foreach ($lockedRepository->getPackages() as $package) {
  14435. $version = $package->getVersion();
  14436. if (isset($aliases[$package->getName()][$version])) {
  14437. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  14438. }
  14439. $constraint = new Constraint('=', $version);
  14440. $constraint->setPrettyString($package->getPrettyVersion());
  14441. $request->install($package->getName(), $constraint);
  14442. }
  14443. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  14444. $request->install($link->getTarget(), $link->getConstraint());
  14445. }
  14446. }
  14447. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  14448. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  14449. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14450. try {
  14451. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  14452. $ruleSetSize = $solver->getRuleSetSize();
  14453. $solver = null;
  14454. } catch (SolverProblemsException $e) {
  14455. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  14456. $this->io->writeError($e->getMessage());
  14457. if ($this->update && !$this->devMode) {
  14458. $this->io->writeError('<warning>Running update with --no-dev does not mean require-dev is ignored, it just means the packages will not be installed. If dev requirements are blocking the update you have to resolve those problems.</warning>', true, IOInterface::QUIET);
  14459. }
  14460. return array(max(1, $e->getCode()), array());
  14461. }
  14462. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  14463. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  14464. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  14465. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  14466. if (!$operations) {
  14467. $this->io->writeError('Nothing to install or update');
  14468. }
  14469. $operations = $this->movePluginsToFront($operations);
  14470. $operations = $this->moveUninstallsToFront($operations);
  14471. if ($this->update) {
  14472. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  14473. if (!$this->devMode) {
  14474. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  14475. }
  14476. } else {
  14477. $devPackages = null;
  14478. }
  14479. if ($operations) {
  14480. $installs = $updates = $uninstalls = array();
  14481. foreach ($operations as $operation) {
  14482. if ($operation instanceof InstallOperation) {
  14483. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  14484. } elseif ($operation instanceof UpdateOperation) {
  14485. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  14486. } elseif ($operation instanceof UninstallOperation) {
  14487. $uninstalls[] = $operation->getPackage()->getPrettyName();
  14488. }
  14489. }
  14490. $this->io->writeError(sprintf(
  14491. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  14492. count($installs),
  14493. 1 === count($installs) ? '' : 's',
  14494. count($updates),
  14495. 1 === count($updates) ? '' : 's',
  14496. count($uninstalls),
  14497. 1 === count($uninstalls) ? '' : 's'
  14498. ));
  14499. if ($installs) {
  14500. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  14501. }
  14502. if ($updates) {
  14503. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  14504. }
  14505. if ($uninstalls) {
  14506. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  14507. }
  14508. }
  14509. foreach ($operations as $operation) {
  14510. $jobType = $operation->getJobType();
  14511. if ('install' === $jobType) {
  14512. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  14513. }
  14514. if ($this->update) {
  14515. $package = null;
  14516. if ('update' === $jobType) {
  14517. $package = $operation->getTargetPackage();
  14518. } elseif ('install' === $jobType) {
  14519. $package = $operation->getPackage();
  14520. }
  14521. if ($package && $package->isDev()) {
  14522. $references = $this->package->getReferences();
  14523. if (isset($references[$package->getName()])) {
  14524. $this->updateInstallReferences($package, $references[$package->getName()]);
  14525. }
  14526. }
  14527. if ('update' === $jobType) {
  14528. $targetPackage = $operation->getTargetPackage();
  14529. if ($targetPackage->isDev()) {
  14530. $initialPackage = $operation->getInitialPackage();
  14531. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  14532. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  14533. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  14534. ) {
  14535. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  14536. $this->io->writeError('', true, IOInterface::DEBUG);
  14537. continue;
  14538. }
  14539. }
  14540. }
  14541. }
  14542. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  14543. if (defined($event) && $this->runScripts) {
  14544. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14545. }
  14546. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  14547. $this->io->writeError(' - ' . $operation);
  14548. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  14549. $this->io->writeError(' - ' . $operation);
  14550. }
  14551. $this->installationManager->execute($localRepo, $operation);
  14552. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  14553. $reason = $operation->getReason();
  14554. if ($reason instanceof Rule) {
  14555. switch ($reason->getReason()) {
  14556. case Rule::RULE_JOB_INSTALL:
  14557. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  14558. $this->io->writeError('');
  14559. break;
  14560. case Rule::RULE_PACKAGE_REQUIRES:
  14561. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  14562. $this->io->writeError('');
  14563. break;
  14564. }
  14565. }
  14566. }
  14567. if ($this->executeOperations || $this->writeLock) {
  14568. $localRepo->write();
  14569. }
  14570. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  14571. if (defined($event) && $this->runScripts) {
  14572. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  14573. }
  14574. }
  14575. if ($this->executeOperations) {
  14576. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  14577. $localRepo->write();
  14578. }
  14579. if ($operations) {
  14580. $vendorDir = $this->config->get('vendor-dir');
  14581. if (is_dir($vendorDir)) {
  14582. @touch($vendorDir);
  14583. }
  14584. }
  14585. return array(0, $devPackages);
  14586. }
  14587. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  14588. {
  14589. if (!$this->package->getDevRequires()) {
  14590. return array();
  14591. }
  14592. $tempLocalRepo = clone $localRepo;
  14593. foreach ($operations as $operation) {
  14594. switch ($operation->getJobType()) {
  14595. case 'install':
  14596. case 'markAliasInstalled':
  14597. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  14598. $tempLocalRepo->addPackage(clone $operation->getPackage());
  14599. }
  14600. break;
  14601. case 'uninstall':
  14602. case 'markAliasUninstalled':
  14603. $tempLocalRepo->removePackage($operation->getPackage());
  14604. break;
  14605. case 'update':
  14606. $tempLocalRepo->removePackage($operation->getInitialPackage());
  14607. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  14608. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  14609. }
  14610. break;
  14611. default:
  14612. throw new \LogicException('Unknown type: '.$operation->getJobType());
  14613. }
  14614. }
  14615. $localRepo = new InstalledArrayRepository(array());
  14616. $loader = new ArrayLoader(null, true);
  14617. $dumper = new ArrayDumper();
  14618. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  14619. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  14620. }
  14621. unset($tempLocalRepo, $loader, $dumper);
  14622. $policy = $this->createPolicy();
  14623. $pool = $this->createPool();
  14624. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  14625. $pool->addRepository($installedRepo, $aliases);
  14626. $request = $this->createRequest($this->package, $platformRepo);
  14627. $request->updateAll();
  14628. foreach ($this->package->getRequires() as $link) {
  14629. $request->install($link->getTarget(), $link->getConstraint());
  14630. }
  14631. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  14632. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  14633. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  14634. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  14635. $devPackages = array();
  14636. foreach ($ops as $op) {
  14637. if ($op->getJobType() === 'uninstall') {
  14638. $devPackages[] = $op->getPackage();
  14639. }
  14640. }
  14641. return $devPackages;
  14642. }
  14643. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  14644. {
  14645. $finalOps = array();
  14646. $packagesToSkip = array();
  14647. foreach ($devPackages as $pkg) {
  14648. $packagesToSkip[$pkg->getName()] = true;
  14649. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  14650. if ($installedDevPkg instanceof AliasPackage) {
  14651. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  14652. $installedDevPkg = $installedDevPkg->getAliasOf();
  14653. }
  14654. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  14655. }
  14656. }
  14657. foreach ($operations as $op) {
  14658. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  14659. if (isset($packagesToSkip[$package->getName()])) {
  14660. continue;
  14661. }
  14662. $finalOps[] = $op;
  14663. }
  14664. return $finalOps;
  14665. }
  14666. private function movePluginsToFront(array $operations)
  14667. {
  14668. $pluginsNoDeps = array();
  14669. $pluginsWithDeps = array();
  14670. $pluginRequires = array();
  14671. foreach (array_reverse($operations, true) as $idx => $op) {
  14672. if ($op instanceof InstallOperation) {
  14673. $package = $op->getPackage();
  14674. } elseif ($op instanceof UpdateOperation) {
  14675. $package = $op->getTargetPackage();
  14676. } else {
  14677. continue;
  14678. }
  14679. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14680. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14681. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14682. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14683. });
  14684. if ($isPlugin && !count($requires)) {
  14685. array_unshift($pluginsNoDeps, $op);
  14686. } else {
  14687. $pluginRequires = array_merge($pluginRequires, $requires);
  14688. array_unshift($pluginsWithDeps, $op);
  14689. }
  14690. unset($operations[$idx]);
  14691. }
  14692. }
  14693. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14694. }
  14695. private function moveUninstallsToFront(array $operations)
  14696. {
  14697. $uninstOps = array();
  14698. foreach ($operations as $idx => $op) {
  14699. if ($op instanceof UninstallOperation) {
  14700. $uninstOps[] = $op;
  14701. unset($operations[$idx]);
  14702. }
  14703. }
  14704. return array_merge($uninstOps, $operations);
  14705. }
  14706. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14707. {
  14708. $installedRootPackage = clone $this->package;
  14709. $installedRootPackage->setRequires(array());
  14710. $installedRootPackage->setDevRequires(array());
  14711. $repos = array(
  14712. $localRepo,
  14713. new InstalledArrayRepository(array($installedRootPackage)),
  14714. $platformRepo,
  14715. );
  14716. $installedRepo = new CompositeRepository($repos);
  14717. if ($this->additionalInstalledRepository) {
  14718. $installedRepo->addRepository($this->additionalInstalledRepository);
  14719. }
  14720. return $installedRepo;
  14721. }
  14722. private function createPool(RepositoryInterface $lockedRepository = null)
  14723. {
  14724. if ($this->update) {
  14725. $minimumStability = $this->package->getMinimumStability();
  14726. $stabilityFlags = $this->package->getStabilityFlags();
  14727. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14728. } else {
  14729. $minimumStability = $this->locker->getMinimumStability();
  14730. $stabilityFlags = $this->locker->getStabilityFlags();
  14731. $requires = array();
  14732. foreach ($lockedRepository->getPackages() as $package) {
  14733. $constraint = new Constraint('=', $package->getVersion());
  14734. $constraint->setPrettyString($package->getPrettyVersion());
  14735. $requires[$package->getName()] = $constraint;
  14736. }
  14737. }
  14738. $rootConstraints = array();
  14739. foreach ($requires as $req => $constraint) {
  14740. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14741. continue;
  14742. }
  14743. if ($constraint instanceof Link) {
  14744. $rootConstraints[$req] = $constraint->getConstraint();
  14745. } else {
  14746. $rootConstraints[$req] = $constraint;
  14747. }
  14748. }
  14749. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14750. }
  14751. private function createPolicy()
  14752. {
  14753. $preferStable = null;
  14754. $preferLowest = null;
  14755. if (!$this->update) {
  14756. $preferStable = $this->locker->getPreferStable();
  14757. $preferLowest = $this->locker->getPreferLowest();
  14758. }
  14759. if (null === $preferStable) {
  14760. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14761. }
  14762. if (null === $preferLowest) {
  14763. $preferLowest = $this->preferLowest;
  14764. }
  14765. return new DefaultPolicy($preferStable, $preferLowest);
  14766. }
  14767. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14768. {
  14769. $request = new Request();
  14770. $constraint = new Constraint('=', $rootPackage->getVersion());
  14771. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14772. $request->install($rootPackage->getName(), $constraint);
  14773. $fixedPackages = $platformRepo->getPackages();
  14774. if ($this->additionalInstalledRepository) {
  14775. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14776. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14777. }
  14778. $provided = $rootPackage->getProvides();
  14779. foreach ($fixedPackages as $package) {
  14780. $constraint = new Constraint('=', $package->getVersion());
  14781. $constraint->setPrettyString($package->getPrettyVersion());
  14782. if ($package->getRepository() !== $platformRepo
  14783. || !isset($provided[$package->getName()])
  14784. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14785. ) {
  14786. $request->fix($package->getName(), $constraint);
  14787. }
  14788. }
  14789. return $request;
  14790. }
  14791. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14792. {
  14793. if ($task === 'force-updates' && null === $operations) {
  14794. throw new \InvalidArgumentException('Missing operations argument');
  14795. }
  14796. if ($task === 'force-links') {
  14797. $operations = array();
  14798. }
  14799. if ($this->update && $this->updateWhitelist) {
  14800. $currentPackages = $this->getCurrentPackages($installedRepo);
  14801. }
  14802. foreach ($localRepo->getCanonicalPackages() as $package) {
  14803. if (!$package->isDev()) {
  14804. continue;
  14805. }
  14806. foreach ($operations as $operation) {
  14807. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14808. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14809. ) {
  14810. continue 2;
  14811. }
  14812. }
  14813. if ($this->update) {
  14814. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14815. foreach ($currentPackages as $curPackage) {
  14816. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14817. if ($task === 'force-links') {
  14818. $package->setRequires($curPackage->getRequires());
  14819. $package->setConflicts($curPackage->getConflicts());
  14820. $package->setProvides($curPackage->getProvides());
  14821. $package->setReplaces($curPackage->getReplaces());
  14822. } elseif ($task === 'force-updates') {
  14823. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14824. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14825. ) {
  14826. $operations[] = new UpdateOperation($package, $curPackage);
  14827. }
  14828. }
  14829. break;
  14830. }
  14831. }
  14832. continue;
  14833. }
  14834. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14835. foreach ($matches as $index => $match) {
  14836. if (!in_array($match->getRepository(), $repositories, true)) {
  14837. unset($matches[$index]);
  14838. continue;
  14839. }
  14840. if ($match->getName() !== $package->getName()) {
  14841. unset($matches[$index]);
  14842. continue;
  14843. }
  14844. $matches[$index] = $match->getId();
  14845. }
  14846. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14847. $newPackage = $pool->literalToPackage($matches[0]);
  14848. if ($task === 'force-links' && $newPackage) {
  14849. $package->setRequires($newPackage->getRequires());
  14850. $package->setConflicts($newPackage->getConflicts());
  14851. $package->setProvides($newPackage->getProvides());
  14852. $package->setReplaces($newPackage->getReplaces());
  14853. }
  14854. if (
  14855. $task === 'force-updates'
  14856. && $newPackage
  14857. && (
  14858. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14859. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14860. )
  14861. ) {
  14862. $operations[] = new UpdateOperation($package, $newPackage);
  14863. continue;
  14864. }
  14865. }
  14866. if ($task === 'force-updates') {
  14867. $references = $this->package->getReferences();
  14868. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14869. $operations[] = new UpdateOperation($package, clone $package);
  14870. }
  14871. }
  14872. } else {
  14873. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14874. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14875. if ($task === 'force-links') {
  14876. $package->setRequires($lockedPackage->getRequires());
  14877. $package->setConflicts($lockedPackage->getConflicts());
  14878. $package->setProvides($lockedPackage->getProvides());
  14879. $package->setReplaces($lockedPackage->getReplaces());
  14880. } elseif ($task === 'force-updates') {
  14881. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14882. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14883. ) {
  14884. $operations[] = new UpdateOperation($package, $lockedPackage);
  14885. }
  14886. }
  14887. break;
  14888. }
  14889. }
  14890. }
  14891. }
  14892. return $operations;
  14893. }
  14894. private function getCurrentPackages($installedRepo)
  14895. {
  14896. if ($this->locker->isLocked()) {
  14897. try {
  14898. return $this->locker->getLockedRepository(true)->getPackages();
  14899. } catch (\RuntimeException $e) {
  14900. return $this->locker->getLockedRepository()->getPackages();
  14901. }
  14902. }
  14903. return $installedRepo->getPackages();
  14904. }
  14905. private function getRootAliases()
  14906. {
  14907. if ($this->update) {
  14908. $aliases = $this->package->getAliases();
  14909. } else {
  14910. $aliases = $this->locker->getAliases();
  14911. }
  14912. $normalizedAliases = array();
  14913. foreach ($aliases as $alias) {
  14914. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14915. 'alias' => $alias['alias'],
  14916. 'alias_normalized' => $alias['alias_normalized'],
  14917. );
  14918. }
  14919. return $normalizedAliases;
  14920. }
  14921. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14922. {
  14923. if (!$this->update) {
  14924. return;
  14925. }
  14926. $rootRefs = $this->package->getReferences();
  14927. foreach ($localRepo->getCanonicalPackages() as $package) {
  14928. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14929. foreach ($matches as $index => $match) {
  14930. if (!in_array($match->getRepository(), $repositories, true)) {
  14931. unset($matches[$index]);
  14932. continue;
  14933. }
  14934. if ($match->getName() !== $package->getName()) {
  14935. unset($matches[$index]);
  14936. continue;
  14937. }
  14938. $matches[$index] = $match->getId();
  14939. }
  14940. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14941. $newPackage = $pool->literalToPackage($matches[0]);
  14942. $sourceUrl = $package->getSourceUrl();
  14943. $newSourceUrl = $newPackage->getSourceUrl();
  14944. $newReference = $newPackage->getSourceReference();
  14945. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14946. $newReference = $rootRefs[$package->getName()];
  14947. }
  14948. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14949. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14950. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14951. }
  14952. $package->setDistMirrors($newPackage->getDistMirrors());
  14953. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14954. $package->setTransportOptions($newPackage->getTransportOptions());
  14955. }
  14956. }
  14957. }
  14958. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14959. {
  14960. $oldSourceRef = $package->getSourceReference();
  14961. if ($package->getSourceUrl() !== $sourceUrl) {
  14962. $package->setSourceType($sourceType);
  14963. $package->setSourceUrl($sourceUrl);
  14964. $package->setSourceReference($sourceReference);
  14965. }
  14966. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14967. $package->setDistUrl($distUrl);
  14968. $package->setDistType($distType);
  14969. $package->setDistSha1Checksum($distShaSum);
  14970. $this->updateInstallReferences($package, $sourceReference);
  14971. }
  14972. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14973. $this->updateInstallReferences($package, $oldSourceRef);
  14974. }
  14975. }
  14976. private function updateInstallReferences(PackageInterface $package, $reference)
  14977. {
  14978. if (!$reference) {
  14979. return;
  14980. }
  14981. $package->setSourceReference($reference);
  14982. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14983. $package->setDistReference($reference);
  14984. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14985. } elseif ($package->getDistReference()) {
  14986. $package->setDistReference($reference);
  14987. }
  14988. }
  14989. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14990. {
  14991. foreach ($aliases as $package => $versions) {
  14992. foreach ($versions as $version => $alias) {
  14993. $packages = $platformRepo->findPackages($package, $version);
  14994. foreach ($packages as $package) {
  14995. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14996. $aliasPackage->setRootPackageAlias(true);
  14997. $platformRepo->addPackage($aliasPackage);
  14998. }
  14999. }
  15000. }
  15001. }
  15002. private function isUpdateable(PackageInterface $package)
  15003. {
  15004. if (!$this->updateWhitelist) {
  15005. throw new \LogicException('isUpdateable should only be called when an allow list is present');
  15006. }
  15007. foreach ($this->updateWhitelist as $pattern => $void) {
  15008. $patternRegexp = BasePackage::packageNameToRegexp($pattern);
  15009. if (preg_match($patternRegexp, $package->getName())) {
  15010. return true;
  15011. }
  15012. }
  15013. return false;
  15014. }
  15015. private function extractPlatformRequirements($links)
  15016. {
  15017. $platformReqs = array();
  15018. foreach ($links as $link) {
  15019. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  15020. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  15021. }
  15022. }
  15023. return $platformReqs;
  15024. }
  15025. private function allowListUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  15026. {
  15027. if (!$this->updateWhitelist) {
  15028. return;
  15029. }
  15030. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  15031. $skipPackages = array();
  15032. if (!$this->whitelistAllDependencies) {
  15033. foreach ($rootRequires as $require) {
  15034. $skipPackages[$require->getTarget()] = true;
  15035. }
  15036. }
  15037. $pool = new Pool('dev');
  15038. $pool->addRepository($localOrLockRepo);
  15039. $seen = array();
  15040. $rootRequiredPackageNames = array_keys($rootRequires);
  15041. foreach ($this->updateWhitelist as $packageName => $void) {
  15042. $packageQueue = new \SplQueue;
  15043. $nameMatchesRequiredPackage = false;
  15044. $depPackages = $pool->whatProvides($packageName);
  15045. $matchesByPattern = array();
  15046. if (empty($depPackages)) {
  15047. $allowListPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  15048. foreach ($localOrLockRepo->search($allowListPatternSearchRegexp) as $installedPackage) {
  15049. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  15050. }
  15051. $allowListPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  15052. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  15053. if (preg_match($allowListPatternRegexp, $rootRequiredPackageName)) {
  15054. $nameMatchesRequiredPackage = true;
  15055. break;
  15056. }
  15057. }
  15058. }
  15059. if (!empty($matchesByPattern)) {
  15060. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  15061. }
  15062. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  15063. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  15064. }
  15065. foreach ($depPackages as $depPackage) {
  15066. $packageQueue->enqueue($depPackage);
  15067. }
  15068. while (!$packageQueue->isEmpty()) {
  15069. $package = $packageQueue->dequeue();
  15070. if (isset($seen[$package->getId()])) {
  15071. continue;
  15072. }
  15073. $seen[$package->getId()] = true;
  15074. $this->updateWhitelist[$package->getName()] = true;
  15075. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  15076. continue;
  15077. }
  15078. $requires = $package->getRequires();
  15079. foreach ($requires as $require) {
  15080. $requirePackages = $pool->whatProvides($require->getTarget());
  15081. foreach ($requirePackages as $requirePackage) {
  15082. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  15083. continue;
  15084. }
  15085. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  15086. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly allowed. Ignoring.</warning>');
  15087. continue;
  15088. }
  15089. $packageQueue->enqueue($requirePackage);
  15090. }
  15091. }
  15092. }
  15093. }
  15094. }
  15095. private function mockLocalRepositories(RepositoryManager $rm)
  15096. {
  15097. $packages = array();
  15098. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  15099. $packages[(string) $package] = clone $package;
  15100. }
  15101. foreach ($packages as $key => $package) {
  15102. if ($package instanceof AliasPackage) {
  15103. $alias = (string) $package->getAliasOf();
  15104. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  15105. }
  15106. }
  15107. $rm->setLocalRepository(
  15108. new InstalledArrayRepository($packages)
  15109. );
  15110. }
  15111. public static function create(IOInterface $io, Composer $composer)
  15112. {
  15113. return new static(
  15114. $io,
  15115. $composer->getConfig(),
  15116. $composer->getPackage(),
  15117. $composer->getDownloadManager(),
  15118. $composer->getRepositoryManager(),
  15119. $composer->getLocker(),
  15120. $composer->getInstallationManager(),
  15121. $composer->getEventDispatcher(),
  15122. $composer->getAutoloadGenerator()
  15123. );
  15124. }
  15125. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  15126. {
  15127. $this->additionalInstalledRepository = $additionalInstalledRepository;
  15128. return $this;
  15129. }
  15130. public function setDryRun($dryRun = true)
  15131. {
  15132. $this->dryRun = (bool) $dryRun;
  15133. return $this;
  15134. }
  15135. public function isDryRun()
  15136. {
  15137. return $this->dryRun;
  15138. }
  15139. public function setPreferSource($preferSource = true)
  15140. {
  15141. $this->preferSource = (bool) $preferSource;
  15142. return $this;
  15143. }
  15144. public function setPreferDist($preferDist = true)
  15145. {
  15146. $this->preferDist = (bool) $preferDist;
  15147. return $this;
  15148. }
  15149. public function setOptimizeAutoloader($optimizeAutoloader = false)
  15150. {
  15151. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  15152. if (!$this->optimizeAutoloader) {
  15153. $this->setClassMapAuthoritative(false);
  15154. }
  15155. return $this;
  15156. }
  15157. public function setClassMapAuthoritative($classMapAuthoritative = false)
  15158. {
  15159. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  15160. if ($this->classMapAuthoritative) {
  15161. $this->setOptimizeAutoloader(true);
  15162. }
  15163. return $this;
  15164. }
  15165. public function setApcuAutoloader($apcuAutoloader = false)
  15166. {
  15167. $this->apcuAutoloader = (bool) $apcuAutoloader;
  15168. return $this;
  15169. }
  15170. public function setUpdate($update = true)
  15171. {
  15172. $this->update = (bool) $update;
  15173. return $this;
  15174. }
  15175. public function setDevMode($devMode = true)
  15176. {
  15177. $this->devMode = (bool) $devMode;
  15178. return $this;
  15179. }
  15180. public function setDumpAutoloader($dumpAutoloader = true)
  15181. {
  15182. $this->dumpAutoloader = (bool) $dumpAutoloader;
  15183. return $this;
  15184. }
  15185. public function setRunScripts($runScripts = true)
  15186. {
  15187. $this->runScripts = (bool) $runScripts;
  15188. return $this;
  15189. }
  15190. public function setConfig(Config $config)
  15191. {
  15192. $this->config = $config;
  15193. return $this;
  15194. }
  15195. public function setVerbose($verbose = true)
  15196. {
  15197. $this->verbose = (bool) $verbose;
  15198. return $this;
  15199. }
  15200. public function isVerbose()
  15201. {
  15202. return $this->verbose;
  15203. }
  15204. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  15205. {
  15206. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  15207. return $this;
  15208. }
  15209. public function setUpdateWhitelist(array $packages)
  15210. {
  15211. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  15212. return $this;
  15213. }
  15214. public function setUpdateAllowList(array $packages)
  15215. {
  15216. return $this->setUpdateWhitelist($packages);
  15217. }
  15218. public function setWhitelistDependencies($updateDependencies = true)
  15219. {
  15220. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  15221. }
  15222. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  15223. {
  15224. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  15225. return $this;
  15226. }
  15227. public function setAllowListTransitiveDependencies($updateTransitiveDependencies = true)
  15228. {
  15229. return $this->setWhitelistTransitiveDependencies($updateTransitiveDependencies);
  15230. }
  15231. public function setWhitelistAllDependencies($updateAllDependencies = true)
  15232. {
  15233. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  15234. return $this;
  15235. }
  15236. public function setAllowListAllDependencies($updateAllDependencies = true)
  15237. {
  15238. return $this->setWhitelistAllDependencies($updateAllDependencies);
  15239. }
  15240. public function setPreferStable($preferStable = true)
  15241. {
  15242. $this->preferStable = (bool) $preferStable;
  15243. return $this;
  15244. }
  15245. public function setPreferLowest($preferLowest = true)
  15246. {
  15247. $this->preferLowest = (bool) $preferLowest;
  15248. return $this;
  15249. }
  15250. public function setWriteLock($writeLock = true)
  15251. {
  15252. $this->writeLock = (bool) $writeLock;
  15253. return $this;
  15254. }
  15255. public function setExecuteOperations($executeOperations = true)
  15256. {
  15257. $this->executeOperations = (bool) $executeOperations;
  15258. return $this;
  15259. }
  15260. public function setSkipSuggest($skipSuggest = true)
  15261. {
  15262. $this->skipSuggest = (bool) $skipSuggest;
  15263. return $this;
  15264. }
  15265. public function disablePlugins()
  15266. {
  15267. $this->installationManager->disablePlugins();
  15268. return $this;
  15269. }
  15270. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  15271. {
  15272. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  15273. return $this;
  15274. }
  15275. }
  15276. <?php
  15277. namespace Composer\Installer;
  15278. use Composer\IO\IOInterface;
  15279. use Composer\Package\PackageInterface;
  15280. use Composer\Util\Filesystem;
  15281. use Composer\Util\Platform;
  15282. use Composer\Util\ProcessExecutor;
  15283. use Composer\Util\Silencer;
  15284. class BinaryInstaller
  15285. {
  15286. protected $binDir;
  15287. protected $binCompat;
  15288. protected $io;
  15289. protected $filesystem;
  15290. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  15291. {
  15292. $this->binDir = $binDir;
  15293. $this->binCompat = $binCompat;
  15294. $this->io = $io;
  15295. $this->filesystem = $filesystem ?: new Filesystem();
  15296. }
  15297. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  15298. {
  15299. $binaries = $this->getBinaries($package);
  15300. if (!$binaries) {
  15301. return;
  15302. }
  15303. foreach ($binaries as $bin) {
  15304. $binPath = $installPath.'/'.$bin;
  15305. if (!file_exists($binPath)) {
  15306. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  15307. continue;
  15308. }
  15309. $binPath = realpath($binPath);
  15310. $this->initializeBinDir();
  15311. $link = $this->binDir.'/'.basename($bin);
  15312. if (file_exists($link)) {
  15313. if (is_link($link)) {
  15314. Silencer::call('chmod', $link, 0777 & ~umask());
  15315. }
  15316. if ($warnOnOverwrite) {
  15317. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  15318. }
  15319. continue;
  15320. }
  15321. if ($this->binCompat === "auto") {
  15322. if (Platform::isWindows()) {
  15323. $this->installFullBinaries($binPath, $link, $bin, $package);
  15324. } else {
  15325. $this->installSymlinkBinaries($binPath, $link);
  15326. }
  15327. } elseif ($this->binCompat === "full") {
  15328. $this->installFullBinaries($binPath, $link, $bin, $package);
  15329. }
  15330. Silencer::call('chmod', $link, 0777 & ~umask());
  15331. }
  15332. }
  15333. public function removeBinaries(PackageInterface $package)
  15334. {
  15335. $this->initializeBinDir();
  15336. $binaries = $this->getBinaries($package);
  15337. if (!$binaries) {
  15338. return;
  15339. }
  15340. foreach ($binaries as $bin) {
  15341. $link = $this->binDir.'/'.basename($bin);
  15342. if (is_link($link) || file_exists($link)) {
  15343. $this->filesystem->unlink($link);
  15344. }
  15345. if (file_exists($link.'.bat')) {
  15346. $this->filesystem->unlink($link.'.bat');
  15347. }
  15348. }
  15349. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  15350. Silencer::call('rmdir', $this->binDir);
  15351. }
  15352. }
  15353. public static function determineBinaryCaller($bin)
  15354. {
  15355. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  15356. return 'call';
  15357. }
  15358. $handle = fopen($bin, 'r');
  15359. $line = fgets($handle);
  15360. fclose($handle);
  15361. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15362. return trim($match[1]);
  15363. }
  15364. return 'php';
  15365. }
  15366. protected function getBinaries(PackageInterface $package)
  15367. {
  15368. return $package->getBinaries();
  15369. }
  15370. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  15371. {
  15372. if ('.bat' !== substr($binPath, -4)) {
  15373. $this->installUnixyProxyBinaries($binPath, $link);
  15374. @chmod($link, 0777 & ~umask());
  15375. $link .= '.bat';
  15376. if (file_exists($link)) {
  15377. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  15378. }
  15379. }
  15380. if (!file_exists($link)) {
  15381. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  15382. }
  15383. }
  15384. protected function installSymlinkBinaries($binPath, $link)
  15385. {
  15386. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  15387. $this->installUnixyProxyBinaries($binPath, $link);
  15388. }
  15389. }
  15390. protected function installUnixyProxyBinaries($binPath, $link)
  15391. {
  15392. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  15393. }
  15394. protected function initializeBinDir()
  15395. {
  15396. $this->filesystem->ensureDirectoryExists($this->binDir);
  15397. $this->binDir = realpath($this->binDir);
  15398. }
  15399. protected function generateWindowsProxyCode($bin, $link)
  15400. {
  15401. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15402. $caller = self::determineBinaryCaller($bin);
  15403. return "@ECHO OFF\r\n".
  15404. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  15405. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  15406. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  15407. }
  15408. protected function generateUnixyProxyCode($bin, $link)
  15409. {
  15410. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15411. $binDir = ProcessExecutor::escape(dirname($binPath));
  15412. $binFile = basename($binPath);
  15413. $proxyCode = <<<PROXY
  15414. #!/usr/bin/env sh
  15415. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  15416. if [ -d /proc/cygdrive ]; then
  15417. case \$(which php) in
  15418. \$(readlink -n /proc/cygdrive)/*)
  15419. # We are in Cygwin using Windows php, so the path must be translated
  15420. dir=\$(cygpath -m "\$dir");
  15421. ;;
  15422. esac
  15423. fi
  15424. "\${dir}/$binFile" "\$@"
  15425. PROXY;
  15426. return $proxyCode;
  15427. }
  15428. }
  15429. <?php
  15430. namespace Composer\Installer;
  15431. use Composer\Package\PackageInterface;
  15432. interface BinaryPresenceInterface
  15433. {
  15434. public function ensureBinariesPresence(PackageInterface $package);
  15435. }
  15436. <?php
  15437. namespace Composer\Installer;
  15438. use Composer\IO\IOInterface;
  15439. use Composer\Package\PackageInterface;
  15440. use Composer\Package\AliasPackage;
  15441. use Composer\Repository\RepositoryInterface;
  15442. use Composer\Repository\InstalledRepositoryInterface;
  15443. use Composer\DependencyResolver\Operation\OperationInterface;
  15444. use Composer\DependencyResolver\Operation\InstallOperation;
  15445. use Composer\DependencyResolver\Operation\UpdateOperation;
  15446. use Composer\DependencyResolver\Operation\UninstallOperation;
  15447. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  15448. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  15449. use Composer\Util\StreamContextFactory;
  15450. class InstallationManager
  15451. {
  15452. private $installers = array();
  15453. private $cache = array();
  15454. private $notifiablePackages = array();
  15455. public function reset()
  15456. {
  15457. $this->notifiablePackages = array();
  15458. }
  15459. public function addInstaller(InstallerInterface $installer)
  15460. {
  15461. array_unshift($this->installers, $installer);
  15462. $this->cache = array();
  15463. }
  15464. public function removeInstaller(InstallerInterface $installer)
  15465. {
  15466. if (false !== ($key = array_search($installer, $this->installers, true))) {
  15467. array_splice($this->installers, $key, 1);
  15468. $this->cache = array();
  15469. }
  15470. }
  15471. public function disablePlugins()
  15472. {
  15473. foreach ($this->installers as $i => $installer) {
  15474. if (!$installer instanceof PluginInstaller) {
  15475. continue;
  15476. }
  15477. unset($this->installers[$i]);
  15478. }
  15479. }
  15480. public function getInstaller($type)
  15481. {
  15482. $type = strtolower($type);
  15483. if (isset($this->cache[$type])) {
  15484. return $this->cache[$type];
  15485. }
  15486. foreach ($this->installers as $installer) {
  15487. if ($installer->supports($type)) {
  15488. return $this->cache[$type] = $installer;
  15489. }
  15490. }
  15491. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  15492. }
  15493. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15494. {
  15495. if ($package instanceof AliasPackage) {
  15496. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  15497. }
  15498. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  15499. }
  15500. public function ensureBinariesPresence(PackageInterface $package)
  15501. {
  15502. try {
  15503. $installer = $this->getInstaller($package->getType());
  15504. } catch (\InvalidArgumentException $e) {
  15505. return;
  15506. }
  15507. if ($installer instanceof BinaryPresenceInterface) {
  15508. $installer->ensureBinariesPresence($package);
  15509. }
  15510. }
  15511. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  15512. {
  15513. $method = $operation->getJobType();
  15514. $this->$method($repo, $operation);
  15515. }
  15516. public function install(RepositoryInterface $repo, InstallOperation $operation)
  15517. {
  15518. $package = $operation->getPackage();
  15519. $installer = $this->getInstaller($package->getType());
  15520. $installer->install($repo, $package);
  15521. $this->markForNotification($package);
  15522. }
  15523. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  15524. {
  15525. $initial = $operation->getInitialPackage();
  15526. $target = $operation->getTargetPackage();
  15527. $initialType = $initial->getType();
  15528. $targetType = $target->getType();
  15529. if ($initialType === $targetType) {
  15530. $installer = $this->getInstaller($initialType);
  15531. $installer->update($repo, $initial, $target);
  15532. $this->markForNotification($target);
  15533. } else {
  15534. $this->getInstaller($initialType)->uninstall($repo, $initial);
  15535. $this->getInstaller($targetType)->install($repo, $target);
  15536. }
  15537. }
  15538. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  15539. {
  15540. $package = $operation->getPackage();
  15541. $installer = $this->getInstaller($package->getType());
  15542. $installer->uninstall($repo, $package);
  15543. }
  15544. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  15545. {
  15546. $package = $operation->getPackage();
  15547. if (!$repo->hasPackage($package)) {
  15548. $repo->addPackage(clone $package);
  15549. }
  15550. }
  15551. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  15552. {
  15553. $package = $operation->getPackage();
  15554. $repo->removePackage($package);
  15555. }
  15556. public function getInstallPath(PackageInterface $package)
  15557. {
  15558. $installer = $this->getInstaller($package->getType());
  15559. return $installer->getInstallPath($package);
  15560. }
  15561. public function notifyInstalls(IOInterface $io)
  15562. {
  15563. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  15564. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  15565. if ($io->hasAuthentication($repositoryName)) {
  15566. $auth = $io->getAuthentication($repositoryName);
  15567. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  15568. $authHeader = 'Authorization: Basic '.$authStr;
  15569. }
  15570. if (strpos($repoUrl, '%package%')) {
  15571. foreach ($packages as $package) {
  15572. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  15573. $params = array(
  15574. 'version' => $package->getPrettyVersion(),
  15575. 'version_normalized' => $package->getVersion(),
  15576. );
  15577. $opts = array('http' =>
  15578. array(
  15579. 'method' => 'POST',
  15580. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  15581. 'content' => http_build_query($params, '', '&'),
  15582. 'timeout' => 3,
  15583. ),
  15584. );
  15585. if (isset($authHeader)) {
  15586. $opts['http']['header'][] = $authHeader;
  15587. }
  15588. $context = StreamContextFactory::getContext($url, $opts);
  15589. @file_get_contents($url, false, $context);
  15590. }
  15591. continue;
  15592. }
  15593. $postData = array('downloads' => array());
  15594. foreach ($packages as $package) {
  15595. $postData['downloads'][] = array(
  15596. 'name' => $package->getPrettyName(),
  15597. 'version' => $package->getVersion(),
  15598. );
  15599. }
  15600. $opts = array('http' =>
  15601. array(
  15602. 'method' => 'POST',
  15603. 'header' => array('Content-Type: application/json'),
  15604. 'content' => json_encode($postData),
  15605. 'timeout' => 6,
  15606. ),
  15607. );
  15608. if (isset($authHeader)) {
  15609. $opts['http']['header'][] = $authHeader;
  15610. }
  15611. $context = StreamContextFactory::getContext($repoUrl, $opts);
  15612. @file_get_contents($repoUrl, false, $context);
  15613. }
  15614. $this->reset();
  15615. }
  15616. private function markForNotification(PackageInterface $package)
  15617. {
  15618. if ($package->getNotificationUrl()) {
  15619. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  15620. }
  15621. }
  15622. }
  15623. <?php
  15624. namespace Composer\Installer;
  15625. use Composer\Composer;
  15626. use Composer\DependencyResolver\PolicyInterface;
  15627. use Composer\DependencyResolver\Operation\OperationInterface;
  15628. use Composer\DependencyResolver\Pool;
  15629. use Composer\DependencyResolver\Request;
  15630. use Composer\EventDispatcher\Event;
  15631. use Composer\IO\IOInterface;
  15632. use Composer\Repository\CompositeRepository;
  15633. class InstallerEvent extends Event
  15634. {
  15635. private $composer;
  15636. private $io;
  15637. private $devMode;
  15638. private $policy;
  15639. private $pool;
  15640. private $installedRepo;
  15641. private $request;
  15642. private $operations;
  15643. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  15644. {
  15645. parent::__construct($eventName);
  15646. $this->composer = $composer;
  15647. $this->io = $io;
  15648. $this->devMode = $devMode;
  15649. $this->policy = $policy;
  15650. $this->pool = $pool;
  15651. $this->installedRepo = $installedRepo;
  15652. $this->request = $request;
  15653. $this->operations = $operations;
  15654. }
  15655. public function getComposer()
  15656. {
  15657. return $this->composer;
  15658. }
  15659. public function getIO()
  15660. {
  15661. return $this->io;
  15662. }
  15663. public function isDevMode()
  15664. {
  15665. return $this->devMode;
  15666. }
  15667. public function getPolicy()
  15668. {
  15669. return $this->policy;
  15670. }
  15671. public function getPool()
  15672. {
  15673. return $this->pool;
  15674. }
  15675. public function getInstalledRepo()
  15676. {
  15677. return $this->installedRepo;
  15678. }
  15679. public function getRequest()
  15680. {
  15681. return $this->request;
  15682. }
  15683. public function getOperations()
  15684. {
  15685. return $this->operations;
  15686. }
  15687. }
  15688. <?php
  15689. namespace Composer\Installer;
  15690. class InstallerEvents
  15691. {
  15692. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15693. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15694. }
  15695. <?php
  15696. namespace Composer\Installer;
  15697. use Composer\Package\PackageInterface;
  15698. use Composer\Repository\InstalledRepositoryInterface;
  15699. use InvalidArgumentException;
  15700. interface InstallerInterface
  15701. {
  15702. public function supports($packageType);
  15703. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15704. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15705. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15706. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15707. public function getInstallPath(PackageInterface $package);
  15708. }
  15709. <?php
  15710. namespace Composer\Installer;
  15711. use Composer\Composer;
  15712. use Composer\IO\IOInterface;
  15713. use Composer\Repository\InstalledRepositoryInterface;
  15714. use Composer\Package\PackageInterface;
  15715. use Composer\Util\Filesystem;
  15716. use Composer\Util\Silencer;
  15717. use Composer\Util\Platform;
  15718. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15719. {
  15720. protected $composer;
  15721. protected $vendorDir;
  15722. protected $binDir;
  15723. protected $downloadManager;
  15724. protected $io;
  15725. protected $type;
  15726. protected $filesystem;
  15727. protected $binCompat;
  15728. protected $binaryInstaller;
  15729. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15730. {
  15731. $this->composer = $composer;
  15732. $this->downloadManager = $composer->getDownloadManager();
  15733. $this->io = $io;
  15734. $this->type = $type;
  15735. $this->filesystem = $filesystem ?: new Filesystem();
  15736. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15737. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15738. }
  15739. public function supports($packageType)
  15740. {
  15741. return $packageType === $this->type || null === $this->type;
  15742. }
  15743. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15744. {
  15745. if (!$repo->hasPackage($package)) {
  15746. return false;
  15747. }
  15748. $installPath = $this->getInstallPath($package);
  15749. if (is_readable($installPath)) {
  15750. return true;
  15751. }
  15752. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15753. }
  15754. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15755. {
  15756. $this->initializeVendorDir();
  15757. $downloadPath = $this->getInstallPath($package);
  15758. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15759. $this->binaryInstaller->removeBinaries($package);
  15760. }
  15761. $this->installCode($package);
  15762. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15763. if (!$repo->hasPackage($package)) {
  15764. $repo->addPackage(clone $package);
  15765. }
  15766. }
  15767. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15768. {
  15769. if (!$repo->hasPackage($initial)) {
  15770. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15771. }
  15772. $this->initializeVendorDir();
  15773. $this->binaryInstaller->removeBinaries($initial);
  15774. $this->updateCode($initial, $target);
  15775. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15776. $repo->removePackage($initial);
  15777. if (!$repo->hasPackage($target)) {
  15778. $repo->addPackage(clone $target);
  15779. }
  15780. }
  15781. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15782. {
  15783. if (!$repo->hasPackage($package)) {
  15784. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15785. }
  15786. $this->removeCode($package);
  15787. $this->binaryInstaller->removeBinaries($package);
  15788. $repo->removePackage($package);
  15789. $downloadPath = $this->getPackageBasePath($package);
  15790. if (strpos($package->getName(), '/')) {
  15791. $packageVendorDir = dirname($downloadPath);
  15792. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15793. Silencer::call('rmdir', $packageVendorDir);
  15794. }
  15795. }
  15796. }
  15797. public function getInstallPath(PackageInterface $package)
  15798. {
  15799. $this->initializeVendorDir();
  15800. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15801. $targetDir = $package->getTargetDir();
  15802. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15803. }
  15804. public function ensureBinariesPresence(PackageInterface $package)
  15805. {
  15806. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15807. }
  15808. protected function getPackageBasePath(PackageInterface $package)
  15809. {
  15810. $installPath = $this->getInstallPath($package);
  15811. $targetDir = $package->getTargetDir();
  15812. if ($targetDir) {
  15813. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15814. }
  15815. return $installPath;
  15816. }
  15817. protected function installCode(PackageInterface $package)
  15818. {
  15819. $downloadPath = $this->getInstallPath($package);
  15820. $this->downloadManager->download($package, $downloadPath);
  15821. }
  15822. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15823. {
  15824. $initialDownloadPath = $this->getInstallPath($initial);
  15825. $targetDownloadPath = $this->getInstallPath($target);
  15826. if ($targetDownloadPath !== $initialDownloadPath) {
  15827. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15828. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15829. ) {
  15830. $this->removeCode($initial);
  15831. $this->installCode($target);
  15832. return;
  15833. }
  15834. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15835. }
  15836. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15837. }
  15838. protected function removeCode(PackageInterface $package)
  15839. {
  15840. $downloadPath = $this->getPackageBasePath($package);
  15841. $this->downloadManager->remove($package, $downloadPath);
  15842. }
  15843. protected function initializeVendorDir()
  15844. {
  15845. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15846. $this->vendorDir = realpath($this->vendorDir);
  15847. }
  15848. }
  15849. <?php
  15850. namespace Composer\Installer;
  15851. use Composer\Repository\InstalledRepositoryInterface;
  15852. use Composer\Package\PackageInterface;
  15853. use Composer\Package\Version\VersionParser;
  15854. use Composer\IO\IOInterface;
  15855. class MetapackageInstaller implements InstallerInterface
  15856. {
  15857. private $io;
  15858. public function __construct(IOInterface $io)
  15859. {
  15860. $this->io = $io;
  15861. }
  15862. public function supports($packageType)
  15863. {
  15864. return $packageType === 'metapackage';
  15865. }
  15866. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15867. {
  15868. return $repo->hasPackage($package);
  15869. }
  15870. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15871. {
  15872. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15873. $repo->addPackage(clone $package);
  15874. }
  15875. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15876. {
  15877. if (!$repo->hasPackage($initial)) {
  15878. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15879. }
  15880. $name = $target->getName();
  15881. $from = $initial->getFullPrettyVersion();
  15882. $to = $target->getFullPrettyVersion();
  15883. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15884. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15885. $repo->removePackage($initial);
  15886. $repo->addPackage(clone $target);
  15887. }
  15888. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15889. {
  15890. if (!$repo->hasPackage($package)) {
  15891. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15892. }
  15893. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15894. $repo->removePackage($package);
  15895. }
  15896. public function getInstallPath(PackageInterface $package)
  15897. {
  15898. return '';
  15899. }
  15900. }
  15901. <?php
  15902. namespace Composer\Installer;
  15903. use Composer\Repository\InstalledRepositoryInterface;
  15904. use Composer\Package\PackageInterface;
  15905. class NoopInstaller implements InstallerInterface
  15906. {
  15907. public function supports($packageType)
  15908. {
  15909. return true;
  15910. }
  15911. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15912. {
  15913. return $repo->hasPackage($package);
  15914. }
  15915. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15916. {
  15917. if (!$repo->hasPackage($package)) {
  15918. $repo->addPackage(clone $package);
  15919. }
  15920. }
  15921. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15922. {
  15923. if (!$repo->hasPackage($initial)) {
  15924. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15925. }
  15926. $repo->removePackage($initial);
  15927. if (!$repo->hasPackage($target)) {
  15928. $repo->addPackage(clone $target);
  15929. }
  15930. }
  15931. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15932. {
  15933. if (!$repo->hasPackage($package)) {
  15934. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15935. }
  15936. $repo->removePackage($package);
  15937. }
  15938. public function getInstallPath(PackageInterface $package)
  15939. {
  15940. $targetDir = $package->getTargetDir();
  15941. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15942. }
  15943. }
  15944. <?php
  15945. namespace Composer\Installer;
  15946. use Composer\Composer;
  15947. use Composer\IO\IOInterface;
  15948. use Composer\DependencyResolver\Operation\OperationInterface;
  15949. use Composer\DependencyResolver\PolicyInterface;
  15950. use Composer\DependencyResolver\Pool;
  15951. use Composer\DependencyResolver\Request;
  15952. use Composer\Repository\CompositeRepository;
  15953. class PackageEvent extends InstallerEvent
  15954. {
  15955. private $operation;
  15956. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15957. {
  15958. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15959. $this->operation = $operation;
  15960. }
  15961. public function getOperation()
  15962. {
  15963. return $this->operation;
  15964. }
  15965. }
  15966. <?php
  15967. namespace Composer\Installer;
  15968. class PackageEvents
  15969. {
  15970. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15971. const POST_PACKAGE_INSTALL = 'post-package-install';
  15972. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15973. const POST_PACKAGE_UPDATE = 'post-package-update';
  15974. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15975. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15976. }
  15977. <?php
  15978. namespace Composer\Installer;
  15979. use Composer\IO\IOInterface;
  15980. use Composer\Package\PackageInterface;
  15981. use Composer\Util\Filesystem;
  15982. use Composer\Util\ProcessExecutor;
  15983. class PearBinaryInstaller extends BinaryInstaller
  15984. {
  15985. private $installer;
  15986. private $vendorDir;
  15987. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15988. {
  15989. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15990. $this->installer = $installer;
  15991. $this->vendorDir = $vendorDir;
  15992. }
  15993. protected function getBinaries(PackageInterface $package)
  15994. {
  15995. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15996. $binaries = array();
  15997. if (file_exists($binariesPath)) {
  15998. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15999. if (!$value->isDir()) {
  16000. $binaries[] = 'bin/'.$fileName;
  16001. }
  16002. }
  16003. }
  16004. return $binaries;
  16005. }
  16006. protected function initializeBinDir()
  16007. {
  16008. parent::initializeBinDir();
  16009. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  16010. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  16011. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  16012. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  16013. }
  16014. protected function generateWindowsProxyCode($bin, $link)
  16015. {
  16016. $binPath = $this->filesystem->findShortestPath($link, $bin);
  16017. if ('.bat' === substr($bin, -4)) {
  16018. $caller = 'call';
  16019. } else {
  16020. $handle = fopen($bin, 'r');
  16021. $line = fgets($handle);
  16022. fclose($handle);
  16023. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  16024. $caller = trim($match[1]);
  16025. } else {
  16026. $caller = 'php';
  16027. }
  16028. if ($caller === 'php') {
  16029. return "@echo off\r\n".
  16030. "pushd .\r\n".
  16031. "cd %~dp0\r\n".
  16032. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  16033. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16034. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16035. "popd\r\n".
  16036. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  16037. }
  16038. }
  16039. return "@echo off\r\n".
  16040. "pushd .\r\n".
  16041. "cd %~dp0\r\n".
  16042. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  16043. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  16044. "popd\r\n".
  16045. $caller." \"%BIN_TARGET%\" %*\r\n";
  16046. }
  16047. private function generateWindowsPhpProxyCode()
  16048. {
  16049. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16050. return
  16051. "@echo off\r\n" .
  16052. "setlocal enabledelayedexpansion\r\n" .
  16053. "set BIN_DIR=%~dp0\r\n" .
  16054. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  16055. "set DIRS=.\r\n" .
  16056. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  16057. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  16058. " set DIRS=!DIRS!;%%~fP\r\n" .
  16059. " )\r\n" .
  16060. ")\r\n" .
  16061. "php.exe -d include_path=!DIRS! %*\r\n";
  16062. }
  16063. private function generateUnixyPhpProxyCode()
  16064. {
  16065. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  16066. return
  16067. "#!/usr/bin/env sh\n".
  16068. "SRC_DIR=`pwd`\n".
  16069. "BIN_DIR=`dirname $0`\n".
  16070. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  16071. "DIRS=\"\"\n".
  16072. "for vendor in \$VENDOR_DIR/*; do\n".
  16073. " if [ -d \"\$vendor\" ]; then\n".
  16074. " for package in \$vendor/*; do\n".
  16075. " if [ -d \"\$package\" ]; then\n".
  16076. " DIRS=\"\${DIRS}:\${package}\"\n".
  16077. " fi\n".
  16078. " done\n".
  16079. " fi\n".
  16080. "done\n".
  16081. "php -d include_path=\".\$DIRS\" $@\n";
  16082. }
  16083. }
  16084. <?php
  16085. namespace Composer\Installer;
  16086. use Composer\IO\IOInterface;
  16087. use Composer\Composer;
  16088. use Composer\Downloader\PearPackageExtractor;
  16089. use Composer\Repository\InstalledRepositoryInterface;
  16090. use Composer\Package\PackageInterface;
  16091. use Composer\Util\Platform;
  16092. use Composer\Util\Filesystem;
  16093. class PearInstaller extends LibraryInstaller
  16094. {
  16095. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  16096. {
  16097. $filesystem = new Filesystem();
  16098. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  16099. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  16100. }
  16101. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16102. {
  16103. $this->uninstall($repo, $initial);
  16104. $this->install($repo, $target);
  16105. }
  16106. protected function installCode(PackageInterface $package)
  16107. {
  16108. parent::installCode($package);
  16109. $isWindows = Platform::isWindows();
  16110. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  16111. if (!$isWindows) {
  16112. $php_bin = '/usr/bin/env ' . $php_bin;
  16113. }
  16114. $installPath = $this->getInstallPath($package);
  16115. $vars = array(
  16116. 'os' => $isWindows ? 'windows' : 'linux',
  16117. 'php_bin' => $php_bin,
  16118. 'pear_php' => $installPath,
  16119. 'php_dir' => $installPath,
  16120. 'bin_dir' => $installPath . '/bin',
  16121. 'data_dir' => $installPath . '/data',
  16122. 'version' => $package->getPrettyVersion(),
  16123. );
  16124. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  16125. $pearExtractor = new PearPackageExtractor($packageArchive);
  16126. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  16127. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  16128. $this->filesystem->unlink($packageArchive);
  16129. }
  16130. }
  16131. <?php
  16132. namespace Composer\Installer;
  16133. use Composer\Composer;
  16134. use Composer\IO\IOInterface;
  16135. use Composer\Repository\InstalledRepositoryInterface;
  16136. use Composer\Package\PackageInterface;
  16137. class PluginInstaller extends LibraryInstaller
  16138. {
  16139. private $installationManager;
  16140. public function __construct(IOInterface $io, Composer $composer)
  16141. {
  16142. parent::__construct($io, $composer, 'composer-plugin');
  16143. $this->installationManager = $composer->getInstallationManager();
  16144. }
  16145. public function supports($packageType)
  16146. {
  16147. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  16148. }
  16149. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16150. {
  16151. $extra = $package->getExtra();
  16152. if (empty($extra['class'])) {
  16153. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16154. }
  16155. parent::install($repo, $package);
  16156. try {
  16157. $this->composer->getPluginManager()->registerPackage($package, true);
  16158. } catch (\Exception $e) {
  16159. $this->io->writeError('Plugin installation failed ('.$e->getMessage().'), rolling back');
  16160. parent::uninstall($repo, $package);
  16161. throw $e;
  16162. }
  16163. }
  16164. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16165. {
  16166. $extra = $target->getExtra();
  16167. if (empty($extra['class'])) {
  16168. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  16169. }
  16170. parent::update($repo, $initial, $target);
  16171. $this->composer->getPluginManager()->registerPackage($target, true);
  16172. }
  16173. }
  16174. <?php
  16175. namespace Composer\Installer;
  16176. use Composer\Package\PackageInterface;
  16177. use Composer\Downloader\DownloadManager;
  16178. use Composer\Repository\InstalledRepositoryInterface;
  16179. use Composer\Util\Filesystem;
  16180. class ProjectInstaller implements InstallerInterface
  16181. {
  16182. private $installPath;
  16183. private $downloadManager;
  16184. private $filesystem;
  16185. public function __construct($installPath, DownloadManager $dm)
  16186. {
  16187. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  16188. $this->downloadManager = $dm;
  16189. $this->filesystem = new Filesystem;
  16190. }
  16191. public function supports($packageType)
  16192. {
  16193. return true;
  16194. }
  16195. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  16196. {
  16197. return false;
  16198. }
  16199. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  16200. {
  16201. $installPath = $this->installPath;
  16202. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  16203. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  16204. }
  16205. if (!is_dir($installPath)) {
  16206. mkdir($installPath, 0777, true);
  16207. }
  16208. $this->downloadManager->download($package, $installPath);
  16209. }
  16210. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  16211. {
  16212. throw new \InvalidArgumentException("not supported");
  16213. }
  16214. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  16215. {
  16216. throw new \InvalidArgumentException("not supported");
  16217. }
  16218. public function getInstallPath(PackageInterface $package)
  16219. {
  16220. return $this->installPath;
  16221. }
  16222. }
  16223. <?php
  16224. namespace Composer\Installer;
  16225. use Composer\IO\IOInterface;
  16226. use Composer\Package\PackageInterface;
  16227. use Composer\Repository\RepositoryInterface;
  16228. use Symfony\Component\Console\Formatter\OutputFormatter;
  16229. class SuggestedPackagesReporter
  16230. {
  16231. protected $suggestedPackages = array();
  16232. private $io;
  16233. public function __construct(IOInterface $io)
  16234. {
  16235. $this->io = $io;
  16236. }
  16237. public function getPackages()
  16238. {
  16239. return $this->suggestedPackages;
  16240. }
  16241. public function addPackage($source, $target, $reason)
  16242. {
  16243. $this->suggestedPackages[] = array(
  16244. 'source' => $source,
  16245. 'target' => $target,
  16246. 'reason' => $reason,
  16247. );
  16248. return $this;
  16249. }
  16250. public function addSuggestionsFromPackage(PackageInterface $package)
  16251. {
  16252. $source = $package->getPrettyName();
  16253. foreach ($package->getSuggests() as $target => $reason) {
  16254. $this->addPackage(
  16255. $source,
  16256. $target,
  16257. $reason
  16258. );
  16259. }
  16260. return $this;
  16261. }
  16262. public function output(RepositoryInterface $installedRepo = null)
  16263. {
  16264. $suggestedPackages = $this->getPackages();
  16265. $installedPackages = array();
  16266. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  16267. foreach ($installedRepo->getPackages() as $package) {
  16268. $installedPackages = array_merge(
  16269. $installedPackages,
  16270. $package->getNames()
  16271. );
  16272. }
  16273. }
  16274. foreach ($suggestedPackages as $suggestion) {
  16275. if (in_array($suggestion['target'], $installedPackages)) {
  16276. continue;
  16277. }
  16278. $this->io->writeError(sprintf(
  16279. '%s suggests installing %s%s',
  16280. $suggestion['source'],
  16281. $this->escapeOutput($suggestion['target']),
  16282. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  16283. ));
  16284. }
  16285. return $this;
  16286. }
  16287. private function escapeOutput($string)
  16288. {
  16289. return OutputFormatter::escape(
  16290. $this->removeControlCharacters($string)
  16291. );
  16292. }
  16293. private function removeControlCharacters($string)
  16294. {
  16295. return preg_replace(
  16296. '/[[:cntrl:]]/',
  16297. '',
  16298. str_replace("\n", ' ', $string)
  16299. );
  16300. }
  16301. }
  16302. <?php
  16303. namespace Composer\Json;
  16304. use JsonSchema\Validator;
  16305. use Seld\JsonLint\JsonParser;
  16306. use Seld\JsonLint\ParsingException;
  16307. use Composer\Util\RemoteFilesystem;
  16308. use Composer\IO\IOInterface;
  16309. use Composer\Downloader\TransportException;
  16310. class JsonFile
  16311. {
  16312. const LAX_SCHEMA = 1;
  16313. const STRICT_SCHEMA = 2;
  16314. const JSON_UNESCAPED_SLASHES = 64;
  16315. const JSON_PRETTY_PRINT = 128;
  16316. const JSON_UNESCAPED_UNICODE = 256;
  16317. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  16318. private $path;
  16319. private $rfs;
  16320. private $io;
  16321. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  16322. {
  16323. $this->path = $path;
  16324. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  16325. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  16326. }
  16327. $this->rfs = $rfs;
  16328. $this->io = $io;
  16329. }
  16330. public function getPath()
  16331. {
  16332. return $this->path;
  16333. }
  16334. public function exists()
  16335. {
  16336. return is_file($this->path);
  16337. }
  16338. public function read()
  16339. {
  16340. try {
  16341. if ($this->rfs) {
  16342. $json = $this->rfs->getContents($this->path, $this->path, false);
  16343. } else {
  16344. if ($this->io && $this->io->isDebug()) {
  16345. $this->io->writeError('Reading ' . $this->path);
  16346. }
  16347. $json = file_get_contents($this->path);
  16348. }
  16349. } catch (TransportException $e) {
  16350. throw new \RuntimeException($e->getMessage(), 0, $e);
  16351. } catch (\Exception $e) {
  16352. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  16353. }
  16354. return static::parseJson($json, $this->path);
  16355. }
  16356. public function write(array $hash, $options = 448)
  16357. {
  16358. $dir = dirname($this->path);
  16359. if (!is_dir($dir)) {
  16360. if (file_exists($dir)) {
  16361. throw new \UnexpectedValueException(
  16362. $dir.' exists and is not a directory.'
  16363. );
  16364. }
  16365. if (!@mkdir($dir, 0777, true)) {
  16366. throw new \UnexpectedValueException(
  16367. $dir.' does not exist and could not be created.'
  16368. );
  16369. }
  16370. }
  16371. $retries = 3;
  16372. while ($retries--) {
  16373. try {
  16374. $this->filePutContentsIfModified($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  16375. break;
  16376. } catch (\Exception $e) {
  16377. if ($retries) {
  16378. usleep(500000);
  16379. continue;
  16380. }
  16381. throw $e;
  16382. }
  16383. }
  16384. }
  16385. private function filePutContentsIfModified($path, $content)
  16386. {
  16387. $currentContent = @file_get_contents($path);
  16388. if (!$currentContent || ($currentContent != $content)) {
  16389. return file_put_contents($path, $content);
  16390. }
  16391. return 0;
  16392. }
  16393. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  16394. {
  16395. $content = file_get_contents($this->path);
  16396. $data = json_decode($content);
  16397. if (null === $data && 'null' !== $content) {
  16398. self::validateSyntax($content, $this->path);
  16399. }
  16400. if (null === $schemaFile) {
  16401. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  16402. }
  16403. if (false === strpos($schemaFile, '://')) {
  16404. $schemaFile = 'file://' . $schemaFile;
  16405. }
  16406. $schemaData = (object) array('$ref' => $schemaFile);
  16407. if ($schema === self::LAX_SCHEMA) {
  16408. $schemaData->additionalProperties = true;
  16409. $schemaData->required = array();
  16410. }
  16411. $validator = new Validator();
  16412. $validator->check($data, $schemaData);
  16413. if (!$validator->isValid()) {
  16414. $errors = array();
  16415. foreach ((array) $validator->getErrors() as $error) {
  16416. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  16417. }
  16418. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  16419. }
  16420. return true;
  16421. }
  16422. public static function encode($data, $options = 448)
  16423. {
  16424. if (PHP_VERSION_ID >= 50400) {
  16425. $json = json_encode($data, $options);
  16426. if (false === $json) {
  16427. self::throwEncodeError(json_last_error());
  16428. }
  16429. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  16430. $json = preg_replace('/\[\s+\]/', '[]', $json);
  16431. $json = preg_replace('/\{\s+\}/', '{}', $json);
  16432. }
  16433. return $json;
  16434. }
  16435. $json = json_encode($data);
  16436. if (false === $json) {
  16437. self::throwEncodeError(json_last_error());
  16438. }
  16439. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  16440. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  16441. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  16442. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  16443. return $json;
  16444. }
  16445. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  16446. }
  16447. private static function throwEncodeError($code)
  16448. {
  16449. switch ($code) {
  16450. case JSON_ERROR_DEPTH:
  16451. $msg = 'Maximum stack depth exceeded';
  16452. break;
  16453. case JSON_ERROR_STATE_MISMATCH:
  16454. $msg = 'Underflow or the modes mismatch';
  16455. break;
  16456. case JSON_ERROR_CTRL_CHAR:
  16457. $msg = 'Unexpected control character found';
  16458. break;
  16459. case JSON_ERROR_UTF8:
  16460. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  16461. break;
  16462. default:
  16463. $msg = 'Unknown error';
  16464. }
  16465. throw new \RuntimeException('JSON encoding failed: '.$msg);
  16466. }
  16467. public static function parseJson($json, $file = null)
  16468. {
  16469. if (null === $json) {
  16470. return;
  16471. }
  16472. $data = json_decode($json, true);
  16473. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  16474. self::validateSyntax($json, $file);
  16475. }
  16476. return $data;
  16477. }
  16478. protected static function validateSyntax($json, $file = null)
  16479. {
  16480. $parser = new JsonParser();
  16481. $result = $parser->lint($json);
  16482. if (null === $result) {
  16483. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  16484. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  16485. }
  16486. return true;
  16487. }
  16488. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  16489. }
  16490. }
  16491. <?php
  16492. namespace Composer\Json;
  16493. class JsonFormatter
  16494. {
  16495. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  16496. {
  16497. $result = '';
  16498. $pos = 0;
  16499. $strLen = strlen($json);
  16500. $indentStr = ' ';
  16501. $newLine = "\n";
  16502. $outOfQuotes = true;
  16503. $buffer = '';
  16504. $noescape = true;
  16505. for ($i = 0; $i < $strLen; $i++) {
  16506. $char = substr($json, $i, 1);
  16507. if ('"' === $char && $noescape) {
  16508. $outOfQuotes = !$outOfQuotes;
  16509. }
  16510. if (!$outOfQuotes) {
  16511. $buffer .= $char;
  16512. $noescape = '\\' === $char ? !$noescape : true;
  16513. continue;
  16514. } elseif ('' !== $buffer) {
  16515. if ($unescapeSlashes) {
  16516. $buffer = str_replace('\\/', '/', $buffer);
  16517. }
  16518. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  16519. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  16520. $l = strlen($match[1]);
  16521. if ($l % 2) {
  16522. $code = hexdec($match[2]);
  16523. if (0xD800 <= $code && 0xDFFF >= $code) {
  16524. return $match[0];
  16525. }
  16526. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  16527. pack('H*', $match[2]),
  16528. 'UTF-8',
  16529. 'UCS-2BE'
  16530. );
  16531. }
  16532. return $match[0];
  16533. }, $buffer);
  16534. }
  16535. $result .= $buffer.$char;
  16536. $buffer = '';
  16537. continue;
  16538. }
  16539. if (':' === $char) {
  16540. $char .= ' ';
  16541. } elseif ('}' === $char || ']' === $char) {
  16542. $pos--;
  16543. $prevChar = substr($json, $i - 1, 1);
  16544. if ('{' !== $prevChar && '[' !== $prevChar) {
  16545. $result .= $newLine;
  16546. for ($j = 0; $j < $pos; $j++) {
  16547. $result .= $indentStr;
  16548. }
  16549. } else {
  16550. $result = rtrim($result);
  16551. }
  16552. }
  16553. $result .= $char;
  16554. if (',' === $char || '{' === $char || '[' === $char) {
  16555. $result .= $newLine;
  16556. if ('{' === $char || '[' === $char) {
  16557. $pos++;
  16558. }
  16559. for ($j = 0; $j < $pos; $j++) {
  16560. $result .= $indentStr;
  16561. }
  16562. }
  16563. }
  16564. return $result;
  16565. }
  16566. }
  16567. <?php
  16568. namespace Composer\Json;
  16569. use Composer\Repository\PlatformRepository;
  16570. class JsonManipulator
  16571. {
  16572. private static $DEFINES = '(?(DEFINE)
  16573. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  16574. (?<boolean> true | false | null )
  16575. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  16576. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  16577. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  16578. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  16579. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  16580. )';
  16581. private $contents;
  16582. private $newline;
  16583. private $indent;
  16584. public function __construct($contents)
  16585. {
  16586. $contents = trim($contents);
  16587. if ($contents === '') {
  16588. $contents = '{}';
  16589. }
  16590. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  16591. throw new \InvalidArgumentException('The json file must be an object ({})');
  16592. }
  16593. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  16594. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  16595. $this->detectIndenting();
  16596. }
  16597. public function getContents()
  16598. {
  16599. return $this->contents . $this->newline;
  16600. }
  16601. public function addLink($type, $package, $constraint, $sortPackages = false)
  16602. {
  16603. $decoded = JsonFile::parseJson($this->contents);
  16604. if (!isset($decoded[$type])) {
  16605. return $this->addMainKey($type, array($package => $constraint));
  16606. }
  16607. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16608. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  16609. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  16610. return false;
  16611. }
  16612. $links = $matches['value'];
  16613. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  16614. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  16615. if ($this->pregMatch($regex, $links, $packageMatches)) {
  16616. $existingPackage = $packageMatches['package'];
  16617. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  16618. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  16619. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  16620. }, $links);
  16621. } else {
  16622. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  16623. $links = preg_replace(
  16624. '{'.preg_quote($match[1]).'$}',
  16625. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  16626. $links
  16627. );
  16628. } else {
  16629. $links = '{' . $this->newline .
  16630. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  16631. $this->indent . '}';
  16632. }
  16633. }
  16634. if (true === $sortPackages) {
  16635. $requirements = json_decode($links, true);
  16636. $this->sortPackages($requirements);
  16637. $links = $this->format($requirements);
  16638. }
  16639. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  16640. return true;
  16641. }
  16642. private function sortPackages(array &$packages = array())
  16643. {
  16644. $prefix = function ($requirement) {
  16645. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  16646. return preg_replace(
  16647. array(
  16648. '/^php/',
  16649. '/^hhvm/',
  16650. '/^ext/',
  16651. '/^lib/',
  16652. '/^\D/',
  16653. ),
  16654. array(
  16655. '0-$0',
  16656. '1-$0',
  16657. '2-$0',
  16658. '3-$0',
  16659. '4-$0',
  16660. ),
  16661. $requirement
  16662. );
  16663. }
  16664. return '5-'.$requirement;
  16665. };
  16666. uksort($packages, function ($a, $b) use ($prefix) {
  16667. return strnatcmp($prefix($a), $prefix($b));
  16668. });
  16669. }
  16670. public function addRepository($name, $config)
  16671. {
  16672. return $this->addSubNode('repositories', $name, $config);
  16673. }
  16674. public function removeRepository($name)
  16675. {
  16676. return $this->removeSubNode('repositories', $name);
  16677. }
  16678. public function addConfigSetting($name, $value)
  16679. {
  16680. return $this->addSubNode('config', $name, $value);
  16681. }
  16682. public function removeConfigSetting($name)
  16683. {
  16684. return $this->removeSubNode('config', $name);
  16685. }
  16686. public function addProperty($name, $value)
  16687. {
  16688. if (substr($name, 0, 8) === 'suggest.') {
  16689. return $this->addSubNode('suggest', substr($name, 8), $value);
  16690. }
  16691. if (substr($name, 0, 6) === 'extra.') {
  16692. return $this->addSubNode('extra', substr($name, 6), $value);
  16693. }
  16694. if (substr($name, 0, 8) === 'scripts.') {
  16695. return $this->addSubNode('scripts', substr($name, 8), $value);
  16696. }
  16697. return $this->addMainKey($name, $value);
  16698. }
  16699. public function removeProperty($name)
  16700. {
  16701. if (substr($name, 0, 8) === 'suggest.') {
  16702. return $this->removeSubNode('suggest', substr($name, 8));
  16703. }
  16704. if (substr($name, 0, 6) === 'extra.') {
  16705. return $this->removeSubNode('extra', substr($name, 6));
  16706. }
  16707. if (substr($name, 0, 8) === 'scripts.') {
  16708. return $this->removeSubNode('scripts', substr($name, 8));
  16709. }
  16710. return $this->removeMainKey($name);
  16711. }
  16712. public function addSubNode($mainNode, $name, $value)
  16713. {
  16714. $decoded = JsonFile::parseJson($this->contents);
  16715. $subName = null;
  16716. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16717. list($name, $subName) = explode('.', $name, 2);
  16718. }
  16719. if (!isset($decoded[$mainNode])) {
  16720. if ($subName !== null) {
  16721. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16722. } else {
  16723. $this->addMainKey($mainNode, array($name => $value));
  16724. }
  16725. return true;
  16726. }
  16727. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16728. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16729. try {
  16730. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16731. return false;
  16732. }
  16733. } catch (\RuntimeException $e) {
  16734. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16735. return false;
  16736. }
  16737. throw $e;
  16738. }
  16739. $children = $match['content'];
  16740. if (!@json_decode($children)) {
  16741. return false;
  16742. }
  16743. $that = $this;
  16744. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16745. if ($this->pregMatch($childRegex, $children, $matches)) {
  16746. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16747. if ($subName !== null) {
  16748. $curVal = json_decode($matches['content'], true);
  16749. if (!is_array($curVal)) {
  16750. $curVal = array();
  16751. }
  16752. $curVal[$subName] = $value;
  16753. $value = $curVal;
  16754. }
  16755. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16756. }, $children);
  16757. } else {
  16758. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16759. $whitespace = '';
  16760. if (!empty($match['trailingspace'])) {
  16761. $whitespace = $match['trailingspace'];
  16762. }
  16763. if (!empty($match['content'])) {
  16764. if ($subName !== null) {
  16765. $value = array($subName => $value);
  16766. }
  16767. $children = preg_replace(
  16768. '#'.$whitespace.'}$#',
  16769. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16770. $children
  16771. );
  16772. } else {
  16773. if ($subName !== null) {
  16774. $value = array($subName => $value);
  16775. }
  16776. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16777. }
  16778. }
  16779. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16780. return $m['start'] . $children . $m['end'];
  16781. }, $this->contents);
  16782. return true;
  16783. }
  16784. public function removeSubNode($mainNode, $name)
  16785. {
  16786. $decoded = JsonFile::parseJson($this->contents);
  16787. if (empty($decoded[$mainNode])) {
  16788. return true;
  16789. }
  16790. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16791. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16792. try {
  16793. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16794. return false;
  16795. }
  16796. } catch (\RuntimeException $e) {
  16797. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16798. return false;
  16799. }
  16800. throw $e;
  16801. }
  16802. $children = $match['content'];
  16803. if (!@json_decode($children, true)) {
  16804. return false;
  16805. }
  16806. $subName = null;
  16807. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16808. list($name, $subName) = explode('.', $name, 2);
  16809. }
  16810. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16811. return true;
  16812. }
  16813. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16814. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16815. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16816. $bestMatch = '';
  16817. foreach ($matches[0] as $match) {
  16818. if (strlen($bestMatch) < strlen($match)) {
  16819. $bestMatch = $match;
  16820. }
  16821. }
  16822. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16823. if (1 !== $count) {
  16824. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16825. if (1 !== $count) {
  16826. return false;
  16827. }
  16828. }
  16829. }
  16830. } else {
  16831. $childrenClean = $children;
  16832. }
  16833. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16834. if (empty($match['content'])) {
  16835. $newline = $this->newline;
  16836. $indent = $this->indent;
  16837. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16838. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16839. }, $this->contents);
  16840. if ($subName !== null) {
  16841. $curVal = json_decode($children, true);
  16842. unset($curVal[$name][$subName]);
  16843. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16844. }
  16845. return true;
  16846. }
  16847. $that = $this;
  16848. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16849. if ($subName !== null) {
  16850. $curVal = json_decode($matches['content'], true);
  16851. unset($curVal[$name][$subName]);
  16852. $childrenClean = $that->format($curVal, 0);
  16853. }
  16854. return $matches['start'] . $childrenClean . $matches['end'];
  16855. }, $this->contents);
  16856. return true;
  16857. }
  16858. public function addMainKey($key, $content)
  16859. {
  16860. $decoded = JsonFile::parseJson($this->contents);
  16861. $content = $this->format($content);
  16862. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16863. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16864. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16865. if (!@json_decode('{'.$matches['key'].'}')) {
  16866. return false;
  16867. }
  16868. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16869. return true;
  16870. }
  16871. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16872. $this->contents = preg_replace(
  16873. '#'.$match[1].'\}$#',
  16874. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16875. $this->contents
  16876. );
  16877. return true;
  16878. }
  16879. $this->contents = preg_replace(
  16880. '#\}$#',
  16881. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16882. $this->contents
  16883. );
  16884. return true;
  16885. }
  16886. public function removeMainKey($key)
  16887. {
  16888. $decoded = JsonFile::parseJson($this->contents);
  16889. if (!array_key_exists($key, $decoded)) {
  16890. return true;
  16891. }
  16892. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16893. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16894. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16895. if (!@json_decode('{'.$matches['removal'].'}')) {
  16896. return false;
  16897. }
  16898. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16899. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16900. }
  16901. $this->contents = $matches['start'] . $matches['end'];
  16902. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16903. $this->contents = "{\n}";
  16904. }
  16905. return true;
  16906. }
  16907. return false;
  16908. }
  16909. public function format($data, $depth = 0)
  16910. {
  16911. if (is_array($data)) {
  16912. reset($data);
  16913. if (is_numeric(key($data))) {
  16914. foreach ($data as $key => $val) {
  16915. $data[$key] = $this->format($val, $depth + 1);
  16916. }
  16917. return '['.implode(', ', $data).']';
  16918. }
  16919. $out = '{' . $this->newline;
  16920. $elems = array();
  16921. foreach ($data as $key => $val) {
  16922. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16923. }
  16924. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16925. }
  16926. return JsonFile::encode($data);
  16927. }
  16928. protected function detectIndenting()
  16929. {
  16930. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16931. $this->indent = $match[1];
  16932. } else {
  16933. $this->indent = ' ';
  16934. }
  16935. }
  16936. protected function pregMatch($re, $str, &$matches = array())
  16937. {
  16938. $count = preg_match($re, $str, $matches);
  16939. if ($count === false) {
  16940. switch (preg_last_error()) {
  16941. case PREG_NO_ERROR:
  16942. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16943. case PREG_INTERNAL_ERROR:
  16944. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16945. case PREG_BACKTRACK_LIMIT_ERROR:
  16946. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16947. case PREG_RECURSION_LIMIT_ERROR:
  16948. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16949. case PREG_BAD_UTF8_ERROR:
  16950. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16951. case PREG_BAD_UTF8_OFFSET_ERROR:
  16952. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16953. case 6:
  16954. if (PHP_VERSION_ID > 70000) {
  16955. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16956. }
  16957. default:
  16958. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16959. }
  16960. }
  16961. return $count;
  16962. }
  16963. }
  16964. <?php
  16965. namespace Composer\Json;
  16966. use Exception;
  16967. class JsonValidationException extends Exception
  16968. {
  16969. protected $errors;
  16970. public function __construct($message, $errors = array(), Exception $previous = null)
  16971. {
  16972. $this->errors = $errors;
  16973. parent::__construct($message, 0, $previous);
  16974. }
  16975. public function getErrors()
  16976. {
  16977. return $this->errors;
  16978. }
  16979. }
  16980. <?php
  16981. namespace Composer\Package;
  16982. use Composer\Semver\Constraint\Constraint;
  16983. use Composer\Package\Version\VersionParser;
  16984. class AliasPackage extends BasePackage implements CompletePackageInterface
  16985. {
  16986. protected $version;
  16987. protected $prettyVersion;
  16988. protected $dev;
  16989. protected $rootPackageAlias = false;
  16990. protected $stability;
  16991. protected $aliasOf;
  16992. protected $requires;
  16993. protected $devRequires;
  16994. protected $conflicts;
  16995. protected $provides;
  16996. protected $replaces;
  16997. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16998. {
  16999. parent::__construct($aliasOf->getName());
  17000. $this->version = $version;
  17001. $this->prettyVersion = $prettyVersion;
  17002. $this->aliasOf = $aliasOf;
  17003. $this->stability = VersionParser::parseStability($version);
  17004. $this->dev = $this->stability === 'dev';
  17005. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  17006. $links = $aliasOf->{'get' . ucfirst($type)}();
  17007. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  17008. }
  17009. }
  17010. public function getAliasOf()
  17011. {
  17012. return $this->aliasOf;
  17013. }
  17014. public function getVersion()
  17015. {
  17016. return $this->version;
  17017. }
  17018. public function getStability()
  17019. {
  17020. return $this->stability;
  17021. }
  17022. public function getPrettyVersion()
  17023. {
  17024. return $this->prettyVersion;
  17025. }
  17026. public function isDev()
  17027. {
  17028. return $this->dev;
  17029. }
  17030. public function getRequires()
  17031. {
  17032. return $this->requires;
  17033. }
  17034. public function getConflicts()
  17035. {
  17036. return $this->conflicts;
  17037. }
  17038. public function getProvides()
  17039. {
  17040. return $this->provides;
  17041. }
  17042. public function getReplaces()
  17043. {
  17044. return $this->replaces;
  17045. }
  17046. public function getDevRequires()
  17047. {
  17048. return $this->devRequires;
  17049. }
  17050. public function setRootPackageAlias($value)
  17051. {
  17052. return $this->rootPackageAlias = $value;
  17053. }
  17054. public function isRootPackageAlias()
  17055. {
  17056. return $this->rootPackageAlias;
  17057. }
  17058. protected function replaceSelfVersionDependencies(array $links, $linkType)
  17059. {
  17060. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  17061. $newLinks = array();
  17062. foreach ($links as $link) {
  17063. if ('self.version' === $link->getPrettyConstraint()) {
  17064. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17065. }
  17066. }
  17067. $links = array_merge($links, $newLinks);
  17068. } else {
  17069. foreach ($links as $index => $link) {
  17070. if ('self.version' === $link->getPrettyConstraint()) {
  17071. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  17072. }
  17073. }
  17074. }
  17075. return $links;
  17076. }
  17077. public function getType()
  17078. {
  17079. return $this->aliasOf->getType();
  17080. }
  17081. public function getTargetDir()
  17082. {
  17083. return $this->aliasOf->getTargetDir();
  17084. }
  17085. public function getExtra()
  17086. {
  17087. return $this->aliasOf->getExtra();
  17088. }
  17089. public function setInstallationSource($type)
  17090. {
  17091. $this->aliasOf->setInstallationSource($type);
  17092. }
  17093. public function getInstallationSource()
  17094. {
  17095. return $this->aliasOf->getInstallationSource();
  17096. }
  17097. public function getSourceType()
  17098. {
  17099. return $this->aliasOf->getSourceType();
  17100. }
  17101. public function getSourceUrl()
  17102. {
  17103. return $this->aliasOf->getSourceUrl();
  17104. }
  17105. public function getSourceUrls()
  17106. {
  17107. return $this->aliasOf->getSourceUrls();
  17108. }
  17109. public function getSourceReference()
  17110. {
  17111. return $this->aliasOf->getSourceReference();
  17112. }
  17113. public function setSourceReference($reference)
  17114. {
  17115. return $this->aliasOf->setSourceReference($reference);
  17116. }
  17117. public function setSourceMirrors($mirrors)
  17118. {
  17119. return $this->aliasOf->setSourceMirrors($mirrors);
  17120. }
  17121. public function getSourceMirrors()
  17122. {
  17123. return $this->aliasOf->getSourceMirrors();
  17124. }
  17125. public function getDistType()
  17126. {
  17127. return $this->aliasOf->getDistType();
  17128. }
  17129. public function getDistUrl()
  17130. {
  17131. return $this->aliasOf->getDistUrl();
  17132. }
  17133. public function getDistUrls()
  17134. {
  17135. return $this->aliasOf->getDistUrls();
  17136. }
  17137. public function getDistReference()
  17138. {
  17139. return $this->aliasOf->getDistReference();
  17140. }
  17141. public function setDistReference($reference)
  17142. {
  17143. return $this->aliasOf->setDistReference($reference);
  17144. }
  17145. public function getDistSha1Checksum()
  17146. {
  17147. return $this->aliasOf->getDistSha1Checksum();
  17148. }
  17149. public function setTransportOptions(array $options)
  17150. {
  17151. return $this->aliasOf->setTransportOptions($options);
  17152. }
  17153. public function getTransportOptions()
  17154. {
  17155. return $this->aliasOf->getTransportOptions();
  17156. }
  17157. public function setDistMirrors($mirrors)
  17158. {
  17159. return $this->aliasOf->setDistMirrors($mirrors);
  17160. }
  17161. public function getDistMirrors()
  17162. {
  17163. return $this->aliasOf->getDistMirrors();
  17164. }
  17165. public function getScripts()
  17166. {
  17167. return $this->aliasOf->getScripts();
  17168. }
  17169. public function getLicense()
  17170. {
  17171. return $this->aliasOf->getLicense();
  17172. }
  17173. public function getAutoload()
  17174. {
  17175. return $this->aliasOf->getAutoload();
  17176. }
  17177. public function getDevAutoload()
  17178. {
  17179. return $this->aliasOf->getDevAutoload();
  17180. }
  17181. public function getIncludePaths()
  17182. {
  17183. return $this->aliasOf->getIncludePaths();
  17184. }
  17185. public function getRepositories()
  17186. {
  17187. return $this->aliasOf->getRepositories();
  17188. }
  17189. public function getReleaseDate()
  17190. {
  17191. return $this->aliasOf->getReleaseDate();
  17192. }
  17193. public function getBinaries()
  17194. {
  17195. return $this->aliasOf->getBinaries();
  17196. }
  17197. public function getKeywords()
  17198. {
  17199. return $this->aliasOf->getKeywords();
  17200. }
  17201. public function getDescription()
  17202. {
  17203. return $this->aliasOf->getDescription();
  17204. }
  17205. public function getHomepage()
  17206. {
  17207. return $this->aliasOf->getHomepage();
  17208. }
  17209. public function getSuggests()
  17210. {
  17211. return $this->aliasOf->getSuggests();
  17212. }
  17213. public function getAuthors()
  17214. {
  17215. return $this->aliasOf->getAuthors();
  17216. }
  17217. public function getSupport()
  17218. {
  17219. return $this->aliasOf->getSupport();
  17220. }
  17221. public function getFunding()
  17222. {
  17223. return $this->aliasOf->getFunding();
  17224. }
  17225. public function getNotificationUrl()
  17226. {
  17227. return $this->aliasOf->getNotificationUrl();
  17228. }
  17229. public function getArchiveExcludes()
  17230. {
  17231. return $this->aliasOf->getArchiveExcludes();
  17232. }
  17233. public function isAbandoned()
  17234. {
  17235. return $this->aliasOf->isAbandoned();
  17236. }
  17237. public function getReplacementPackage()
  17238. {
  17239. return $this->aliasOf->getReplacementPackage();
  17240. }
  17241. public function __toString()
  17242. {
  17243. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  17244. }
  17245. public function setDistUrl($url)
  17246. {
  17247. return $this->aliasOf->setDistUrl($url);
  17248. }
  17249. public function setDistType($type)
  17250. {
  17251. return $this->aliasOf->setDistType($type);
  17252. }
  17253. }
  17254. <?php
  17255. namespace Composer\Package\Archiver;
  17256. use FilterIterator;
  17257. use PharData;
  17258. class ArchivableFilesFilter extends FilterIterator
  17259. {
  17260. private $dirs = array();
  17261. public function accept()
  17262. {
  17263. $file = $this->getInnerIterator()->current();
  17264. if ($file->isDir()) {
  17265. $this->dirs[] = (string) $file;
  17266. return false;
  17267. }
  17268. return true;
  17269. }
  17270. public function addEmptyDir(PharData $phar, $sources)
  17271. {
  17272. foreach ($this->dirs as $filepath) {
  17273. $localname = str_replace($sources . "/", '', $filepath);
  17274. $phar->addEmptyDir($localname);
  17275. }
  17276. }
  17277. }
  17278. <?php
  17279. namespace Composer\Package\Archiver;
  17280. use Composer\Util\Filesystem;
  17281. use FilesystemIterator;
  17282. use Symfony\Component\Finder\Finder;
  17283. use Symfony\Component\Finder\SplFileInfo;
  17284. class ArchivableFilesFinder extends \FilterIterator
  17285. {
  17286. protected $finder;
  17287. public function __construct($sources, array $excludes, $ignoreFilters = false)
  17288. {
  17289. $fs = new Filesystem();
  17290. $sources = $fs->normalizePath($sources);
  17291. if ($ignoreFilters) {
  17292. $filters = array();
  17293. } else {
  17294. $filters = array(
  17295. new HgExcludeFilter($sources),
  17296. new GitExcludeFilter($sources),
  17297. new ComposerExcludeFilter($sources, $excludes),
  17298. );
  17299. }
  17300. $this->finder = new Finder();
  17301. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  17302. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  17303. return false;
  17304. }
  17305. $relativePath = preg_replace(
  17306. '#^'.preg_quote($sources, '#').'#',
  17307. '',
  17308. $fs->normalizePath($file->getRealPath())
  17309. );
  17310. $exclude = false;
  17311. foreach ($filters as $filter) {
  17312. $exclude = $filter->filter($relativePath, $exclude);
  17313. }
  17314. return !$exclude;
  17315. };
  17316. if (method_exists($filter, 'bindTo')) {
  17317. $filter = $filter->bindTo(null);
  17318. }
  17319. $this->finder
  17320. ->in($sources)
  17321. ->filter($filter)
  17322. ->ignoreVCS(true)
  17323. ->ignoreDotFiles(false);
  17324. parent::__construct($this->finder->getIterator());
  17325. }
  17326. public function accept()
  17327. {
  17328. $current = $this->getInnerIterator()->current();
  17329. if (!$current->isDir()) {
  17330. return true;
  17331. }
  17332. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  17333. return !$iterator->valid();
  17334. }
  17335. }
  17336. <?php
  17337. namespace Composer\Package\Archiver;
  17338. use Composer\Downloader\DownloadManager;
  17339. use Composer\Package\PackageInterface;
  17340. use Composer\Package\RootPackageInterface;
  17341. use Composer\Util\Filesystem;
  17342. use Composer\Json\JsonFile;
  17343. class ArchiveManager
  17344. {
  17345. protected $downloadManager;
  17346. protected $archivers = array();
  17347. protected $overwriteFiles = true;
  17348. public function __construct(DownloadManager $downloadManager)
  17349. {
  17350. $this->downloadManager = $downloadManager;
  17351. }
  17352. public function addArchiver(ArchiverInterface $archiver)
  17353. {
  17354. $this->archivers[] = $archiver;
  17355. }
  17356. public function setOverwriteFiles($overwriteFiles)
  17357. {
  17358. $this->overwriteFiles = $overwriteFiles;
  17359. return $this;
  17360. }
  17361. public function getPackageFilename(PackageInterface $package)
  17362. {
  17363. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  17364. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  17365. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  17366. } else {
  17367. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  17368. }
  17369. if ($package->getSourceReference()) {
  17370. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  17371. }
  17372. $name = implode('-', array_filter($nameParts, function ($p) {
  17373. return !empty($p);
  17374. }));
  17375. return str_replace('/', '-', $name);
  17376. }
  17377. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  17378. {
  17379. if (empty($format)) {
  17380. throw new \InvalidArgumentException('Format must be specified');
  17381. }
  17382. $usableArchiver = null;
  17383. foreach ($this->archivers as $archiver) {
  17384. if ($archiver->supports($format, $package->getSourceType())) {
  17385. $usableArchiver = $archiver;
  17386. break;
  17387. }
  17388. }
  17389. if (null === $usableArchiver) {
  17390. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  17391. }
  17392. $filesystem = new Filesystem();
  17393. if (null === $fileName) {
  17394. $packageName = $this->getPackageFilename($package);
  17395. } else {
  17396. $packageName = $fileName;
  17397. }
  17398. $filesystem->ensureDirectoryExists($targetDir);
  17399. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  17400. $filesystem->ensureDirectoryExists(dirname($target));
  17401. if (!$this->overwriteFiles && file_exists($target)) {
  17402. return $target;
  17403. }
  17404. if ($package instanceof RootPackageInterface) {
  17405. $sourcePath = realpath('.');
  17406. } else {
  17407. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  17408. $filesystem->ensureDirectoryExists($sourcePath);
  17409. try {
  17410. $this->downloadManager->download($package, $sourcePath);
  17411. } catch (\Exception $e) {
  17412. $filesystem->removeDirectory($sourcePath);
  17413. throw $e;
  17414. }
  17415. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  17416. $jsonFile = new JsonFile($composerJsonPath);
  17417. $jsonData = $jsonFile->read();
  17418. if (!empty($jsonData['archive']['exclude'])) {
  17419. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  17420. }
  17421. }
  17422. }
  17423. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  17424. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  17425. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  17426. $filesystem->rename($archivePath, $target);
  17427. if (!$package instanceof RootPackageInterface) {
  17428. $filesystem->removeDirectory($sourcePath);
  17429. }
  17430. $filesystem->remove($tempTarget);
  17431. return $target;
  17432. }
  17433. }
  17434. <?php
  17435. namespace Composer\Package\Archiver;
  17436. interface ArchiverInterface
  17437. {
  17438. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  17439. public function supports($format, $sourceType);
  17440. }
  17441. <?php
  17442. namespace Composer\Package\Archiver;
  17443. use Symfony\Component\Finder;
  17444. abstract class BaseExcludeFilter
  17445. {
  17446. protected $sourcePath;
  17447. protected $excludePatterns;
  17448. public function __construct($sourcePath)
  17449. {
  17450. $this->sourcePath = $sourcePath;
  17451. $this->excludePatterns = array();
  17452. }
  17453. public function filter($relativePath, $exclude)
  17454. {
  17455. foreach ($this->excludePatterns as $patternData) {
  17456. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  17457. if ($stripLeadingSlash) {
  17458. $path = substr($relativePath, 1);
  17459. } else {
  17460. $path = $relativePath;
  17461. }
  17462. if (preg_match($pattern, $path)) {
  17463. $exclude = !$negate;
  17464. }
  17465. }
  17466. return $exclude;
  17467. }
  17468. protected function parseLines(array $lines, $lineParser)
  17469. {
  17470. return array_filter(
  17471. array_map(
  17472. function ($line) use ($lineParser) {
  17473. $line = trim($line);
  17474. if (!$line || 0 === strpos($line, '#')) {
  17475. return null;
  17476. }
  17477. return call_user_func($lineParser, $line);
  17478. },
  17479. $lines
  17480. ),
  17481. function ($pattern) {
  17482. return $pattern !== null;
  17483. }
  17484. );
  17485. }
  17486. protected function generatePatterns($rules)
  17487. {
  17488. $patterns = array();
  17489. foreach ($rules as $rule) {
  17490. $patterns[] = $this->generatePattern($rule);
  17491. }
  17492. return $patterns;
  17493. }
  17494. protected function generatePattern($rule)
  17495. {
  17496. $negate = false;
  17497. $pattern = '{';
  17498. if (strlen($rule) && $rule[0] === '!') {
  17499. $negate = true;
  17500. $rule = substr($rule, 1);
  17501. }
  17502. if (strlen($rule) && $rule[0] === '/') {
  17503. $pattern .= '^/';
  17504. $rule = substr($rule, 1);
  17505. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  17506. $pattern .= '/';
  17507. $rule = substr($rule, 0, -1);
  17508. } elseif (false === strpos($rule, '/')) {
  17509. $pattern .= '/';
  17510. }
  17511. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  17512. return array($pattern . '}', $negate, false);
  17513. }
  17514. }
  17515. <?php
  17516. namespace Composer\Package\Archiver;
  17517. class ComposerExcludeFilter extends BaseExcludeFilter
  17518. {
  17519. public function __construct($sourcePath, array $excludeRules)
  17520. {
  17521. parent::__construct($sourcePath);
  17522. $this->excludePatterns = $this->generatePatterns($excludeRules);
  17523. }
  17524. }
  17525. <?php
  17526. namespace Composer\Package\Archiver;
  17527. class GitExcludeFilter extends BaseExcludeFilter
  17528. {
  17529. public function __construct($sourcePath)
  17530. {
  17531. parent::__construct($sourcePath);
  17532. if (file_exists($sourcePath.'/.gitignore')) {
  17533. $this->excludePatterns = $this->parseLines(
  17534. file($sourcePath.'/.gitignore'),
  17535. array($this, 'parseGitIgnoreLine')
  17536. );
  17537. }
  17538. if (file_exists($sourcePath.'/.gitattributes')) {
  17539. $this->excludePatterns = array_merge(
  17540. $this->excludePatterns,
  17541. $this->parseLines(
  17542. file($sourcePath.'/.gitattributes'),
  17543. array($this, 'parseGitAttributesLine')
  17544. )
  17545. );
  17546. }
  17547. }
  17548. public function parseGitIgnoreLine($line)
  17549. {
  17550. return $this->generatePattern($line);
  17551. }
  17552. public function parseGitAttributesLine($line)
  17553. {
  17554. $parts = preg_split('#\s+#', $line);
  17555. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  17556. return $this->generatePattern($parts[0]);
  17557. }
  17558. return null;
  17559. }
  17560. }
  17561. <?php
  17562. namespace Composer\Package\Archiver;
  17563. use Symfony\Component\Finder;
  17564. class HgExcludeFilter extends BaseExcludeFilter
  17565. {
  17566. const HG_IGNORE_REGEX = 1;
  17567. const HG_IGNORE_GLOB = 2;
  17568. protected $patternMode;
  17569. public function __construct($sourcePath)
  17570. {
  17571. parent::__construct($sourcePath);
  17572. $this->patternMode = self::HG_IGNORE_REGEX;
  17573. if (file_exists($sourcePath.'/.hgignore')) {
  17574. $this->excludePatterns = $this->parseLines(
  17575. file($sourcePath.'/.hgignore'),
  17576. array($this, 'parseHgIgnoreLine')
  17577. );
  17578. }
  17579. }
  17580. public function parseHgIgnoreLine($line)
  17581. {
  17582. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  17583. if ($matches[1] === 'glob') {
  17584. $this->patternMode = self::HG_IGNORE_GLOB;
  17585. } else {
  17586. $this->patternMode = self::HG_IGNORE_REGEX;
  17587. }
  17588. return null;
  17589. }
  17590. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  17591. return $this->patternFromGlob($line);
  17592. }
  17593. return $this->patternFromRegex($line);
  17594. }
  17595. protected function patternFromGlob($line)
  17596. {
  17597. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  17598. $pattern = str_replace('[^/]*', '.*', $pattern);
  17599. return array($pattern, false, true);
  17600. }
  17601. public function patternFromRegex($line)
  17602. {
  17603. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  17604. return array($pattern, false, true);
  17605. }
  17606. }
  17607. <?php
  17608. namespace Composer\Package\Archiver;
  17609. class PharArchiver implements ArchiverInterface
  17610. {
  17611. protected static $formats = array(
  17612. 'zip' => \Phar::ZIP,
  17613. 'tar' => \Phar::TAR,
  17614. 'tar.gz' => \Phar::TAR,
  17615. 'tar.bz2' => \Phar::TAR,
  17616. );
  17617. protected static $compressFormats = array(
  17618. 'tar.gz' => \Phar::GZ,
  17619. 'tar.bz2' => \Phar::BZ2,
  17620. );
  17621. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17622. {
  17623. $sources = realpath($sources);
  17624. if (file_exists($target)) {
  17625. unlink($target);
  17626. }
  17627. try {
  17628. $filename = substr($target, 0, strrpos($target, $format) - 1);
  17629. if (isset(static::$compressFormats[$format])) {
  17630. $target = $filename . '.tar';
  17631. }
  17632. $phar = new \PharData($target, null, null, static::$formats[$format]);
  17633. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17634. $filesOnly = new ArchivableFilesFilter($files);
  17635. $phar->buildFromIterator($filesOnly, $sources);
  17636. $filesOnly->addEmptyDir($phar, $sources);
  17637. if (isset(static::$compressFormats[$format])) {
  17638. if (!$phar->canCompress(static::$compressFormats[$format])) {
  17639. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  17640. }
  17641. unlink($target);
  17642. $phar->compress(static::$compressFormats[$format]);
  17643. $target = $filename . '.' . $format;
  17644. }
  17645. return $target;
  17646. } catch (\UnexpectedValueException $e) {
  17647. $message = sprintf(
  17648. "Could not create archive '%s' from '%s': %s",
  17649. $target,
  17650. $sources,
  17651. $e->getMessage()
  17652. );
  17653. throw new \RuntimeException($message, $e->getCode(), $e);
  17654. }
  17655. }
  17656. public function supports($format, $sourceType)
  17657. {
  17658. return isset(static::$formats[$format]);
  17659. }
  17660. }
  17661. <?php
  17662. namespace Composer\Package\Archiver;
  17663. use ZipArchive;
  17664. use Composer\Util\Filesystem;
  17665. class ZipArchiver implements ArchiverInterface
  17666. {
  17667. protected static $formats = array(
  17668. 'zip' => 1,
  17669. );
  17670. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  17671. {
  17672. $fs = new Filesystem();
  17673. $sources = $fs->normalizePath($sources);
  17674. $zip = new ZipArchive();
  17675. $res = $zip->open($target, ZipArchive::CREATE);
  17676. if ($res === true) {
  17677. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  17678. foreach ($files as $file) {
  17679. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  17680. $localname = str_replace($sources.'/', '', $filepath);
  17681. if ($file->isDir()) {
  17682. $zip->addEmptyDir($localname);
  17683. } else {
  17684. $zip->addFile($filepath, $localname);
  17685. }
  17686. if (PHP_VERSION_ID >= 50600) {
  17687. $perms = fileperms($filepath);
  17688. $zip->setExternalAttributesName($localname, ZipArchive::OPSYS_UNIX, $perms << 16);
  17689. }
  17690. }
  17691. if ($zip->close()) {
  17692. return $target;
  17693. }
  17694. }
  17695. $message = sprintf(
  17696. "Could not create archive '%s' from '%s': %s",
  17697. $target,
  17698. $sources,
  17699. $zip->getStatusString()
  17700. );
  17701. throw new \RuntimeException($message);
  17702. }
  17703. public function supports($format, $sourceType)
  17704. {
  17705. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17706. }
  17707. private function compressionAvailable()
  17708. {
  17709. return class_exists('ZipArchive');
  17710. }
  17711. }
  17712. <?php
  17713. namespace Composer\Package;
  17714. use Composer\Repository\RepositoryInterface;
  17715. use Composer\Repository\PlatformRepository;
  17716. abstract class BasePackage implements PackageInterface
  17717. {
  17718. public static $supportedLinkTypes = array(
  17719. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17720. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17721. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17722. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17723. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17724. );
  17725. const STABILITY_STABLE = 0;
  17726. const STABILITY_RC = 5;
  17727. const STABILITY_BETA = 10;
  17728. const STABILITY_ALPHA = 15;
  17729. const STABILITY_DEV = 20;
  17730. public static $stabilities = array(
  17731. 'stable' => self::STABILITY_STABLE,
  17732. 'RC' => self::STABILITY_RC,
  17733. 'beta' => self::STABILITY_BETA,
  17734. 'alpha' => self::STABILITY_ALPHA,
  17735. 'dev' => self::STABILITY_DEV,
  17736. );
  17737. public $id;
  17738. protected $name;
  17739. protected $prettyName;
  17740. protected $repository;
  17741. protected $transportOptions = array();
  17742. public function __construct($name)
  17743. {
  17744. $this->prettyName = $name;
  17745. $this->name = strtolower($name);
  17746. $this->id = -1;
  17747. }
  17748. public function getName()
  17749. {
  17750. return $this->name;
  17751. }
  17752. public function getPrettyName()
  17753. {
  17754. return $this->prettyName;
  17755. }
  17756. public function getNames()
  17757. {
  17758. $names = array(
  17759. $this->getName() => true,
  17760. );
  17761. foreach ($this->getProvides() as $link) {
  17762. $names[$link->getTarget()] = true;
  17763. }
  17764. foreach ($this->getReplaces() as $link) {
  17765. $names[$link->getTarget()] = true;
  17766. }
  17767. return array_keys($names);
  17768. }
  17769. public function setId($id)
  17770. {
  17771. $this->id = $id;
  17772. }
  17773. public function getId()
  17774. {
  17775. return $this->id;
  17776. }
  17777. public function setRepository(RepositoryInterface $repository)
  17778. {
  17779. if ($this->repository && $repository !== $this->repository) {
  17780. throw new \LogicException('A package can only be added to one repository');
  17781. }
  17782. $this->repository = $repository;
  17783. }
  17784. public function getRepository()
  17785. {
  17786. return $this->repository;
  17787. }
  17788. public function getTransportOptions()
  17789. {
  17790. return $this->transportOptions;
  17791. }
  17792. public function setTransportOptions(array $options)
  17793. {
  17794. $this->transportOptions = $options;
  17795. }
  17796. public function isPlatform()
  17797. {
  17798. return $this->getRepository() instanceof PlatformRepository;
  17799. }
  17800. public function getUniqueName()
  17801. {
  17802. return $this->getName().'-'.$this->getVersion();
  17803. }
  17804. public function equals(PackageInterface $package)
  17805. {
  17806. $self = $this;
  17807. if ($this instanceof AliasPackage) {
  17808. $self = $this->getAliasOf();
  17809. }
  17810. if ($package instanceof AliasPackage) {
  17811. $package = $package->getAliasOf();
  17812. }
  17813. return $package === $self;
  17814. }
  17815. public function __toString()
  17816. {
  17817. return $this->getUniqueName();
  17818. }
  17819. public function getPrettyString()
  17820. {
  17821. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17822. }
  17823. public function getFullPrettyVersion($truncate = true)
  17824. {
  17825. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17826. return $this->getPrettyVersion();
  17827. }
  17828. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17829. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17830. }
  17831. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17832. }
  17833. public function getStabilityPriority()
  17834. {
  17835. return self::$stabilities[$this->getStability()];
  17836. }
  17837. public function __clone()
  17838. {
  17839. $this->repository = null;
  17840. $this->id = -1;
  17841. }
  17842. public static function packageNameToRegexp($allowListPattern, $wrap = '{^%s$}i')
  17843. {
  17844. $cleanedAllowListPattern = str_replace('\\*', '.*', preg_quote($allowListPattern));
  17845. return sprintf($wrap, $cleanedAllowListPattern);
  17846. }
  17847. }
  17848. <?php
  17849. namespace Composer\Package\Comparer;
  17850. class Comparer
  17851. {
  17852. private $source;
  17853. private $update;
  17854. private $changed;
  17855. public function setSource($source)
  17856. {
  17857. $this->source = $source;
  17858. }
  17859. public function setUpdate($update)
  17860. {
  17861. $this->update = $update;
  17862. }
  17863. public function getChanged($toString = false, $explicated = false)
  17864. {
  17865. $changed = $this->changed;
  17866. if (!count($changed)) {
  17867. return false;
  17868. }
  17869. if ($explicated) {
  17870. foreach ($changed as $sectionKey => $itemSection) {
  17871. foreach ($itemSection as $itemKey => $item) {
  17872. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17873. }
  17874. }
  17875. }
  17876. if ($toString) {
  17877. foreach ($changed as $sectionKey => $itemSection) {
  17878. foreach ($itemSection as $itemKey => $item) {
  17879. $changed['string'][] = $item."\r\n";
  17880. }
  17881. }
  17882. $changed = implode("\r\n", $changed['string']);
  17883. }
  17884. return $changed;
  17885. }
  17886. public function doCompare()
  17887. {
  17888. $source = array();
  17889. $destination = array();
  17890. $this->changed = array();
  17891. $currentDirectory = getcwd();
  17892. chdir($this->source);
  17893. $source = $this->doTree('.', $source);
  17894. if (!is_array($source)) {
  17895. return;
  17896. }
  17897. chdir($currentDirectory);
  17898. chdir($this->update);
  17899. $destination = $this->doTree('.', $destination);
  17900. if (!is_array($destination)) {
  17901. exit;
  17902. }
  17903. chdir($currentDirectory);
  17904. foreach ($source as $dir => $value) {
  17905. foreach ($value as $file => $hash) {
  17906. if (isset($destination[$dir][$file])) {
  17907. if ($hash !== $destination[$dir][$file]) {
  17908. $this->changed['changed'][] = $dir.'/'.$file;
  17909. }
  17910. } else {
  17911. $this->changed['removed'][] = $dir.'/'.$file;
  17912. }
  17913. }
  17914. }
  17915. foreach ($destination as $dir => $value) {
  17916. foreach ($value as $file => $hash) {
  17917. if (!isset($source[$dir][$file])) {
  17918. $this->changed['added'][] = $dir.'/'.$file;
  17919. }
  17920. }
  17921. }
  17922. }
  17923. private function doTree($dir, &$array)
  17924. {
  17925. if ($dh = opendir($dir)) {
  17926. while ($file = readdir($dh)) {
  17927. if ($file !== '.' && $file !== '..') {
  17928. if (is_link($dir.'/'.$file)) {
  17929. $array[$dir][$file] = readlink($dir.'/'.$file);
  17930. } elseif (is_dir($dir.'/'.$file)) {
  17931. if (!count($array)) {
  17932. $array[0] = 'Temp';
  17933. }
  17934. if (!$this->doTree($dir.'/'.$file, $array)) {
  17935. return false;
  17936. }
  17937. } elseif (is_file($dir.'/'.$file) && filesize($dir.'/'.$file)) {
  17938. set_time_limit(30);
  17939. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17940. }
  17941. }
  17942. }
  17943. if (count($array) > 1 && isset($array['0'])) {
  17944. unset($array['0']);
  17945. }
  17946. return $array;
  17947. }
  17948. return false;
  17949. }
  17950. }
  17951. <?php
  17952. namespace Composer\Package;
  17953. class CompletePackage extends Package implements CompletePackageInterface
  17954. {
  17955. protected $repositories;
  17956. protected $license = array();
  17957. protected $keywords;
  17958. protected $authors;
  17959. protected $description;
  17960. protected $homepage;
  17961. protected $scripts = array();
  17962. protected $support = array();
  17963. protected $funding = array();
  17964. protected $abandoned = false;
  17965. public function setScripts(array $scripts)
  17966. {
  17967. $this->scripts = $scripts;
  17968. }
  17969. public function getScripts()
  17970. {
  17971. return $this->scripts;
  17972. }
  17973. public function setRepositories($repositories)
  17974. {
  17975. $this->repositories = $repositories;
  17976. }
  17977. public function getRepositories()
  17978. {
  17979. return $this->repositories;
  17980. }
  17981. public function setLicense(array $license)
  17982. {
  17983. $this->license = $license;
  17984. }
  17985. public function getLicense()
  17986. {
  17987. return $this->license;
  17988. }
  17989. public function setKeywords(array $keywords)
  17990. {
  17991. $this->keywords = $keywords;
  17992. }
  17993. public function getKeywords()
  17994. {
  17995. return $this->keywords;
  17996. }
  17997. public function setAuthors(array $authors)
  17998. {
  17999. $this->authors = $authors;
  18000. }
  18001. public function getAuthors()
  18002. {
  18003. return $this->authors;
  18004. }
  18005. public function setDescription($description)
  18006. {
  18007. $this->description = $description;
  18008. }
  18009. public function getDescription()
  18010. {
  18011. return $this->description;
  18012. }
  18013. public function setHomepage($homepage)
  18014. {
  18015. $this->homepage = $homepage;
  18016. }
  18017. public function getHomepage()
  18018. {
  18019. return $this->homepage;
  18020. }
  18021. public function setSupport(array $support)
  18022. {
  18023. $this->support = $support;
  18024. }
  18025. public function getSupport()
  18026. {
  18027. return $this->support;
  18028. }
  18029. public function setFunding(array $funding)
  18030. {
  18031. $this->funding = $funding;
  18032. }
  18033. public function getFunding()
  18034. {
  18035. return $this->funding;
  18036. }
  18037. public function isAbandoned()
  18038. {
  18039. return (bool) $this->abandoned;
  18040. }
  18041. public function setAbandoned($abandoned)
  18042. {
  18043. $this->abandoned = $abandoned;
  18044. }
  18045. public function getReplacementPackage()
  18046. {
  18047. return is_string($this->abandoned) ? $this->abandoned : null;
  18048. }
  18049. }
  18050. <?php
  18051. namespace Composer\Package;
  18052. interface CompletePackageInterface extends PackageInterface
  18053. {
  18054. public function getScripts();
  18055. public function getRepositories();
  18056. public function getLicense();
  18057. public function getKeywords();
  18058. public function getDescription();
  18059. public function getHomepage();
  18060. public function getAuthors();
  18061. public function getSupport();
  18062. public function getFunding();
  18063. public function isAbandoned();
  18064. public function getReplacementPackage();
  18065. }
  18066. <?php
  18067. namespace Composer\Package\Dumper;
  18068. use Composer\Package\BasePackage;
  18069. use Composer\Package\PackageInterface;
  18070. use Composer\Package\CompletePackageInterface;
  18071. use Composer\Package\RootPackageInterface;
  18072. class ArrayDumper
  18073. {
  18074. public function dump(PackageInterface $package)
  18075. {
  18076. $keys = array(
  18077. 'binaries' => 'bin',
  18078. 'type',
  18079. 'extra',
  18080. 'installationSource' => 'installation-source',
  18081. 'autoload',
  18082. 'devAutoload' => 'autoload-dev',
  18083. 'notificationUrl' => 'notification-url',
  18084. 'includePaths' => 'include-path',
  18085. );
  18086. $data = array();
  18087. $data['name'] = $package->getPrettyName();
  18088. $data['version'] = $package->getPrettyVersion();
  18089. $data['version_normalized'] = $package->getVersion();
  18090. if ($package->getTargetDir()) {
  18091. $data['target-dir'] = $package->getTargetDir();
  18092. }
  18093. if ($package->getSourceType()) {
  18094. $data['source']['type'] = $package->getSourceType();
  18095. $data['source']['url'] = $package->getSourceUrl();
  18096. if (null !== ($value = $package->getSourceReference())) {
  18097. $data['source']['reference'] = $value;
  18098. }
  18099. if ($mirrors = $package->getSourceMirrors()) {
  18100. $data['source']['mirrors'] = $mirrors;
  18101. }
  18102. }
  18103. if ($package->getDistType()) {
  18104. $data['dist']['type'] = $package->getDistType();
  18105. $data['dist']['url'] = $package->getDistUrl();
  18106. if (null !== ($value = $package->getDistReference())) {
  18107. $data['dist']['reference'] = $value;
  18108. }
  18109. if (null !== ($value = $package->getDistSha1Checksum())) {
  18110. $data['dist']['shasum'] = $value;
  18111. }
  18112. if ($mirrors = $package->getDistMirrors()) {
  18113. $data['dist']['mirrors'] = $mirrors;
  18114. }
  18115. }
  18116. if ($package->getArchiveExcludes()) {
  18117. $data['archive']['exclude'] = $package->getArchiveExcludes();
  18118. }
  18119. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  18120. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  18121. foreach ($links as $link) {
  18122. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  18123. }
  18124. ksort($data[$type]);
  18125. }
  18126. }
  18127. if ($packages = $package->getSuggests()) {
  18128. ksort($packages);
  18129. $data['suggest'] = $packages;
  18130. }
  18131. if ($package->getReleaseDate()) {
  18132. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  18133. }
  18134. $data = $this->dumpValues($package, $keys, $data);
  18135. if ($package instanceof CompletePackageInterface) {
  18136. $keys = array(
  18137. 'scripts',
  18138. 'license',
  18139. 'authors',
  18140. 'description',
  18141. 'homepage',
  18142. 'keywords',
  18143. 'repositories',
  18144. 'support',
  18145. 'funding',
  18146. );
  18147. $data = $this->dumpValues($package, $keys, $data);
  18148. if (isset($data['keywords']) && is_array($data['keywords'])) {
  18149. sort($data['keywords']);
  18150. }
  18151. if ($package->isAbandoned()) {
  18152. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  18153. }
  18154. }
  18155. if ($package instanceof RootPackageInterface) {
  18156. $minimumStability = $package->getMinimumStability();
  18157. if ($minimumStability) {
  18158. $data['minimum-stability'] = $minimumStability;
  18159. }
  18160. }
  18161. if (count($package->getTransportOptions()) > 0) {
  18162. $data['transport-options'] = $package->getTransportOptions();
  18163. }
  18164. return $data;
  18165. }
  18166. private function dumpValues(PackageInterface $package, array $keys, array $data)
  18167. {
  18168. foreach ($keys as $method => $key) {
  18169. if (is_numeric($method)) {
  18170. $method = $key;
  18171. }
  18172. $getter = 'get'.ucfirst($method);
  18173. $value = $package->$getter();
  18174. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  18175. $data[$key] = $value;
  18176. }
  18177. }
  18178. return $data;
  18179. }
  18180. }
  18181. <?php
  18182. namespace Composer\Package;
  18183. use Composer\Semver\Constraint\ConstraintInterface;
  18184. class Link
  18185. {
  18186. protected $source;
  18187. protected $target;
  18188. protected $constraint;
  18189. protected $description;
  18190. protected $prettyConstraint;
  18191. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  18192. {
  18193. $this->source = strtolower($source);
  18194. $this->target = strtolower($target);
  18195. $this->constraint = $constraint;
  18196. $this->description = $description;
  18197. $this->prettyConstraint = $prettyConstraint;
  18198. }
  18199. public function getDescription()
  18200. {
  18201. return $this->description;
  18202. }
  18203. public function getSource()
  18204. {
  18205. return $this->source;
  18206. }
  18207. public function getTarget()
  18208. {
  18209. return $this->target;
  18210. }
  18211. public function getConstraint()
  18212. {
  18213. return $this->constraint;
  18214. }
  18215. public function getPrettyConstraint()
  18216. {
  18217. if (null === $this->prettyConstraint) {
  18218. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  18219. }
  18220. return $this->prettyConstraint;
  18221. }
  18222. public function __toString()
  18223. {
  18224. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  18225. }
  18226. public function getPrettyString(PackageInterface $sourcePackage)
  18227. {
  18228. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  18229. }
  18230. }
  18231. <?php
  18232. namespace Composer\Package\LinkConstraint;
  18233. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  18234. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  18235. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  18236. {
  18237. }
  18238. <?php
  18239. namespace Composer\Package\LinkConstraint;
  18240. use Composer\Semver\Constraint\ConstraintInterface;
  18241. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  18242. interface LinkConstraintInterface extends ConstraintInterface
  18243. {
  18244. }
  18245. <?php
  18246. namespace Composer\Package\LinkConstraint;
  18247. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  18248. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  18249. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  18250. {
  18251. }
  18252. <?php
  18253. namespace Composer\Package\LinkConstraint;
  18254. use Composer\Semver\Constraint\AbstractConstraint;
  18255. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  18256. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  18257. {
  18258. }
  18259. <?php
  18260. namespace Composer\Package\LinkConstraint;
  18261. use Composer\Semver\Constraint\Constraint;
  18262. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  18263. class VersionConstraint extends Constraint implements LinkConstraintInterface
  18264. {
  18265. }
  18266. <?php
  18267. namespace Composer\Package\Loader;
  18268. use Composer\Package;
  18269. use Composer\Package\AliasPackage;
  18270. use Composer\Package\Link;
  18271. use Composer\Package\RootAliasPackage;
  18272. use Composer\Package\RootPackageInterface;
  18273. use Composer\Package\Version\VersionParser;
  18274. use Composer\Semver\VersionParser as SemverVersionParser;
  18275. class ArrayLoader implements LoaderInterface
  18276. {
  18277. protected $versionParser;
  18278. protected $loadOptions;
  18279. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  18280. {
  18281. if (!$parser) {
  18282. $parser = new VersionParser;
  18283. }
  18284. $this->versionParser = $parser;
  18285. $this->loadOptions = $loadOptions;
  18286. }
  18287. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18288. {
  18289. if (!isset($config['name'])) {
  18290. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  18291. }
  18292. if (!isset($config['version'])) {
  18293. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  18294. }
  18295. if (isset($config['version_normalized'])) {
  18296. $version = $config['version_normalized'];
  18297. } else {
  18298. $version = $this->versionParser->normalize($config['version']);
  18299. }
  18300. $package = new $class($config['name'], $version, $config['version']);
  18301. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  18302. if (isset($config['target-dir'])) {
  18303. $package->setTargetDir($config['target-dir']);
  18304. }
  18305. if (isset($config['extra']) && is_array($config['extra'])) {
  18306. $package->setExtra($config['extra']);
  18307. }
  18308. if (isset($config['bin'])) {
  18309. foreach ((array) $config['bin'] as $key => $bin) {
  18310. $config['bin'][$key] = ltrim($bin, '/');
  18311. }
  18312. $package->setBinaries((array) $config['bin']);
  18313. }
  18314. if (isset($config['installation-source'])) {
  18315. $package->setInstallationSource($config['installation-source']);
  18316. }
  18317. if (isset($config['source'])) {
  18318. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  18319. throw new \UnexpectedValueException(sprintf(
  18320. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  18321. $config['name'],
  18322. json_encode($config['source'])
  18323. ));
  18324. }
  18325. $package->setSourceType($config['source']['type']);
  18326. $package->setSourceUrl($config['source']['url']);
  18327. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  18328. if (isset($config['source']['mirrors'])) {
  18329. $package->setSourceMirrors($config['source']['mirrors']);
  18330. }
  18331. }
  18332. if (isset($config['dist'])) {
  18333. if (!isset($config['dist']['type'])
  18334. || !isset($config['dist']['url'])) {
  18335. throw new \UnexpectedValueException(sprintf(
  18336. "Package %s's dist key should be specified as ".
  18337. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  18338. $config['name'],
  18339. json_encode($config['dist'])
  18340. ));
  18341. }
  18342. $package->setDistType($config['dist']['type']);
  18343. $package->setDistUrl($config['dist']['url']);
  18344. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  18345. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  18346. if (isset($config['dist']['mirrors'])) {
  18347. $package->setDistMirrors($config['dist']['mirrors']);
  18348. }
  18349. }
  18350. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  18351. if (isset($config[$type])) {
  18352. $method = 'set'.ucfirst($opts['method']);
  18353. $package->{$method}(
  18354. $this->parseLinks(
  18355. $package->getName(),
  18356. $package->getPrettyVersion(),
  18357. $opts['description'],
  18358. $config[$type]
  18359. )
  18360. );
  18361. }
  18362. }
  18363. if (isset($config['suggest']) && is_array($config['suggest'])) {
  18364. foreach ($config['suggest'] as $target => $reason) {
  18365. if ('self.version' === trim($reason)) {
  18366. $config['suggest'][$target] = $package->getPrettyVersion();
  18367. }
  18368. }
  18369. $package->setSuggests($config['suggest']);
  18370. }
  18371. if (isset($config['autoload'])) {
  18372. $package->setAutoload($config['autoload']);
  18373. }
  18374. if (isset($config['autoload-dev'])) {
  18375. $package->setDevAutoload($config['autoload-dev']);
  18376. }
  18377. if (isset($config['include-path'])) {
  18378. $package->setIncludePaths($config['include-path']);
  18379. }
  18380. if (!empty($config['time'])) {
  18381. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  18382. try {
  18383. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  18384. $package->setReleaseDate($date);
  18385. } catch (\Exception $e) {
  18386. }
  18387. }
  18388. if (!empty($config['notification-url'])) {
  18389. $package->setNotificationUrl($config['notification-url']);
  18390. }
  18391. if (!empty($config['archive']['exclude'])) {
  18392. $package->setArchiveExcludes($config['archive']['exclude']);
  18393. }
  18394. if ($package instanceof Package\CompletePackageInterface) {
  18395. if (isset($config['scripts']) && is_array($config['scripts'])) {
  18396. foreach ($config['scripts'] as $event => $listeners) {
  18397. $config['scripts'][$event] = (array) $listeners;
  18398. }
  18399. if (isset($config['scripts']['composer'])) {
  18400. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  18401. }
  18402. $package->setScripts($config['scripts']);
  18403. }
  18404. if (!empty($config['description']) && is_string($config['description'])) {
  18405. $package->setDescription($config['description']);
  18406. }
  18407. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  18408. $package->setHomepage($config['homepage']);
  18409. }
  18410. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  18411. $package->setKeywords($config['keywords']);
  18412. }
  18413. if (!empty($config['license'])) {
  18414. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  18415. }
  18416. if (!empty($config['authors']) && is_array($config['authors'])) {
  18417. $package->setAuthors($config['authors']);
  18418. }
  18419. if (isset($config['support'])) {
  18420. $package->setSupport($config['support']);
  18421. }
  18422. if (!empty($config['funding']) && is_array($config['funding'])) {
  18423. $package->setFunding($config['funding']);
  18424. }
  18425. if (isset($config['abandoned'])) {
  18426. $package->setAbandoned($config['abandoned']);
  18427. }
  18428. }
  18429. if ($aliasNormalized = $this->getBranchAlias($config)) {
  18430. if ($package instanceof RootPackageInterface) {
  18431. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18432. } else {
  18433. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  18434. }
  18435. }
  18436. if ($this->loadOptions && isset($config['transport-options'])) {
  18437. $package->setTransportOptions($config['transport-options']);
  18438. }
  18439. return $package;
  18440. }
  18441. public function parseLinks($source, $sourceVersion, $description, $links)
  18442. {
  18443. $res = array();
  18444. foreach ($links as $target => $constraint) {
  18445. if (!is_string($constraint)) {
  18446. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  18447. }
  18448. if ('self.version' === $constraint) {
  18449. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  18450. } else {
  18451. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  18452. }
  18453. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  18454. }
  18455. return $res;
  18456. }
  18457. public function getBranchAlias(array $config)
  18458. {
  18459. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  18460. || !isset($config['extra']['branch-alias'])
  18461. || !is_array($config['extra']['branch-alias'])
  18462. ) {
  18463. return;
  18464. }
  18465. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18466. if ('-dev' !== substr($targetBranch, -4)) {
  18467. continue;
  18468. }
  18469. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18470. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18471. continue;
  18472. }
  18473. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  18474. continue;
  18475. }
  18476. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18477. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18478. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18479. ) {
  18480. continue;
  18481. }
  18482. return $validatedTargetBranch;
  18483. }
  18484. }
  18485. }
  18486. <?php
  18487. namespace Composer\Package\Loader;
  18488. class InvalidPackageException extends \Exception
  18489. {
  18490. private $errors;
  18491. private $warnings;
  18492. private $data;
  18493. public function __construct(array $errors, array $warnings, array $data)
  18494. {
  18495. $this->errors = $errors;
  18496. $this->warnings = $warnings;
  18497. $this->data = $data;
  18498. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  18499. }
  18500. public function getData()
  18501. {
  18502. return $this->data;
  18503. }
  18504. public function getErrors()
  18505. {
  18506. return $this->errors;
  18507. }
  18508. public function getWarnings()
  18509. {
  18510. return $this->warnings;
  18511. }
  18512. }
  18513. <?php
  18514. namespace Composer\Package\Loader;
  18515. use Composer\Json\JsonFile;
  18516. class JsonLoader
  18517. {
  18518. private $loader;
  18519. public function __construct(LoaderInterface $loader)
  18520. {
  18521. $this->loader = $loader;
  18522. }
  18523. public function load($json)
  18524. {
  18525. if ($json instanceof JsonFile) {
  18526. $config = $json->read();
  18527. } elseif (file_exists($json)) {
  18528. $config = JsonFile::parseJson(file_get_contents($json), $json);
  18529. } elseif (is_string($json)) {
  18530. $config = JsonFile::parseJson($json);
  18531. }
  18532. return $this->loader->load($config);
  18533. }
  18534. }
  18535. <?php
  18536. namespace Composer\Package\Loader;
  18537. interface LoaderInterface
  18538. {
  18539. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  18540. }
  18541. <?php
  18542. namespace Composer\Package\Loader;
  18543. use Composer\Package\BasePackage;
  18544. use Composer\Package\AliasPackage;
  18545. use Composer\Config;
  18546. use Composer\IO\IOInterface;
  18547. use Composer\Package\RootPackageInterface;
  18548. use Composer\Repository\RepositoryFactory;
  18549. use Composer\Package\Version\VersionGuesser;
  18550. use Composer\Package\Version\VersionParser;
  18551. use Composer\Repository\RepositoryManager;
  18552. use Composer\Util\ProcessExecutor;
  18553. class RootPackageLoader extends ArrayLoader
  18554. {
  18555. private $manager;
  18556. private $config;
  18557. private $versionGuesser;
  18558. private $io;
  18559. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  18560. {
  18561. parent::__construct($parser);
  18562. $this->manager = $manager;
  18563. $this->config = $config;
  18564. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  18565. $this->io = $io;
  18566. }
  18567. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  18568. {
  18569. if (!isset($config['name'])) {
  18570. $config['name'] = '__root__';
  18571. } elseif ($this->io) {
  18572. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  18573. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18574. }
  18575. }
  18576. $autoVersioned = false;
  18577. if (!isset($config['version'])) {
  18578. $commit = null;
  18579. if (isset($config['extra']['branch-version'])) {
  18580. $config['version'] = preg_replace('{(\.x)?(-dev)?$}', '', $config['extra']['branch-version']).'.x-dev';
  18581. } elseif (getenv('COMPOSER_ROOT_VERSION')) {
  18582. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  18583. } else {
  18584. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  18585. if ($versionData) {
  18586. $config['version'] = $versionData['pretty_version'];
  18587. $config['version_normalized'] = $versionData['version'];
  18588. $commit = $versionData['commit'];
  18589. }
  18590. }
  18591. if (!isset($config['version'])) {
  18592. $config['version'] = '1.0.0';
  18593. $autoVersioned = true;
  18594. }
  18595. if ($commit) {
  18596. $config['source'] = array(
  18597. 'type' => '',
  18598. 'url' => '',
  18599. 'reference' => $commit,
  18600. );
  18601. $config['dist'] = array(
  18602. 'type' => '',
  18603. 'url' => '',
  18604. 'reference' => $commit,
  18605. );
  18606. }
  18607. }
  18608. $realPackage = $package = parent::load($config, $class);
  18609. if ($realPackage instanceof AliasPackage) {
  18610. $realPackage = $package->getAliasOf();
  18611. }
  18612. if ($autoVersioned) {
  18613. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  18614. }
  18615. if (isset($config['minimum-stability'])) {
  18616. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  18617. }
  18618. $aliases = array();
  18619. $stabilityFlags = array();
  18620. $references = array();
  18621. foreach (array('require', 'require-dev') as $linkType) {
  18622. if (isset($config[$linkType])) {
  18623. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  18624. $method = 'get'.ucfirst($linkInfo['method']);
  18625. $links = array();
  18626. foreach ($realPackage->$method() as $link) {
  18627. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  18628. }
  18629. $aliases = $this->extractAliases($links, $aliases);
  18630. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  18631. $references = $this->extractReferences($links, $references);
  18632. if (isset($links[$config['name']])) {
  18633. throw new \RuntimeException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  18634. 'Did you accidentally name your root package after an external package?', $config['name']));
  18635. }
  18636. }
  18637. }
  18638. if ($this->io) {
  18639. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18640. if (isset($config[$linkType])) {
  18641. foreach ($config[$linkType] as $linkName => $constraint) {
  18642. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  18643. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  18644. }
  18645. }
  18646. }
  18647. }
  18648. }
  18649. $realPackage->setAliases($aliases);
  18650. $realPackage->setStabilityFlags($stabilityFlags);
  18651. $realPackage->setReferences($references);
  18652. if (isset($config['prefer-stable'])) {
  18653. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  18654. }
  18655. if (isset($config['config'])) {
  18656. $realPackage->setConfig($config['config']);
  18657. }
  18658. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  18659. foreach ($repos as $repo) {
  18660. $this->manager->addRepository($repo);
  18661. }
  18662. $realPackage->setRepositories($this->config->getRepositories());
  18663. return $package;
  18664. }
  18665. private function extractAliases(array $requires, array $aliases)
  18666. {
  18667. foreach ($requires as $reqName => $reqVersion) {
  18668. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  18669. $aliases[] = array(
  18670. 'package' => strtolower($reqName),
  18671. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  18672. 'alias' => $match[2],
  18673. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  18674. );
  18675. } elseif (strpos($reqVersion, ' as ') !== false) {
  18676. throw new \UnexpectedValueException('Invalid alias definition in "'.$reqName.'": "'.$reqVersion.'". Aliases should be in the form "exact-version as other-exact-version".');
  18677. }
  18678. }
  18679. return $aliases;
  18680. }
  18681. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  18682. {
  18683. $stabilities = BasePackage::$stabilities;
  18684. $minimumStability = $stabilities[$minimumStability];
  18685. foreach ($requires as $reqName => $reqVersion) {
  18686. $constraints = array();
  18687. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  18688. foreach ($orSplit as $orConstraint) {
  18689. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  18690. foreach ($andSplit as $andConstraint) {
  18691. $constraints[] = $andConstraint;
  18692. }
  18693. }
  18694. $match = false;
  18695. foreach ($constraints as $constraint) {
  18696. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  18697. $name = strtolower($reqName);
  18698. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  18699. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  18700. continue;
  18701. }
  18702. $stabilityFlags[$name] = $stability;
  18703. $match = true;
  18704. }
  18705. }
  18706. if ($match) {
  18707. continue;
  18708. }
  18709. foreach ($constraints as $constraint) {
  18710. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  18711. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  18712. $name = strtolower($reqName);
  18713. $stability = $stabilities[$stabilityName];
  18714. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18715. continue;
  18716. }
  18717. $stabilityFlags[$name] = $stability;
  18718. }
  18719. }
  18720. }
  18721. return $stabilityFlags;
  18722. }
  18723. private function extractReferences(array $requires, array $references)
  18724. {
  18725. foreach ($requires as $reqName => $reqVersion) {
  18726. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18727. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18728. $name = strtolower($reqName);
  18729. $references[$name] = $match[1];
  18730. }
  18731. }
  18732. return $references;
  18733. }
  18734. }
  18735. <?php
  18736. namespace Composer\Package\Loader;
  18737. use Composer\Package\BasePackage;
  18738. use Composer\Semver\Constraint\Constraint;
  18739. use Composer\Package\Version\VersionParser;
  18740. use Composer\Repository\PlatformRepository;
  18741. use Composer\Spdx\SpdxLicenses;
  18742. class ValidatingArrayLoader implements LoaderInterface
  18743. {
  18744. const CHECK_ALL = 3;
  18745. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18746. const CHECK_STRICT_CONSTRAINTS = 2;
  18747. private $loader;
  18748. private $versionParser;
  18749. private $errors;
  18750. private $warnings;
  18751. private $config;
  18752. private $strictName;
  18753. private $flags;
  18754. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18755. {
  18756. $this->loader = $loader;
  18757. $this->versionParser = $parser ?: new VersionParser();
  18758. $this->strictName = $strictName;
  18759. $this->flags = $flags;
  18760. }
  18761. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18762. {
  18763. $this->errors = array();
  18764. $this->warnings = array();
  18765. $this->config = $config;
  18766. if ($err = self::hasPackageNamingError($config['name'])) {
  18767. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18768. }
  18769. if ($this->strictName) {
  18770. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18771. } else {
  18772. $this->validateString('name', true);
  18773. }
  18774. if (!empty($this->config['version'])) {
  18775. try {
  18776. $this->versionParser->normalize($this->config['version']);
  18777. } catch (\Exception $e) {
  18778. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18779. unset($this->config['version']);
  18780. }
  18781. }
  18782. if (!empty($this->config['config']['platform'])) {
  18783. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18784. try {
  18785. $this->versionParser->normalize($platform);
  18786. } catch (\Exception $e) {
  18787. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18788. }
  18789. }
  18790. }
  18791. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18792. $this->validateString('target-dir');
  18793. $this->validateArray('extra');
  18794. if (isset($this->config['bin'])) {
  18795. if (is_string($this->config['bin'])) {
  18796. $this->validateString('bin');
  18797. } else {
  18798. $this->validateFlatArray('bin');
  18799. }
  18800. }
  18801. $this->validateArray('scripts');
  18802. $this->validateString('description');
  18803. $this->validateUrl('homepage');
  18804. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18805. $releaseDate = null;
  18806. $this->validateString('time');
  18807. if (!empty($this->config['time'])) {
  18808. try {
  18809. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18810. } catch (\Exception $e) {
  18811. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18812. unset($this->config['time']);
  18813. }
  18814. }
  18815. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18816. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18817. $licenses = (array) $this->config['license'];
  18818. $licenseValidator = new SpdxLicenses();
  18819. foreach ($licenses as $license) {
  18820. if ('proprietary' === $license) {
  18821. continue;
  18822. }
  18823. $licenseToValidate = str_replace('proprietary', 'MIT', $license);
  18824. if (!$licenseValidator->validate($licenseToValidate)) {
  18825. if ($licenseValidator->validate(trim($licenseToValidate))) {
  18826. $this->warnings[] = sprintf(
  18827. 'License %s must not contain extra spaces, make sure to trim it.',
  18828. json_encode($license)
  18829. );
  18830. } else {
  18831. $this->warnings[] = sprintf(
  18832. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18833. 'If the software is closed-source, you may use "proprietary" as license.',
  18834. json_encode($license)
  18835. );
  18836. }
  18837. }
  18838. }
  18839. }
  18840. }
  18841. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18842. foreach ($this->config['authors'] as $key => $author) {
  18843. if (!is_array($author)) {
  18844. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18845. unset($this->config['authors'][$key]);
  18846. continue;
  18847. }
  18848. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18849. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18850. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18851. unset($this->config['authors'][$key][$authorData]);
  18852. }
  18853. }
  18854. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18855. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18856. unset($this->config['authors'][$key]['homepage']);
  18857. }
  18858. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18859. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18860. unset($this->config['authors'][$key]['email']);
  18861. }
  18862. if (empty($this->config['authors'][$key])) {
  18863. unset($this->config['authors'][$key]);
  18864. }
  18865. }
  18866. if (empty($this->config['authors'])) {
  18867. unset($this->config['authors']);
  18868. }
  18869. }
  18870. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18871. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18872. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18873. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18874. unset($this->config['support'][$key]);
  18875. }
  18876. }
  18877. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18878. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18879. unset($this->config['support']['email']);
  18880. }
  18881. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18882. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18883. unset($this->config['support']['irc']);
  18884. }
  18885. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18886. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18887. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18888. unset($this->config['support'][$key]);
  18889. }
  18890. }
  18891. if (empty($this->config['support'])) {
  18892. unset($this->config['support']);
  18893. }
  18894. }
  18895. if ($this->validateArray('funding') && !empty($this->config['funding'])) {
  18896. foreach ($this->config['funding'] as $key => $fundingOption) {
  18897. if (!is_array($fundingOption)) {
  18898. $this->errors[] = 'funding.'.$key.' : should be an array, '.gettype($fundingOption).' given';
  18899. unset($this->config['funding'][$key]);
  18900. continue;
  18901. }
  18902. foreach (array('type', 'url') as $fundingData) {
  18903. if (isset($fundingOption[$fundingData]) && !is_string($fundingOption[$fundingData])) {
  18904. $this->errors[] = 'funding.'.$key.'.'.$fundingData.' : invalid value, must be a string';
  18905. unset($this->config['funding'][$key][$fundingData]);
  18906. }
  18907. }
  18908. if (isset($fundingOption['url']) && !$this->filterUrl($fundingOption['url'])) {
  18909. $this->warnings[] = 'funding.'.$key.'.url : invalid value ('.$fundingOption['url'].'), must be an http/https URL';
  18910. unset($this->config['funding'][$key]['url']);
  18911. }
  18912. if (empty($this->config['funding'][$key])) {
  18913. unset($this->config['funding'][$key]);
  18914. }
  18915. }
  18916. if (empty($this->config['funding'])) {
  18917. unset($this->config['funding']);
  18918. }
  18919. }
  18920. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18921. $stableConstraint = new Constraint('=', '1.0.0');
  18922. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18923. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18924. foreach ($this->config[$linkType] as $package => $constraint) {
  18925. if ($err = self::hasPackageNamingError($package, true)) {
  18926. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18927. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18928. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18929. }
  18930. if (!is_string($constraint)) {
  18931. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18932. unset($this->config[$linkType][$package]);
  18933. } elseif ('self.version' !== $constraint) {
  18934. try {
  18935. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18936. } catch (\Exception $e) {
  18937. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18938. unset($this->config[$linkType][$package]);
  18939. continue;
  18940. }
  18941. if (
  18942. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18943. && 'require' === $linkType
  18944. && $linkConstraint->matches($unboundConstraint)
  18945. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18946. ) {
  18947. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18948. } elseif (
  18949. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18950. && 'require' === $linkType
  18951. && substr($linkConstraint, 0, 1) === '='
  18952. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18953. ) {
  18954. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18955. }
  18956. }
  18957. }
  18958. }
  18959. }
  18960. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18961. foreach ($this->config['suggest'] as $package => $description) {
  18962. if (!is_string($description)) {
  18963. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18964. unset($this->config['suggest'][$package]);
  18965. }
  18966. }
  18967. }
  18968. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18969. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18970. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18971. unset($this->config['minimum-stability']);
  18972. }
  18973. }
  18974. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18975. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18976. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18977. if (!in_array($type, $types)) {
  18978. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18979. unset($this->config['autoload'][$type]);
  18980. }
  18981. if ($type === 'psr-4') {
  18982. foreach ($typeConfig as $namespace => $dirs) {
  18983. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18984. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18985. }
  18986. }
  18987. }
  18988. }
  18989. }
  18990. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18991. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18992. unset($this->config['autoload']['psr-4']);
  18993. }
  18994. $this->validateFlatArray('include-path');
  18995. $this->validateArray('transport-options');
  18996. if (isset($this->config['extra']['branch-alias'])) {
  18997. if (!is_array($this->config['extra']['branch-alias'])) {
  18998. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18999. } else {
  19000. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  19001. if ('-dev' !== substr($targetBranch, -4)) {
  19002. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  19003. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19004. continue;
  19005. }
  19006. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  19007. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  19008. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  19009. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19010. continue;
  19011. }
  19012. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  19013. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  19014. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  19015. ) {
  19016. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  19017. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  19018. }
  19019. }
  19020. }
  19021. }
  19022. if ($this->errors) {
  19023. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  19024. }
  19025. $package = $this->loader->load($this->config, $class);
  19026. $this->config = null;
  19027. return $package;
  19028. }
  19029. public function getWarnings()
  19030. {
  19031. return $this->warnings;
  19032. }
  19033. public function getErrors()
  19034. {
  19035. return $this->errors;
  19036. }
  19037. public static function hasPackageNamingError($name, $isLink = false)
  19038. {
  19039. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  19040. return;
  19041. }
  19042. if (!preg_match('{^[a-z0-9](?:[_.-]?[a-z0-9]+)*/[a-z0-9](?:(?:[_.]?|-{0,2})[a-z0-9]+)*$}iD', $name)) {
  19043. return $name.' is invalid, it should have a vendor name, a forward slash, and a package name. The vendor and package name can be words separated by -, . or _. The complete name should match "^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9](([_.]?|-{0,2})[a-z0-9]+)*$".';
  19044. }
  19045. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  19046. $bits = explode('/', strtolower($name));
  19047. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  19048. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  19049. }
  19050. if (preg_match('{\.json$}', $name)) {
  19051. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  19052. }
  19053. if (preg_match('{[A-Z]}', $name)) {
  19054. if ($isLink) {
  19055. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  19056. }
  19057. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  19058. $suggestName = strtolower($suggestName);
  19059. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  19060. }
  19061. }
  19062. private function validateRegex($property, $regex, $mandatory = false)
  19063. {
  19064. if (!$this->validateString($property, $mandatory)) {
  19065. return false;
  19066. }
  19067. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  19068. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  19069. if ($mandatory) {
  19070. $this->errors[] = $message;
  19071. } else {
  19072. $this->warnings[] = $message;
  19073. }
  19074. unset($this->config[$property]);
  19075. return false;
  19076. }
  19077. return true;
  19078. }
  19079. private function validateString($property, $mandatory = false)
  19080. {
  19081. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  19082. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  19083. unset($this->config[$property]);
  19084. return false;
  19085. }
  19086. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  19087. if ($mandatory) {
  19088. $this->errors[] = $property.' : must be present';
  19089. }
  19090. unset($this->config[$property]);
  19091. return false;
  19092. }
  19093. return true;
  19094. }
  19095. private function validateArray($property, $mandatory = false)
  19096. {
  19097. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  19098. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  19099. unset($this->config[$property]);
  19100. return false;
  19101. }
  19102. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  19103. if ($mandatory) {
  19104. $this->errors[] = $property.' : must be present and contain at least one element';
  19105. }
  19106. unset($this->config[$property]);
  19107. return false;
  19108. }
  19109. return true;
  19110. }
  19111. private function validateFlatArray($property, $regex = null, $mandatory = false)
  19112. {
  19113. if (!$this->validateArray($property, $mandatory)) {
  19114. return false;
  19115. }
  19116. $pass = true;
  19117. foreach ($this->config[$property] as $key => $value) {
  19118. if (!is_string($value) && !is_numeric($value)) {
  19119. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  19120. unset($this->config[$property][$key]);
  19121. $pass = false;
  19122. continue;
  19123. }
  19124. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  19125. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  19126. unset($this->config[$property][$key]);
  19127. $pass = false;
  19128. }
  19129. }
  19130. return $pass;
  19131. }
  19132. private function validateUrl($property, $mandatory = false)
  19133. {
  19134. if (!$this->validateString($property, $mandatory)) {
  19135. return false;
  19136. }
  19137. if (!$this->filterUrl($this->config[$property])) {
  19138. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  19139. unset($this->config[$property]);
  19140. return false;
  19141. }
  19142. return true;
  19143. }
  19144. private function filterUrl($value, array $schemes = array('http', 'https'))
  19145. {
  19146. if ($value === '') {
  19147. return true;
  19148. }
  19149. $bits = parse_url($value);
  19150. if (empty($bits['scheme']) || empty($bits['host'])) {
  19151. return false;
  19152. }
  19153. if (!in_array($bits['scheme'], $schemes, true)) {
  19154. return false;
  19155. }
  19156. return true;
  19157. }
  19158. }
  19159. <?php
  19160. namespace Composer\Package;
  19161. use Composer\Json\JsonFile;
  19162. use Composer\Installer\InstallationManager;
  19163. use Composer\Repository\RepositoryManager;
  19164. use Composer\Util\ProcessExecutor;
  19165. use Composer\Repository\ArrayRepository;
  19166. use Composer\Package\Dumper\ArrayDumper;
  19167. use Composer\Package\Loader\ArrayLoader;
  19168. use Composer\Plugin\PluginInterface;
  19169. use Composer\Util\Git as GitUtil;
  19170. use Composer\IO\IOInterface;
  19171. use Seld\JsonLint\ParsingException;
  19172. class Locker
  19173. {
  19174. private $lockFile;
  19175. private $repositoryManager;
  19176. private $installationManager;
  19177. private $hash;
  19178. private $contentHash;
  19179. private $loader;
  19180. private $dumper;
  19181. private $process;
  19182. private $lockDataCache;
  19183. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  19184. {
  19185. $this->lockFile = $lockFile;
  19186. $this->repositoryManager = $repositoryManager;
  19187. $this->installationManager = $installationManager;
  19188. $this->hash = md5($composerFileContents);
  19189. $this->contentHash = self::getContentHash($composerFileContents);
  19190. $this->loader = new ArrayLoader(null, true);
  19191. $this->dumper = new ArrayDumper();
  19192. $this->process = new ProcessExecutor($io);
  19193. }
  19194. public static function getContentHash($composerFileContents)
  19195. {
  19196. $content = json_decode($composerFileContents, true);
  19197. $relevantKeys = array(
  19198. 'name',
  19199. 'version',
  19200. 'require',
  19201. 'require-dev',
  19202. 'conflict',
  19203. 'replace',
  19204. 'provide',
  19205. 'minimum-stability',
  19206. 'prefer-stable',
  19207. 'repositories',
  19208. 'extra',
  19209. );
  19210. $relevantContent = array();
  19211. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  19212. $relevantContent[$key] = $content[$key];
  19213. }
  19214. if (isset($content['config']['platform'])) {
  19215. $relevantContent['config']['platform'] = $content['config']['platform'];
  19216. }
  19217. ksort($relevantContent);
  19218. return md5(json_encode($relevantContent));
  19219. }
  19220. public function isLocked()
  19221. {
  19222. if (!$this->lockFile->exists()) {
  19223. return false;
  19224. }
  19225. $data = $this->getLockData();
  19226. return isset($data['packages']);
  19227. }
  19228. public function isFresh()
  19229. {
  19230. $lock = $this->lockFile->read();
  19231. if (!empty($lock['content-hash'])) {
  19232. return $this->contentHash === $lock['content-hash'];
  19233. }
  19234. if (!empty($lock['hash'])) {
  19235. return $this->hash === $lock['hash'];
  19236. }
  19237. return false;
  19238. }
  19239. public function getLockedRepository($withDevReqs = false)
  19240. {
  19241. $lockData = $this->getLockData();
  19242. $packages = new ArrayRepository();
  19243. $lockedPackages = $lockData['packages'];
  19244. if ($withDevReqs) {
  19245. if (isset($lockData['packages-dev'])) {
  19246. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  19247. } else {
  19248. throw new \RuntimeException('The lock file does not contain require-dev information, run install with the --no-dev option or run update to install those packages.');
  19249. }
  19250. }
  19251. if (empty($lockedPackages)) {
  19252. return $packages;
  19253. }
  19254. if (isset($lockedPackages[0]['name'])) {
  19255. foreach ($lockedPackages as $info) {
  19256. $packages->addPackage($this->loader->load($info));
  19257. }
  19258. return $packages;
  19259. }
  19260. throw new \RuntimeException('Your composer.lock was created before 2012-09-15, and is not supported anymore. Run "composer update" to generate a new one.');
  19261. }
  19262. public function getPlatformRequirements($withDevReqs = false)
  19263. {
  19264. $lockData = $this->getLockData();
  19265. $requirements = array();
  19266. if (!empty($lockData['platform'])) {
  19267. $requirements = $this->loader->parseLinks(
  19268. '__ROOT__',
  19269. '1.0.0',
  19270. 'requires',
  19271. isset($lockData['platform']) ? $lockData['platform'] : array()
  19272. );
  19273. }
  19274. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  19275. $devRequirements = $this->loader->parseLinks(
  19276. '__ROOT__',
  19277. '1.0.0',
  19278. 'requires',
  19279. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  19280. );
  19281. $requirements = array_merge($requirements, $devRequirements);
  19282. }
  19283. return $requirements;
  19284. }
  19285. public function getMinimumStability()
  19286. {
  19287. $lockData = $this->getLockData();
  19288. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  19289. }
  19290. public function getStabilityFlags()
  19291. {
  19292. $lockData = $this->getLockData();
  19293. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  19294. }
  19295. public function getPreferStable()
  19296. {
  19297. $lockData = $this->getLockData();
  19298. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  19299. }
  19300. public function getPreferLowest()
  19301. {
  19302. $lockData = $this->getLockData();
  19303. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  19304. }
  19305. public function getPlatformOverrides()
  19306. {
  19307. $lockData = $this->getLockData();
  19308. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  19309. }
  19310. public function getAliases()
  19311. {
  19312. $lockData = $this->getLockData();
  19313. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  19314. }
  19315. public function getLockData()
  19316. {
  19317. if (null !== $this->lockDataCache) {
  19318. return $this->lockDataCache;
  19319. }
  19320. if (!$this->lockFile->exists()) {
  19321. throw new \LogicException('No lockfile found. Unable to read locked packages');
  19322. }
  19323. return $this->lockDataCache = $this->lockFile->read();
  19324. }
  19325. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  19326. {
  19327. $lock = array(
  19328. '_readme' => array('This file locks the dependencies of your project to a known state',
  19329. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  19330. 'This file is @gener'.'ated automatically', ),
  19331. 'content-hash' => $this->contentHash,
  19332. 'packages' => null,
  19333. 'packages-dev' => null,
  19334. 'aliases' => array(),
  19335. 'minimum-stability' => $minimumStability,
  19336. 'stability-flags' => $stabilityFlags,
  19337. 'prefer-stable' => $preferStable,
  19338. 'prefer-lowest' => $preferLowest,
  19339. );
  19340. foreach ($aliases as $package => $versions) {
  19341. foreach ($versions as $version => $alias) {
  19342. $lock['aliases'][] = array(
  19343. 'alias' => $alias['alias'],
  19344. 'alias_normalized' => $alias['alias_normalized'],
  19345. 'version' => $version,
  19346. 'package' => $package,
  19347. );
  19348. }
  19349. }
  19350. $lock['packages'] = $this->lockPackages($packages);
  19351. if (null !== $devPackages) {
  19352. $lock['packages-dev'] = $this->lockPackages($devPackages);
  19353. }
  19354. $lock['platform'] = $platformReqs;
  19355. $lock['platform-dev'] = $platformDevReqs;
  19356. if ($platformOverrides) {
  19357. $lock['platform-overrides'] = $platformOverrides;
  19358. }
  19359. $lock['plugin-api-version'] = PluginInterface::PLUGIN_API_VERSION;
  19360. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  19361. if ($this->lockFile->exists()) {
  19362. unlink($this->lockFile->getPath());
  19363. }
  19364. return false;
  19365. }
  19366. try {
  19367. $isLocked = $this->isLocked();
  19368. } catch (ParsingException $e) {
  19369. $isLocked = false;
  19370. }
  19371. if (!$isLocked || $lock !== $this->getLockData()) {
  19372. $this->lockFile->write($lock);
  19373. $this->lockDataCache = null;
  19374. return true;
  19375. }
  19376. return false;
  19377. }
  19378. private function lockPackages(array $packages)
  19379. {
  19380. $locked = array();
  19381. foreach ($packages as $package) {
  19382. if ($package instanceof AliasPackage) {
  19383. continue;
  19384. }
  19385. $name = $package->getPrettyName();
  19386. $version = $package->getPrettyVersion();
  19387. if (!$name || !$version) {
  19388. throw new \LogicException(sprintf(
  19389. 'Package "%s" has no version or name and can not be locked',
  19390. $package
  19391. ));
  19392. }
  19393. $spec = $this->dumper->dump($package);
  19394. unset($spec['version_normalized']);
  19395. $time = isset($spec['time']) ? $spec['time'] : null;
  19396. unset($spec['time']);
  19397. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  19398. $time = $this->getPackageTime($package) ?: $time;
  19399. }
  19400. if (null !== $time) {
  19401. $spec['time'] = $time;
  19402. }
  19403. unset($spec['installation-source']);
  19404. $locked[] = $spec;
  19405. }
  19406. usort($locked, function ($a, $b) {
  19407. $comparison = strcmp($a['name'], $b['name']);
  19408. if (0 !== $comparison) {
  19409. return $comparison;
  19410. }
  19411. return strcmp($a['version'], $b['version']);
  19412. });
  19413. return $locked;
  19414. }
  19415. private function getPackageTime(PackageInterface $package)
  19416. {
  19417. if (!function_exists('proc_open')) {
  19418. return null;
  19419. }
  19420. $path = realpath($this->installationManager->getInstallPath($package));
  19421. $sourceType = $package->getSourceType();
  19422. $datetime = null;
  19423. if ($path && in_array($sourceType, array('git', 'hg'))) {
  19424. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  19425. switch ($sourceType) {
  19426. case 'git':
  19427. GitUtil::cleanEnv();
  19428. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef).GitUtil::getNoShowSignatureFlag($this->process), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  19429. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  19430. }
  19431. break;
  19432. case 'hg':
  19433. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  19434. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  19435. }
  19436. break;
  19437. }
  19438. }
  19439. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  19440. }
  19441. }
  19442. <?php
  19443. namespace Composer\Package;
  19444. use Composer\Package\Version\VersionParser;
  19445. use Composer\Util\ComposerMirror;
  19446. class Package extends BasePackage
  19447. {
  19448. protected $type;
  19449. protected $targetDir;
  19450. protected $installationSource;
  19451. protected $sourceType;
  19452. protected $sourceUrl;
  19453. protected $sourceReference;
  19454. protected $sourceMirrors;
  19455. protected $distType;
  19456. protected $distUrl;
  19457. protected $distReference;
  19458. protected $distSha1Checksum;
  19459. protected $distMirrors;
  19460. protected $version;
  19461. protected $prettyVersion;
  19462. protected $releaseDate;
  19463. protected $extra = array();
  19464. protected $binaries = array();
  19465. protected $dev;
  19466. protected $stability;
  19467. protected $notificationUrl;
  19468. protected $requires = array();
  19469. protected $conflicts = array();
  19470. protected $provides = array();
  19471. protected $replaces = array();
  19472. protected $devRequires = array();
  19473. protected $suggests = array();
  19474. protected $autoload = array();
  19475. protected $devAutoload = array();
  19476. protected $includePaths = array();
  19477. protected $archiveExcludes = array();
  19478. public function __construct($name, $version, $prettyVersion)
  19479. {
  19480. parent::__construct($name);
  19481. $this->version = $version;
  19482. $this->prettyVersion = $prettyVersion;
  19483. $this->stability = VersionParser::parseStability($version);
  19484. $this->dev = $this->stability === 'dev';
  19485. }
  19486. public function isDev()
  19487. {
  19488. return $this->dev;
  19489. }
  19490. public function setType($type)
  19491. {
  19492. $this->type = $type;
  19493. }
  19494. public function getType()
  19495. {
  19496. return $this->type ?: 'library';
  19497. }
  19498. public function getStability()
  19499. {
  19500. return $this->stability;
  19501. }
  19502. public function setTargetDir($targetDir)
  19503. {
  19504. $this->targetDir = $targetDir;
  19505. }
  19506. public function getTargetDir()
  19507. {
  19508. if (null === $this->targetDir) {
  19509. return;
  19510. }
  19511. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  19512. }
  19513. public function setExtra(array $extra)
  19514. {
  19515. $this->extra = $extra;
  19516. }
  19517. public function getExtra()
  19518. {
  19519. return $this->extra;
  19520. }
  19521. public function setBinaries(array $binaries)
  19522. {
  19523. $this->binaries = $binaries;
  19524. }
  19525. public function getBinaries()
  19526. {
  19527. return $this->binaries;
  19528. }
  19529. public function setInstallationSource($type)
  19530. {
  19531. $this->installationSource = $type;
  19532. }
  19533. public function getInstallationSource()
  19534. {
  19535. return $this->installationSource;
  19536. }
  19537. public function setSourceType($type)
  19538. {
  19539. $this->sourceType = $type;
  19540. }
  19541. public function getSourceType()
  19542. {
  19543. return $this->sourceType;
  19544. }
  19545. public function setSourceUrl($url)
  19546. {
  19547. $this->sourceUrl = $url;
  19548. }
  19549. public function getSourceUrl()
  19550. {
  19551. return $this->sourceUrl;
  19552. }
  19553. public function setSourceReference($reference)
  19554. {
  19555. $this->sourceReference = $reference;
  19556. }
  19557. public function getSourceReference()
  19558. {
  19559. return $this->sourceReference;
  19560. }
  19561. public function setSourceMirrors($mirrors)
  19562. {
  19563. $this->sourceMirrors = $mirrors;
  19564. }
  19565. public function getSourceMirrors()
  19566. {
  19567. return $this->sourceMirrors;
  19568. }
  19569. public function getSourceUrls()
  19570. {
  19571. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  19572. }
  19573. public function setDistType($type)
  19574. {
  19575. $this->distType = $type;
  19576. }
  19577. public function getDistType()
  19578. {
  19579. return $this->distType;
  19580. }
  19581. public function setDistUrl($url)
  19582. {
  19583. $this->distUrl = $url;
  19584. }
  19585. public function getDistUrl()
  19586. {
  19587. return $this->distUrl;
  19588. }
  19589. public function setDistReference($reference)
  19590. {
  19591. $this->distReference = $reference;
  19592. }
  19593. public function getDistReference()
  19594. {
  19595. return $this->distReference;
  19596. }
  19597. public function setDistSha1Checksum($sha1checksum)
  19598. {
  19599. $this->distSha1Checksum = $sha1checksum;
  19600. }
  19601. public function getDistSha1Checksum()
  19602. {
  19603. return $this->distSha1Checksum;
  19604. }
  19605. public function setDistMirrors($mirrors)
  19606. {
  19607. $this->distMirrors = $mirrors;
  19608. }
  19609. public function getDistMirrors()
  19610. {
  19611. return $this->distMirrors;
  19612. }
  19613. public function getDistUrls()
  19614. {
  19615. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  19616. }
  19617. public function getVersion()
  19618. {
  19619. return $this->version;
  19620. }
  19621. public function getPrettyVersion()
  19622. {
  19623. return $this->prettyVersion;
  19624. }
  19625. public function setReleaseDate(\DateTime $releaseDate)
  19626. {
  19627. $this->releaseDate = $releaseDate;
  19628. }
  19629. public function getReleaseDate()
  19630. {
  19631. return $this->releaseDate;
  19632. }
  19633. public function setRequires(array $requires)
  19634. {
  19635. $this->requires = $requires;
  19636. }
  19637. public function getRequires()
  19638. {
  19639. return $this->requires;
  19640. }
  19641. public function setConflicts(array $conflicts)
  19642. {
  19643. $this->conflicts = $conflicts;
  19644. }
  19645. public function getConflicts()
  19646. {
  19647. return $this->conflicts;
  19648. }
  19649. public function setProvides(array $provides)
  19650. {
  19651. $this->provides = $provides;
  19652. }
  19653. public function getProvides()
  19654. {
  19655. return $this->provides;
  19656. }
  19657. public function setReplaces(array $replaces)
  19658. {
  19659. $this->replaces = $replaces;
  19660. }
  19661. public function getReplaces()
  19662. {
  19663. return $this->replaces;
  19664. }
  19665. public function setDevRequires(array $devRequires)
  19666. {
  19667. $this->devRequires = $devRequires;
  19668. }
  19669. public function getDevRequires()
  19670. {
  19671. return $this->devRequires;
  19672. }
  19673. public function setSuggests(array $suggests)
  19674. {
  19675. $this->suggests = $suggests;
  19676. }
  19677. public function getSuggests()
  19678. {
  19679. return $this->suggests;
  19680. }
  19681. public function setAutoload(array $autoload)
  19682. {
  19683. $this->autoload = $autoload;
  19684. }
  19685. public function getAutoload()
  19686. {
  19687. return $this->autoload;
  19688. }
  19689. public function setDevAutoload(array $devAutoload)
  19690. {
  19691. $this->devAutoload = $devAutoload;
  19692. }
  19693. public function getDevAutoload()
  19694. {
  19695. return $this->devAutoload;
  19696. }
  19697. public function setIncludePaths(array $includePaths)
  19698. {
  19699. $this->includePaths = $includePaths;
  19700. }
  19701. public function getIncludePaths()
  19702. {
  19703. return $this->includePaths;
  19704. }
  19705. public function setNotificationUrl($notificationUrl)
  19706. {
  19707. $this->notificationUrl = $notificationUrl;
  19708. }
  19709. public function getNotificationUrl()
  19710. {
  19711. return $this->notificationUrl;
  19712. }
  19713. public function setArchiveExcludes(array $excludes)
  19714. {
  19715. $this->archiveExcludes = $excludes;
  19716. }
  19717. public function getArchiveExcludes()
  19718. {
  19719. return $this->archiveExcludes;
  19720. }
  19721. public function replaceVersion($version, $prettyVersion)
  19722. {
  19723. $this->version = $version;
  19724. $this->prettyVersion = $prettyVersion;
  19725. $this->stability = VersionParser::parseStability($version);
  19726. $this->dev = $this->stability === 'dev';
  19727. }
  19728. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  19729. {
  19730. if (!$url) {
  19731. return array();
  19732. }
  19733. $urls = array($url);
  19734. if ($mirrors) {
  19735. foreach ($mirrors as $mirror) {
  19736. if ($urlType === 'dist') {
  19737. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  19738. } elseif ($urlType === 'source' && $type === 'git') {
  19739. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  19740. } elseif ($urlType === 'source' && $type === 'hg') {
  19741. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  19742. }
  19743. if (!in_array($mirrorUrl, $urls)) {
  19744. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19745. $func($urls, $mirrorUrl);
  19746. }
  19747. }
  19748. }
  19749. return $urls;
  19750. }
  19751. }
  19752. <?php
  19753. namespace Composer\Package;
  19754. use Composer\Repository\RepositoryInterface;
  19755. interface PackageInterface
  19756. {
  19757. public function getName();
  19758. public function getPrettyName();
  19759. public function getNames();
  19760. public function setId($id);
  19761. public function getId();
  19762. public function isDev();
  19763. public function getType();
  19764. public function getTargetDir();
  19765. public function getExtra();
  19766. public function setInstallationSource($type);
  19767. public function getInstallationSource();
  19768. public function getSourceType();
  19769. public function getSourceUrl();
  19770. public function getSourceUrls();
  19771. public function getSourceReference();
  19772. public function getSourceMirrors();
  19773. public function getDistType();
  19774. public function getDistUrl();
  19775. public function getDistUrls();
  19776. public function getDistReference();
  19777. public function getDistSha1Checksum();
  19778. public function getDistMirrors();
  19779. public function getVersion();
  19780. public function getPrettyVersion();
  19781. public function getFullPrettyVersion($truncate = true);
  19782. public function getReleaseDate();
  19783. public function getStability();
  19784. public function getRequires();
  19785. public function getConflicts();
  19786. public function getProvides();
  19787. public function getReplaces();
  19788. public function getDevRequires();
  19789. public function getSuggests();
  19790. public function getAutoload();
  19791. public function getDevAutoload();
  19792. public function getIncludePaths();
  19793. public function setRepository(RepositoryInterface $repository);
  19794. public function getRepository();
  19795. public function getBinaries();
  19796. public function getUniqueName();
  19797. public function getNotificationUrl();
  19798. public function __toString();
  19799. public function getPrettyString();
  19800. public function getArchiveExcludes();
  19801. public function getTransportOptions();
  19802. public function setSourceReference($reference);
  19803. public function setDistUrl($url);
  19804. public function setDistType($type);
  19805. public function setDistReference($reference);
  19806. }
  19807. <?php
  19808. namespace Composer\Package;
  19809. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19810. {
  19811. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19812. {
  19813. parent::__construct($aliasOf, $version, $prettyVersion);
  19814. }
  19815. public function getAliases()
  19816. {
  19817. return $this->aliasOf->getAliases();
  19818. }
  19819. public function getMinimumStability()
  19820. {
  19821. return $this->aliasOf->getMinimumStability();
  19822. }
  19823. public function getStabilityFlags()
  19824. {
  19825. return $this->aliasOf->getStabilityFlags();
  19826. }
  19827. public function getReferences()
  19828. {
  19829. return $this->aliasOf->getReferences();
  19830. }
  19831. public function getPreferStable()
  19832. {
  19833. return $this->aliasOf->getPreferStable();
  19834. }
  19835. public function getConfig()
  19836. {
  19837. return $this->aliasOf->getConfig();
  19838. }
  19839. public function setRequires(array $require)
  19840. {
  19841. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19842. $this->aliasOf->setRequires($require);
  19843. }
  19844. public function setDevRequires(array $devRequire)
  19845. {
  19846. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19847. $this->aliasOf->setDevRequires($devRequire);
  19848. }
  19849. public function setConflicts(array $conflicts)
  19850. {
  19851. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19852. $this->aliasOf->setConflicts($conflicts);
  19853. }
  19854. public function setProvides(array $provides)
  19855. {
  19856. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19857. $this->aliasOf->setProvides($provides);
  19858. }
  19859. public function setReplaces(array $replaces)
  19860. {
  19861. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19862. $this->aliasOf->setReplaces($replaces);
  19863. }
  19864. public function setRepositories($repositories)
  19865. {
  19866. $this->aliasOf->setRepositories($repositories);
  19867. }
  19868. public function setAutoload(array $autoload)
  19869. {
  19870. $this->aliasOf->setAutoload($autoload);
  19871. }
  19872. public function setDevAutoload(array $devAutoload)
  19873. {
  19874. $this->aliasOf->setDevAutoload($devAutoload);
  19875. }
  19876. public function setStabilityFlags(array $stabilityFlags)
  19877. {
  19878. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19879. }
  19880. public function setSuggests(array $suggests)
  19881. {
  19882. $this->aliasOf->setSuggests($suggests);
  19883. }
  19884. public function setExtra(array $extra)
  19885. {
  19886. $this->aliasOf->setExtra($extra);
  19887. }
  19888. public function __clone()
  19889. {
  19890. parent::__clone();
  19891. $this->aliasOf = clone $this->aliasOf;
  19892. }
  19893. }
  19894. <?php
  19895. namespace Composer\Package;
  19896. class RootPackage extends CompletePackage implements RootPackageInterface
  19897. {
  19898. protected $minimumStability = 'stable';
  19899. protected $preferStable = false;
  19900. protected $stabilityFlags = array();
  19901. protected $config = array();
  19902. protected $references = array();
  19903. protected $aliases = array();
  19904. public function setMinimumStability($minimumStability)
  19905. {
  19906. $this->minimumStability = $minimumStability;
  19907. }
  19908. public function getMinimumStability()
  19909. {
  19910. return $this->minimumStability;
  19911. }
  19912. public function setStabilityFlags(array $stabilityFlags)
  19913. {
  19914. $this->stabilityFlags = $stabilityFlags;
  19915. }
  19916. public function getStabilityFlags()
  19917. {
  19918. return $this->stabilityFlags;
  19919. }
  19920. public function setPreferStable($preferStable)
  19921. {
  19922. $this->preferStable = $preferStable;
  19923. }
  19924. public function getPreferStable()
  19925. {
  19926. return $this->preferStable;
  19927. }
  19928. public function setConfig(array $config)
  19929. {
  19930. $this->config = $config;
  19931. }
  19932. public function getConfig()
  19933. {
  19934. return $this->config;
  19935. }
  19936. public function setReferences(array $references)
  19937. {
  19938. $this->references = $references;
  19939. }
  19940. public function getReferences()
  19941. {
  19942. return $this->references;
  19943. }
  19944. public function setAliases(array $aliases)
  19945. {
  19946. $this->aliases = $aliases;
  19947. }
  19948. public function getAliases()
  19949. {
  19950. return $this->aliases;
  19951. }
  19952. }
  19953. <?php
  19954. namespace Composer\Package;
  19955. interface RootPackageInterface extends CompletePackageInterface
  19956. {
  19957. public function getAliases();
  19958. public function getMinimumStability();
  19959. public function getStabilityFlags();
  19960. public function getReferences();
  19961. public function getPreferStable();
  19962. public function getConfig();
  19963. public function setRequires(array $requires);
  19964. public function setDevRequires(array $devRequires);
  19965. public function setConflicts(array $conflicts);
  19966. public function setProvides(array $provides);
  19967. public function setReplaces(array $replaces);
  19968. public function setRepositories($repositories);
  19969. public function setAutoload(array $autoload);
  19970. public function setDevAutoload(array $devAutoload);
  19971. public function setStabilityFlags(array $stabilityFlags);
  19972. public function setSuggests(array $suggests);
  19973. public function setExtra(array $extra);
  19974. }
  19975. <?php
  19976. namespace Composer\Package\Version;
  19977. use Composer\Config;
  19978. use Composer\Repository\Vcs\HgDriver;
  19979. use Composer\IO\NullIO;
  19980. use Composer\Semver\VersionParser as SemverVersionParser;
  19981. use Composer\Util\Git as GitUtil;
  19982. use Composer\Util\ProcessExecutor;
  19983. use Composer\Util\Svn as SvnUtil;
  19984. class VersionGuesser
  19985. {
  19986. private $config;
  19987. private $process;
  19988. private $versionParser;
  19989. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19990. {
  19991. $this->config = $config;
  19992. $this->process = $process;
  19993. $this->versionParser = $versionParser;
  19994. }
  19995. public function guessVersion(array $packageConfig, $path)
  19996. {
  19997. if (!function_exists('proc_open')) {
  19998. return null;
  19999. }
  20000. $versionData = $this->guessGitVersion($packageConfig, $path);
  20001. if (null !== $versionData && null !== $versionData['version']) {
  20002. return $this->postprocess($versionData);
  20003. }
  20004. $versionData = $this->guessHgVersion($packageConfig, $path);
  20005. if (null !== $versionData && null !== $versionData['version']) {
  20006. return $this->postprocess($versionData);
  20007. }
  20008. $versionData = $this->guessFossilVersion($packageConfig, $path);
  20009. if (null !== $versionData && null !== $versionData['version']) {
  20010. return $this->postprocess($versionData);
  20011. }
  20012. $versionData = $this->guessSvnVersion($packageConfig, $path);
  20013. if (null !== $versionData && null !== $versionData['version']) {
  20014. return $this->postprocess($versionData);
  20015. }
  20016. return null;
  20017. }
  20018. private function postprocess(array $versionData)
  20019. {
  20020. if (!empty($versionData['feature_version']) && $versionData['feature_version'] === $versionData['version'] && $versionData['feature_pretty_version'] === $versionData['feature_pretty_version']) {
  20021. unset($versionData['feature_version'], $versionData['feature_pretty_version']);
  20022. }
  20023. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  20024. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  20025. }
  20026. if (!empty($versionData['feature_version']) && '-dev' === substr($versionData['feature_version'], -4) && preg_match('{\.9{7}}', $versionData['feature_version'])) {
  20027. $versionData['feature_pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['feature_version']);
  20028. }
  20029. return $versionData;
  20030. }
  20031. private function guessGitVersion(array $packageConfig, $path)
  20032. {
  20033. GitUtil::cleanEnv();
  20034. $commit = null;
  20035. $version = null;
  20036. $prettyVersion = null;
  20037. $featureVersion = null;
  20038. $featurePrettyVersion = null;
  20039. $isDetached = false;
  20040. if (0 === $this->process->execute('git branch -a --no-color --no-abbrev -v', $output, $path)) {
  20041. $branches = array();
  20042. $isFeatureBranch = false;
  20043. foreach ($this->process->splitLines($output) as $branch) {
  20044. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20045. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  20046. $version = 'dev-' . $match[2];
  20047. $prettyVersion = $version;
  20048. $isFeatureBranch = true;
  20049. $isDetached = true;
  20050. } else {
  20051. $version = $this->versionParser->normalizeBranch($match[1]);
  20052. $prettyVersion = 'dev-' . $match[1];
  20053. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20054. }
  20055. if ($match[2]) {
  20056. $commit = $match[2];
  20057. }
  20058. }
  20059. if ($branch && !preg_match('{^ *.+/HEAD }', $branch)) {
  20060. if (preg_match('{^(?:\* )? *((?:remotes/(?:origin|upstream)/)?[^\s/]+) *([a-f0-9]+) .*$}', $branch, $match)) {
  20061. $branches[] = $match[1];
  20062. }
  20063. }
  20064. }
  20065. if ($isFeatureBranch) {
  20066. $featureVersion = $version;
  20067. $featurePrettyVersion = $prettyVersion;
  20068. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  20069. $version = $result['version'];
  20070. $prettyVersion = $result['pretty_version'];
  20071. }
  20072. }
  20073. if (!$version || $isDetached) {
  20074. $result = $this->versionFromGitTags($path);
  20075. if ($result) {
  20076. $version = $result['version'];
  20077. $prettyVersion = $result['pretty_version'];
  20078. $featureVersion = null;
  20079. $featurePrettyVersion = null;
  20080. }
  20081. }
  20082. if (!$commit) {
  20083. $command = 'git log --pretty="%H" -n1 HEAD'.GitUtil::getNoShowSignatureFlag($this->process);
  20084. if (0 === $this->process->execute($command, $output, $path)) {
  20085. $commit = trim($output) ?: null;
  20086. }
  20087. }
  20088. if ($featureVersion) {
  20089. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion, 'feature_version' => $featureVersion, 'feature_pretty_version' => $featurePrettyVersion);
  20090. }
  20091. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  20092. }
  20093. private function versionFromGitTags($path)
  20094. {
  20095. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  20096. try {
  20097. $version = $this->versionParser->normalize(trim($output));
  20098. return array('version' => $version, 'pretty_version' => trim($output));
  20099. } catch (\Exception $e) {
  20100. }
  20101. }
  20102. return null;
  20103. }
  20104. private function guessHgVersion(array $packageConfig, $path)
  20105. {
  20106. if (0 === $this->process->execute('hg branch', $output, $path)) {
  20107. $branch = trim($output);
  20108. $version = $this->versionParser->normalizeBranch($branch);
  20109. $isFeatureBranch = 0 === strpos($version, 'dev-');
  20110. if ('9999999-dev' === $version) {
  20111. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  20112. }
  20113. if (!$isFeatureBranch) {
  20114. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  20115. }
  20116. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  20117. $branches = array_keys($driver->getBranches());
  20118. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  20119. $result['commit'] = '';
  20120. $result['feature_version'] = $version;
  20121. $result['feature_pretty_version'] = $version;
  20122. return $result;
  20123. }
  20124. }
  20125. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  20126. {
  20127. $prettyVersion = $version;
  20128. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  20129. || strpos(json_encode($packageConfig), '"self.version"')
  20130. ) {
  20131. $branch = preg_replace('{^dev-}', '', $version);
  20132. $length = PHP_INT_MAX;
  20133. $nonFeatureBranches = '';
  20134. if (!empty($packageConfig['non-feature-branches'])) {
  20135. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  20136. }
  20137. if (preg_match('{^(' . $nonFeatureBranches . ')$}', $branch) && in_array($branch, $branches, true)) {
  20138. return array('version' => $version, 'pretty_version' => $prettyVersion);
  20139. }
  20140. usort($branches, function ($a, $b) {
  20141. $aRemote = 0 === strpos($a, 'remotes/');
  20142. $bRemote = 0 === strpos($b, 'remotes/');
  20143. if ($aRemote !== $bRemote) {
  20144. return $aRemote ? 1 : -1;
  20145. }
  20146. return strnatcasecmp($b, $a);
  20147. });
  20148. foreach ($branches as $candidate) {
  20149. $candidateVersion = preg_replace('{^remotes/\S+/}', '', $candidate);
  20150. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidateVersion, $match)) {
  20151. continue;
  20152. }
  20153. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  20154. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  20155. continue;
  20156. }
  20157. if (strlen($output) < $length) {
  20158. $length = strlen($output);
  20159. $version = $this->versionParser->normalizeBranch($candidateVersion);
  20160. $prettyVersion = 'dev-' . $candidateVersion;
  20161. if ($length === 0) {
  20162. break;
  20163. }
  20164. }
  20165. }
  20166. }
  20167. return array('version' => $version, 'pretty_version' => $prettyVersion);
  20168. }
  20169. private function guessFossilVersion(array $packageConfig, $path)
  20170. {
  20171. $version = null;
  20172. $prettyVersion = null;
  20173. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  20174. $branch = trim($output);
  20175. $version = $this->versionParser->normalizeBranch($branch);
  20176. $prettyVersion = 'dev-' . $branch;
  20177. }
  20178. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  20179. try {
  20180. $version = $this->versionParser->normalize(trim($output));
  20181. $prettyVersion = trim($output);
  20182. } catch (\Exception $e) {
  20183. }
  20184. }
  20185. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20186. }
  20187. private function guessSvnVersion(array $packageConfig, $path)
  20188. {
  20189. SvnUtil::cleanEnv();
  20190. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  20191. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  20192. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  20193. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  20194. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  20195. if (preg_match($urlPattern, $output, $matches)) {
  20196. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  20197. $version = $this->versionParser->normalizeBranch($matches[3]);
  20198. $prettyVersion = 'dev-' . $matches[3];
  20199. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20200. }
  20201. $prettyVersion = trim($matches[1]);
  20202. $version = $this->versionParser->normalize($prettyVersion);
  20203. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  20204. }
  20205. }
  20206. }
  20207. }
  20208. <?php
  20209. namespace Composer\Package\Version;
  20210. use Composer\Repository\PlatformRepository;
  20211. use Composer\Semver\VersionParser as SemverVersionParser;
  20212. use Composer\Semver\Semver;
  20213. class VersionParser extends SemverVersionParser
  20214. {
  20215. private static $constraints = array();
  20216. public function parseConstraints($constraints)
  20217. {
  20218. if (!isset(self::$constraints[$constraints])) {
  20219. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  20220. }
  20221. return self::$constraints[$constraints];
  20222. }
  20223. public function parseNameVersionPairs(array $pairs)
  20224. {
  20225. $pairs = array_values($pairs);
  20226. $result = array();
  20227. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  20228. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  20229. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  20230. $pair .= ' '.$pairs[$i + 1];
  20231. $i++;
  20232. }
  20233. if (strpos($pair, ' ')) {
  20234. list($name, $version) = explode(' ', $pair, 2);
  20235. $result[] = array('name' => $name, 'version' => $version);
  20236. } else {
  20237. $result[] = array('name' => $pair);
  20238. }
  20239. }
  20240. return $result;
  20241. }
  20242. public static function isUpgrade($normalizedFrom, $normalizedTo)
  20243. {
  20244. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  20245. return true;
  20246. }
  20247. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  20248. return $sorted[0] === $normalizedFrom;
  20249. }
  20250. }
  20251. <?php
  20252. namespace Composer\Package\Version;
  20253. use Composer\DependencyResolver\Pool;
  20254. use Composer\Package\BasePackage;
  20255. use Composer\Package\PackageInterface;
  20256. use Composer\Plugin\PluginInterface;
  20257. use Composer\Composer;
  20258. use Composer\Package\Loader\ArrayLoader;
  20259. use Composer\Package\Dumper\ArrayDumper;
  20260. use Composer\Semver\Constraint\Constraint;
  20261. class VersionSelector
  20262. {
  20263. private $pool;
  20264. private $parser;
  20265. public function __construct(Pool $pool)
  20266. {
  20267. $this->pool = $pool;
  20268. }
  20269. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  20270. {
  20271. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  20272. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  20273. if ($targetPhpVersion) {
  20274. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  20275. $composerRuntimeConstraint = new Constraint('==', $this->getParser()->normalize(Composer::RUNTIME_API_VERSION));
  20276. $composerPluginConstraint = new Constraint('==', $this->getParser()->normalize(PluginInterface::PLUGIN_API_VERSION));
  20277. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint, $composerPluginConstraint, $composerRuntimeConstraint) {
  20278. $reqs = $pkg->getRequires();
  20279. return (!isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint))
  20280. && (!isset($reqs['composer-plugin-api']) || $reqs['composer-plugin-api']->getConstraint()->matches($composerPluginConstraint))
  20281. && (!isset($reqs['composer-runtime-api']) || $reqs['composer-runtime-api']->getConstraint()->matches($composerRuntimeConstraint));
  20282. });
  20283. }
  20284. if (!$candidates) {
  20285. return false;
  20286. }
  20287. $package = reset($candidates);
  20288. $minPriority = BasePackage::$stabilities[$preferredStability];
  20289. foreach ($candidates as $candidate) {
  20290. $candidatePriority = $candidate->getStabilityPriority();
  20291. $currentPriority = $package->getStabilityPriority();
  20292. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  20293. continue;
  20294. }
  20295. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  20296. $package = $candidate;
  20297. continue;
  20298. }
  20299. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  20300. $package = $candidate;
  20301. continue;
  20302. }
  20303. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  20304. $package = $candidate;
  20305. }
  20306. }
  20307. return $package;
  20308. }
  20309. public function findRecommendedRequireVersion(PackageInterface $package)
  20310. {
  20311. $version = $package->getVersion();
  20312. if (!$package->isDev()) {
  20313. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  20314. }
  20315. $loader = new ArrayLoader($this->getParser());
  20316. $dumper = new ArrayDumper();
  20317. $extra = $loader->getBranchAlias($dumper->dump($package));
  20318. if ($extra) {
  20319. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  20320. if ($count) {
  20321. $extra = str_replace('.9999999', '.0', $extra);
  20322. return $this->transformVersion($extra, $extra, 'dev');
  20323. }
  20324. }
  20325. return $package->getPrettyVersion();
  20326. }
  20327. private function transformVersion($version, $prettyVersion, $stability)
  20328. {
  20329. $semanticVersionParts = explode('.', $version);
  20330. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  20331. if ($semanticVersionParts[0] === '0') {
  20332. unset($semanticVersionParts[3]);
  20333. } else {
  20334. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  20335. }
  20336. $version = implode('.', $semanticVersionParts);
  20337. } else {
  20338. return $prettyVersion;
  20339. }
  20340. if ($stability != 'stable') {
  20341. $version .= '@'.$stability;
  20342. }
  20343. return '^' . $version;
  20344. }
  20345. private function getParser()
  20346. {
  20347. if ($this->parser === null) {
  20348. $this->parser = new VersionParser();
  20349. }
  20350. return $this->parser;
  20351. }
  20352. }
  20353. <?php
  20354. namespace Composer\Plugin\Capability;
  20355. interface Capability
  20356. {
  20357. }
  20358. <?php
  20359. namespace Composer\Plugin\Capability;
  20360. interface CommandProvider extends Capability
  20361. {
  20362. public function getCommands();
  20363. }
  20364. <?php
  20365. namespace Composer\Plugin;
  20366. interface Capable
  20367. {
  20368. public function getCapabilities();
  20369. }
  20370. <?php
  20371. namespace Composer\Plugin;
  20372. use Composer\EventDispatcher\Event;
  20373. use Symfony\Component\Console\Input\InputInterface;
  20374. use Symfony\Component\Console\Output\OutputInterface;
  20375. class CommandEvent extends Event
  20376. {
  20377. private $commandName;
  20378. private $input;
  20379. private $output;
  20380. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  20381. {
  20382. parent::__construct($name, $args, $flags);
  20383. $this->commandName = $commandName;
  20384. $this->input = $input;
  20385. $this->output = $output;
  20386. }
  20387. public function getInput()
  20388. {
  20389. return $this->input;
  20390. }
  20391. public function getOutput()
  20392. {
  20393. return $this->output;
  20394. }
  20395. public function getCommandName()
  20396. {
  20397. return $this->commandName;
  20398. }
  20399. }
  20400. <?php
  20401. namespace Composer\Plugin;
  20402. class PluginEvents
  20403. {
  20404. const INIT = 'init';
  20405. const COMMAND = 'command';
  20406. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  20407. const PRE_COMMAND_RUN = 'pre-command-run';
  20408. }
  20409. <?php
  20410. namespace Composer\Plugin;
  20411. use Composer\Composer;
  20412. use Composer\IO\IOInterface;
  20413. interface PluginInterface
  20414. {
  20415. const PLUGIN_API_VERSION = '1.1.0';
  20416. public function activate(Composer $composer, IOInterface $io);
  20417. }
  20418. <?php
  20419. namespace Composer\Plugin;
  20420. use Composer\Composer;
  20421. use Composer\EventDispatcher\EventSubscriberInterface;
  20422. use Composer\IO\IOInterface;
  20423. use Composer\Package\CompletePackage;
  20424. use Composer\Package\Package;
  20425. use Composer\Package\Version\VersionParser;
  20426. use Composer\Repository\RepositoryInterface;
  20427. use Composer\Package\PackageInterface;
  20428. use Composer\Package\Link;
  20429. use Composer\Semver\Constraint\Constraint;
  20430. use Composer\DependencyResolver\Pool;
  20431. use Composer\Plugin\Capability\Capability;
  20432. use Composer\Util\PackageSorter;
  20433. class PluginManager
  20434. {
  20435. protected $composer;
  20436. protected $io;
  20437. protected $globalComposer;
  20438. protected $versionParser;
  20439. protected $disablePlugins = false;
  20440. protected $plugins = array();
  20441. protected $registeredPlugins = array();
  20442. private static $classCounter = 0;
  20443. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  20444. {
  20445. $this->io = $io;
  20446. $this->composer = $composer;
  20447. $this->globalComposer = $globalComposer;
  20448. $this->versionParser = new VersionParser();
  20449. $this->disablePlugins = $disablePlugins;
  20450. }
  20451. public function loadInstalledPlugins()
  20452. {
  20453. if ($this->disablePlugins) {
  20454. return;
  20455. }
  20456. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  20457. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20458. if ($repo) {
  20459. $this->loadRepository($repo);
  20460. }
  20461. if ($globalRepo) {
  20462. $this->loadRepository($globalRepo);
  20463. }
  20464. }
  20465. public function getPlugins()
  20466. {
  20467. return $this->plugins;
  20468. }
  20469. public function getGlobalComposer()
  20470. {
  20471. return $this->globalComposer;
  20472. }
  20473. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  20474. {
  20475. if ($this->disablePlugins) {
  20476. return;
  20477. }
  20478. if ($package->getType() === 'composer-plugin') {
  20479. $requiresComposer = null;
  20480. foreach ($package->getRequires() as $link) {
  20481. if ('composer-plugin-api' === $link->getTarget()) {
  20482. $requiresComposer = $link->getConstraint();
  20483. break;
  20484. }
  20485. }
  20486. if (!$requiresComposer) {
  20487. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  20488. }
  20489. $currentPluginApiVersion = $this->getPluginApiVersion();
  20490. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  20491. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  20492. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin requires composer-plugin-api 1.0.0, this *WILL* break in the future and it should be fixed ASAP (require ^1.0 for example).</warning>');
  20493. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  20494. $this->io->writeError('<warning>The "' . $package->getName() . '" plugin was skipped because it requires a Plugin API version ("' . $requiresComposer->getPrettyString() . '") that does not match your Composer installation ("' . $currentPluginApiVersion . '"). You may need to run composer update with the "--no-plugins" option.</warning>');
  20495. return;
  20496. }
  20497. }
  20498. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  20499. if (in_array($package->getName(), $this->registeredPlugins)) {
  20500. return;
  20501. }
  20502. $extra = $package->getExtra();
  20503. if (empty($extra['class'])) {
  20504. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  20505. }
  20506. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  20507. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  20508. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  20509. $pool = new Pool('dev');
  20510. $pool->addRepository($localRepo);
  20511. if ($globalRepo) {
  20512. $pool->addRepository($globalRepo);
  20513. }
  20514. $autoloadPackages = array($package->getName() => $package);
  20515. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  20516. $generator = $this->composer->getAutoloadGenerator();
  20517. $autoloads = array();
  20518. foreach ($autoloadPackages as $autoloadPackage) {
  20519. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  20520. $autoloads[] = array($autoloadPackage, $downloadPath);
  20521. }
  20522. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  20523. $classLoader = $generator->createLoader($map);
  20524. $classLoader->register();
  20525. foreach ($classes as $class) {
  20526. if (class_exists($class, false)) {
  20527. $class = trim($class, '\\');
  20528. $path = $classLoader->findFile($class);
  20529. $code = file_get_contents($path);
  20530. $separatorPos = strrpos($class, '\\');
  20531. $className = $class;
  20532. if ($separatorPos) {
  20533. $className = substr($class, $separatorPos + 1);
  20534. }
  20535. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  20536. $code = str_replace('__FILE__', var_export($path, true), $code);
  20537. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  20538. $code = str_replace('__CLASS__', var_export($class, true), $code);
  20539. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  20540. eval($code);
  20541. $class .= '_composer_tmp'.self::$classCounter;
  20542. self::$classCounter++;
  20543. }
  20544. if ($oldInstallerPlugin) {
  20545. $installer = new $class($this->io, $this->composer);
  20546. $this->composer->getInstallationManager()->addInstaller($installer);
  20547. } elseif (class_exists($class)) {
  20548. $plugin = new $class();
  20549. $this->addPlugin($plugin);
  20550. $this->registeredPlugins[] = $package->getName();
  20551. } elseif ($failOnMissingClasses) {
  20552. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  20553. }
  20554. }
  20555. }
  20556. protected function getPluginApiVersion()
  20557. {
  20558. return PluginInterface::PLUGIN_API_VERSION;
  20559. }
  20560. public function addPlugin(PluginInterface $plugin)
  20561. {
  20562. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  20563. $this->plugins[] = $plugin;
  20564. $plugin->activate($this->composer, $this->io);
  20565. if ($plugin instanceof EventSubscriberInterface) {
  20566. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  20567. }
  20568. }
  20569. private function loadRepository(RepositoryInterface $repo)
  20570. {
  20571. $packages = $repo->getPackages();
  20572. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  20573. foreach ($sortedPackages as $package) {
  20574. if (!($package instanceof CompletePackage)) {
  20575. continue;
  20576. }
  20577. if ('composer-plugin' === $package->getType()) {
  20578. $this->registerPackage($package);
  20579. } elseif ('composer-installer' === $package->getType()) {
  20580. $this->registerPackage($package);
  20581. }
  20582. }
  20583. }
  20584. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  20585. {
  20586. $requires = array_merge(
  20587. $package->getRequires(),
  20588. $package->getDevRequires()
  20589. );
  20590. foreach ($requires as $requireLink) {
  20591. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  20592. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  20593. $collected[$requiredPackage->getName()] = $requiredPackage;
  20594. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  20595. }
  20596. }
  20597. return $collected;
  20598. }
  20599. private function lookupInstalledPackage(Pool $pool, Link $link)
  20600. {
  20601. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  20602. return !empty($packages) ? $packages[0] : null;
  20603. }
  20604. private function getInstallPath(PackageInterface $package, $global = false)
  20605. {
  20606. if (!$global) {
  20607. return $this->composer->getInstallationManager()->getInstallPath($package);
  20608. }
  20609. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  20610. }
  20611. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  20612. {
  20613. if (!($plugin instanceof Capable)) {
  20614. return null;
  20615. }
  20616. $capabilities = (array) $plugin->getCapabilities();
  20617. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  20618. return trim($capabilities[$capability]);
  20619. }
  20620. if (
  20621. array_key_exists($capability, $capabilities)
  20622. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  20623. ) {
  20624. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  20625. }
  20626. }
  20627. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  20628. {
  20629. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  20630. if (!class_exists($capabilityClass)) {
  20631. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  20632. }
  20633. $ctorArgs['plugin'] = $plugin;
  20634. $capabilityObj = new $capabilityClass($ctorArgs);
  20635. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  20636. throw new \RuntimeException(
  20637. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  20638. );
  20639. }
  20640. return $capabilityObj;
  20641. }
  20642. }
  20643. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  20644. {
  20645. $capabilities = array();
  20646. foreach ($this->getPlugins() as $plugin) {
  20647. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  20648. $capabilities[] = $capability;
  20649. }
  20650. }
  20651. return $capabilities;
  20652. }
  20653. }
  20654. <?php
  20655. namespace Composer\Plugin;
  20656. use Composer\EventDispatcher\Event;
  20657. use Symfony\Component\Console\Input\InputInterface;
  20658. class PreCommandRunEvent extends Event
  20659. {
  20660. private $input;
  20661. private $command;
  20662. public function __construct($name, InputInterface $input, $command)
  20663. {
  20664. parent::__construct($name);
  20665. $this->input = $input;
  20666. $this->command = $command;
  20667. }
  20668. public function getInput()
  20669. {
  20670. return $this->input;
  20671. }
  20672. public function getCommand()
  20673. {
  20674. return $this->command;
  20675. }
  20676. }
  20677. <?php
  20678. namespace Composer\Plugin;
  20679. use Composer\EventDispatcher\Event;
  20680. use Composer\Util\RemoteFilesystem;
  20681. class PreFileDownloadEvent extends Event
  20682. {
  20683. private $rfs;
  20684. private $processedUrl;
  20685. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  20686. {
  20687. parent::__construct($name);
  20688. $this->rfs = $rfs;
  20689. $this->processedUrl = $processedUrl;
  20690. }
  20691. public function getRemoteFilesystem()
  20692. {
  20693. return $this->rfs;
  20694. }
  20695. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  20696. {
  20697. $this->rfs = $rfs;
  20698. }
  20699. public function getProcessedUrl()
  20700. {
  20701. return $this->processedUrl;
  20702. }
  20703. }
  20704. <?php
  20705. namespace Composer\Question;
  20706. use Symfony\Component\Console\Exception\InvalidArgumentException;
  20707. use Symfony\Component\Console\Question\Question;
  20708. class StrictConfirmationQuestion extends Question
  20709. {
  20710. private $trueAnswerRegex;
  20711. private $falseAnswerRegex;
  20712. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  20713. {
  20714. parent::__construct($question, (bool) $default);
  20715. $this->trueAnswerRegex = $trueAnswerRegex;
  20716. $this->falseAnswerRegex = $falseAnswerRegex;
  20717. $this->setNormalizer($this->getDefaultNormalizer());
  20718. $this->setValidator($this->getDefaultValidator());
  20719. }
  20720. private function getDefaultNormalizer()
  20721. {
  20722. $default = $this->getDefault();
  20723. $trueRegex = $this->trueAnswerRegex;
  20724. $falseRegex = $this->falseAnswerRegex;
  20725. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  20726. if (is_bool($answer)) {
  20727. return $answer;
  20728. }
  20729. if (empty($answer) && !empty($default)) {
  20730. return $default;
  20731. }
  20732. if (preg_match($trueRegex, $answer)) {
  20733. return true;
  20734. }
  20735. if (preg_match($falseRegex, $answer)) {
  20736. return false;
  20737. }
  20738. return null;
  20739. };
  20740. }
  20741. private function getDefaultValidator()
  20742. {
  20743. return function ($answer) {
  20744. if (!is_bool($answer)) {
  20745. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  20746. }
  20747. return $answer;
  20748. };
  20749. }
  20750. }
  20751. <?php
  20752. namespace Composer\Repository;
  20753. use Composer\Package\AliasPackage;
  20754. use Composer\Package\PackageInterface;
  20755. use Composer\Package\CompletePackageInterface;
  20756. use Composer\Package\Version\VersionParser;
  20757. use Composer\Semver\Constraint\ConstraintInterface;
  20758. use Composer\Semver\Constraint\Constraint;
  20759. class ArrayRepository extends BaseRepository
  20760. {
  20761. protected $packages;
  20762. protected $packageMap;
  20763. public function __construct(array $packages = array())
  20764. {
  20765. foreach ($packages as $package) {
  20766. $this->addPackage($package);
  20767. }
  20768. }
  20769. public function findPackage($name, $constraint)
  20770. {
  20771. $name = strtolower($name);
  20772. if (!$constraint instanceof ConstraintInterface) {
  20773. $versionParser = new VersionParser();
  20774. $constraint = $versionParser->parseConstraints($constraint);
  20775. }
  20776. foreach ($this->getPackages() as $package) {
  20777. if ($name === $package->getName()) {
  20778. $pkgConstraint = new Constraint('==', $package->getVersion());
  20779. if ($constraint->matches($pkgConstraint)) {
  20780. return $package;
  20781. }
  20782. }
  20783. }
  20784. return null;
  20785. }
  20786. public function findPackages($name, $constraint = null)
  20787. {
  20788. $name = strtolower($name);
  20789. $packages = array();
  20790. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20791. $versionParser = new VersionParser();
  20792. $constraint = $versionParser->parseConstraints($constraint);
  20793. }
  20794. foreach ($this->getPackages() as $package) {
  20795. if ($name === $package->getName()) {
  20796. $pkgConstraint = new Constraint('==', $package->getVersion());
  20797. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20798. $packages[] = $package;
  20799. }
  20800. }
  20801. }
  20802. return $packages;
  20803. }
  20804. public function search($query, $mode = 0, $type = null)
  20805. {
  20806. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20807. $matches = array();
  20808. foreach ($this->getPackages() as $package) {
  20809. $name = $package->getName();
  20810. if (isset($matches[$name])) {
  20811. continue;
  20812. }
  20813. if (preg_match($regex, $name)
  20814. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20815. ) {
  20816. if (null !== $type && $package->getType() !== $type) {
  20817. continue;
  20818. }
  20819. $matches[$name] = array(
  20820. 'name' => $package->getPrettyName(),
  20821. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20822. );
  20823. }
  20824. }
  20825. return array_values($matches);
  20826. }
  20827. public function hasPackage(PackageInterface $package)
  20828. {
  20829. if ($this->packageMap === null) {
  20830. $this->packageMap = array();
  20831. foreach ($this->getPackages() as $repoPackage) {
  20832. $this->packageMap[$repoPackage->getUniqueName()] = $repoPackage;
  20833. }
  20834. }
  20835. return isset($this->packageMap[$package->getUniqueName()]);
  20836. }
  20837. public function addPackage(PackageInterface $package)
  20838. {
  20839. if (null === $this->packages) {
  20840. $this->initialize();
  20841. }
  20842. $package->setRepository($this);
  20843. $this->packages[] = $package;
  20844. if ($package instanceof AliasPackage) {
  20845. $aliasedPackage = $package->getAliasOf();
  20846. if (null === $aliasedPackage->getRepository()) {
  20847. $this->addPackage($aliasedPackage);
  20848. }
  20849. }
  20850. $this->packageMap = null;
  20851. }
  20852. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20853. {
  20854. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20855. }
  20856. public function removePackage(PackageInterface $package)
  20857. {
  20858. $packageId = $package->getUniqueName();
  20859. foreach ($this->getPackages() as $key => $repoPackage) {
  20860. if ($packageId === $repoPackage->getUniqueName()) {
  20861. array_splice($this->packages, $key, 1);
  20862. $this->packageMap = null;
  20863. return;
  20864. }
  20865. }
  20866. }
  20867. public function getPackages()
  20868. {
  20869. if (null === $this->packages) {
  20870. $this->initialize();
  20871. }
  20872. return $this->packages;
  20873. }
  20874. public function count()
  20875. {
  20876. return count($this->packages);
  20877. }
  20878. protected function initialize()
  20879. {
  20880. $this->packages = array();
  20881. }
  20882. }
  20883. <?php
  20884. namespace Composer\Repository;
  20885. use Composer\IO\IOInterface;
  20886. use Composer\Json\JsonFile;
  20887. use Composer\Package\Loader\ArrayLoader;
  20888. use Composer\Package\Loader\LoaderInterface;
  20889. use Composer\Util\Zip;
  20890. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20891. {
  20892. protected $loader;
  20893. protected $lookup;
  20894. protected $repoConfig;
  20895. private $io;
  20896. public function __construct(array $repoConfig, IOInterface $io)
  20897. {
  20898. parent::__construct();
  20899. if (!extension_loaded('zip')) {
  20900. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20901. }
  20902. $this->loader = new ArrayLoader();
  20903. $this->lookup = $repoConfig['url'];
  20904. $this->io = $io;
  20905. $this->repoConfig = $repoConfig;
  20906. }
  20907. public function getRepoConfig()
  20908. {
  20909. return $this->repoConfig;
  20910. }
  20911. protected function initialize()
  20912. {
  20913. parent::initialize();
  20914. $this->scanDirectory($this->lookup);
  20915. }
  20916. private function scanDirectory($path)
  20917. {
  20918. $io = $this->io;
  20919. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20920. $iterator = new \RecursiveIteratorIterator($directory);
  20921. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20922. foreach ($regex as $file) {
  20923. if (!$file->isFile()) {
  20924. continue;
  20925. }
  20926. $package = $this->getComposerInformation($file);
  20927. if (!$package) {
  20928. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20929. continue;
  20930. }
  20931. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20932. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20933. $this->addPackage($package);
  20934. }
  20935. }
  20936. private function getComposerInformation(\SplFileInfo $file)
  20937. {
  20938. $json = Zip::getComposerJson($file->getPathname());
  20939. if (null === $json) {
  20940. return false;
  20941. }
  20942. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20943. $package['dist'] = array(
  20944. 'type' => 'zip',
  20945. 'url' => strtr($file->getPathname(), '\\', '/'),
  20946. 'shasum' => sha1_file($file->getRealPath()),
  20947. );
  20948. try {
  20949. $package = $this->loader->load($package);
  20950. } catch (\UnexpectedValueException $e) {
  20951. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20952. }
  20953. return $package;
  20954. }
  20955. }
  20956. <?php
  20957. namespace Composer\Repository;
  20958. use Composer\Package\RootPackageInterface;
  20959. use Composer\Semver\Constraint\ConstraintInterface;
  20960. use Composer\Semver\Constraint\Constraint;
  20961. use Composer\Package\Link;
  20962. abstract class BaseRepository implements RepositoryInterface
  20963. {
  20964. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20965. {
  20966. $needles = array_map('strtolower', (array) $needle);
  20967. $results = array();
  20968. if (null === $packagesFound) {
  20969. $packagesFound = $needles;
  20970. }
  20971. $rootPackage = null;
  20972. foreach ($this->getPackages() as $package) {
  20973. if ($package instanceof RootPackageInterface) {
  20974. $rootPackage = $package;
  20975. break;
  20976. }
  20977. }
  20978. foreach ($this->getPackages() as $package) {
  20979. $links = $package->getRequires();
  20980. $packagesInTree = $packagesFound;
  20981. if (!$invert) {
  20982. $links += $package->getReplaces();
  20983. foreach ($package->getReplaces() as $link) {
  20984. foreach ($needles as $needle) {
  20985. if ($link->getSource() === $needle) {
  20986. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20987. if (in_array($link->getTarget(), $packagesInTree)) {
  20988. $results[] = array($package, $link, false);
  20989. continue;
  20990. }
  20991. $packagesInTree[] = $link->getTarget();
  20992. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20993. $results[] = array($package, $link, $dependents);
  20994. $needles[] = $link->getTarget();
  20995. }
  20996. }
  20997. }
  20998. }
  20999. }
  21000. if ($package instanceof RootPackageInterface) {
  21001. $links += $package->getDevRequires();
  21002. }
  21003. foreach ($links as $link) {
  21004. foreach ($needles as $needle) {
  21005. if ($link->getTarget() === $needle) {
  21006. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  21007. if (in_array($link->getSource(), $packagesInTree)) {
  21008. $results[] = array($package, $link, false);
  21009. continue;
  21010. }
  21011. $packagesInTree[] = $link->getSource();
  21012. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  21013. $results[] = array($package, $link, $dependents);
  21014. }
  21015. }
  21016. }
  21017. }
  21018. if ($invert && in_array($package->getName(), $needles)) {
  21019. foreach ($package->getConflicts() as $link) {
  21020. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  21021. $version = new Constraint('=', $pkg->getVersion());
  21022. if ($link->getConstraint()->matches($version) === $invert) {
  21023. $results[] = array($package, $link, false);
  21024. }
  21025. }
  21026. }
  21027. }
  21028. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  21029. foreach ($package->getRequires() as $link) {
  21030. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  21031. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  21032. continue;
  21033. }
  21034. $platformPkg = $this->findPackage($link->getTarget(), '*');
  21035. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  21036. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  21037. continue;
  21038. }
  21039. foreach ($this->getPackages() as $pkg) {
  21040. if (!in_array($link->getTarget(), $pkg->getNames())) {
  21041. continue;
  21042. }
  21043. $version = new Constraint('=', $pkg->getVersion());
  21044. if (!$link->getConstraint()->matches($version)) {
  21045. if ($rootPackage) {
  21046. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  21047. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  21048. $results[] = array($package, $link, false);
  21049. $results[] = array($rootPackage, $rootReq, false);
  21050. continue 3;
  21051. }
  21052. }
  21053. $results[] = array($package, $link, false);
  21054. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  21055. } else {
  21056. $results[] = array($package, $link, false);
  21057. }
  21058. }
  21059. continue 2;
  21060. }
  21061. }
  21062. }
  21063. }
  21064. ksort($results);
  21065. return $results;
  21066. }
  21067. }
  21068. <?php
  21069. namespace Composer\Repository;
  21070. use Composer\Package\Loader\ArrayLoader;
  21071. use Composer\Package\PackageInterface;
  21072. use Composer\Package\AliasPackage;
  21073. use Composer\Package\Version\VersionParser;
  21074. use Composer\DependencyResolver\Pool;
  21075. use Composer\Json\JsonFile;
  21076. use Composer\Cache;
  21077. use Composer\Config;
  21078. use Composer\Composer;
  21079. use Composer\Factory;
  21080. use Composer\IO\IOInterface;
  21081. use Composer\Util\RemoteFilesystem;
  21082. use Composer\Plugin\PluginEvents;
  21083. use Composer\Plugin\PreFileDownloadEvent;
  21084. use Composer\EventDispatcher\EventDispatcher;
  21085. use Composer\Downloader\TransportException;
  21086. use Composer\Semver\Constraint\ConstraintInterface;
  21087. use Composer\Semver\Constraint\Constraint;
  21088. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21089. {
  21090. protected $config;
  21091. protected $repoConfig;
  21092. protected $options;
  21093. protected $url;
  21094. protected $baseUrl;
  21095. protected $io;
  21096. protected $rfs;
  21097. protected $cache;
  21098. protected $notifyUrl;
  21099. protected $searchUrl;
  21100. protected $hasProviders = false;
  21101. protected $providersUrl;
  21102. protected $lazyProvidersUrl;
  21103. protected $providerListing;
  21104. protected $providers = array();
  21105. protected $providersByUid = array();
  21106. protected $loader;
  21107. protected $rootAliases;
  21108. protected $allowSslDowngrade = false;
  21109. protected $eventDispatcher;
  21110. protected $sourceMirrors;
  21111. protected $distMirrors;
  21112. private $degradedMode = false;
  21113. private $rootData;
  21114. private $hasPartialPackages;
  21115. private $partialPackagesByName;
  21116. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  21117. {
  21118. parent::__construct();
  21119. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  21120. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21121. }
  21122. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  21123. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  21124. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  21125. }
  21126. $urlBits = parse_url($repoConfig['url']);
  21127. if ($urlBits === false || empty($urlBits['scheme'])) {
  21128. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  21129. }
  21130. if (!isset($repoConfig['options'])) {
  21131. $repoConfig['options'] = array();
  21132. }
  21133. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  21134. $this->allowSslDowngrade = true;
  21135. }
  21136. $this->config = $config;
  21137. $this->options = $repoConfig['options'];
  21138. $this->url = $repoConfig['url'];
  21139. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  21140. $this->url = $match['proto'].'://repo.packagist.org';
  21141. }
  21142. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  21143. $this->io = $io;
  21144. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  21145. $this->loader = new ArrayLoader();
  21146. if ($rfs && $this->options) {
  21147. $rfs = clone $rfs;
  21148. $rfs->setOptions($this->options);
  21149. }
  21150. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  21151. $this->eventDispatcher = $eventDispatcher;
  21152. $this->repoConfig = $repoConfig;
  21153. }
  21154. public function getRepoConfig()
  21155. {
  21156. return $this->repoConfig;
  21157. }
  21158. public function setRootAliases(array $rootAliases)
  21159. {
  21160. $this->rootAliases = $rootAliases;
  21161. }
  21162. public function findPackage($name, $constraint)
  21163. {
  21164. if (!$this->hasProviders()) {
  21165. return parent::findPackage($name, $constraint);
  21166. }
  21167. $name = strtolower($name);
  21168. if (!$constraint instanceof ConstraintInterface) {
  21169. $versionParser = new VersionParser();
  21170. $constraint = $versionParser->parseConstraints($constraint);
  21171. }
  21172. foreach ($this->getProviderNames() as $providerName) {
  21173. if ($name === $providerName) {
  21174. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  21175. foreach ($packages as $package) {
  21176. if ($name === $package->getName()) {
  21177. $pkgConstraint = new Constraint('==', $package->getVersion());
  21178. if ($constraint->matches($pkgConstraint)) {
  21179. return $package;
  21180. }
  21181. }
  21182. }
  21183. break;
  21184. }
  21185. }
  21186. }
  21187. public function findPackages($name, $constraint = null)
  21188. {
  21189. if (!$this->hasProviders()) {
  21190. return parent::findPackages($name, $constraint);
  21191. }
  21192. $name = strtolower($name);
  21193. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  21194. $versionParser = new VersionParser();
  21195. $constraint = $versionParser->parseConstraints($constraint);
  21196. }
  21197. $packages = array();
  21198. foreach ($this->getProviderNames() as $providerName) {
  21199. if ($name === $providerName) {
  21200. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  21201. foreach ($candidates as $package) {
  21202. if ($name === $package->getName()) {
  21203. $pkgConstraint = new Constraint('==', $package->getVersion());
  21204. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  21205. $packages[] = $package;
  21206. }
  21207. }
  21208. }
  21209. break;
  21210. }
  21211. }
  21212. return $packages;
  21213. }
  21214. public function getPackages()
  21215. {
  21216. if ($this->hasProviders()) {
  21217. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  21218. }
  21219. return parent::getPackages();
  21220. }
  21221. public function search($query, $mode = 0, $type = null)
  21222. {
  21223. $this->loadRootServerFile();
  21224. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  21225. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  21226. $origin = RemoteFilesystem::getOrigin($url);
  21227. $json = $this->rfs->getContents($origin, $url, false);
  21228. $search = JsonFile::parseJson($json, $url);
  21229. if (empty($search['results'])) {
  21230. return array();
  21231. }
  21232. $results = array();
  21233. foreach ($search['results'] as $result) {
  21234. if (empty($result['virtual'])) {
  21235. $results[] = $result;
  21236. }
  21237. }
  21238. return $results;
  21239. }
  21240. if ($this->hasProviders()) {
  21241. $results = array();
  21242. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  21243. foreach ($this->getProviderNames() as $name) {
  21244. if (preg_match($regex, $name)) {
  21245. $results[] = array('name' => $name);
  21246. }
  21247. }
  21248. return $results;
  21249. }
  21250. return parent::search($query, $mode);
  21251. }
  21252. public function getProviderNames()
  21253. {
  21254. $this->loadRootServerFile();
  21255. if (null === $this->providerListing) {
  21256. $this->loadProviderListings($this->loadRootServerFile());
  21257. }
  21258. if ($this->hasPartialPackages) {
  21259. if (null === $this->partialPackagesByName) {
  21260. $this->initializePartialPackages();
  21261. }
  21262. return array_keys($this->partialPackagesByName);
  21263. }
  21264. if ($this->lazyProvidersUrl) {
  21265. return array();
  21266. }
  21267. if ($this->providersUrl) {
  21268. return array_keys($this->providerListing);
  21269. }
  21270. return array();
  21271. }
  21272. protected function configurePackageTransportOptions(PackageInterface $package)
  21273. {
  21274. foreach ($package->getDistUrls() as $url) {
  21275. if (strpos($url, $this->baseUrl) === 0) {
  21276. $package->setTransportOptions($this->options);
  21277. return;
  21278. }
  21279. }
  21280. }
  21281. public function hasProviders()
  21282. {
  21283. $this->loadRootServerFile();
  21284. return $this->hasProviders;
  21285. }
  21286. public function resetPackageIds()
  21287. {
  21288. foreach ($this->providersByUid as $package) {
  21289. if ($package instanceof AliasPackage) {
  21290. $package->getAliasOf()->setId(-1);
  21291. }
  21292. $package->setId(-1);
  21293. }
  21294. }
  21295. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  21296. {
  21297. if (isset($this->providers[$name]) && !$bypassFilters) {
  21298. return $this->providers[$name];
  21299. }
  21300. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  21301. $this->initializePartialPackages();
  21302. }
  21303. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  21304. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  21305. return array();
  21306. }
  21307. if (null === $this->providerListing) {
  21308. $this->loadProviderListings($this->loadRootServerFile());
  21309. }
  21310. $useLastModifiedCheck = false;
  21311. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  21312. $hash = null;
  21313. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  21314. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21315. $useLastModifiedCheck = true;
  21316. } elseif ($this->providersUrl) {
  21317. if (!isset($this->providerListing[$name])) {
  21318. return array();
  21319. }
  21320. $hash = $this->providerListing[$name]['sha256'];
  21321. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  21322. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  21323. } else {
  21324. return array();
  21325. }
  21326. $packages = null;
  21327. if ($cacheKey) {
  21328. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  21329. $packages = json_decode($this->cache->read($cacheKey), true);
  21330. } elseif ($useLastModifiedCheck) {
  21331. if ($contents = $this->cache->read($cacheKey)) {
  21332. $contents = json_decode($contents, true);
  21333. if (isset($contents['last-modified'])) {
  21334. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  21335. if (true === $response) {
  21336. $packages = $contents;
  21337. } elseif ($response) {
  21338. $packages = $response;
  21339. }
  21340. }
  21341. }
  21342. }
  21343. }
  21344. if (!$packages) {
  21345. try {
  21346. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  21347. } catch (TransportException $e) {
  21348. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  21349. $packages = array('packages' => array());
  21350. } else {
  21351. throw $e;
  21352. }
  21353. }
  21354. }
  21355. $loadingPartialPackage = false;
  21356. } else {
  21357. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  21358. $loadingPartialPackage = true;
  21359. }
  21360. $this->providers[$name] = array();
  21361. foreach ($packages['packages'] as $versions) {
  21362. foreach ($versions as $version) {
  21363. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  21364. continue;
  21365. }
  21366. if (isset($this->providersByUid[$version['uid']])) {
  21367. if (!isset($this->providers[$name][$version['uid']])) {
  21368. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  21369. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  21370. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  21371. } else {
  21372. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  21373. }
  21374. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  21375. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  21376. }
  21377. }
  21378. } else {
  21379. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  21380. continue;
  21381. }
  21382. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  21383. $package->setRepository($this);
  21384. if ($package instanceof AliasPackage) {
  21385. $aliased = $package->getAliasOf();
  21386. $aliased->setRepository($this);
  21387. $this->providers[$name][$version['uid']] = $aliased;
  21388. $this->providers[$name][$version['uid'].'-alias'] = $package;
  21389. $this->providersByUid[$version['uid']] = $package;
  21390. } else {
  21391. $this->providers[$name][$version['uid']] = $package;
  21392. $this->providersByUid[$version['uid']] = $package;
  21393. }
  21394. unset($rootAliasData);
  21395. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  21396. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  21397. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  21398. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  21399. }
  21400. if (isset($rootAliasData)) {
  21401. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  21402. $alias->setRepository($this);
  21403. $this->providers[$name][$version['uid'].'-root'] = $alias;
  21404. $this->providersByUid[$version['uid'].'-root'] = $alias;
  21405. }
  21406. }
  21407. }
  21408. }
  21409. $result = $this->providers[$name];
  21410. if ($bypassFilters) {
  21411. foreach ($this->providers[$name] as $uid => $provider) {
  21412. unset($this->providersByUid[$uid]);
  21413. }
  21414. unset($this->providers[$name]);
  21415. }
  21416. return $result;
  21417. }
  21418. protected function initialize()
  21419. {
  21420. parent::initialize();
  21421. $repoData = $this->loadDataFromServer();
  21422. foreach ($repoData as $package) {
  21423. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  21424. }
  21425. }
  21426. public function addPackage(PackageInterface $package)
  21427. {
  21428. parent::addPackage($package);
  21429. $this->configurePackageTransportOptions($package);
  21430. }
  21431. protected function loadRootServerFile()
  21432. {
  21433. if (null !== $this->rootData) {
  21434. return $this->rootData;
  21435. }
  21436. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  21437. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  21438. }
  21439. $jsonUrlParts = parse_url($this->url);
  21440. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  21441. $jsonUrl = $this->url;
  21442. } else {
  21443. $jsonUrl = $this->url . '/packages.json';
  21444. }
  21445. $data = $this->fetchFile($jsonUrl, 'packages.json');
  21446. if (!empty($data['notify-batch'])) {
  21447. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  21448. } elseif (!empty($data['notify'])) {
  21449. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  21450. }
  21451. if (!empty($data['search'])) {
  21452. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  21453. }
  21454. if (!empty($data['mirrors'])) {
  21455. foreach ($data['mirrors'] as $mirror) {
  21456. if (!empty($mirror['git-url'])) {
  21457. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  21458. }
  21459. if (!empty($mirror['hg-url'])) {
  21460. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  21461. }
  21462. if (!empty($mirror['dist-url'])) {
  21463. $this->distMirrors[] = array(
  21464. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  21465. 'preferred' => !empty($mirror['preferred']),
  21466. );
  21467. }
  21468. }
  21469. }
  21470. if (!empty($data['providers-lazy-url'])) {
  21471. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  21472. $this->hasProviders = true;
  21473. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  21474. }
  21475. if ($this->allowSslDowngrade) {
  21476. $this->url = str_replace('https://', 'http://', $this->url);
  21477. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  21478. }
  21479. if (!empty($data['providers-url'])) {
  21480. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  21481. $this->hasProviders = true;
  21482. }
  21483. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  21484. $this->hasProviders = true;
  21485. }
  21486. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  21487. $this->url = 'https://repo.packagist.org';
  21488. $this->baseUrl = 'https://repo.packagist.org';
  21489. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  21490. $this->providersUrl = null;
  21491. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  21492. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  21493. $this->providersUrl = null;
  21494. }
  21495. return $this->rootData = $data;
  21496. }
  21497. protected function canonicalizeUrl($url)
  21498. {
  21499. if ('/' === $url[0]) {
  21500. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  21501. return $matches[0] . $url;
  21502. }
  21503. return $this->url;
  21504. }
  21505. return $url;
  21506. }
  21507. protected function loadDataFromServer()
  21508. {
  21509. $data = $this->loadRootServerFile();
  21510. return $this->loadIncludes($data);
  21511. }
  21512. protected function loadProviderListings($data)
  21513. {
  21514. if (isset($data['providers'])) {
  21515. if (!is_array($this->providerListing)) {
  21516. $this->providerListing = array();
  21517. }
  21518. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  21519. }
  21520. if ($this->providersUrl && isset($data['provider-includes'])) {
  21521. $includes = $data['provider-includes'];
  21522. foreach ($includes as $include => $metadata) {
  21523. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  21524. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  21525. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  21526. $includedData = json_decode($this->cache->read($cacheKey), true);
  21527. } else {
  21528. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  21529. }
  21530. $this->loadProviderListings($includedData);
  21531. }
  21532. }
  21533. }
  21534. protected function loadIncludes($data)
  21535. {
  21536. $packages = array();
  21537. if (!isset($data['packages']) && !isset($data['includes'])) {
  21538. foreach ($data as $pkg) {
  21539. foreach ($pkg['versions'] as $metadata) {
  21540. $packages[] = $metadata;
  21541. }
  21542. }
  21543. return $packages;
  21544. }
  21545. if (isset($data['packages'])) {
  21546. foreach ($data['packages'] as $package => $versions) {
  21547. foreach ($versions as $version => $metadata) {
  21548. $packages[] = $metadata;
  21549. }
  21550. }
  21551. }
  21552. if (isset($data['includes'])) {
  21553. foreach ($data['includes'] as $include => $metadata) {
  21554. if (isset($metadata['sha1']) && $this->cache->sha1($include) === $metadata['sha1']) {
  21555. $includedData = json_decode($this->cache->read($include), true);
  21556. } else {
  21557. $includedData = $this->fetchFile($include);
  21558. }
  21559. $packages = array_merge($packages, $this->loadIncludes($includedData));
  21560. }
  21561. }
  21562. return $packages;
  21563. }
  21564. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  21565. {
  21566. try {
  21567. if (!isset($data['notification-url'])) {
  21568. $data['notification-url'] = $this->notifyUrl;
  21569. }
  21570. $package = $this->loader->load($data, $class);
  21571. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  21572. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  21573. }
  21574. $package->setDistMirrors($this->distMirrors);
  21575. $this->configurePackageTransportOptions($package);
  21576. return $package;
  21577. } catch (\Exception $e) {
  21578. throw new \RuntimeException('Could not load package '.(isset($data['name']) ? $data['name'] : json_encode($data)).' in '.$this->url.': ['.get_class($e).'] '.$e->getMessage(), 0, $e);
  21579. }
  21580. }
  21581. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  21582. {
  21583. if (null === $cacheKey) {
  21584. $cacheKey = $filename;
  21585. $filename = $this->baseUrl.'/'.$filename;
  21586. }
  21587. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  21588. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  21589. }
  21590. $retries = 3;
  21591. while ($retries--) {
  21592. try {
  21593. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21594. if ($this->eventDispatcher) {
  21595. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21596. }
  21597. $origin = RemoteFilesystem::getOrigin($filename);
  21598. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21599. $json = $rfs->getContents($origin, $filename, false);
  21600. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  21601. if ($this->allowSslDowngrade) {
  21602. $this->url = str_replace('http://', 'https://', $this->url);
  21603. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  21604. $filename = str_replace('http://', 'https://', $filename);
  21605. }
  21606. if ($retries) {
  21607. usleep(100000);
  21608. continue;
  21609. }
  21610. throw new RepositorySecurityException('The contents of '.$filename.' do not match its signature. This could indicate a man-in-the-middle attack or e.g. antivirus software corrupting files. Try running composer again and report this if you think it is a mistake.');
  21611. }
  21612. $data = JsonFile::parseJson($json, $filename);
  21613. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21614. if ($cacheKey) {
  21615. if ($storeLastModifiedTime) {
  21616. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21617. if ($lastModifiedDate) {
  21618. $data['last-modified'] = $lastModifiedDate;
  21619. $json = json_encode($data);
  21620. }
  21621. }
  21622. $this->cache->write($cacheKey, $json);
  21623. }
  21624. break;
  21625. } catch (\Exception $e) {
  21626. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21627. throw $e;
  21628. }
  21629. if ($retries) {
  21630. usleep(100000);
  21631. continue;
  21632. }
  21633. if ($e instanceof RepositorySecurityException) {
  21634. throw $e;
  21635. }
  21636. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  21637. if (!$this->degradedMode) {
  21638. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21639. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21640. }
  21641. $this->degradedMode = true;
  21642. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  21643. break;
  21644. }
  21645. throw $e;
  21646. }
  21647. }
  21648. return $data;
  21649. }
  21650. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  21651. {
  21652. $retries = 3;
  21653. while ($retries--) {
  21654. try {
  21655. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  21656. if ($this->eventDispatcher) {
  21657. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  21658. }
  21659. $origin = RemoteFilesystem::getOrigin($filename);
  21660. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  21661. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  21662. $json = $rfs->getContents($origin, $filename, false, $options);
  21663. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  21664. return true;
  21665. }
  21666. $data = JsonFile::parseJson($json, $filename);
  21667. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  21668. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  21669. if ($lastModifiedDate) {
  21670. $data['last-modified'] = $lastModifiedDate;
  21671. $json = json_encode($data);
  21672. }
  21673. $this->cache->write($cacheKey, $json);
  21674. return $data;
  21675. } catch (\Exception $e) {
  21676. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  21677. throw $e;
  21678. }
  21679. if ($retries) {
  21680. usleep(100000);
  21681. continue;
  21682. }
  21683. if (!$this->degradedMode) {
  21684. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  21685. $this->io->writeError('<warning>'.$this->url.' could not be fully loaded, package information was loaded from the local cache and may be out of date</warning>');
  21686. }
  21687. $this->degradedMode = true;
  21688. return true;
  21689. }
  21690. }
  21691. }
  21692. private function initializePartialPackages()
  21693. {
  21694. $rootData = $this->loadRootServerFile();
  21695. $this->partialPackagesByName = array();
  21696. foreach ($rootData['packages'] as $package => $versions) {
  21697. $package = strtolower($package);
  21698. foreach ($versions as $version) {
  21699. $this->partialPackagesByName[$package][] = $version;
  21700. if (!empty($version['provide']) && is_array($version['provide'])) {
  21701. foreach ($version['provide'] as $provided => $providedVersion) {
  21702. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21703. }
  21704. }
  21705. if (!empty($version['replace']) && is_array($version['replace'])) {
  21706. foreach ($version['replace'] as $provided => $providedVersion) {
  21707. $this->partialPackagesByName[strtolower($provided)][] = $version;
  21708. }
  21709. }
  21710. }
  21711. }
  21712. $this->rootData = true;
  21713. }
  21714. }
  21715. <?php
  21716. namespace Composer\Repository;
  21717. use Composer\Package\PackageInterface;
  21718. class CompositeRepository extends BaseRepository
  21719. {
  21720. private $repositories;
  21721. public function __construct(array $repositories)
  21722. {
  21723. $this->repositories = array();
  21724. foreach ($repositories as $repo) {
  21725. $this->addRepository($repo);
  21726. }
  21727. }
  21728. public function getRepositories()
  21729. {
  21730. return $this->repositories;
  21731. }
  21732. public function hasPackage(PackageInterface $package)
  21733. {
  21734. foreach ($this->repositories as $repository) {
  21735. if ($repository->hasPackage($package)) {
  21736. return true;
  21737. }
  21738. }
  21739. return false;
  21740. }
  21741. public function findPackage($name, $constraint)
  21742. {
  21743. foreach ($this->repositories as $repository) {
  21744. $package = $repository->findPackage($name, $constraint);
  21745. if (null !== $package) {
  21746. return $package;
  21747. }
  21748. }
  21749. return null;
  21750. }
  21751. public function findPackages($name, $constraint = null)
  21752. {
  21753. $packages = array();
  21754. foreach ($this->repositories as $repository) {
  21755. $packages[] = $repository->findPackages($name, $constraint);
  21756. }
  21757. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21758. }
  21759. public function search($query, $mode = 0, $type = null)
  21760. {
  21761. $matches = array();
  21762. foreach ($this->repositories as $repository) {
  21763. $matches[] = $repository->search($query, $mode, $type);
  21764. }
  21765. return $matches ? call_user_func_array('array_merge', $matches) : array();
  21766. }
  21767. public function getPackages()
  21768. {
  21769. $packages = array();
  21770. foreach ($this->repositories as $repository) {
  21771. $packages[] = $repository->getPackages();
  21772. }
  21773. return $packages ? call_user_func_array('array_merge', $packages) : array();
  21774. }
  21775. public function removePackage(PackageInterface $package)
  21776. {
  21777. foreach ($this->repositories as $repository) {
  21778. $repository->removePackage($package);
  21779. }
  21780. }
  21781. public function count()
  21782. {
  21783. $total = 0;
  21784. foreach ($this->repositories as $repository) {
  21785. $total += $repository->count();
  21786. }
  21787. return $total;
  21788. }
  21789. public function addRepository(RepositoryInterface $repository)
  21790. {
  21791. if ($repository instanceof self) {
  21792. foreach ($repository->getRepositories() as $repo) {
  21793. $this->addRepository($repo);
  21794. }
  21795. } else {
  21796. $this->repositories[] = $repository;
  21797. }
  21798. }
  21799. }
  21800. <?php
  21801. namespace Composer\Repository;
  21802. interface ConfigurableRepositoryInterface
  21803. {
  21804. public function getRepoConfig();
  21805. }
  21806. <?php
  21807. namespace Composer\Repository;
  21808. use Composer\Json\JsonFile;
  21809. use Composer\Package\Loader\ArrayLoader;
  21810. use Composer\Package\Dumper\ArrayDumper;
  21811. class FilesystemRepository extends WritableArrayRepository
  21812. {
  21813. private $file;
  21814. public function __construct(JsonFile $repositoryFile)
  21815. {
  21816. parent::__construct();
  21817. $this->file = $repositoryFile;
  21818. }
  21819. protected function initialize()
  21820. {
  21821. parent::initialize();
  21822. if (!$this->file->exists()) {
  21823. return;
  21824. }
  21825. try {
  21826. $packages = $this->file->read();
  21827. if (isset($packages['packages'])) {
  21828. $packages = $packages['packages'];
  21829. }
  21830. if (!is_array($packages)) {
  21831. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21832. }
  21833. } catch (\Exception $e) {
  21834. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21835. }
  21836. $loader = new ArrayLoader(null, true);
  21837. foreach ($packages as $packageData) {
  21838. $package = $loader->load($packageData);
  21839. $this->addPackage($package);
  21840. }
  21841. }
  21842. public function reload()
  21843. {
  21844. $this->packages = null;
  21845. $this->initialize();
  21846. }
  21847. public function write()
  21848. {
  21849. $data = array();
  21850. $dumper = new ArrayDumper();
  21851. foreach ($this->getCanonicalPackages() as $package) {
  21852. $data[] = $dumper->dump($package);
  21853. }
  21854. usort($data, function ($a, $b) {
  21855. return strcmp($a['name'], $b['name']);
  21856. });
  21857. $this->file->write($data);
  21858. }
  21859. }
  21860. <?php
  21861. namespace Composer\Repository;
  21862. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21863. {
  21864. }
  21865. <?php
  21866. namespace Composer\Repository;
  21867. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21868. {
  21869. }
  21870. <?php
  21871. namespace Composer\Repository;
  21872. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21873. {
  21874. }
  21875. <?php
  21876. namespace Composer\Repository;
  21877. class InvalidRepositoryException extends \Exception
  21878. {
  21879. }
  21880. <?php
  21881. namespace Composer\Repository;
  21882. use Composer\Package\Loader\ArrayLoader;
  21883. use Composer\Package\Loader\ValidatingArrayLoader;
  21884. class PackageRepository extends ArrayRepository
  21885. {
  21886. private $config;
  21887. public function __construct(array $config)
  21888. {
  21889. parent::__construct();
  21890. $this->config = $config['package'];
  21891. if (!is_numeric(key($this->config))) {
  21892. $this->config = array($this->config);
  21893. }
  21894. }
  21895. protected function initialize()
  21896. {
  21897. parent::initialize();
  21898. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21899. foreach ($this->config as $package) {
  21900. try {
  21901. $package = $loader->load($package);
  21902. } catch (\Exception $e) {
  21903. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21904. }
  21905. $this->addPackage($package);
  21906. }
  21907. }
  21908. }
  21909. <?php
  21910. namespace Composer\Repository;
  21911. use Composer\Config;
  21912. use Composer\IO\IOInterface;
  21913. use Composer\Json\JsonFile;
  21914. use Composer\Package\Loader\ArrayLoader;
  21915. use Composer\Package\Version\VersionGuesser;
  21916. use Composer\Package\Version\VersionParser;
  21917. use Composer\Util\Platform;
  21918. use Composer\Util\ProcessExecutor;
  21919. use Composer\Util\Filesystem;
  21920. use Composer\Util\Git as GitUtil;
  21921. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21922. {
  21923. private $loader;
  21924. private $versionGuesser;
  21925. private $url;
  21926. private $repoConfig;
  21927. private $process;
  21928. private $options;
  21929. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21930. {
  21931. if (!isset($repoConfig['url'])) {
  21932. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21933. }
  21934. $this->loader = new ArrayLoader(null, true);
  21935. $this->url = Platform::expandPath($repoConfig['url']);
  21936. $this->process = new ProcessExecutor($io);
  21937. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21938. $this->repoConfig = $repoConfig;
  21939. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21940. if (!isset($this->options['relative'])) {
  21941. $filesystem = new Filesystem();
  21942. $this->options['relative'] = !$filesystem->isAbsolutePath($this->url);
  21943. }
  21944. parent::__construct();
  21945. }
  21946. public function getRepoConfig()
  21947. {
  21948. return $this->repoConfig;
  21949. }
  21950. protected function initialize()
  21951. {
  21952. parent::initialize();
  21953. $urlMatches = $this->getUrlMatches();
  21954. if (empty($urlMatches)) {
  21955. if (preg_match('{[*{}]}', $this->url)) {
  21956. $url = $this->url;
  21957. while (preg_match('{[*{}]}', $url)) {
  21958. $url = dirname($url);
  21959. }
  21960. if (is_dir($url)) {
  21961. return;
  21962. }
  21963. }
  21964. throw new \RuntimeException('The `url` supplied for the path (' . $this->url . ') repository does not exist');
  21965. }
  21966. foreach ($urlMatches as $url) {
  21967. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21968. $composerFilePath = $path.'composer.json';
  21969. if (!file_exists($composerFilePath)) {
  21970. continue;
  21971. }
  21972. $json = file_get_contents($composerFilePath);
  21973. $package = JsonFile::parseJson($json, $composerFilePath);
  21974. $package['dist'] = array(
  21975. 'type' => 'path',
  21976. 'url' => $url,
  21977. 'reference' => sha1($json . serialize($this->options)),
  21978. );
  21979. $package['transport-options'] = $this->options;
  21980. if (!isset($package['version']) && isset($package['extra']['branch-version'])) {
  21981. $package['version'] = preg_replace('{(\.x)?(-dev)?$}', '', $package['extra']['branch-version']).'.x-dev';
  21982. }
  21983. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21984. if (
  21985. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21986. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21987. && $ref1 === $ref2
  21988. ) {
  21989. $package['version'] = $rootVersion;
  21990. }
  21991. }
  21992. $output = '';
  21993. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H'.GitUtil::getNoShowSignatureFlag($this->process), $output, $path)) {
  21994. $package['dist']['reference'] = trim($output);
  21995. }
  21996. if (!isset($package['version'])) {
  21997. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21998. if (is_array($versionData) && $versionData['pretty_version']) {
  21999. if (!empty($versionData['feature_pretty_version'])) {
  22000. $package['version'] = $versionData['feature_pretty_version'];
  22001. $this->addPackage($this->loader->load($package));
  22002. }
  22003. $package['version'] = $versionData['pretty_version'];
  22004. } else {
  22005. $package['version'] = 'dev-master';
  22006. }
  22007. }
  22008. $package = $this->loader->load($package);
  22009. $this->addPackage($package);
  22010. }
  22011. }
  22012. private function getUrlMatches()
  22013. {
  22014. $flags = GLOB_MARK | GLOB_ONLYDIR;
  22015. if (defined('GLOB_BRACE')) {
  22016. $flags |= GLOB_BRACE;
  22017. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  22018. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  22019. }
  22020. return array_map(function ($val) {
  22021. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  22022. }, glob($this->url, $flags));
  22023. }
  22024. }
  22025. <?php
  22026. namespace Composer\Repository\Pear;
  22027. use Composer\Util\RemoteFilesystem;
  22028. abstract class BaseChannelReader
  22029. {
  22030. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  22031. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  22032. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  22033. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  22034. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  22035. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  22036. private $rfs;
  22037. protected function __construct(RemoteFilesystem $rfs)
  22038. {
  22039. $this->rfs = $rfs;
  22040. }
  22041. protected function requestContent($origin, $path)
  22042. {
  22043. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  22044. $content = $this->rfs->getContents($origin, $url, false);
  22045. if (!$content) {
  22046. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  22047. }
  22048. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  22049. }
  22050. protected function requestXml($origin, $path)
  22051. {
  22052. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  22053. if (false === $xml) {
  22054. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  22055. }
  22056. return $xml;
  22057. }
  22058. }
  22059. <?php
  22060. namespace Composer\Repository\Pear;
  22061. class ChannelInfo
  22062. {
  22063. private $name;
  22064. private $alias;
  22065. private $packages;
  22066. public function __construct($name, $alias, array $packages)
  22067. {
  22068. $this->name = $name;
  22069. $this->alias = $alias;
  22070. $this->packages = $packages;
  22071. }
  22072. public function getName()
  22073. {
  22074. return $this->name;
  22075. }
  22076. public function getAlias()
  22077. {
  22078. return $this->alias;
  22079. }
  22080. public function getPackages()
  22081. {
  22082. return $this->packages;
  22083. }
  22084. }
  22085. <?php
  22086. namespace Composer\Repository\Pear;
  22087. use Composer\Util\RemoteFilesystem;
  22088. class ChannelReader extends BaseChannelReader
  22089. {
  22090. private $readerMap;
  22091. public function __construct(RemoteFilesystem $rfs)
  22092. {
  22093. parent::__construct($rfs);
  22094. $rest10reader = new ChannelRest10Reader($rfs);
  22095. $rest11reader = new ChannelRest11Reader($rfs);
  22096. $this->readerMap = array(
  22097. 'REST1.3' => $rest11reader,
  22098. 'REST1.2' => $rest11reader,
  22099. 'REST1.1' => $rest11reader,
  22100. 'REST1.0' => $rest10reader,
  22101. );
  22102. }
  22103. public function read($url)
  22104. {
  22105. $xml = $this->requestXml($url, "/channel.xml");
  22106. $channelName = (string) $xml->name;
  22107. $channelAlias = (string) $xml->suggestedalias;
  22108. $supportedVersions = array_keys($this->readerMap);
  22109. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  22110. if (!$selectedRestVersion) {
  22111. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  22112. }
  22113. $reader = $this->readerMap[$selectedRestVersion['version']];
  22114. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  22115. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  22116. }
  22117. private function selectRestVersion($channelXml, $supportedVersions)
  22118. {
  22119. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  22120. foreach ($supportedVersions as $version) {
  22121. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  22122. $testResult = $channelXml->xpath($xpathTest);
  22123. foreach ($testResult as $result) {
  22124. $result = (string) $result;
  22125. if (preg_match('{^https://}i', $result)) {
  22126. return array('version' => $version, 'baseUrl' => $result);
  22127. }
  22128. }
  22129. if (count($testResult) > 0) {
  22130. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  22131. }
  22132. }
  22133. return null;
  22134. }
  22135. }
  22136. <?php
  22137. namespace Composer\Repository\Pear;
  22138. use Composer\Downloader\TransportException;
  22139. class ChannelRest10Reader extends BaseChannelReader
  22140. {
  22141. private $dependencyReader;
  22142. public function __construct($rfs)
  22143. {
  22144. parent::__construct($rfs);
  22145. $this->dependencyReader = new PackageDependencyParser();
  22146. }
  22147. public function read($baseUrl)
  22148. {
  22149. return $this->readPackages($baseUrl);
  22150. }
  22151. private function readPackages($baseUrl)
  22152. {
  22153. $result = array();
  22154. $xmlPath = '/p/packages.xml';
  22155. $xml = $this->requestXml($baseUrl, $xmlPath);
  22156. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  22157. foreach ($xml->xpath('ns:p') as $node) {
  22158. $packageName = (string) $node;
  22159. $packageInfo = $this->readPackage($baseUrl, $packageName);
  22160. $result[] = $packageInfo;
  22161. }
  22162. return $result;
  22163. }
  22164. private function readPackage($baseUrl, $packageName)
  22165. {
  22166. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  22167. $xml = $this->requestXml($baseUrl, $xmlPath);
  22168. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  22169. $channelName = (string) $xml->c;
  22170. $packageName = (string) $xml->n;
  22171. $license = (string) $xml->l;
  22172. $shortDescription = (string) $xml->s;
  22173. $description = (string) $xml->d;
  22174. return new PackageInfo(
  22175. $channelName,
  22176. $packageName,
  22177. $license,
  22178. $shortDescription,
  22179. $description,
  22180. $this->readPackageReleases($baseUrl, $packageName)
  22181. );
  22182. }
  22183. private function readPackageReleases($baseUrl, $packageName)
  22184. {
  22185. $result = array();
  22186. try {
  22187. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  22188. $xml = $this->requestXml($baseUrl, $xmlPath);
  22189. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  22190. foreach ($xml->xpath('ns:r') as $node) {
  22191. $releaseVersion = (string) $node->v;
  22192. $releaseStability = (string) $node->s;
  22193. try {
  22194. $result[$releaseVersion] = new ReleaseInfo(
  22195. $releaseStability,
  22196. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  22197. );
  22198. } catch (TransportException $exception) {
  22199. if ($exception->getCode() != 404) {
  22200. throw $exception;
  22201. }
  22202. }
  22203. }
  22204. } catch (TransportException $exception) {
  22205. if ($exception->getCode() != 404) {
  22206. throw $exception;
  22207. }
  22208. }
  22209. return $result;
  22210. }
  22211. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  22212. {
  22213. $dependencyReader = new PackageDependencyParser();
  22214. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  22215. $content = $this->requestContent($baseUrl, $depthPath);
  22216. $dependencyArray = unserialize($content);
  22217. return $dependencyReader->buildDependencyInfo($dependencyArray);
  22218. }
  22219. }
  22220. <?php
  22221. namespace Composer\Repository\Pear;
  22222. class ChannelRest11Reader extends BaseChannelReader
  22223. {
  22224. private $dependencyReader;
  22225. public function __construct($rfs)
  22226. {
  22227. parent::__construct($rfs);
  22228. $this->dependencyReader = new PackageDependencyParser();
  22229. }
  22230. public function read($baseUrl)
  22231. {
  22232. return $this->readChannelPackages($baseUrl);
  22233. }
  22234. private function readChannelPackages($baseUrl)
  22235. {
  22236. $result = array();
  22237. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  22238. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  22239. foreach ($xml->xpath('ns:c') as $node) {
  22240. $categoryName = (string) $node;
  22241. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  22242. $result = array_merge($result, $categoryPackages);
  22243. }
  22244. return $result;
  22245. }
  22246. private function readCategoryPackages($baseUrl, $categoryName)
  22247. {
  22248. $result = array();
  22249. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  22250. $xml = $this->requestXml($baseUrl, $categoryPath);
  22251. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22252. foreach ($xml->xpath('ns:pi') as $node) {
  22253. $packageInfo = $this->parsePackage($node);
  22254. $result[] = $packageInfo;
  22255. }
  22256. return $result;
  22257. }
  22258. private function parsePackage($packageInfo)
  22259. {
  22260. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  22261. $channelName = (string) $packageInfo->p->c;
  22262. $packageName = (string) $packageInfo->p->n;
  22263. $license = (string) $packageInfo->p->l;
  22264. $shortDescription = (string) $packageInfo->p->s;
  22265. $description = (string) $packageInfo->p->d;
  22266. $dependencies = array();
  22267. foreach ($packageInfo->xpath('ns:deps') as $node) {
  22268. $dependencyVersion = (string) $node->v;
  22269. $dependencyArray = unserialize((string) $node->d);
  22270. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  22271. $dependencies[$dependencyVersion] = $dependencyInfo;
  22272. }
  22273. $releases = array();
  22274. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  22275. if ($releasesInfo) {
  22276. foreach ($releasesInfo as $node) {
  22277. $releaseVersion = (string) $node->v;
  22278. $releaseStability = (string) $node->s;
  22279. $releases[$releaseVersion] = new ReleaseInfo(
  22280. $releaseStability,
  22281. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  22282. );
  22283. }
  22284. }
  22285. return new PackageInfo(
  22286. $channelName,
  22287. $packageName,
  22288. $license,
  22289. $shortDescription,
  22290. $description,
  22291. $releases
  22292. );
  22293. }
  22294. }
  22295. <?php
  22296. namespace Composer\Repository\Pear;
  22297. class DependencyConstraint
  22298. {
  22299. private $type;
  22300. private $constraint;
  22301. private $channelName;
  22302. private $packageName;
  22303. public function __construct($type, $constraint, $channelName, $packageName)
  22304. {
  22305. $this->type = $type;
  22306. $this->constraint = $constraint;
  22307. $this->channelName = $channelName;
  22308. $this->packageName = $packageName;
  22309. }
  22310. public function getChannelName()
  22311. {
  22312. return $this->channelName;
  22313. }
  22314. public function getConstraint()
  22315. {
  22316. return $this->constraint;
  22317. }
  22318. public function getPackageName()
  22319. {
  22320. return $this->packageName;
  22321. }
  22322. public function getType()
  22323. {
  22324. return $this->type;
  22325. }
  22326. }
  22327. <?php
  22328. namespace Composer\Repository\Pear;
  22329. class DependencyInfo
  22330. {
  22331. private $requires;
  22332. private $optionals;
  22333. public function __construct($requires, $optionals)
  22334. {
  22335. $this->requires = $requires;
  22336. $this->optionals = $optionals;
  22337. }
  22338. public function getRequires()
  22339. {
  22340. return $this->requires;
  22341. }
  22342. public function getOptionals()
  22343. {
  22344. return $this->optionals;
  22345. }
  22346. }
  22347. <?php
  22348. namespace Composer\Repository\Pear;
  22349. class PackageDependencyParser
  22350. {
  22351. public function buildDependencyInfo($depArray)
  22352. {
  22353. if (!is_array($depArray)) {
  22354. return new DependencyInfo(array(), array());
  22355. }
  22356. if (!$this->isHash($depArray)) {
  22357. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  22358. }
  22359. return $this->buildDependency20Info($depArray);
  22360. }
  22361. private function buildDependency10Info($depArray)
  22362. {
  22363. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  22364. $result = array();
  22365. foreach ($depArray as $depItem) {
  22366. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  22367. continue;
  22368. }
  22369. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  22370. ? 'optional'
  22371. : 'required';
  22372. $depType = 'not' == $depItem['rel']
  22373. ? 'conflicts'
  22374. : $depType;
  22375. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  22376. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  22377. ? '*'
  22378. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  22379. switch ($depItem['type']) {
  22380. case 'php':
  22381. $depChannelName = 'php';
  22382. $depPackageName = '';
  22383. break;
  22384. case 'pkg':
  22385. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  22386. $depPackageName = $depItem['name'];
  22387. break;
  22388. case 'ext':
  22389. $depChannelName = 'ext';
  22390. $depPackageName = $depItem['name'];
  22391. break;
  22392. case 'os':
  22393. case 'sapi':
  22394. $depChannelName = '';
  22395. $depPackageName = '';
  22396. break;
  22397. default:
  22398. $depChannelName = '';
  22399. $depPackageName = '';
  22400. break;
  22401. }
  22402. if ('' != $depChannelName) {
  22403. $result[] = new DependencyConstraint(
  22404. $depType,
  22405. $depVersionConstraint,
  22406. $depChannelName,
  22407. $depPackageName
  22408. );
  22409. }
  22410. }
  22411. return $result;
  22412. }
  22413. private function buildDependency20Info($depArray)
  22414. {
  22415. $result = array();
  22416. $optionals = array();
  22417. $defaultOptionals = array();
  22418. foreach ($depArray as $depType => $depTypeGroup) {
  22419. if (!is_array($depTypeGroup)) {
  22420. continue;
  22421. }
  22422. if ('required' == $depType || 'optional' == $depType) {
  22423. foreach ($depTypeGroup as $depItemType => $depItem) {
  22424. switch ($depItemType) {
  22425. case 'php':
  22426. $result[] = new DependencyConstraint(
  22427. $depType,
  22428. $this->parse20VersionConstraint($depItem),
  22429. 'php',
  22430. ''
  22431. );
  22432. break;
  22433. case 'package':
  22434. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  22435. $result = array_merge($result, $deps);
  22436. break;
  22437. case 'extension':
  22438. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  22439. $result = array_merge($result, $deps);
  22440. break;
  22441. case 'subpackage':
  22442. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  22443. $defaultOptionals += $deps;
  22444. break;
  22445. case 'os':
  22446. case 'pearinstaller':
  22447. break;
  22448. default:
  22449. break;
  22450. }
  22451. }
  22452. } elseif ('group' == $depType) {
  22453. if ($this->isHash($depTypeGroup)) {
  22454. $depTypeGroup = array($depTypeGroup);
  22455. }
  22456. foreach ($depTypeGroup as $depItem) {
  22457. $groupName = $depItem['attribs']['name'];
  22458. if (!isset($optionals[$groupName])) {
  22459. $optionals[$groupName] = array();
  22460. }
  22461. if (isset($depItem['subpackage'])) {
  22462. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  22463. } else {
  22464. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  22465. }
  22466. }
  22467. }
  22468. }
  22469. if (count($defaultOptionals) > 0) {
  22470. $optionals['*'] = $defaultOptionals;
  22471. }
  22472. return new DependencyInfo($result, $optionals);
  22473. }
  22474. private function buildDepExtensionConstraints($depItem, $depType)
  22475. {
  22476. if ($this->isHash($depItem)) {
  22477. $depItem = array($depItem);
  22478. }
  22479. $result = array();
  22480. foreach ($depItem as $subDepItem) {
  22481. $depChannelName = 'ext';
  22482. $depPackageName = $subDepItem['name'];
  22483. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22484. $result[] = new DependencyConstraint(
  22485. $depType,
  22486. $depVersionConstraint,
  22487. $depChannelName,
  22488. $depPackageName
  22489. );
  22490. }
  22491. return $result;
  22492. }
  22493. private function buildDepPackageConstraints($depItem, $depType)
  22494. {
  22495. if ($this->isHash($depItem)) {
  22496. $depItem = array($depItem);
  22497. }
  22498. $result = array();
  22499. foreach ($depItem as $subDepItem) {
  22500. if (!array_key_exists('channel', $subDepItem)) {
  22501. $subDepItem['channel'] = $subDepItem['uri'];
  22502. }
  22503. $depChannelName = $subDepItem['channel'];
  22504. $depPackageName = $subDepItem['name'];
  22505. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  22506. if (isset($subDepItem['conflicts'])) {
  22507. $depType = 'conflicts';
  22508. }
  22509. $result[] = new DependencyConstraint(
  22510. $depType,
  22511. $depVersionConstraint,
  22512. $depChannelName,
  22513. $depPackageName
  22514. );
  22515. }
  22516. return $result;
  22517. }
  22518. private function parse20VersionConstraint(array $data)
  22519. {
  22520. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  22521. $versions = array();
  22522. $values = array_intersect_key($data, $dep20toOperatorMap);
  22523. if (0 == count($values)) {
  22524. return '*';
  22525. }
  22526. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  22527. $versions[] = '>' . $this->parseVersion($values['min']);
  22528. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  22529. $versions[] = '<' . $this->parseVersion($values['max']);
  22530. } else {
  22531. foreach ($values as $op => $version) {
  22532. if ('exclude' == $op && is_array($version)) {
  22533. foreach ($version as $versionPart) {
  22534. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  22535. }
  22536. } else {
  22537. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  22538. }
  22539. }
  22540. }
  22541. return implode(',', $versions);
  22542. }
  22543. private function parseVersion($version)
  22544. {
  22545. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  22546. $version = $matches[1]
  22547. .(!empty($matches[2]) ? $matches[2] : '.0')
  22548. .(!empty($matches[3]) ? $matches[3] : '.0')
  22549. .(!empty($matches[4]) ? $matches[4] : '.0');
  22550. return $version;
  22551. }
  22552. return null;
  22553. }
  22554. private function isHash(array $array)
  22555. {
  22556. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  22557. }
  22558. }
  22559. <?php
  22560. namespace Composer\Repository\Pear;
  22561. class PackageInfo
  22562. {
  22563. private $channelName;
  22564. private $packageName;
  22565. private $license;
  22566. private $shortDescription;
  22567. private $description;
  22568. private $releases;
  22569. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  22570. {
  22571. $this->channelName = $channelName;
  22572. $this->packageName = $packageName;
  22573. $this->license = $license;
  22574. $this->shortDescription = $shortDescription;
  22575. $this->description = $description;
  22576. $this->releases = $releases;
  22577. }
  22578. public function getChannelName()
  22579. {
  22580. return $this->channelName;
  22581. }
  22582. public function getPackageName()
  22583. {
  22584. return $this->packageName;
  22585. }
  22586. public function getDescription()
  22587. {
  22588. return $this->description;
  22589. }
  22590. public function getShortDescription()
  22591. {
  22592. return $this->shortDescription;
  22593. }
  22594. public function getLicense()
  22595. {
  22596. return $this->license;
  22597. }
  22598. public function getReleases()
  22599. {
  22600. return $this->releases;
  22601. }
  22602. }
  22603. <?php
  22604. namespace Composer\Repository\Pear;
  22605. class ReleaseInfo
  22606. {
  22607. private $stability;
  22608. private $dependencyInfo;
  22609. public function __construct($stability, $dependencyInfo)
  22610. {
  22611. $this->stability = $stability;
  22612. $this->dependencyInfo = $dependencyInfo;
  22613. }
  22614. public function getDependencyInfo()
  22615. {
  22616. return $this->dependencyInfo;
  22617. }
  22618. public function getStability()
  22619. {
  22620. return $this->stability;
  22621. }
  22622. }
  22623. <?php
  22624. namespace Composer\Repository;
  22625. use Composer\IO\IOInterface;
  22626. use Composer\Semver\VersionParser as SemverVersionParser;
  22627. use Composer\Package\Version\VersionParser;
  22628. use Composer\Repository\Pear\ChannelReader;
  22629. use Composer\Package\CompletePackage;
  22630. use Composer\Repository\Pear\ChannelInfo;
  22631. use Composer\EventDispatcher\EventDispatcher;
  22632. use Composer\Package\Link;
  22633. use Composer\Semver\Constraint\Constraint;
  22634. use Composer\Util\RemoteFilesystem;
  22635. use Composer\Config;
  22636. use Composer\Factory;
  22637. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  22638. {
  22639. private $url;
  22640. private $io;
  22641. private $rfs;
  22642. private $versionParser;
  22643. private $repoConfig;
  22644. private $vendorAlias;
  22645. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  22646. {
  22647. parent::__construct();
  22648. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  22649. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  22650. }
  22651. $urlBits = parse_url($repoConfig['url']);
  22652. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  22653. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  22654. }
  22655. $this->url = rtrim($repoConfig['url'], '/');
  22656. $this->io = $io;
  22657. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  22658. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  22659. $this->versionParser = new VersionParser();
  22660. $this->repoConfig = $repoConfig;
  22661. }
  22662. public function getRepoConfig()
  22663. {
  22664. return $this->repoConfig;
  22665. }
  22666. protected function initialize()
  22667. {
  22668. parent::initialize();
  22669. $this->io->writeError('Initializing PEAR repository '.$this->url);
  22670. $reader = new ChannelReader($this->rfs);
  22671. try {
  22672. $channelInfo = $reader->read($this->url);
  22673. } catch (\Exception $e) {
  22674. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  22675. return;
  22676. }
  22677. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  22678. foreach ($packages as $package) {
  22679. $this->addPackage($package);
  22680. }
  22681. }
  22682. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  22683. {
  22684. $result = array();
  22685. foreach ($channelInfo->getPackages() as $packageDefinition) {
  22686. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  22687. try {
  22688. $normalizedVersion = $versionParser->normalize($version);
  22689. } catch (\UnexpectedValueException $e) {
  22690. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  22691. continue;
  22692. }
  22693. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  22694. $urlBits = parse_url($this->url);
  22695. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  22696. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  22697. $requires = array();
  22698. $suggests = array();
  22699. $conflicts = array();
  22700. $replaces = array();
  22701. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  22702. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  22703. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22704. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22705. }
  22706. if (!empty($this->vendorAlias)
  22707. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  22708. ) {
  22709. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  22710. $aliasConstraint = new Constraint('==', $normalizedVersion);
  22711. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  22712. }
  22713. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  22714. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22715. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  22716. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  22717. switch ($dependencyConstraint->getType()) {
  22718. case 'required':
  22719. $requires[] = $link;
  22720. break;
  22721. case 'conflicts':
  22722. $conflicts[] = $link;
  22723. break;
  22724. case 'replaces':
  22725. $replaces[] = $link;
  22726. break;
  22727. }
  22728. }
  22729. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  22730. foreach ($dependencyConstraints as $dependencyConstraint) {
  22731. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  22732. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  22733. }
  22734. }
  22735. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  22736. $package->setType('pear-library');
  22737. $package->setDescription($packageDefinition->getDescription());
  22738. $package->setLicense(array($packageDefinition->getLicense()));
  22739. $package->setDistType('file');
  22740. $package->setDistUrl($distUrl);
  22741. $package->setAutoload(array('classmap' => array('')));
  22742. $package->setIncludePaths(array('/'));
  22743. $package->setRequires($requires);
  22744. $package->setConflicts($conflicts);
  22745. $package->setSuggests($suggests);
  22746. $package->setReplaces($replaces);
  22747. $result[] = $package;
  22748. }
  22749. }
  22750. return $result;
  22751. }
  22752. private function buildComposerPackageName($channelName, $packageName)
  22753. {
  22754. if ('php' === $channelName) {
  22755. return "php";
  22756. }
  22757. if ('ext' === $channelName) {
  22758. return "ext-{$packageName}";
  22759. }
  22760. return "pear-{$channelName}/{$packageName}";
  22761. }
  22762. }
  22763. <?php
  22764. namespace Composer\Repository;
  22765. use Composer\Composer;
  22766. use Composer\Package\CompletePackage;
  22767. use Composer\Package\PackageInterface;
  22768. use Composer\Package\Version\VersionParser;
  22769. use Composer\Plugin\PluginInterface;
  22770. use Composer\Util\ProcessExecutor;
  22771. use Composer\Util\Silencer;
  22772. use Composer\Util\Platform;
  22773. use Composer\XdebugHandler\XdebugHandler;
  22774. use Symfony\Component\Process\ExecutableFinder;
  22775. class PlatformRepository extends ArrayRepository
  22776. {
  22777. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-(?:plugin|runtime)-api)$}iD';
  22778. private $versionParser;
  22779. private $overrides = array();
  22780. private $process;
  22781. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  22782. {
  22783. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  22784. foreach ($overrides as $name => $version) {
  22785. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  22786. }
  22787. parent::__construct($packages);
  22788. }
  22789. protected function initialize()
  22790. {
  22791. parent::initialize();
  22792. $this->versionParser = new VersionParser();
  22793. foreach ($this->overrides as $override) {
  22794. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  22795. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  22796. }
  22797. $this->addOverriddenPackage($override);
  22798. }
  22799. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  22800. $version = $this->versionParser->normalize($prettyVersion);
  22801. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  22802. $composerPluginApi->setDescription('The Composer Plugin API');
  22803. $this->addPackage($composerPluginApi);
  22804. $prettyVersion = Composer::RUNTIME_API_VERSION;
  22805. $version = $this->versionParser->normalize($prettyVersion);
  22806. $composerRuntimeApi = new CompletePackage('composer-runtime-api', $version, $prettyVersion);
  22807. $composerRuntimeApi->setDescription('The Composer Runtime API');
  22808. $this->addPackage($composerRuntimeApi);
  22809. try {
  22810. $prettyVersion = PHP_VERSION;
  22811. $version = $this->versionParser->normalize($prettyVersion);
  22812. } catch (\UnexpectedValueException $e) {
  22813. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  22814. $version = $this->versionParser->normalize($prettyVersion);
  22815. }
  22816. $php = new CompletePackage('php', $version, $prettyVersion);
  22817. $php->setDescription('The PHP interpreter');
  22818. $this->addPackage($php);
  22819. if (PHP_DEBUG) {
  22820. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  22821. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  22822. $this->addPackage($phpdebug);
  22823. }
  22824. if (defined('PHP_ZTS') && PHP_ZTS) {
  22825. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22826. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22827. $this->addPackage($phpzts);
  22828. }
  22829. if (PHP_INT_SIZE === 8) {
  22830. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22831. $php64->setDescription('The PHP interpreter, 64bit');
  22832. $this->addPackage($php64);
  22833. }
  22834. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22835. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22836. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22837. $this->addPackage($phpIpv6);
  22838. }
  22839. $loadedExtensions = get_loaded_extensions();
  22840. foreach ($loadedExtensions as $name) {
  22841. if (in_array($name, array('standard', 'Core'))) {
  22842. continue;
  22843. }
  22844. $reflExt = new \ReflectionExtension($name);
  22845. $prettyVersion = $reflExt->getVersion();
  22846. $this->addExtension($name, $prettyVersion);
  22847. }
  22848. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22849. $this->addExtension('xdebug', $prettyVersion);
  22850. }
  22851. foreach ($loadedExtensions as $name) {
  22852. $prettyVersion = null;
  22853. $description = 'The '.$name.' PHP library';
  22854. switch ($name) {
  22855. case 'curl':
  22856. $curlVersion = curl_version();
  22857. $prettyVersion = $curlVersion['version'];
  22858. break;
  22859. case 'iconv':
  22860. $prettyVersion = ICONV_VERSION;
  22861. break;
  22862. case 'intl':
  22863. $name = 'ICU';
  22864. if (defined('INTL_ICU_VERSION')) {
  22865. $prettyVersion = INTL_ICU_VERSION;
  22866. } else {
  22867. $reflector = new \ReflectionExtension('intl');
  22868. ob_start();
  22869. $reflector->info();
  22870. $output = ob_get_clean();
  22871. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22872. $prettyVersion = $matches[1];
  22873. }
  22874. break;
  22875. case 'imagick':
  22876. $imagick = new \Imagick();
  22877. $imageMagickVersion = $imagick->getVersion();
  22878. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22879. if (isset($matches[2])) {
  22880. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22881. } else {
  22882. $prettyVersion = $matches[1];
  22883. }
  22884. break;
  22885. case 'libxml':
  22886. $prettyVersion = LIBXML_DOTTED_VERSION;
  22887. break;
  22888. case 'openssl':
  22889. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22890. if (empty($match[2])) {
  22891. return $match[1];
  22892. }
  22893. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22894. return 0;
  22895. }
  22896. $len = strlen($match[2]);
  22897. $patchVersion = ($len - 1) * 26;
  22898. $patchVersion += ord($match[2][$len - 1]) - 96;
  22899. return $match[1].'.'.$patchVersion;
  22900. }, OPENSSL_VERSION_TEXT);
  22901. $description = OPENSSL_VERSION_TEXT;
  22902. break;
  22903. case 'pcre':
  22904. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22905. break;
  22906. case 'uuid':
  22907. $prettyVersion = phpversion('uuid');
  22908. break;
  22909. case 'xsl':
  22910. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22911. break;
  22912. default:
  22913. continue 2;
  22914. }
  22915. try {
  22916. $version = $this->versionParser->normalize($prettyVersion);
  22917. } catch (\UnexpectedValueException $e) {
  22918. continue;
  22919. }
  22920. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22921. $lib->setDescription($description);
  22922. $this->addPackage($lib);
  22923. }
  22924. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22925. if ($hhvmVersion === null && !Platform::isWindows()) {
  22926. $finder = new ExecutableFinder();
  22927. $hhvm = $finder->find('hhvm');
  22928. if ($hhvm !== null) {
  22929. $exitCode = $this->process->execute(
  22930. ProcessExecutor::escape($hhvm).
  22931. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22932. $hhvmVersion
  22933. );
  22934. if ($exitCode !== 0) {
  22935. $hhvmVersion = null;
  22936. }
  22937. }
  22938. }
  22939. if ($hhvmVersion) {
  22940. try {
  22941. $prettyVersion = $hhvmVersion;
  22942. $version = $this->versionParser->normalize($prettyVersion);
  22943. } catch (\UnexpectedValueException $e) {
  22944. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22945. $version = $this->versionParser->normalize($prettyVersion);
  22946. }
  22947. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22948. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22949. $this->addPackage($hhvm);
  22950. }
  22951. }
  22952. public function addPackage(PackageInterface $package)
  22953. {
  22954. if (isset($this->overrides[$package->getName()])) {
  22955. $overrider = $this->findPackage($package->getName(), '*');
  22956. if ($package->getVersion() === $overrider->getVersion()) {
  22957. $actualText = 'same as actual';
  22958. } else {
  22959. $actualText = 'actual: '.$package->getPrettyVersion();
  22960. }
  22961. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22962. return;
  22963. }
  22964. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22965. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22966. if ($package->getVersion() === $overrider->getVersion()) {
  22967. $actualText = 'same as actual';
  22968. } else {
  22969. $actualText = 'actual: '.$package->getPrettyVersion();
  22970. }
  22971. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22972. return;
  22973. }
  22974. parent::addPackage($package);
  22975. }
  22976. private function addOverriddenPackage(array $override, $name = null)
  22977. {
  22978. $version = $this->versionParser->normalize($override['version']);
  22979. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22980. $package->setDescription('Package overridden via config.platform');
  22981. $package->setExtra(array('config.platform' => true));
  22982. parent::addPackage($package);
  22983. return $package;
  22984. }
  22985. private function addExtension($name, $prettyVersion)
  22986. {
  22987. $extraDescription = null;
  22988. try {
  22989. $version = $this->versionParser->normalize($prettyVersion);
  22990. } catch (\UnexpectedValueException $e) {
  22991. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22992. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22993. $prettyVersion = $match[1];
  22994. } else {
  22995. $prettyVersion = '0';
  22996. }
  22997. $version = $this->versionParser->normalize($prettyVersion);
  22998. }
  22999. $packageName = $this->buildPackageName($name);
  23000. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  23001. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  23002. $this->addPackage($ext);
  23003. }
  23004. private function buildPackageName($name)
  23005. {
  23006. return 'ext-' . str_replace(' ', '-', $name);
  23007. }
  23008. }
  23009. <?php
  23010. namespace Composer\Repository;
  23011. use Composer\Factory;
  23012. use Composer\IO\IOInterface;
  23013. use Composer\Config;
  23014. use Composer\EventDispatcher\EventDispatcher;
  23015. use Composer\Util\RemoteFilesystem;
  23016. use Composer\Json\JsonFile;
  23017. class RepositoryFactory
  23018. {
  23019. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  23020. {
  23021. if (0 === strpos($repository, 'http')) {
  23022. $repoConfig = array('type' => 'composer', 'url' => $repository);
  23023. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  23024. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  23025. $data = $json->read();
  23026. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  23027. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  23028. } elseif ($allowFilesystem) {
  23029. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  23030. } else {
  23031. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  23032. }
  23033. } elseif ('{' === substr($repository, 0, 1)) {
  23034. $repoConfig = JsonFile::parseJson($repository);
  23035. } else {
  23036. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  23037. }
  23038. return $repoConfig;
  23039. }
  23040. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false, RepositoryManager $rm = null)
  23041. {
  23042. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  23043. return static::createRepo($io, $config, $repoConfig, $rm);
  23044. }
  23045. public static function createRepo(IOInterface $io, Config $config, array $repoConfig, RepositoryManager $rm = null)
  23046. {
  23047. if (!$rm) {
  23048. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23049. }
  23050. $repos = static::createRepos($rm, array($repoConfig));
  23051. return reset($repos);
  23052. }
  23053. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  23054. {
  23055. if (!$config) {
  23056. $config = Factory::createConfig($io);
  23057. }
  23058. if ($io) {
  23059. $io->loadConfiguration($config);
  23060. }
  23061. if (!$rm) {
  23062. if (!$io) {
  23063. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  23064. }
  23065. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  23066. }
  23067. return static::createRepos($rm, $config->getRepositories());
  23068. }
  23069. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23070. {
  23071. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  23072. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  23073. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  23074. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  23075. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  23076. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  23077. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  23078. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  23079. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  23080. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  23081. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  23082. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  23083. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  23084. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  23085. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  23086. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  23087. return $rm;
  23088. }
  23089. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  23090. {
  23091. $repos = array();
  23092. foreach ($repoConfigs as $index => $repo) {
  23093. if (is_string($repo)) {
  23094. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  23095. }
  23096. if (!is_array($repo)) {
  23097. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  23098. }
  23099. if (!isset($repo['type'])) {
  23100. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  23101. }
  23102. $name = self::generateRepositoryName($index, $repo, $repos);
  23103. if ($repo['type'] === 'filesystem') {
  23104. $repos[$name] = new FilesystemRepository($repo['json']);
  23105. } else {
  23106. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  23107. }
  23108. }
  23109. return $repos;
  23110. }
  23111. public static function generateRepositoryName($index, array $repo, array $existingRepos)
  23112. {
  23113. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  23114. while (isset($existingRepos[$name])) {
  23115. $name .= '2';
  23116. }
  23117. return $name;
  23118. }
  23119. }
  23120. <?php
  23121. namespace Composer\Repository;
  23122. use Composer\Package\PackageInterface;
  23123. interface RepositoryInterface extends \Countable
  23124. {
  23125. const SEARCH_FULLTEXT = 0;
  23126. const SEARCH_NAME = 1;
  23127. public function hasPackage(PackageInterface $package);
  23128. public function findPackage($name, $constraint);
  23129. public function findPackages($name, $constraint = null);
  23130. public function getPackages();
  23131. public function search($query, $mode = 0);
  23132. }
  23133. <?php
  23134. namespace Composer\Repository;
  23135. use Composer\IO\IOInterface;
  23136. use Composer\Config;
  23137. use Composer\EventDispatcher\EventDispatcher;
  23138. use Composer\Package\PackageInterface;
  23139. use Composer\Util\RemoteFilesystem;
  23140. class RepositoryManager
  23141. {
  23142. private $localRepository;
  23143. private $repositories = array();
  23144. private $repositoryClasses = array();
  23145. private $io;
  23146. private $config;
  23147. private $eventDispatcher;
  23148. private $rfs;
  23149. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  23150. {
  23151. $this->io = $io;
  23152. $this->config = $config;
  23153. $this->eventDispatcher = $eventDispatcher;
  23154. $this->rfs = $rfs;
  23155. }
  23156. public function findPackage($name, $constraint)
  23157. {
  23158. foreach ($this->repositories as $repository) {
  23159. if ($package = $repository->findPackage($name, $constraint)) {
  23160. return $package;
  23161. }
  23162. }
  23163. return null;
  23164. }
  23165. public function findPackages($name, $constraint)
  23166. {
  23167. $packages = array();
  23168. foreach ($this->getRepositories() as $repository) {
  23169. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  23170. }
  23171. return $packages;
  23172. }
  23173. public function addRepository(RepositoryInterface $repository)
  23174. {
  23175. $this->repositories[] = $repository;
  23176. }
  23177. public function prependRepository(RepositoryInterface $repository)
  23178. {
  23179. array_unshift($this->repositories, $repository);
  23180. }
  23181. public function createRepository($type, $config, $name = null)
  23182. {
  23183. if (!isset($this->repositoryClasses[$type])) {
  23184. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  23185. }
  23186. if (isset($config['packagist']) && false === $config['packagist']) {
  23187. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  23188. }
  23189. $class = $this->repositoryClasses[$type];
  23190. $reflMethod = new \ReflectionMethod($class, '__construct');
  23191. $params = $reflMethod->getParameters();
  23192. if (isset($params[4])) {
  23193. $paramType = null;
  23194. if (\PHP_VERSION_ID >= 70000) {
  23195. $reflectionType = $params[4]->getType();
  23196. if ($reflectionType) {
  23197. $paramType = $reflectionType instanceof \ReflectionNamedType ? $reflectionType->getName() : (string)$reflectionType;
  23198. }
  23199. } else {
  23200. $paramType = $params[4]->getClass() ? $params[4]->getClass()->getName() : null;
  23201. }
  23202. if ($paramType === 'Composer\Util\RemoteFilesystem') {
  23203. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  23204. }
  23205. }
  23206. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  23207. }
  23208. public function setRepositoryClass($type, $class)
  23209. {
  23210. $this->repositoryClasses[$type] = $class;
  23211. }
  23212. public function getRepositories()
  23213. {
  23214. return $this->repositories;
  23215. }
  23216. public function setLocalRepository(WritableRepositoryInterface $repository)
  23217. {
  23218. $this->localRepository = $repository;
  23219. }
  23220. public function getLocalRepository()
  23221. {
  23222. return $this->localRepository;
  23223. }
  23224. }
  23225. <?php
  23226. namespace Composer\Repository;
  23227. class RepositorySecurityException extends \Exception
  23228. {
  23229. }
  23230. <?php
  23231. namespace Composer\Repository\Vcs;
  23232. use Composer\Cache;
  23233. use Composer\Downloader\TransportException;
  23234. use Composer\Json\JsonFile;
  23235. use Composer\Util\Bitbucket;
  23236. abstract class BitbucketDriver extends VcsDriver
  23237. {
  23238. protected $cache;
  23239. protected $owner;
  23240. protected $repository;
  23241. protected $hasIssues;
  23242. protected $rootIdentifier;
  23243. protected $tags;
  23244. protected $branches;
  23245. protected $infoCache = array();
  23246. protected $branchesUrl = '';
  23247. protected $tagsUrl = '';
  23248. protected $homeUrl = '';
  23249. protected $website = '';
  23250. protected $cloneHttpsUrl = '';
  23251. protected $fallbackDriver;
  23252. protected $vcsType;
  23253. public function initialize()
  23254. {
  23255. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  23256. $this->owner = $match[1];
  23257. $this->repository = $match[2];
  23258. $this->originUrl = 'bitbucket.org';
  23259. $this->cache = new Cache(
  23260. $this->io,
  23261. implode('/', array(
  23262. $this->config->get('cache-repo-dir'),
  23263. $this->originUrl,
  23264. $this->owner,
  23265. $this->repository,
  23266. ))
  23267. );
  23268. }
  23269. public function getUrl()
  23270. {
  23271. if ($this->fallbackDriver) {
  23272. return $this->fallbackDriver->getUrl();
  23273. }
  23274. return $this->cloneHttpsUrl;
  23275. }
  23276. protected function getRepoData()
  23277. {
  23278. $resource = sprintf(
  23279. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  23280. $this->owner,
  23281. $this->repository,
  23282. http_build_query(
  23283. array('fields' => '-project,-owner'),
  23284. null,
  23285. '&'
  23286. )
  23287. );
  23288. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  23289. if ($this->fallbackDriver) {
  23290. return false;
  23291. }
  23292. $this->parseCloneUrls($repoData['links']['clone']);
  23293. $this->hasIssues = !empty($repoData['has_issues']);
  23294. $this->branchesUrl = $repoData['links']['branches']['href'];
  23295. $this->tagsUrl = $repoData['links']['tags']['href'];
  23296. $this->homeUrl = $repoData['links']['html']['href'];
  23297. $this->website = $repoData['website'];
  23298. $this->vcsType = $repoData['scm'];
  23299. return true;
  23300. }
  23301. public function getComposerInformation($identifier)
  23302. {
  23303. if ($this->fallbackDriver) {
  23304. return $this->fallbackDriver->getComposerInformation($identifier);
  23305. }
  23306. if (!isset($this->infoCache[$identifier])) {
  23307. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23308. $composer = JsonFile::parseJson($res);
  23309. } else {
  23310. $composer = $this->getBaseComposerInformation($identifier);
  23311. if ($this->shouldCache($identifier)) {
  23312. $this->cache->write($identifier, json_encode($composer));
  23313. }
  23314. }
  23315. if ($composer) {
  23316. if (!isset($composer['support']['source'])) {
  23317. $label = array_search(
  23318. $identifier,
  23319. $this->getTags()
  23320. ) ?: array_search(
  23321. $identifier,
  23322. $this->getBranches()
  23323. ) ?: $identifier;
  23324. if (array_key_exists($label, $tags = $this->getTags())) {
  23325. $hash = $tags[$label];
  23326. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  23327. $hash = $branches[$label];
  23328. }
  23329. if (! isset($hash)) {
  23330. $composer['support']['source'] = sprintf(
  23331. 'https://%s/%s/%s/src',
  23332. $this->originUrl,
  23333. $this->owner,
  23334. $this->repository
  23335. );
  23336. } else {
  23337. $composer['support']['source'] = sprintf(
  23338. 'https://%s/%s/%s/src/%s/?at=%s',
  23339. $this->originUrl,
  23340. $this->owner,
  23341. $this->repository,
  23342. $hash,
  23343. $label
  23344. );
  23345. }
  23346. }
  23347. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23348. $composer['support']['issues'] = sprintf(
  23349. 'https://%s/%s/%s/issues',
  23350. $this->originUrl,
  23351. $this->owner,
  23352. $this->repository
  23353. );
  23354. }
  23355. if (!isset($composer['homepage'])) {
  23356. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  23357. }
  23358. }
  23359. $this->infoCache[$identifier] = $composer;
  23360. }
  23361. return $this->infoCache[$identifier];
  23362. }
  23363. public function getFileContent($file, $identifier)
  23364. {
  23365. if ($this->fallbackDriver) {
  23366. return $this->fallbackDriver->getFileContent($file, $identifier);
  23367. }
  23368. if (strpos($identifier, '/') !== false) {
  23369. $branches = $this->getBranches();
  23370. if (isset($branches[$identifier])) {
  23371. $identifier = $branches[$identifier];
  23372. }
  23373. }
  23374. $resource = sprintf(
  23375. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  23376. $this->owner,
  23377. $this->repository,
  23378. $identifier,
  23379. $file
  23380. );
  23381. return $this->getContentsWithOAuthCredentials($resource);
  23382. }
  23383. public function getChangeDate($identifier)
  23384. {
  23385. if ($this->fallbackDriver) {
  23386. return $this->fallbackDriver->getChangeDate($identifier);
  23387. }
  23388. if (strpos($identifier, '/') !== false) {
  23389. $branches = $this->getBranches();
  23390. if (isset($branches[$identifier])) {
  23391. $identifier = $branches[$identifier];
  23392. }
  23393. }
  23394. $resource = sprintf(
  23395. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  23396. $this->owner,
  23397. $this->repository,
  23398. $identifier
  23399. );
  23400. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23401. return new \DateTime($commit['date']);
  23402. }
  23403. public function getSource($identifier)
  23404. {
  23405. if ($this->fallbackDriver) {
  23406. return $this->fallbackDriver->getSource($identifier);
  23407. }
  23408. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  23409. }
  23410. public function getDist($identifier)
  23411. {
  23412. if ($this->fallbackDriver) {
  23413. return $this->fallbackDriver->getDist($identifier);
  23414. }
  23415. $url = sprintf(
  23416. 'https://bitbucket.org/%s/%s/get/%s.zip',
  23417. $this->owner,
  23418. $this->repository,
  23419. $identifier
  23420. );
  23421. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23422. }
  23423. public function getTags()
  23424. {
  23425. if ($this->fallbackDriver) {
  23426. return $this->fallbackDriver->getTags();
  23427. }
  23428. if (null === $this->tags) {
  23429. $this->tags = array();
  23430. $resource = sprintf(
  23431. '%s?%s',
  23432. $this->tagsUrl,
  23433. http_build_query(
  23434. array(
  23435. 'pagelen' => 100,
  23436. 'fields' => 'values.name,values.target.hash,next',
  23437. 'sort' => '-target.date',
  23438. ),
  23439. null,
  23440. '&'
  23441. )
  23442. );
  23443. $hasNext = true;
  23444. while ($hasNext) {
  23445. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23446. foreach ($tagsData['values'] as $data) {
  23447. $this->tags[$data['name']] = $data['target']['hash'];
  23448. }
  23449. if (empty($tagsData['next'])) {
  23450. $hasNext = false;
  23451. } else {
  23452. $resource = $tagsData['next'];
  23453. }
  23454. }
  23455. if ($this->vcsType === 'hg') {
  23456. unset($this->tags['tip']);
  23457. }
  23458. }
  23459. return $this->tags;
  23460. }
  23461. public function getBranches()
  23462. {
  23463. if ($this->fallbackDriver) {
  23464. return $this->fallbackDriver->getBranches();
  23465. }
  23466. if (null === $this->branches) {
  23467. $this->branches = array();
  23468. $resource = sprintf(
  23469. '%s?%s',
  23470. $this->branchesUrl,
  23471. http_build_query(
  23472. array(
  23473. 'pagelen' => 100,
  23474. 'fields' => 'values.name,values.target.hash,values.heads,next',
  23475. 'sort' => '-target.date',
  23476. ),
  23477. null,
  23478. '&'
  23479. )
  23480. );
  23481. $hasNext = true;
  23482. while ($hasNext) {
  23483. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23484. foreach ($branchData['values'] as $data) {
  23485. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  23486. continue;
  23487. }
  23488. $this->branches[$data['name']] = $data['target']['hash'];
  23489. }
  23490. if (empty($branchData['next'])) {
  23491. $hasNext = false;
  23492. } else {
  23493. $resource = $branchData['next'];
  23494. }
  23495. }
  23496. }
  23497. return $this->branches;
  23498. }
  23499. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  23500. {
  23501. try {
  23502. return parent::getContents($url);
  23503. } catch (TransportException $e) {
  23504. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23505. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  23506. if (!$this->io->hasAuthentication($this->originUrl)
  23507. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  23508. ) {
  23509. return parent::getContents($url);
  23510. }
  23511. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23512. return $this->attemptCloneFallback();
  23513. }
  23514. }
  23515. throw $e;
  23516. }
  23517. }
  23518. abstract protected function generateSshUrl();
  23519. protected function attemptCloneFallback()
  23520. {
  23521. try {
  23522. $this->setupFallbackDriver($this->generateSshUrl());
  23523. } catch (\RuntimeException $e) {
  23524. $this->fallbackDriver = null;
  23525. $this->io->writeError(
  23526. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  23527. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  23528. );
  23529. throw $e;
  23530. }
  23531. }
  23532. abstract protected function setupFallbackDriver($url);
  23533. protected function parseCloneUrls(array $cloneLinks)
  23534. {
  23535. foreach ($cloneLinks as $cloneLink) {
  23536. if ($cloneLink['name'] === 'https') {
  23537. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  23538. }
  23539. }
  23540. }
  23541. protected function getMainBranchData()
  23542. {
  23543. $resource = sprintf(
  23544. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  23545. $this->owner,
  23546. $this->repository
  23547. );
  23548. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  23549. if (isset($data['mainbranch'])) {
  23550. return $data['mainbranch'];
  23551. }
  23552. return null;
  23553. }
  23554. }
  23555. <?php
  23556. namespace Composer\Repository\Vcs;
  23557. use Composer\Cache;
  23558. use Composer\Config;
  23559. use Composer\Util\ProcessExecutor;
  23560. use Composer\Util\Filesystem;
  23561. use Composer\IO\IOInterface;
  23562. class FossilDriver extends VcsDriver
  23563. {
  23564. protected $tags;
  23565. protected $branches;
  23566. protected $rootIdentifier;
  23567. protected $repoFile;
  23568. protected $checkoutDir;
  23569. protected $infoCache = array();
  23570. public function initialize()
  23571. {
  23572. $this->checkFossil();
  23573. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23574. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  23575. $this->checkoutDir = $this->url;
  23576. } else {
  23577. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23578. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23579. }
  23580. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  23581. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  23582. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  23583. $this->updateLocalRepo();
  23584. }
  23585. $this->getTags();
  23586. $this->getBranches();
  23587. }
  23588. protected function checkFossil()
  23589. {
  23590. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  23591. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  23592. }
  23593. }
  23594. protected function updateLocalRepo()
  23595. {
  23596. $fs = new Filesystem();
  23597. $fs->ensureDirectoryExists($this->checkoutDir);
  23598. if (!is_writable(dirname($this->checkoutDir))) {
  23599. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  23600. }
  23601. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  23602. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  23603. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23604. }
  23605. } else {
  23606. $fs->removeDirectory($this->checkoutDir);
  23607. $fs->remove($this->repoFile);
  23608. $fs->ensureDirectoryExists($this->checkoutDir);
  23609. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  23610. $output = $this->process->getErrorOutput();
  23611. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  23612. }
  23613. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  23614. $output = $this->process->getErrorOutput();
  23615. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  23616. }
  23617. }
  23618. }
  23619. public function getRootIdentifier()
  23620. {
  23621. if (null === $this->rootIdentifier) {
  23622. $this->rootIdentifier = 'trunk';
  23623. }
  23624. return $this->rootIdentifier;
  23625. }
  23626. public function getUrl()
  23627. {
  23628. return $this->url;
  23629. }
  23630. public function getSource($identifier)
  23631. {
  23632. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  23633. }
  23634. public function getDist($identifier)
  23635. {
  23636. return null;
  23637. }
  23638. public function getFileContent($file, $identifier)
  23639. {
  23640. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23641. $this->process->execute($command, $content, $this->checkoutDir);
  23642. if (!trim($content)) {
  23643. return null;
  23644. }
  23645. return $content;
  23646. }
  23647. public function getChangeDate($identifier)
  23648. {
  23649. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  23650. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  23651. return new \DateTime($date, new \DateTimeZone('UTC'));
  23652. }
  23653. public function getTags()
  23654. {
  23655. if (null === $this->tags) {
  23656. $tags = array();
  23657. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  23658. foreach ($this->process->splitLines($output) as $tag) {
  23659. $tags[$tag] = $tag;
  23660. }
  23661. $this->tags = $tags;
  23662. }
  23663. return $this->tags;
  23664. }
  23665. public function getBranches()
  23666. {
  23667. if (null === $this->branches) {
  23668. $branches = array();
  23669. $bookmarks = array();
  23670. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  23671. foreach ($this->process->splitLines($output) as $branch) {
  23672. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  23673. $branches[$branch] = $branch;
  23674. }
  23675. $this->branches = $branches;
  23676. }
  23677. return $this->branches;
  23678. }
  23679. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23680. {
  23681. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  23682. return true;
  23683. }
  23684. if (preg_match('!/fossil/|\.fossil!', $url)) {
  23685. return true;
  23686. }
  23687. if (Filesystem::isLocalPath($url)) {
  23688. $url = Filesystem::getPlatformPath($url);
  23689. if (!is_dir($url)) {
  23690. return false;
  23691. }
  23692. $process = new ProcessExecutor($io);
  23693. if ($process->execute('fossil info', $output, $url) === 0) {
  23694. return true;
  23695. }
  23696. }
  23697. return false;
  23698. }
  23699. }
  23700. <?php
  23701. namespace Composer\Repository\Vcs;
  23702. use Composer\Config;
  23703. use Composer\IO\IOInterface;
  23704. class GitBitbucketDriver extends BitbucketDriver
  23705. {
  23706. public function getRootIdentifier()
  23707. {
  23708. if ($this->fallbackDriver) {
  23709. return $this->fallbackDriver->getRootIdentifier();
  23710. }
  23711. if (null === $this->rootIdentifier) {
  23712. if (! $this->getRepoData()) {
  23713. return $this->fallbackDriver->getRootIdentifier();
  23714. }
  23715. if ($this->vcsType !== 'git') {
  23716. throw new \RuntimeException(
  23717. $this->url.' does not appear to be a git repository, use '.
  23718. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  23719. );
  23720. }
  23721. $mainBranchData = $this->getMainBranchData();
  23722. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  23723. }
  23724. return $this->rootIdentifier;
  23725. }
  23726. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23727. {
  23728. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  23729. return false;
  23730. }
  23731. if (!extension_loaded('openssl')) {
  23732. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23733. return false;
  23734. }
  23735. return true;
  23736. }
  23737. protected function setupFallbackDriver($url)
  23738. {
  23739. $this->fallbackDriver = new GitDriver(
  23740. array('url' => $url),
  23741. $this->io,
  23742. $this->config,
  23743. $this->process,
  23744. $this->remoteFilesystem
  23745. );
  23746. $this->fallbackDriver->initialize();
  23747. }
  23748. protected function generateSshUrl()
  23749. {
  23750. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  23751. }
  23752. }
  23753. <?php
  23754. namespace Composer\Repository\Vcs;
  23755. use Composer\Util\ProcessExecutor;
  23756. use Composer\Util\Filesystem;
  23757. use Composer\Util\Git as GitUtil;
  23758. use Composer\IO\IOInterface;
  23759. use Composer\Cache;
  23760. use Composer\Config;
  23761. class GitDriver extends VcsDriver
  23762. {
  23763. protected $cache;
  23764. protected $tags;
  23765. protected $branches;
  23766. protected $rootIdentifier;
  23767. protected $repoDir;
  23768. protected $infoCache = array();
  23769. public function initialize()
  23770. {
  23771. if (Filesystem::isLocalPath($this->url)) {
  23772. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  23773. $this->repoDir = $this->url;
  23774. $cacheUrl = realpath($this->url);
  23775. } else {
  23776. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23777. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23778. }
  23779. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  23780. GitUtil::cleanEnv();
  23781. $fs = new Filesystem();
  23782. $fs->ensureDirectoryExists(dirname($this->repoDir));
  23783. if (!is_writable(dirname($this->repoDir))) {
  23784. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  23785. }
  23786. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  23787. throw new \InvalidArgumentException('The source URL '.$this->url.' is invalid, ssh URLs should have a port number after ":".'."\n".'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  23788. }
  23789. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  23790. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  23791. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  23792. }
  23793. $cacheUrl = $this->url;
  23794. }
  23795. $this->getTags();
  23796. $this->getBranches();
  23797. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  23798. }
  23799. public function getRootIdentifier()
  23800. {
  23801. if (null === $this->rootIdentifier) {
  23802. $this->rootIdentifier = 'master';
  23803. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  23804. $branches = $this->process->splitLines($output);
  23805. if (!in_array('* master', $branches)) {
  23806. foreach ($branches as $branch) {
  23807. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  23808. $this->rootIdentifier = $match[1];
  23809. break;
  23810. }
  23811. }
  23812. }
  23813. }
  23814. return $this->rootIdentifier;
  23815. }
  23816. public function getUrl()
  23817. {
  23818. return $this->url;
  23819. }
  23820. public function getSource($identifier)
  23821. {
  23822. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  23823. }
  23824. public function getDist($identifier)
  23825. {
  23826. return null;
  23827. }
  23828. public function getFileContent($file, $identifier)
  23829. {
  23830. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23831. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  23832. if (!trim($content)) {
  23833. return null;
  23834. }
  23835. return $content;
  23836. }
  23837. public function getChangeDate($identifier)
  23838. {
  23839. $this->process->execute(sprintf(
  23840. 'git -c log.showSignature=false log -1 --format=%%at %s',
  23841. ProcessExecutor::escape($identifier)
  23842. ), $output, $this->repoDir);
  23843. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23844. }
  23845. public function getTags()
  23846. {
  23847. if (null === $this->tags) {
  23848. $this->tags = array();
  23849. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23850. foreach ($output = $this->process->splitLines($output) as $tag) {
  23851. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23852. $this->tags[$match[2]] = $match[1];
  23853. }
  23854. }
  23855. }
  23856. return $this->tags;
  23857. }
  23858. public function getBranches()
  23859. {
  23860. if (null === $this->branches) {
  23861. $branches = array();
  23862. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23863. foreach ($this->process->splitLines($output) as $branch) {
  23864. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23865. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23866. $branches[$match[1]] = $match[2];
  23867. }
  23868. }
  23869. }
  23870. $this->branches = $branches;
  23871. }
  23872. return $this->branches;
  23873. }
  23874. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23875. {
  23876. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23877. return true;
  23878. }
  23879. if (Filesystem::isLocalPath($url)) {
  23880. $url = Filesystem::getPlatformPath($url);
  23881. if (!is_dir($url)) {
  23882. return false;
  23883. }
  23884. $process = new ProcessExecutor($io);
  23885. if ($process->execute('git tag', $output, $url) === 0) {
  23886. return true;
  23887. }
  23888. }
  23889. if (!$deep) {
  23890. return false;
  23891. }
  23892. $gitUtil = new GitUtil($io, $config, new ProcessExecutor($io), new Filesystem());
  23893. GitUtil::cleanEnv();
  23894. try {
  23895. $gitUtil->runCommand(function ($url) {
  23896. return 'git ls-remote --heads ' . ProcessExecutor::escape($url);
  23897. }, $url, sys_get_temp_dir());
  23898. } catch (\RuntimeException $e) {
  23899. return false;
  23900. }
  23901. return true;
  23902. }
  23903. }
  23904. <?php
  23905. namespace Composer\Repository\Vcs;
  23906. use Composer\Config;
  23907. use Composer\Downloader\TransportException;
  23908. use Composer\Json\JsonFile;
  23909. use Composer\Cache;
  23910. use Composer\IO\IOInterface;
  23911. use Composer\Util\GitHub;
  23912. class GitHubDriver extends VcsDriver
  23913. {
  23914. protected $cache;
  23915. protected $owner;
  23916. protected $repository;
  23917. protected $tags;
  23918. protected $branches;
  23919. protected $rootIdentifier;
  23920. protected $repoData;
  23921. protected $hasIssues;
  23922. protected $infoCache = array();
  23923. protected $isPrivate = false;
  23924. private $isArchived = false;
  23925. private $fundingInfo;
  23926. protected $gitDriver;
  23927. public function initialize()
  23928. {
  23929. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23930. $this->owner = $match[3];
  23931. $this->repository = $match[4];
  23932. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23933. if ($this->originUrl === 'www.github.com') {
  23934. $this->originUrl = 'github.com';
  23935. }
  23936. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23937. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23938. $this->setupGitDriver($this->url);
  23939. return;
  23940. }
  23941. $this->fetchRootIdentifier();
  23942. }
  23943. public function getRepositoryUrl()
  23944. {
  23945. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23946. }
  23947. public function getRootIdentifier()
  23948. {
  23949. if ($this->gitDriver) {
  23950. return $this->gitDriver->getRootIdentifier();
  23951. }
  23952. return $this->rootIdentifier;
  23953. }
  23954. public function getUrl()
  23955. {
  23956. if ($this->gitDriver) {
  23957. return $this->gitDriver->getUrl();
  23958. }
  23959. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23960. }
  23961. protected function getApiUrl()
  23962. {
  23963. if ('github.com' === $this->originUrl) {
  23964. $apiUrl = 'api.github.com';
  23965. } else {
  23966. $apiUrl = $this->originUrl . '/api/v3';
  23967. }
  23968. return 'https://' . $apiUrl;
  23969. }
  23970. public function getSource($identifier)
  23971. {
  23972. if ($this->gitDriver) {
  23973. return $this->gitDriver->getSource($identifier);
  23974. }
  23975. if ($this->isPrivate) {
  23976. $url = $this->generateSshUrl();
  23977. } else {
  23978. $url = $this->getUrl();
  23979. }
  23980. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23981. }
  23982. public function getDist($identifier)
  23983. {
  23984. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23985. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23986. }
  23987. public function getComposerInformation($identifier)
  23988. {
  23989. if ($this->gitDriver) {
  23990. return $this->gitDriver->getComposerInformation($identifier);
  23991. }
  23992. if (!isset($this->infoCache[$identifier])) {
  23993. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23994. $composer = JsonFile::parseJson($res);
  23995. } else {
  23996. $composer = $this->getBaseComposerInformation($identifier);
  23997. if ($this->shouldCache($identifier)) {
  23998. $this->cache->write($identifier, json_encode($composer));
  23999. }
  24000. }
  24001. if ($composer) {
  24002. if (!isset($composer['support']['source'])) {
  24003. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  24004. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  24005. }
  24006. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  24007. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  24008. }
  24009. if (!isset($composer['abandoned']) && $this->isArchived) {
  24010. $composer['abandoned'] = true;
  24011. }
  24012. if (!isset($composer['funding']) && $funding = $this->getFundingInfo()) {
  24013. $composer['funding'] = $funding;
  24014. }
  24015. }
  24016. $this->infoCache[$identifier] = $composer;
  24017. }
  24018. return $this->infoCache[$identifier];
  24019. }
  24020. private function getFundingInfo()
  24021. {
  24022. if (null !== $this->fundingInfo) {
  24023. return $this->fundingInfo;
  24024. }
  24025. if ($this->originUrl !== 'github.com') {
  24026. return $this->fundingInfo = false;
  24027. }
  24028. foreach (array($this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/.github/FUNDING.yml', $this->getApiUrl() . '/repos/'.$this->owner.'/.github/contents/FUNDING.yml') as $file) {
  24029. try {
  24030. $result = $this->remoteFilesystem->getContents($this->originUrl, $file, false, array(
  24031. 'retry-auth-failure' => false,
  24032. ));
  24033. $response = json_decode($result, true);
  24034. } catch (TransportException $e) {
  24035. continue;
  24036. }
  24037. if (empty($response['content']) || $response['encoding'] !== 'base64' || !($funding = base64_decode($response['content']))) {
  24038. continue;
  24039. }
  24040. break;
  24041. }
  24042. if (empty($funding)) {
  24043. return $this->fundingInfo = false;
  24044. }
  24045. $result = array();
  24046. $key = null;
  24047. foreach (preg_split('{\r?\n}', $funding) as $line) {
  24048. $line = trim($line);
  24049. if (preg_match('{^(\w+)\s*:\s*(.+)$}', $line, $match)) {
  24050. if (preg_match('{^\[(.*)\](?:\s*#.*)?$}', $match[2], $match2)) {
  24051. foreach (array_map('trim', preg_split('{[\'"]?\s*,\s*[\'"]?}', $match2[1])) as $item) {
  24052. $result[] = array('type' => $match[1], 'url' => trim($item, '"\' '));
  24053. }
  24054. } elseif (preg_match('{^([^#].*?)(\s+#.*)?$}', $match[2], $match2)) {
  24055. $result[] = array('type' => $match[1], 'url' => trim($match2[1], '"\' '));
  24056. }
  24057. $key = null;
  24058. } elseif (preg_match('{^(\w+)\s*:\s*#\s*$}', $line, $match)) {
  24059. $key = $match[1];
  24060. } elseif ($key && preg_match('{^-\s*(.+)(\s+#.*)?$}', $line, $match)) {
  24061. $result[] = array('type' => $key, 'url' => trim($match[1], '"\' '));
  24062. }
  24063. }
  24064. foreach ($result as $key => $item) {
  24065. switch ($item['type']) {
  24066. case 'tidelift':
  24067. $result[$key]['url'] = 'https://tidelift.com/funding/github/' . $item['url'];
  24068. break;
  24069. case 'github':
  24070. $result[$key]['url'] = 'https://github.com/' . basename($item['url']);
  24071. break;
  24072. case 'patreon':
  24073. $result[$key]['url'] = 'https://www.patreon.com/' . basename($item['url']);
  24074. break;
  24075. case 'otechie':
  24076. $result[$key]['url'] = 'https://otechie.com/' . basename($item['url']);
  24077. break;
  24078. case 'open_collective':
  24079. $result[$key]['url'] = 'https://opencollective.com/' . basename($item['url']);
  24080. break;
  24081. case 'liberapay':
  24082. $result[$key]['url'] = 'https://liberapay.com/' . basename($item['url']);
  24083. break;
  24084. case 'ko_fi':
  24085. $result[$key]['url'] = 'https://ko-fi.com/' . basename($item['url']);
  24086. break;
  24087. case 'issuehunt':
  24088. $result[$key]['url'] = 'https://issuehunt.io/r/' . $item['url'];
  24089. break;
  24090. case 'community_bridge':
  24091. $result[$key]['url'] = 'https://funding.communitybridge.org/projects/' . basename($item['url']);
  24092. break;
  24093. }
  24094. }
  24095. return $this->fundingInfo = $result;
  24096. }
  24097. public function getFileContent($file, $identifier)
  24098. {
  24099. if ($this->gitDriver) {
  24100. return $this->gitDriver->getFileContent($file, $identifier);
  24101. }
  24102. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  24103. $resource = JsonFile::parseJson($this->getContents($resource));
  24104. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  24105. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  24106. }
  24107. return $content;
  24108. }
  24109. public function getChangeDate($identifier)
  24110. {
  24111. if ($this->gitDriver) {
  24112. return $this->gitDriver->getChangeDate($identifier);
  24113. }
  24114. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  24115. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  24116. return new \DateTime($commit['commit']['committer']['date']);
  24117. }
  24118. public function getTags()
  24119. {
  24120. if ($this->gitDriver) {
  24121. return $this->gitDriver->getTags();
  24122. }
  24123. if (null === $this->tags) {
  24124. $this->tags = array();
  24125. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  24126. do {
  24127. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  24128. foreach ($tagsData as $tag) {
  24129. $this->tags[$tag['name']] = $tag['commit']['sha'];
  24130. }
  24131. $resource = $this->getNextPage();
  24132. } while ($resource);
  24133. }
  24134. return $this->tags;
  24135. }
  24136. public function getBranches()
  24137. {
  24138. if ($this->gitDriver) {
  24139. return $this->gitDriver->getBranches();
  24140. }
  24141. if (null === $this->branches) {
  24142. $this->branches = array();
  24143. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  24144. do {
  24145. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  24146. foreach ($branchData as $branch) {
  24147. $name = substr($branch['ref'], 11);
  24148. if ($name !== 'gh-pages') {
  24149. $this->branches[$name] = $branch['object']['sha'];
  24150. }
  24151. }
  24152. $resource = $this->getNextPage();
  24153. } while ($resource);
  24154. }
  24155. return $this->branches;
  24156. }
  24157. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24158. {
  24159. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  24160. return false;
  24161. }
  24162. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  24163. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  24164. return false;
  24165. }
  24166. if (!extension_loaded('openssl')) {
  24167. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24168. return false;
  24169. }
  24170. return true;
  24171. }
  24172. public function getRepoData()
  24173. {
  24174. $this->fetchRootIdentifier();
  24175. return $this->repoData;
  24176. }
  24177. protected function generateSshUrl()
  24178. {
  24179. if (false !== strpos($this->originUrl, ':')) {
  24180. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  24181. }
  24182. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  24183. }
  24184. protected function getContents($url, $fetchingRepoData = false)
  24185. {
  24186. try {
  24187. return parent::getContents($url);
  24188. } catch (TransportException $e) {
  24189. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24190. switch ($e->getCode()) {
  24191. case 401:
  24192. case 404:
  24193. if (!$fetchingRepoData) {
  24194. throw $e;
  24195. }
  24196. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  24197. return parent::getContents($url);
  24198. }
  24199. if (!$this->io->isInteractive()) {
  24200. return $this->attemptCloneFallback();
  24201. }
  24202. $scopesIssued = array();
  24203. $scopesNeeded = array();
  24204. if ($headers = $e->getHeaders()) {
  24205. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  24206. $scopesIssued = explode(' ', $scopes);
  24207. }
  24208. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  24209. $scopesNeeded = explode(' ', $scopes);
  24210. }
  24211. }
  24212. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  24213. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  24214. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24215. }
  24216. return parent::getContents($url);
  24217. case 403:
  24218. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  24219. return parent::getContents($url);
  24220. }
  24221. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24222. return $this->attemptCloneFallback();
  24223. }
  24224. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  24225. if (!$this->io->hasAuthentication($this->originUrl)) {
  24226. if (!$this->io->isInteractive()) {
  24227. $this->io->writeError('<error>GitHub API limit exhausted. Failed to get metadata for the '.$this->url.' repository, try running in interactive mode so that you can enter your GitHub credentials to increase the API limit</error>');
  24228. throw $e;
  24229. }
  24230. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  24231. return parent::getContents($url);
  24232. }
  24233. if ($rateLimited) {
  24234. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  24235. $this->io->writeError(sprintf(
  24236. '<error>GitHub API limit (%d calls/hr) is exhausted. You are already authorized so you have to wait until %s before doing more requests</error>',
  24237. $rateLimit['limit'],
  24238. $rateLimit['reset']
  24239. ));
  24240. }
  24241. throw $e;
  24242. default:
  24243. throw $e;
  24244. }
  24245. }
  24246. }
  24247. protected function fetchRootIdentifier()
  24248. {
  24249. if ($this->repoData) {
  24250. return;
  24251. }
  24252. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  24253. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  24254. if (null === $this->repoData && null !== $this->gitDriver) {
  24255. return;
  24256. }
  24257. $this->owner = $this->repoData['owner']['login'];
  24258. $this->repository = $this->repoData['name'];
  24259. $this->isPrivate = !empty($this->repoData['private']);
  24260. if (isset($this->repoData['default_branch'])) {
  24261. $this->rootIdentifier = $this->repoData['default_branch'];
  24262. } elseif (isset($this->repoData['master_branch'])) {
  24263. $this->rootIdentifier = $this->repoData['master_branch'];
  24264. } else {
  24265. $this->rootIdentifier = 'master';
  24266. }
  24267. $this->hasIssues = !empty($this->repoData['has_issues']);
  24268. $this->isArchived = !empty($this->repoData['archived']);
  24269. }
  24270. protected function attemptCloneFallback()
  24271. {
  24272. $this->isPrivate = true;
  24273. try {
  24274. $this->setupGitDriver($this->generateSshUrl());
  24275. return;
  24276. } catch (\RuntimeException $e) {
  24277. $this->gitDriver = null;
  24278. $this->io->writeError('<error>Failed to clone the '.$this->generateSshUrl().' repository, try running in interactive mode so that you can enter your GitHub credentials</error>');
  24279. throw $e;
  24280. }
  24281. }
  24282. protected function setupGitDriver($url)
  24283. {
  24284. $this->gitDriver = new GitDriver(
  24285. array('url' => $url),
  24286. $this->io,
  24287. $this->config,
  24288. $this->process,
  24289. $this->remoteFilesystem
  24290. );
  24291. $this->gitDriver->initialize();
  24292. }
  24293. protected function getNextPage()
  24294. {
  24295. $headers = $this->remoteFilesystem->getLastHeaders();
  24296. foreach ($headers as $header) {
  24297. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24298. $links = explode(',', $match[1]);
  24299. foreach ($links as $link) {
  24300. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24301. return $match[1];
  24302. }
  24303. }
  24304. }
  24305. }
  24306. }
  24307. }
  24308. <?php
  24309. namespace Composer\Repository\Vcs;
  24310. use Composer\Config;
  24311. use Composer\Cache;
  24312. use Composer\IO\IOInterface;
  24313. use Composer\Json\JsonFile;
  24314. use Composer\Downloader\TransportException;
  24315. use Composer\Util\RemoteFilesystem;
  24316. use Composer\Util\GitLab;
  24317. class GitLabDriver extends VcsDriver
  24318. {
  24319. private $scheme;
  24320. private $namespace;
  24321. private $repository;
  24322. private $project;
  24323. private $commits = array();
  24324. private $tags;
  24325. private $branches;
  24326. protected $gitDriver;
  24327. private $isPrivate = true;
  24328. private $hasNonstandardOrigin = false;
  24329. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  24330. public function initialize()
  24331. {
  24332. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  24333. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  24334. }
  24335. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24336. $configuredDomains = $this->config->get('gitlab-domains');
  24337. $urlParts = explode('/', $match['parts']);
  24338. $this->scheme = !empty($match['scheme'])
  24339. ? $match['scheme']
  24340. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  24341. ;
  24342. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  24343. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  24344. $this->hasNonstandardOrigin = true;
  24345. }
  24346. $this->namespace = implode('/', $urlParts);
  24347. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  24348. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  24349. $this->fetchProject();
  24350. }
  24351. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  24352. {
  24353. $this->remoteFilesystem = $remoteFilesystem;
  24354. }
  24355. public function getComposerInformation($identifier)
  24356. {
  24357. if ($this->gitDriver) {
  24358. return $this->gitDriver->getComposerInformation($identifier);
  24359. }
  24360. if (!isset($this->infoCache[$identifier])) {
  24361. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24362. $composer = JsonFile::parseJson($res);
  24363. } else {
  24364. $composer = $this->getBaseComposerInformation($identifier);
  24365. if ($this->shouldCache($identifier)) {
  24366. $this->cache->write($identifier, json_encode($composer));
  24367. }
  24368. }
  24369. if ($composer) {
  24370. if (!isset($composer['support']['issues']) && isset($this->project['_links']['issues'])) {
  24371. $composer['support']['issues'] = $this->project['_links']['issues'];
  24372. }
  24373. if (!isset($composer['abandoned']) && !empty($this->project['archived'])) {
  24374. $composer['abandoned'] = true;
  24375. }
  24376. }
  24377. $this->infoCache[$identifier] = $composer;
  24378. }
  24379. return $this->infoCache[$identifier];
  24380. }
  24381. public function getFileContent($file, $identifier)
  24382. {
  24383. if ($this->gitDriver) {
  24384. return $this->gitDriver->getFileContent($file, $identifier);
  24385. }
  24386. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  24387. $branches = $this->getBranches();
  24388. if (isset($branches[$identifier])) {
  24389. $identifier = $branches[$identifier];
  24390. }
  24391. }
  24392. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  24393. try {
  24394. $content = $this->getContents($resource);
  24395. } catch (TransportException $e) {
  24396. if ($e->getCode() !== 404) {
  24397. throw $e;
  24398. }
  24399. return null;
  24400. }
  24401. return $content;
  24402. }
  24403. public function getChangeDate($identifier)
  24404. {
  24405. if ($this->gitDriver) {
  24406. return $this->gitDriver->getChangeDate($identifier);
  24407. }
  24408. if (isset($this->commits[$identifier])) {
  24409. return new \DateTime($this->commits[$identifier]['committed_date']);
  24410. }
  24411. return new \DateTime();
  24412. }
  24413. public function getRepositoryUrl()
  24414. {
  24415. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  24416. }
  24417. public function getUrl()
  24418. {
  24419. if ($this->gitDriver) {
  24420. return $this->gitDriver->getUrl();
  24421. }
  24422. return $this->project['web_url'];
  24423. }
  24424. public function getDist($identifier)
  24425. {
  24426. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  24427. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  24428. }
  24429. public function getSource($identifier)
  24430. {
  24431. if ($this->gitDriver) {
  24432. return $this->gitDriver->getSource($identifier);
  24433. }
  24434. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  24435. }
  24436. public function getRootIdentifier()
  24437. {
  24438. if ($this->gitDriver) {
  24439. return $this->gitDriver->getRootIdentifier();
  24440. }
  24441. return $this->project['default_branch'];
  24442. }
  24443. public function getBranches()
  24444. {
  24445. if ($this->gitDriver) {
  24446. return $this->gitDriver->getBranches();
  24447. }
  24448. if (!$this->branches) {
  24449. $this->branches = $this->getReferences('branches');
  24450. }
  24451. return $this->branches;
  24452. }
  24453. public function getTags()
  24454. {
  24455. if ($this->gitDriver) {
  24456. return $this->gitDriver->getTags();
  24457. }
  24458. if (!$this->tags) {
  24459. $this->tags = $this->getReferences('tags');
  24460. }
  24461. return $this->tags;
  24462. }
  24463. public function getApiUrl()
  24464. {
  24465. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  24466. }
  24467. private function urlEncodeAll($string)
  24468. {
  24469. $encoded = '';
  24470. for ($i = 0; isset($string[$i]); $i++) {
  24471. $character = $string[$i];
  24472. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  24473. $character = '%' . sprintf('%02X', ord($character));
  24474. }
  24475. $encoded .= $character;
  24476. }
  24477. return $encoded;
  24478. }
  24479. protected function getReferences($type)
  24480. {
  24481. $perPage = 100;
  24482. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  24483. $references = array();
  24484. do {
  24485. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  24486. foreach ($data as $datum) {
  24487. $references[$datum['name']] = $datum['commit']['id'];
  24488. $this->commits[$datum['commit']['id']] = $datum['commit'];
  24489. }
  24490. if (count($data) >= $perPage) {
  24491. $resource = $this->getNextPage();
  24492. } else {
  24493. $resource = false;
  24494. }
  24495. } while ($resource);
  24496. return $references;
  24497. }
  24498. protected function fetchProject()
  24499. {
  24500. $resource = $this->getApiUrl();
  24501. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  24502. if (isset($this->project['visibility'])) {
  24503. $this->isPrivate = $this->project['visibility'] !== 'public';
  24504. } else {
  24505. $this->isPrivate = false;
  24506. }
  24507. }
  24508. protected function attemptCloneFallback()
  24509. {
  24510. try {
  24511. if ($this->isPrivate === false) {
  24512. $url = $this->generatePublicUrl();
  24513. } else {
  24514. $url = $this->generateSshUrl();
  24515. }
  24516. $this->setupGitDriver($url);
  24517. return;
  24518. } catch (\RuntimeException $e) {
  24519. $this->gitDriver = null;
  24520. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  24521. throw $e;
  24522. }
  24523. }
  24524. protected function generateSshUrl()
  24525. {
  24526. if ($this->hasNonstandardOrigin) {
  24527. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  24528. }
  24529. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  24530. }
  24531. protected function generatePublicUrl()
  24532. {
  24533. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  24534. }
  24535. protected function setupGitDriver($url)
  24536. {
  24537. $this->gitDriver = new GitDriver(
  24538. array('url' => $url),
  24539. $this->io,
  24540. $this->config,
  24541. $this->process,
  24542. $this->remoteFilesystem
  24543. );
  24544. $this->gitDriver->initialize();
  24545. }
  24546. protected function getContents($url, $fetchingRepoData = false)
  24547. {
  24548. try {
  24549. $res = parent::getContents($url);
  24550. if ($fetchingRepoData) {
  24551. $json = JsonFile::parseJson($res, $url);
  24552. if (!isset($json['default_branch']) && isset($json['permissions'])) {
  24553. $this->isPrivate = $json['visibility'] !== 'public';
  24554. $moreThanGuestAccess = false;
  24555. foreach ($json['permissions'] as $permission) {
  24556. if ($permission && $permission['access_level'] > 10) {
  24557. $moreThanGuestAccess = true;
  24558. }
  24559. }
  24560. if (!$moreThanGuestAccess) {
  24561. $this->io->writeError('<warning>GitLab token with Guest only access detected</warning>');
  24562. return $this->attemptCloneFallback();
  24563. }
  24564. }
  24565. if (!isset($json['default_branch'])) {
  24566. if (!empty($json['id'])) {
  24567. $this->isPrivate = false;
  24568. }
  24569. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  24570. }
  24571. }
  24572. return $res;
  24573. } catch (TransportException $e) {
  24574. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  24575. switch ($e->getCode()) {
  24576. case 401:
  24577. case 404:
  24578. if (!$fetchingRepoData) {
  24579. throw $e;
  24580. }
  24581. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  24582. return parent::getContents($url);
  24583. }
  24584. if (!$this->io->isInteractive()) {
  24585. return $this->attemptCloneFallback();
  24586. }
  24587. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  24588. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  24589. return parent::getContents($url);
  24590. case 403:
  24591. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  24592. return parent::getContents($url);
  24593. }
  24594. if (!$this->io->isInteractive() && $fetchingRepoData) {
  24595. return $this->attemptCloneFallback();
  24596. }
  24597. throw $e;
  24598. default:
  24599. throw $e;
  24600. }
  24601. }
  24602. }
  24603. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24604. {
  24605. if (!preg_match(self::URL_REGEX, $url, $match)) {
  24606. return false;
  24607. }
  24608. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  24609. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  24610. $urlParts = explode('/', $match['parts']);
  24611. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  24612. return false;
  24613. }
  24614. if ('https' === $scheme && !extension_loaded('openssl')) {
  24615. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24616. return false;
  24617. }
  24618. return true;
  24619. }
  24620. private function getNextPage()
  24621. {
  24622. $headers = $this->remoteFilesystem->getLastHeaders();
  24623. foreach ($headers as $header) {
  24624. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  24625. $links = explode(',', $match[1]);
  24626. foreach ($links as $link) {
  24627. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  24628. return $match[1];
  24629. }
  24630. }
  24631. }
  24632. }
  24633. }
  24634. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  24635. {
  24636. $guessedDomain = strtolower($guessedDomain);
  24637. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  24638. if ($portNumber) {
  24639. return $guessedDomain.':'.$portNumber;
  24640. }
  24641. return $guessedDomain;
  24642. }
  24643. if ($portNumber) {
  24644. $guessedDomain .= ':'.$portNumber;
  24645. }
  24646. while (null !== ($part = array_shift($urlParts))) {
  24647. $guessedDomain .= '/' . $part;
  24648. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  24649. return $guessedDomain;
  24650. }
  24651. }
  24652. return false;
  24653. }
  24654. }
  24655. <?php
  24656. namespace Composer\Repository\Vcs;
  24657. use Composer\Config;
  24658. use Composer\IO\IOInterface;
  24659. class HgBitbucketDriver extends BitbucketDriver
  24660. {
  24661. public function getRootIdentifier()
  24662. {
  24663. if ($this->fallbackDriver) {
  24664. return $this->fallbackDriver->getRootIdentifier();
  24665. }
  24666. if (null === $this->rootIdentifier) {
  24667. if (! $this->getRepoData()) {
  24668. return $this->fallbackDriver->getRootIdentifier();
  24669. }
  24670. if ($this->vcsType !== 'hg') {
  24671. throw new \RuntimeException(
  24672. $this->url.' does not appear to be a mercurial repository, use '.
  24673. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  24674. );
  24675. }
  24676. $mainBranchData = $this->getMainBranchData();
  24677. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  24678. }
  24679. return $this->rootIdentifier;
  24680. }
  24681. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24682. {
  24683. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  24684. return false;
  24685. }
  24686. if (!extension_loaded('openssl')) {
  24687. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  24688. return false;
  24689. }
  24690. return true;
  24691. }
  24692. protected function setupFallbackDriver($url)
  24693. {
  24694. $this->fallbackDriver = new HgDriver(
  24695. array('url' => $url),
  24696. $this->io,
  24697. $this->config,
  24698. $this->process,
  24699. $this->remoteFilesystem
  24700. );
  24701. $this->fallbackDriver->initialize();
  24702. }
  24703. protected function generateSshUrl()
  24704. {
  24705. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  24706. }
  24707. }
  24708. <?php
  24709. namespace Composer\Repository\Vcs;
  24710. use Composer\Config;
  24711. use Composer\Cache;
  24712. use Composer\Util\Hg as HgUtils;
  24713. use Composer\Util\ProcessExecutor;
  24714. use Composer\Util\Filesystem;
  24715. use Composer\IO\IOInterface;
  24716. class HgDriver extends VcsDriver
  24717. {
  24718. protected $tags;
  24719. protected $branches;
  24720. protected $rootIdentifier;
  24721. protected $repoDir;
  24722. protected $infoCache = array();
  24723. public function initialize()
  24724. {
  24725. if (Filesystem::isLocalPath($this->url)) {
  24726. $this->repoDir = $this->url;
  24727. } else {
  24728. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24729. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24730. }
  24731. $cacheDir = $this->config->get('cache-vcs-dir');
  24732. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  24733. $fs = new Filesystem();
  24734. $fs->ensureDirectoryExists($cacheDir);
  24735. if (!is_writable(dirname($this->repoDir))) {
  24736. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  24737. }
  24738. $this->config->prohibitUrlByConfig($this->url, $this->io);
  24739. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  24740. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  24741. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  24742. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  24743. }
  24744. } else {
  24745. $fs->removeDirectory($this->repoDir);
  24746. $repoDir = $this->repoDir;
  24747. $command = function ($url) use ($repoDir) {
  24748. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  24749. };
  24750. $hgUtils->runCommand($command, $this->url, null);
  24751. }
  24752. }
  24753. $this->getTags();
  24754. $this->getBranches();
  24755. }
  24756. public function getRootIdentifier()
  24757. {
  24758. if (null === $this->rootIdentifier) {
  24759. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  24760. $output = $this->process->splitLines($output);
  24761. $this->rootIdentifier = $output[0];
  24762. }
  24763. return $this->rootIdentifier;
  24764. }
  24765. public function getUrl()
  24766. {
  24767. return $this->url;
  24768. }
  24769. public function getSource($identifier)
  24770. {
  24771. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  24772. }
  24773. public function getDist($identifier)
  24774. {
  24775. return null;
  24776. }
  24777. public function getFileContent($file, $identifier)
  24778. {
  24779. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  24780. $this->process->execute($resource, $content, $this->repoDir);
  24781. if (!trim($content)) {
  24782. return;
  24783. }
  24784. return $content;
  24785. }
  24786. public function getChangeDate($identifier)
  24787. {
  24788. $this->process->execute(
  24789. sprintf(
  24790. 'hg log --template "{date|rfc3339date}" -r %s',
  24791. ProcessExecutor::escape($identifier)
  24792. ),
  24793. $output,
  24794. $this->repoDir
  24795. );
  24796. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  24797. }
  24798. public function getTags()
  24799. {
  24800. if (null === $this->tags) {
  24801. $tags = array();
  24802. $this->process->execute('hg tags', $output, $this->repoDir);
  24803. foreach ($this->process->splitLines($output) as $tag) {
  24804. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  24805. $tags[$match[1]] = $match[2];
  24806. }
  24807. }
  24808. unset($tags['tip']);
  24809. $this->tags = $tags;
  24810. }
  24811. return $this->tags;
  24812. }
  24813. public function getBranches()
  24814. {
  24815. if (null === $this->branches) {
  24816. $branches = array();
  24817. $bookmarks = array();
  24818. $this->process->execute('hg branches', $output, $this->repoDir);
  24819. foreach ($this->process->splitLines($output) as $branch) {
  24820. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  24821. $branches[$match[1]] = $match[2];
  24822. }
  24823. }
  24824. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  24825. foreach ($this->process->splitLines($output) as $branch) {
  24826. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  24827. $bookmarks[$match[1]] = $match[2];
  24828. }
  24829. }
  24830. $this->branches = array_merge($bookmarks, $branches);
  24831. }
  24832. return $this->branches;
  24833. }
  24834. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24835. {
  24836. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  24837. return true;
  24838. }
  24839. if (Filesystem::isLocalPath($url)) {
  24840. $url = Filesystem::getPlatformPath($url);
  24841. if (!is_dir($url)) {
  24842. return false;
  24843. }
  24844. $process = new ProcessExecutor($io);
  24845. if ($process->execute('hg summary', $output, $url) === 0) {
  24846. return true;
  24847. }
  24848. }
  24849. if (!$deep) {
  24850. return false;
  24851. }
  24852. $processExecutor = new ProcessExecutor($io);
  24853. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  24854. return $exit === 0;
  24855. }
  24856. }
  24857. <?php
  24858. namespace Composer\Repository\Vcs;
  24859. use Composer\Config;
  24860. use Composer\Cache;
  24861. use Composer\IO\IOInterface;
  24862. use Composer\Util\ProcessExecutor;
  24863. use Composer\Util\Perforce;
  24864. class PerforceDriver extends VcsDriver
  24865. {
  24866. protected $depot;
  24867. protected $branch;
  24868. protected $perforce;
  24869. public function initialize()
  24870. {
  24871. $this->depot = $this->repoConfig['depot'];
  24872. $this->branch = '';
  24873. if (!empty($this->repoConfig['branch'])) {
  24874. $this->branch = $this->repoConfig['branch'];
  24875. }
  24876. $this->initPerforce($this->repoConfig);
  24877. $this->perforce->p4Login();
  24878. $this->perforce->checkStream();
  24879. $this->perforce->writeP4ClientSpec();
  24880. $this->perforce->connectClient();
  24881. return true;
  24882. }
  24883. private function initPerforce($repoConfig)
  24884. {
  24885. if (!empty($this->perforce)) {
  24886. return;
  24887. }
  24888. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  24889. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  24890. }
  24891. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  24892. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  24893. }
  24894. public function getFileContent($file, $identifier)
  24895. {
  24896. return $this->perforce->getFileContent($file, $identifier);
  24897. }
  24898. public function getChangeDate($identifier)
  24899. {
  24900. return null;
  24901. }
  24902. public function getRootIdentifier()
  24903. {
  24904. return $this->branch;
  24905. }
  24906. public function getBranches()
  24907. {
  24908. return $this->perforce->getBranches();
  24909. }
  24910. public function getTags()
  24911. {
  24912. return $this->perforce->getTags();
  24913. }
  24914. public function getDist($identifier)
  24915. {
  24916. return null;
  24917. }
  24918. public function getSource($identifier)
  24919. {
  24920. $source = array(
  24921. 'type' => 'perforce',
  24922. 'url' => $this->repoConfig['url'],
  24923. 'reference' => $identifier,
  24924. 'p4user' => $this->perforce->getUser(),
  24925. );
  24926. return $source;
  24927. }
  24928. public function getUrl()
  24929. {
  24930. return $this->url;
  24931. }
  24932. public function hasComposerFile($identifier)
  24933. {
  24934. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  24935. $composerInfoIdentifier = $identifier;
  24936. return !empty($composerInfo);
  24937. }
  24938. public function getContents($url)
  24939. {
  24940. return false;
  24941. }
  24942. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24943. {
  24944. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  24945. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  24946. }
  24947. return false;
  24948. }
  24949. public function cleanup()
  24950. {
  24951. $this->perforce->cleanupClientSpec();
  24952. $this->perforce = null;
  24953. }
  24954. public function getDepot()
  24955. {
  24956. return $this->depot;
  24957. }
  24958. public function getBranch()
  24959. {
  24960. return $this->branch;
  24961. }
  24962. }
  24963. <?php
  24964. namespace Composer\Repository\Vcs;
  24965. use Composer\Cache;
  24966. use Composer\Config;
  24967. use Composer\Json\JsonFile;
  24968. use Composer\Util\ProcessExecutor;
  24969. use Composer\Util\Filesystem;
  24970. use Composer\Util\Svn as SvnUtil;
  24971. use Composer\IO\IOInterface;
  24972. use Composer\Downloader\TransportException;
  24973. class SvnDriver extends VcsDriver
  24974. {
  24975. protected $cache;
  24976. protected $baseUrl;
  24977. protected $tags;
  24978. protected $branches;
  24979. protected $rootIdentifier;
  24980. protected $infoCache = array();
  24981. protected $trunkPath = 'trunk';
  24982. protected $branchesPath = 'branches';
  24983. protected $tagsPath = 'tags';
  24984. protected $packagePath = '';
  24985. protected $cacheCredentials = true;
  24986. private $util;
  24987. public function initialize()
  24988. {
  24989. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24990. SvnUtil::cleanEnv();
  24991. if (isset($this->repoConfig['trunk-path'])) {
  24992. $this->trunkPath = $this->repoConfig['trunk-path'];
  24993. }
  24994. if (isset($this->repoConfig['branches-path'])) {
  24995. $this->branchesPath = $this->repoConfig['branches-path'];
  24996. }
  24997. if (isset($this->repoConfig['tags-path'])) {
  24998. $this->tagsPath = $this->repoConfig['tags-path'];
  24999. }
  25000. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  25001. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  25002. }
  25003. if (isset($this->repoConfig['package-path'])) {
  25004. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  25005. }
  25006. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  25007. $this->baseUrl = substr($this->url, 0, $pos);
  25008. }
  25009. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  25010. $this->getBranches();
  25011. $this->getTags();
  25012. }
  25013. public function getRootIdentifier()
  25014. {
  25015. return $this->rootIdentifier ?: $this->trunkPath;
  25016. }
  25017. public function getUrl()
  25018. {
  25019. return $this->url;
  25020. }
  25021. public function getSource($identifier)
  25022. {
  25023. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  25024. }
  25025. public function getDist($identifier)
  25026. {
  25027. return null;
  25028. }
  25029. protected function shouldCache($identifier)
  25030. {
  25031. return $this->cache && preg_match('{@\d+$}', $identifier);
  25032. }
  25033. public function getComposerInformation($identifier)
  25034. {
  25035. if (!isset($this->infoCache[$identifier])) {
  25036. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  25037. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25038. }
  25039. try {
  25040. $composer = $this->getBaseComposerInformation($identifier);
  25041. } catch (TransportException $e) {
  25042. $message = $e->getMessage();
  25043. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  25044. throw $e;
  25045. }
  25046. $composer = '';
  25047. }
  25048. if ($this->shouldCache($identifier)) {
  25049. $this->cache->write($identifier.'.json', json_encode($composer));
  25050. }
  25051. $this->infoCache[$identifier] = $composer;
  25052. }
  25053. return $this->infoCache[$identifier];
  25054. }
  25055. public function getFileContent($file, $identifier)
  25056. {
  25057. $identifier = '/' . trim($identifier, '/') . '/';
  25058. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25059. if (!empty($match[2])) {
  25060. $path = $match[1];
  25061. $rev = $match[2];
  25062. } else {
  25063. $path = $identifier;
  25064. $rev = '';
  25065. }
  25066. try {
  25067. $resource = $path.$file;
  25068. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  25069. if (!trim($output)) {
  25070. return null;
  25071. }
  25072. } catch (\RuntimeException $e) {
  25073. throw new TransportException($e->getMessage());
  25074. }
  25075. return $output;
  25076. }
  25077. public function getChangeDate($identifier)
  25078. {
  25079. $identifier = '/' . trim($identifier, '/') . '/';
  25080. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  25081. if (!empty($match[2])) {
  25082. $path = $match[1];
  25083. $rev = $match[2];
  25084. } else {
  25085. $path = $identifier;
  25086. $rev = '';
  25087. }
  25088. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  25089. foreach ($this->process->splitLines($output) as $line) {
  25090. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  25091. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  25092. }
  25093. }
  25094. return null;
  25095. }
  25096. public function getTags()
  25097. {
  25098. if (null === $this->tags) {
  25099. $this->tags = array();
  25100. if ($this->tagsPath !== false) {
  25101. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  25102. if ($output) {
  25103. foreach ($this->process->splitLines($output) as $line) {
  25104. $line = trim($line);
  25105. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25106. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25107. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  25108. '/' . $this->tagsPath . '/' . $match[2],
  25109. $match[1]
  25110. );
  25111. }
  25112. }
  25113. }
  25114. }
  25115. }
  25116. }
  25117. return $this->tags;
  25118. }
  25119. public function getBranches()
  25120. {
  25121. if (null === $this->branches) {
  25122. $this->branches = array();
  25123. if (false === $this->trunkPath) {
  25124. $trunkParent = $this->baseUrl . '/';
  25125. } else {
  25126. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  25127. }
  25128. $output = $this->execute('svn ls --verbose', $trunkParent);
  25129. if ($output) {
  25130. foreach ($this->process->splitLines($output) as $line) {
  25131. $line = trim($line);
  25132. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25133. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  25134. $this->branches['trunk'] = $this->buildIdentifier(
  25135. '/' . $this->trunkPath,
  25136. $match[1]
  25137. );
  25138. $this->rootIdentifier = $this->branches['trunk'];
  25139. break;
  25140. }
  25141. }
  25142. }
  25143. }
  25144. unset($output);
  25145. if ($this->branchesPath !== false) {
  25146. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  25147. if ($output) {
  25148. foreach ($this->process->splitLines(trim($output)) as $line) {
  25149. $line = trim($line);
  25150. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  25151. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  25152. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  25153. '/' . $this->branchesPath . '/' . $match[2],
  25154. $match[1]
  25155. );
  25156. }
  25157. }
  25158. }
  25159. }
  25160. }
  25161. }
  25162. return $this->branches;
  25163. }
  25164. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  25165. {
  25166. $url = self::normalizeUrl($url);
  25167. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  25168. return true;
  25169. }
  25170. if (!$deep && !Filesystem::isLocalPath($url)) {
  25171. return false;
  25172. }
  25173. $processExecutor = new ProcessExecutor($io);
  25174. $exit = $processExecutor->execute(
  25175. "svn info --non-interactive ".ProcessExecutor::escape($url),
  25176. $ignoredOutput
  25177. );
  25178. if ($exit === 0) {
  25179. return true;
  25180. }
  25181. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  25182. return true;
  25183. }
  25184. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  25185. return true;
  25186. }
  25187. return false;
  25188. }
  25189. protected static function normalizeUrl($url)
  25190. {
  25191. $fs = new Filesystem();
  25192. if ($fs->isAbsolutePath($url)) {
  25193. return 'file://' . strtr($url, '\\', '/');
  25194. }
  25195. return $url;
  25196. }
  25197. protected function execute($command, $url)
  25198. {
  25199. if (null === $this->util) {
  25200. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  25201. $this->util->setCacheCredentials($this->cacheCredentials);
  25202. }
  25203. try {
  25204. return $this->util->execute($command, $url);
  25205. } catch (\RuntimeException $e) {
  25206. if (null === $this->util->binaryVersion()) {
  25207. throw new \RuntimeException('Failed to load '.$this->url.', svn was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput());
  25208. }
  25209. throw new \RuntimeException(
  25210. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  25211. );
  25212. }
  25213. }
  25214. protected function buildIdentifier($baseDir, $revision)
  25215. {
  25216. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  25217. }
  25218. }
  25219. <?php
  25220. namespace Composer\Repository\Vcs;
  25221. use Composer\Cache;
  25222. use Composer\Downloader\TransportException;
  25223. use Composer\Config;
  25224. use Composer\Factory;
  25225. use Composer\IO\IOInterface;
  25226. use Composer\Json\JsonFile;
  25227. use Composer\Util\ProcessExecutor;
  25228. use Composer\Util\RemoteFilesystem;
  25229. use Composer\Util\Filesystem;
  25230. abstract class VcsDriver implements VcsDriverInterface
  25231. {
  25232. protected $url;
  25233. protected $originUrl;
  25234. protected $repoConfig;
  25235. protected $io;
  25236. protected $config;
  25237. protected $process;
  25238. protected $remoteFilesystem;
  25239. protected $infoCache = array();
  25240. protected $cache;
  25241. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  25242. {
  25243. if (Filesystem::isLocalPath($repoConfig['url'])) {
  25244. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  25245. }
  25246. $this->url = $repoConfig['url'];
  25247. $this->originUrl = $repoConfig['url'];
  25248. $this->repoConfig = $repoConfig;
  25249. $this->io = $io;
  25250. $this->config = $config;
  25251. $this->process = $process ?: new ProcessExecutor($io);
  25252. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25253. }
  25254. protected function shouldCache($identifier)
  25255. {
  25256. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  25257. }
  25258. public function getComposerInformation($identifier)
  25259. {
  25260. if (!isset($this->infoCache[$identifier])) {
  25261. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  25262. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  25263. }
  25264. $composer = $this->getBaseComposerInformation($identifier);
  25265. if ($this->shouldCache($identifier)) {
  25266. $this->cache->write($identifier, json_encode($composer));
  25267. }
  25268. $this->infoCache[$identifier] = $composer;
  25269. }
  25270. return $this->infoCache[$identifier];
  25271. }
  25272. protected function getBaseComposerInformation($identifier)
  25273. {
  25274. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  25275. if (!$composerFileContent) {
  25276. return null;
  25277. }
  25278. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  25279. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  25280. $composer['time'] = $changeDate->format(DATE_RFC3339);
  25281. }
  25282. return $composer;
  25283. }
  25284. public function hasComposerFile($identifier)
  25285. {
  25286. try {
  25287. return (bool) $this->getComposerInformation($identifier);
  25288. } catch (TransportException $e) {
  25289. }
  25290. return false;
  25291. }
  25292. protected function getScheme()
  25293. {
  25294. if (extension_loaded('openssl')) {
  25295. return 'https';
  25296. }
  25297. return 'http';
  25298. }
  25299. protected function getContents($url)
  25300. {
  25301. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  25302. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  25303. }
  25304. public function cleanup()
  25305. {
  25306. return;
  25307. }
  25308. }
  25309. <?php
  25310. namespace Composer\Repository\Vcs;
  25311. use Composer\Config;
  25312. use Composer\IO\IOInterface;
  25313. interface VcsDriverInterface
  25314. {
  25315. public function initialize();
  25316. public function getComposerInformation($identifier);
  25317. public function getFileContent($file, $identifier);
  25318. public function getChangeDate($identifier);
  25319. public function getRootIdentifier();
  25320. public function getBranches();
  25321. public function getTags();
  25322. public function getDist($identifier);
  25323. public function getSource($identifier);
  25324. public function getUrl();
  25325. public function hasComposerFile($identifier);
  25326. public function cleanup();
  25327. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  25328. }
  25329. <?php
  25330. namespace Composer\Repository;
  25331. use Composer\Downloader\TransportException;
  25332. use Composer\Repository\Vcs\VcsDriverInterface;
  25333. use Composer\Package\Version\VersionParser;
  25334. use Composer\Package\Loader\ArrayLoader;
  25335. use Composer\Package\Loader\ValidatingArrayLoader;
  25336. use Composer\Package\Loader\InvalidPackageException;
  25337. use Composer\Package\Loader\LoaderInterface;
  25338. use Composer\EventDispatcher\EventDispatcher;
  25339. use Composer\Semver\Constraint\Constraint;
  25340. use Composer\IO\IOInterface;
  25341. use Composer\Config;
  25342. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  25343. {
  25344. protected $url;
  25345. protected $packageName;
  25346. protected $isVerbose;
  25347. protected $isVeryVerbose;
  25348. protected $io;
  25349. protected $config;
  25350. protected $versionParser;
  25351. protected $type;
  25352. protected $loader;
  25353. protected $repoConfig;
  25354. protected $branchErrorOccurred = false;
  25355. private $drivers;
  25356. private $driver;
  25357. private $versionCache;
  25358. private $emptyReferences = array();
  25359. private $versionTransportExceptions = array();
  25360. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  25361. {
  25362. parent::__construct();
  25363. $this->drivers = $drivers ?: array(
  25364. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  25365. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  25366. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  25367. 'git' => 'Composer\Repository\Vcs\GitDriver',
  25368. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  25369. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  25370. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  25371. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  25372. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  25373. );
  25374. $this->url = $repoConfig['url'];
  25375. $this->io = $io;
  25376. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  25377. $this->isVerbose = $io->isVerbose();
  25378. $this->isVeryVerbose = $io->isVeryVerbose();
  25379. $this->config = $config;
  25380. $this->repoConfig = $repoConfig;
  25381. $this->versionCache = $versionCache;
  25382. }
  25383. public function getRepoConfig()
  25384. {
  25385. return $this->repoConfig;
  25386. }
  25387. public function setLoader(LoaderInterface $loader)
  25388. {
  25389. $this->loader = $loader;
  25390. }
  25391. public function getDriver()
  25392. {
  25393. if ($this->driver) {
  25394. return $this->driver;
  25395. }
  25396. if (isset($this->drivers[$this->type])) {
  25397. $class = $this->drivers[$this->type];
  25398. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  25399. $this->driver->initialize();
  25400. return $this->driver;
  25401. }
  25402. foreach ($this->drivers as $driver) {
  25403. if ($driver::supports($this->io, $this->config, $this->url)) {
  25404. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25405. $this->driver->initialize();
  25406. return $this->driver;
  25407. }
  25408. }
  25409. foreach ($this->drivers as $driver) {
  25410. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  25411. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  25412. $this->driver->initialize();
  25413. return $this->driver;
  25414. }
  25415. }
  25416. }
  25417. public function hadInvalidBranches()
  25418. {
  25419. return $this->branchErrorOccurred;
  25420. }
  25421. public function getEmptyReferences()
  25422. {
  25423. return $this->emptyReferences;
  25424. }
  25425. public function getVersionTransportExceptions()
  25426. {
  25427. return $this->versionTransportExceptions;
  25428. }
  25429. protected function initialize()
  25430. {
  25431. parent::initialize();
  25432. $isVerbose = $this->isVerbose;
  25433. $isVeryVerbose = $this->isVeryVerbose;
  25434. $driver = $this->getDriver();
  25435. if (!$driver) {
  25436. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  25437. }
  25438. $this->versionParser = new VersionParser;
  25439. if (!$this->loader) {
  25440. $this->loader = new ArrayLoader($this->versionParser);
  25441. }
  25442. try {
  25443. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  25444. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  25445. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  25446. }
  25447. } catch (\Exception $e) {
  25448. if ($isVeryVerbose) {
  25449. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  25450. }
  25451. }
  25452. foreach ($driver->getTags() as $tag => $identifier) {
  25453. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  25454. if ($isVeryVerbose) {
  25455. $this->io->writeError($msg);
  25456. } elseif ($isVerbose) {
  25457. $this->io->overwriteError($msg, false);
  25458. }
  25459. $tag = str_replace('release-', '', $tag);
  25460. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  25461. if ($cachedPackage) {
  25462. $this->addPackage($cachedPackage);
  25463. continue;
  25464. } elseif ($cachedPackage === false) {
  25465. $this->emptyReferences[] = $identifier;
  25466. continue;
  25467. }
  25468. if (!$parsedTag = $this->validateTag($tag)) {
  25469. if ($isVeryVerbose) {
  25470. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  25471. }
  25472. continue;
  25473. }
  25474. try {
  25475. if (!$data = $driver->getComposerInformation($identifier)) {
  25476. if ($isVeryVerbose) {
  25477. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  25478. }
  25479. $this->emptyReferences[] = $identifier;
  25480. continue;
  25481. }
  25482. if (isset($data['version'])) {
  25483. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  25484. } else {
  25485. $data['version'] = $tag;
  25486. $data['version_normalized'] = $parsedTag;
  25487. }
  25488. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  25489. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  25490. if ($data['version_normalized'] !== $parsedTag) {
  25491. if ($isVeryVerbose) {
  25492. if (preg_match('{(^dev-|[.-]?dev$)}i', $parsedTag)) {
  25493. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name, tags can not use dev prefixes or suffixes</warning>');
  25494. } else {
  25495. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  25496. }
  25497. }
  25498. continue;
  25499. }
  25500. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  25501. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  25502. if ($isVeryVerbose) {
  25503. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  25504. }
  25505. continue;
  25506. }
  25507. if ($isVeryVerbose) {
  25508. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  25509. }
  25510. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  25511. } catch (\Exception $e) {
  25512. if ($e instanceof TransportException) {
  25513. $this->versionTransportExceptions['tags'][$tag] = $e;
  25514. if ($e->getCode() === 404) {
  25515. $this->emptyReferences[] = $identifier;
  25516. }
  25517. }
  25518. if ($isVeryVerbose) {
  25519. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found (' . $e->getCode() . ' HTTP status code)' : $e->getMessage()).'</warning>');
  25520. }
  25521. continue;
  25522. }
  25523. }
  25524. if (!$isVeryVerbose) {
  25525. $this->io->overwriteError('', false);
  25526. }
  25527. $branches = $driver->getBranches();
  25528. foreach ($branches as $branch => $identifier) {
  25529. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  25530. if ($isVeryVerbose) {
  25531. $this->io->writeError($msg);
  25532. } elseif ($isVerbose) {
  25533. $this->io->overwriteError($msg, false);
  25534. }
  25535. if ($branch === 'trunk' && isset($branches['master'])) {
  25536. if ($isVeryVerbose) {
  25537. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  25538. }
  25539. continue;
  25540. }
  25541. if (!$parsedBranch = $this->validateBranch($branch)) {
  25542. if ($isVeryVerbose) {
  25543. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  25544. }
  25545. continue;
  25546. }
  25547. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  25548. $version = 'dev-' . $branch;
  25549. } else {
  25550. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  25551. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  25552. }
  25553. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  25554. if ($cachedPackage) {
  25555. $this->addPackage($cachedPackage);
  25556. continue;
  25557. } elseif ($cachedPackage === false) {
  25558. $this->emptyReferences[] = $identifier;
  25559. continue;
  25560. }
  25561. try {
  25562. if (!$data = $driver->getComposerInformation($identifier)) {
  25563. if ($isVeryVerbose) {
  25564. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  25565. }
  25566. $this->emptyReferences[] = $identifier;
  25567. continue;
  25568. }
  25569. $data['version'] = $version;
  25570. $data['version_normalized'] = $parsedBranch;
  25571. if ($isVeryVerbose) {
  25572. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  25573. }
  25574. $packageData = $this->preProcess($driver, $data, $identifier);
  25575. $package = $this->loader->load($packageData);
  25576. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  25577. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  25578. }
  25579. $this->addPackage($package);
  25580. } catch (TransportException $e) {
  25581. $this->versionTransportExceptions['branches'][$branch] = $e;
  25582. if ($e->getCode() === 404) {
  25583. $this->emptyReferences[] = $identifier;
  25584. }
  25585. if ($isVeryVerbose) {
  25586. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found (' . $e->getCode() . ' HTTP status code)</warning>');
  25587. }
  25588. continue;
  25589. } catch (\Exception $e) {
  25590. if (!$isVeryVerbose) {
  25591. $this->io->writeError('');
  25592. }
  25593. $this->branchErrorOccurred = true;
  25594. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  25595. $this->io->writeError('');
  25596. continue;
  25597. }
  25598. }
  25599. $driver->cleanup();
  25600. if (!$isVeryVerbose) {
  25601. $this->io->overwriteError('', false);
  25602. }
  25603. if (!$this->getPackages()) {
  25604. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  25605. }
  25606. }
  25607. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  25608. {
  25609. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  25610. $data['name'] = $this->packageName ?: $dataPackageName;
  25611. if (!isset($data['dist'])) {
  25612. $data['dist'] = $driver->getDist($identifier);
  25613. }
  25614. if (!isset($data['source'])) {
  25615. $data['source'] = $driver->getSource($identifier);
  25616. }
  25617. return $data;
  25618. }
  25619. private function validateBranch($branch)
  25620. {
  25621. try {
  25622. $normalizedBranch = $this->versionParser->normalizeBranch($branch);
  25623. $this->versionParser->parseConstraints($normalizedBranch);
  25624. return $normalizedBranch;
  25625. } catch (\Exception $e) {
  25626. }
  25627. return false;
  25628. }
  25629. private function validateTag($version)
  25630. {
  25631. try {
  25632. return $this->versionParser->normalize($version);
  25633. } catch (\Exception $e) {
  25634. }
  25635. return false;
  25636. }
  25637. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  25638. {
  25639. if (!$this->versionCache) {
  25640. return;
  25641. }
  25642. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  25643. if ($cachedPackage === false) {
  25644. if ($isVeryVerbose) {
  25645. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  25646. }
  25647. return false;
  25648. }
  25649. if ($cachedPackage) {
  25650. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  25651. if ($isVeryVerbose) {
  25652. $this->io->writeError($msg);
  25653. } elseif ($isVerbose) {
  25654. $this->io->overwriteError($msg, false);
  25655. }
  25656. if ($existingPackage = $this->findPackage($cachedPackage['name'], new Constraint('=', $cachedPackage['version_normalized']))) {
  25657. if ($isVeryVerbose) {
  25658. $this->io->writeError('<warning>Skipped cached version '.$version.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$cachedPackage['version_normalized'].' internally</warning>');
  25659. }
  25660. $cachedPackage = null;
  25661. }
  25662. }
  25663. if ($cachedPackage) {
  25664. return $this->loader->load($cachedPackage);
  25665. }
  25666. return null;
  25667. }
  25668. }
  25669. <?php
  25670. namespace Composer\Repository;
  25671. interface VersionCacheInterface
  25672. {
  25673. public function getVersionPackage($version, $identifier);
  25674. }
  25675. <?php
  25676. namespace Composer\Repository;
  25677. use Composer\Package\AliasPackage;
  25678. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  25679. {
  25680. public function write()
  25681. {
  25682. }
  25683. public function reload()
  25684. {
  25685. }
  25686. public function getCanonicalPackages()
  25687. {
  25688. $packages = $this->getPackages();
  25689. $packagesByName = array();
  25690. foreach ($packages as $package) {
  25691. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  25692. $packagesByName[$package->getName()] = $package;
  25693. }
  25694. }
  25695. $canonicalPackages = array();
  25696. foreach ($packagesByName as $package) {
  25697. while ($package instanceof AliasPackage) {
  25698. $package = $package->getAliasOf();
  25699. }
  25700. $canonicalPackages[] = $package;
  25701. }
  25702. return $canonicalPackages;
  25703. }
  25704. }
  25705. <?php
  25706. namespace Composer\Repository;
  25707. use Composer\Package\PackageInterface;
  25708. interface WritableRepositoryInterface extends RepositoryInterface
  25709. {
  25710. public function write();
  25711. public function addPackage(PackageInterface $package);
  25712. public function removePackage(PackageInterface $package);
  25713. public function getCanonicalPackages();
  25714. public function reload();
  25715. }
  25716. <?php
  25717. namespace Composer\Script;
  25718. class CommandEvent extends Event
  25719. {
  25720. }
  25721. <?php
  25722. namespace Composer\Script;
  25723. use Composer\Composer;
  25724. use Composer\IO\IOInterface;
  25725. use Composer\EventDispatcher\Event as BaseEvent;
  25726. class Event extends BaseEvent
  25727. {
  25728. private $composer;
  25729. private $io;
  25730. private $devMode;
  25731. private $originatingEvent;
  25732. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  25733. {
  25734. parent::__construct($name, $args, $flags);
  25735. $this->composer = $composer;
  25736. $this->io = $io;
  25737. $this->devMode = $devMode;
  25738. $this->originatingEvent = null;
  25739. }
  25740. public function getComposer()
  25741. {
  25742. return $this->composer;
  25743. }
  25744. public function getIO()
  25745. {
  25746. return $this->io;
  25747. }
  25748. public function isDevMode()
  25749. {
  25750. return $this->devMode;
  25751. }
  25752. public function getOriginatingEvent()
  25753. {
  25754. return $this->originatingEvent;
  25755. }
  25756. public function setOriginatingEvent(BaseEvent $event)
  25757. {
  25758. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  25759. return $this;
  25760. }
  25761. private function calculateOriginatingEvent(BaseEvent $event)
  25762. {
  25763. if ($event instanceof Event && $event->getOriginatingEvent()) {
  25764. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  25765. }
  25766. return $event;
  25767. }
  25768. }
  25769. <?php
  25770. namespace Composer\Script;
  25771. use Composer\Installer\PackageEvent as BasePackageEvent;
  25772. class PackageEvent extends BasePackageEvent
  25773. {
  25774. }
  25775. <?php
  25776. namespace Composer\Script;
  25777. class ScriptEvents
  25778. {
  25779. const PRE_INSTALL_CMD = 'pre-install-cmd';
  25780. const POST_INSTALL_CMD = 'post-install-cmd';
  25781. const PRE_UPDATE_CMD = 'pre-update-cmd';
  25782. const POST_UPDATE_CMD = 'post-update-cmd';
  25783. const PRE_STATUS_CMD = 'pre-status-cmd';
  25784. const POST_STATUS_CMD = 'post-status-cmd';
  25785. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  25786. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  25787. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  25788. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  25789. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  25790. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  25791. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  25792. const POST_PACKAGE_INSTALL = 'post-package-install';
  25793. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  25794. const POST_PACKAGE_UPDATE = 'post-package-update';
  25795. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  25796. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  25797. }
  25798. <?php
  25799. namespace Composer\SelfUpdate;
  25800. class Keys
  25801. {
  25802. public static function fingerprint($path)
  25803. {
  25804. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  25805. return implode(' ', array(
  25806. substr($hash, 0, 8),
  25807. substr($hash, 8, 8),
  25808. substr($hash, 16, 8),
  25809. substr($hash, 24, 8),
  25810. '',
  25811. substr($hash, 32, 8),
  25812. substr($hash, 40, 8),
  25813. substr($hash, 48, 8),
  25814. substr($hash, 56, 8),
  25815. ));
  25816. }
  25817. }
  25818. <?php
  25819. namespace Composer\SelfUpdate;
  25820. use Composer\Util\RemoteFilesystem;
  25821. use Composer\Config;
  25822. use Composer\Json\JsonFile;
  25823. class Versions
  25824. {
  25825. public static $channels = array('stable', 'preview', 'snapshot', '1', '2');
  25826. private $rfs;
  25827. private $config;
  25828. private $channel;
  25829. private $versionsData;
  25830. public function __construct(Config $config, RemoteFilesystem $rfs)
  25831. {
  25832. $this->rfs = $rfs;
  25833. $this->config = $config;
  25834. }
  25835. public function getChannel()
  25836. {
  25837. if ($this->channel) {
  25838. return $this->channel;
  25839. }
  25840. $channelFile = $this->config->get('home').'/update-channel';
  25841. if (file_exists($channelFile)) {
  25842. $channel = trim(file_get_contents($channelFile));
  25843. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  25844. return $this->channel = $channel;
  25845. }
  25846. }
  25847. return $this->channel = 'stable';
  25848. }
  25849. public function setChannel($channel)
  25850. {
  25851. if (!in_array($channel, self::$channels, true)) {
  25852. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: ' . implode(', ', self::$channels));
  25853. }
  25854. $channelFile = $this->config->get('home').'/update-channel';
  25855. $this->channel = $channel;
  25856. file_put_contents($channelFile, (is_numeric($channel) ? 'stable' : $channel).PHP_EOL);
  25857. }
  25858. public function getLatest($channel = null)
  25859. {
  25860. $versions = $this->getVersionsData();
  25861. foreach ($versions[$channel ?: $this->getChannel()] as $version) {
  25862. if ($version['min-php'] <= PHP_VERSION_ID) {
  25863. return $version;
  25864. }
  25865. }
  25866. throw new \UnexpectedValueException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  25867. }
  25868. private function getVersionsData()
  25869. {
  25870. if (!$this->versionsData) {
  25871. if ($this->config->get('disable-tls') === true) {
  25872. $protocol = 'http';
  25873. } else {
  25874. $protocol = 'https';
  25875. }
  25876. $this->versionsData = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  25877. }
  25878. return $this->versionsData;
  25879. }
  25880. }
  25881. <?php
  25882. namespace Composer\Util;
  25883. use Composer\Config;
  25884. use Composer\IO\IOInterface;
  25885. class AuthHelper
  25886. {
  25887. protected $io;
  25888. protected $config;
  25889. public function __construct(IOInterface $io, Config $config)
  25890. {
  25891. $this->io = $io;
  25892. $this->config = $config;
  25893. }
  25894. public function storeAuth($originUrl, $storeAuth)
  25895. {
  25896. $store = false;
  25897. $configSource = $this->config->getAuthConfigSource();
  25898. if ($storeAuth === true) {
  25899. $store = $configSource;
  25900. } elseif ($storeAuth === 'prompt') {
  25901. $answer = $this->io->askAndValidate(
  25902. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  25903. function ($value) {
  25904. $input = strtolower(substr(trim($value), 0, 1));
  25905. if (in_array($input, array('y','n'))) {
  25906. return $input;
  25907. }
  25908. throw new \RuntimeException('Please answer (y)es or (n)o');
  25909. },
  25910. null,
  25911. 'y'
  25912. );
  25913. if ($answer === 'y') {
  25914. $store = $configSource;
  25915. }
  25916. }
  25917. if ($store) {
  25918. $store->addConfigSetting(
  25919. 'http-basic.'.$originUrl,
  25920. $this->io->getAuthentication($originUrl)
  25921. );
  25922. }
  25923. }
  25924. }
  25925. <?php
  25926. namespace Composer\Util;
  25927. use Composer\Factory;
  25928. use Composer\IO\IOInterface;
  25929. use Composer\Config;
  25930. use Composer\Downloader\TransportException;
  25931. class Bitbucket
  25932. {
  25933. private $io;
  25934. private $config;
  25935. private $process;
  25936. private $remoteFilesystem;
  25937. private $token = array();
  25938. private $time;
  25939. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  25940. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  25941. {
  25942. $this->io = $io;
  25943. $this->config = $config;
  25944. $this->process = $process ?: new ProcessExecutor($io);
  25945. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  25946. $this->time = $time;
  25947. }
  25948. public function getToken()
  25949. {
  25950. if (!isset($this->token['access_token'])) {
  25951. return '';
  25952. }
  25953. return $this->token['access_token'];
  25954. }
  25955. public function authorizeOAuth($originUrl)
  25956. {
  25957. if ($originUrl !== 'bitbucket.org') {
  25958. return false;
  25959. }
  25960. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  25961. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  25962. return true;
  25963. }
  25964. return false;
  25965. }
  25966. private function requestAccessToken($originUrl)
  25967. {
  25968. try {
  25969. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  25970. 'retry-auth-failure' => false,
  25971. 'http' => array(
  25972. 'method' => 'POST',
  25973. 'content' => 'grant_type=client_credentials',
  25974. ),
  25975. ));
  25976. $this->token = json_decode($json, true);
  25977. } catch (TransportException $e) {
  25978. if ($e->getCode() === 400) {
  25979. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25980. $this->io->writeError('This can have two reasons:');
  25981. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  25982. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  25983. return false;
  25984. } elseif (in_array($e->getCode(), array(403, 401))) {
  25985. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  25986. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25987. return false;
  25988. }
  25989. throw $e;
  25990. }
  25991. return true;
  25992. }
  25993. public function authorizeOAuthInteractively($originUrl, $message = null)
  25994. {
  25995. if ($message) {
  25996. $this->io->writeError($message);
  25997. }
  25998. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  25999. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  26000. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  26001. $this->io->writeError('Ensure you enter a "Callback URL" (http://example.com is fine) or it will not be possible to create an Access Token (this callback url will not be used by composer)');
  26002. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  26003. if (!$consumerKey) {
  26004. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  26005. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  26006. return false;
  26007. }
  26008. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  26009. if (!$consumerSecret) {
  26010. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  26011. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  26012. return false;
  26013. }
  26014. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  26015. if (!$this->requestAccessToken($originUrl)) {
  26016. return false;
  26017. }
  26018. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  26019. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  26020. $this->io->writeError('<info>Consumer stored successfully.</info>');
  26021. return true;
  26022. }
  26023. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  26024. {
  26025. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  26026. return $this->token['access_token'];
  26027. }
  26028. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  26029. if (!$this->requestAccessToken($originUrl)) {
  26030. return '';
  26031. }
  26032. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  26033. return $this->token['access_token'];
  26034. }
  26035. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  26036. {
  26037. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  26038. $time = null === $this->time ? time() : $this->time;
  26039. $consumer = array(
  26040. "consumer-key" => $consumerKey,
  26041. "consumer-secret" => $consumerSecret,
  26042. "access-token" => $this->token['access_token'],
  26043. "access-token-expiration" => $time + $this->token['expires_in'],
  26044. );
  26045. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  26046. }
  26047. private function getTokenFromConfig($originUrl)
  26048. {
  26049. $authConfig = $this->config->get('bitbucket-oauth');
  26050. if (
  26051. !isset($authConfig[$originUrl]['access-token'])
  26052. || !isset($authConfig[$originUrl]['access-token-expiration'])
  26053. || time() > $authConfig[$originUrl]['access-token-expiration']
  26054. ) {
  26055. return false;
  26056. }
  26057. $this->token = array(
  26058. 'access_token' => $authConfig[$originUrl]['access-token'],
  26059. );
  26060. return true;
  26061. }
  26062. }
  26063. <?php
  26064. namespace Composer\Util;
  26065. class ComposerMirror
  26066. {
  26067. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  26068. {
  26069. if ($reference) {
  26070. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  26071. }
  26072. $version = strpos($version, '/') === false ? $version : md5($version);
  26073. return str_replace(
  26074. array('%package%', '%version%', '%reference%', '%type%'),
  26075. array($packageName, $version, $reference, $type),
  26076. $mirrorUrl
  26077. );
  26078. }
  26079. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  26080. {
  26081. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  26082. $url = 'gh-'.$match[1].'/'.$match[2];
  26083. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  26084. $url = 'bb-'.$match[1].'/'.$match[2];
  26085. } else {
  26086. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  26087. }
  26088. return str_replace(
  26089. array('%package%', '%normalizedUrl%', '%type%'),
  26090. array($packageName, $url, $type),
  26091. $mirrorUrl
  26092. );
  26093. }
  26094. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  26095. {
  26096. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  26097. }
  26098. }
  26099. <?php
  26100. namespace Composer\Util;
  26101. use Composer\Package\Loader\ArrayLoader;
  26102. use Composer\Package\Loader\ValidatingArrayLoader;
  26103. use Composer\Package\Loader\InvalidPackageException;
  26104. use Composer\Json\JsonValidationException;
  26105. use Composer\IO\IOInterface;
  26106. use Composer\Json\JsonFile;
  26107. use Composer\Spdx\SpdxLicenses;
  26108. class ConfigValidator
  26109. {
  26110. private $io;
  26111. public function __construct(IOInterface $io)
  26112. {
  26113. $this->io = $io;
  26114. }
  26115. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  26116. {
  26117. $errors = array();
  26118. $publishErrors = array();
  26119. $warnings = array();
  26120. $laxValid = false;
  26121. try {
  26122. $json = new JsonFile($file, null, $this->io);
  26123. $manifest = $json->read();
  26124. $json->validateSchema(JsonFile::LAX_SCHEMA);
  26125. $laxValid = true;
  26126. $json->validateSchema();
  26127. } catch (JsonValidationException $e) {
  26128. foreach ($e->getErrors() as $message) {
  26129. if ($laxValid) {
  26130. $publishErrors[] = $message;
  26131. } else {
  26132. $errors[] = $message;
  26133. }
  26134. }
  26135. } catch (\Exception $e) {
  26136. $errors[] = $e->getMessage();
  26137. return array($errors, $publishErrors, $warnings);
  26138. }
  26139. if (empty($manifest['license'])) {
  26140. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  26141. } else {
  26142. $licenses = (array) $manifest['license'];
  26143. foreach ($licenses as $key => $license) {
  26144. if ('proprietary' === $license) {
  26145. unset($licenses[$key]);
  26146. }
  26147. }
  26148. $licenseValidator = new SpdxLicenses();
  26149. foreach ($licenses as $license) {
  26150. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  26151. if ($spdxLicense && $spdxLicense[3]) {
  26152. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  26153. $warnings[] = sprintf(
  26154. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  26155. $license
  26156. );
  26157. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  26158. $warnings[] = sprintf(
  26159. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  26160. $license
  26161. );
  26162. } else {
  26163. $warnings[] = sprintf(
  26164. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  26165. $license
  26166. );
  26167. }
  26168. }
  26169. }
  26170. }
  26171. if (isset($manifest['version'])) {
  26172. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  26173. }
  26174. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  26175. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  26176. $suggestName = strtolower($suggestName);
  26177. $publishErrors[] = sprintf(
  26178. 'Name "%s" does not match the best practice (e.g. lower-cased/with-dashes). We suggest using "%s" instead. As such you will not be able to submit it to Packagist.',
  26179. $manifest['name'],
  26180. $suggestName
  26181. );
  26182. }
  26183. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  26184. $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See https://getcomposer.org/doc/articles/plugins.md for plugin documentation.";
  26185. }
  26186. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  26187. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  26188. if (!empty($requireOverrides)) {
  26189. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  26190. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  26191. }
  26192. }
  26193. $require = isset($manifest['require']) ? $manifest['require'] : array();
  26194. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  26195. $packages = array_merge($require, $requireDev);
  26196. foreach ($packages as $package => $version) {
  26197. if (preg_match('/#/', $version) === 1) {
  26198. $warnings[] = sprintf(
  26199. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  26200. $package
  26201. );
  26202. }
  26203. }
  26204. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  26205. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  26206. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  26207. if (!array_key_exists($scriptName, $scripts)) {
  26208. $warnings[] = sprintf(
  26209. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  26210. $scriptName
  26211. );
  26212. }
  26213. }
  26214. if (isset($manifest['autoload']['psr-0'][''])) {
  26215. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  26216. }
  26217. if (isset($manifest['autoload']['psr-4'][''])) {
  26218. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  26219. }
  26220. try {
  26221. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  26222. if (!isset($manifest['version'])) {
  26223. $manifest['version'] = '1.0.0';
  26224. }
  26225. if (!isset($manifest['name'])) {
  26226. $manifest['name'] = 'dummy/dummy';
  26227. }
  26228. $loader->load($manifest);
  26229. } catch (InvalidPackageException $e) {
  26230. $errors = array_merge($errors, $e->getErrors());
  26231. }
  26232. $warnings = array_merge($warnings, $loader->getWarnings());
  26233. return array($errors, $publishErrors, $warnings);
  26234. }
  26235. }
  26236. <?php
  26237. namespace Composer\Util;
  26238. use Composer\IO\IOInterface;
  26239. class ErrorHandler
  26240. {
  26241. private static $io;
  26242. public static function handle($level, $message, $file, $line)
  26243. {
  26244. if (!(error_reporting() & $level)) {
  26245. return;
  26246. }
  26247. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  26248. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  26249. "\na legitimately suppressed error that you were not supposed to see.";
  26250. }
  26251. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  26252. throw new \ErrorException($message, 0, $level, $file, $line);
  26253. }
  26254. if (self::$io) {
  26255. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  26256. if (self::$io->isVerbose()) {
  26257. self::$io->writeError('<warning>Stack trace:</warning>');
  26258. self::$io->writeError(array_filter(array_map(function ($a) {
  26259. if (isset($a['line'], $a['file'])) {
  26260. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  26261. }
  26262. return null;
  26263. }, array_slice(debug_backtrace(), 2))));
  26264. }
  26265. }
  26266. return true;
  26267. }
  26268. public static function register(IOInterface $io = null)
  26269. {
  26270. set_error_handler(array(__CLASS__, 'handle'));
  26271. error_reporting(E_ALL | E_STRICT);
  26272. self::$io = $io;
  26273. }
  26274. }
  26275. <?php
  26276. namespace Composer\Util;
  26277. use RecursiveDirectoryIterator;
  26278. use RecursiveIteratorIterator;
  26279. use Symfony\Component\Filesystem\Exception\IOException;
  26280. use Symfony\Component\Finder\Finder;
  26281. class Filesystem
  26282. {
  26283. private $processExecutor;
  26284. public function __construct(ProcessExecutor $executor = null)
  26285. {
  26286. $this->processExecutor = $executor ?: new ProcessExecutor();
  26287. }
  26288. public function remove($file)
  26289. {
  26290. if (is_dir($file)) {
  26291. return $this->removeDirectory($file);
  26292. }
  26293. if (file_exists($file)) {
  26294. return $this->unlink($file);
  26295. }
  26296. return false;
  26297. }
  26298. public function isDirEmpty($dir)
  26299. {
  26300. $finder = Finder::create()
  26301. ->ignoreVCS(false)
  26302. ->ignoreDotFiles(false)
  26303. ->depth(0)
  26304. ->in($dir);
  26305. return count($finder) === 0;
  26306. }
  26307. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  26308. {
  26309. if (file_exists($dir) && is_link($dir)) {
  26310. $this->unlink($dir);
  26311. }
  26312. if ($ensureDirectoryExists) {
  26313. $this->ensureDirectoryExists($dir);
  26314. }
  26315. if (is_dir($dir)) {
  26316. $finder = Finder::create()
  26317. ->ignoreVCS(false)
  26318. ->ignoreDotFiles(false)
  26319. ->depth(0)
  26320. ->in($dir);
  26321. foreach ($finder as $path) {
  26322. $this->remove((string) $path);
  26323. }
  26324. }
  26325. }
  26326. public function removeDirectory($directory)
  26327. {
  26328. if ($this->isSymlinkedDirectory($directory)) {
  26329. return $this->unlinkSymlinkedDirectory($directory);
  26330. }
  26331. if ($this->isJunction($directory)) {
  26332. return $this->removeJunction($directory);
  26333. }
  26334. if (is_link($directory)) {
  26335. return unlink($directory);
  26336. }
  26337. if (!file_exists($directory) || !is_dir($directory)) {
  26338. return true;
  26339. }
  26340. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  26341. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  26342. }
  26343. if (!function_exists('proc_open')) {
  26344. return $this->removeDirectoryPhp($directory);
  26345. }
  26346. if (Platform::isWindows()) {
  26347. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  26348. } else {
  26349. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  26350. }
  26351. $result = $this->getProcess()->execute($cmd, $output) === 0;
  26352. clearstatcache();
  26353. if ($result && !file_exists($directory)) {
  26354. return true;
  26355. }
  26356. return $this->removeDirectoryPhp($directory);
  26357. }
  26358. public function removeDirectoryPhp($directory)
  26359. {
  26360. try {
  26361. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26362. } catch (\UnexpectedValueException $e) {
  26363. clearstatcache();
  26364. usleep(100000);
  26365. if (!is_dir($directory)) {
  26366. return true;
  26367. }
  26368. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26369. }
  26370. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26371. foreach ($ri as $file) {
  26372. if ($file->isDir()) {
  26373. $this->rmdir($file->getPathname());
  26374. } else {
  26375. $this->unlink($file->getPathname());
  26376. }
  26377. }
  26378. return $this->rmdir($directory);
  26379. }
  26380. public function ensureDirectoryExists($directory)
  26381. {
  26382. if (!is_dir($directory)) {
  26383. if (file_exists($directory)) {
  26384. throw new \RuntimeException(
  26385. $directory.' exists and is not a directory.'
  26386. );
  26387. }
  26388. if (!@mkdir($directory, 0777, true)) {
  26389. throw new \RuntimeException(
  26390. $directory.' does not exist and could not be created.'
  26391. );
  26392. }
  26393. }
  26394. }
  26395. public function unlink($path)
  26396. {
  26397. $unlinked = @$this->unlinkImplementation($path);
  26398. if (!$unlinked) {
  26399. if (Platform::isWindows()) {
  26400. usleep(350000);
  26401. $unlinked = @$this->unlinkImplementation($path);
  26402. }
  26403. if (!$unlinked) {
  26404. $error = error_get_last();
  26405. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26406. if (Platform::isWindows()) {
  26407. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26408. }
  26409. throw new \RuntimeException($message);
  26410. }
  26411. }
  26412. return true;
  26413. }
  26414. public function rmdir($path)
  26415. {
  26416. $deleted = @rmdir($path);
  26417. if (!$deleted) {
  26418. if (Platform::isWindows()) {
  26419. usleep(350000);
  26420. $deleted = @rmdir($path);
  26421. }
  26422. if (!$deleted) {
  26423. $error = error_get_last();
  26424. $message = 'Could not delete '.$path.': ' . @$error['message'];
  26425. if (Platform::isWindows()) {
  26426. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  26427. }
  26428. throw new \RuntimeException($message);
  26429. }
  26430. }
  26431. return true;
  26432. }
  26433. public function copyThenRemove($source, $target)
  26434. {
  26435. $this->copy($source, $target);
  26436. if (!is_dir($source)) {
  26437. $this->unlink($source);
  26438. return;
  26439. }
  26440. $this->removeDirectoryPhp($source);
  26441. }
  26442. public function copy($source, $target)
  26443. {
  26444. if (!is_dir($source)) {
  26445. return copy($source, $target);
  26446. }
  26447. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  26448. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  26449. $this->ensureDirectoryExists($target);
  26450. $result = true;
  26451. foreach ($ri as $file) {
  26452. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  26453. if ($file->isDir()) {
  26454. $this->ensureDirectoryExists($targetPath);
  26455. } else {
  26456. $result = $result && copy($file->getPathname(), $targetPath);
  26457. }
  26458. }
  26459. return $result;
  26460. }
  26461. public function rename($source, $target)
  26462. {
  26463. if (true === @rename($source, $target)) {
  26464. return;
  26465. }
  26466. if (!function_exists('proc_open')) {
  26467. $this->copyThenRemove($source, $target);
  26468. return;
  26469. }
  26470. if (Platform::isWindows()) {
  26471. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26472. $result = $this->processExecutor->execute($command, $output);
  26473. clearstatcache();
  26474. if (0 === $result) {
  26475. $this->remove($source);
  26476. return;
  26477. }
  26478. } else {
  26479. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  26480. $result = $this->processExecutor->execute($command, $output);
  26481. clearstatcache();
  26482. if (0 === $result) {
  26483. return;
  26484. }
  26485. }
  26486. $this->copyThenRemove($source, $target);
  26487. }
  26488. public function findShortestPath($from, $to, $directories = false)
  26489. {
  26490. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26491. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26492. }
  26493. $from = lcfirst($this->normalizePath($from));
  26494. $to = lcfirst($this->normalizePath($to));
  26495. if ($directories) {
  26496. $from = rtrim($from, '/') . '/dummy_file';
  26497. }
  26498. if (dirname($from) === dirname($to)) {
  26499. return './'.basename($to);
  26500. }
  26501. $commonPath = $to;
  26502. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  26503. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26504. }
  26505. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  26506. return $to;
  26507. }
  26508. $commonPath = rtrim($commonPath, '/') . '/';
  26509. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  26510. $commonPathCode = str_repeat('../', $sourcePathDepth);
  26511. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  26512. }
  26513. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  26514. {
  26515. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  26516. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  26517. }
  26518. $from = lcfirst($this->normalizePath($from));
  26519. $to = lcfirst($this->normalizePath($to));
  26520. if ($from === $to) {
  26521. return $directories ? '__DIR__' : '__FILE__';
  26522. }
  26523. $commonPath = $to;
  26524. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  26525. $commonPath = strtr(dirname($commonPath), '\\', '/');
  26526. }
  26527. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  26528. return var_export($to, true);
  26529. }
  26530. $commonPath = rtrim($commonPath, '/') . '/';
  26531. if (strpos($to, $from.'/') === 0) {
  26532. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  26533. }
  26534. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  26535. if ($staticCode) {
  26536. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  26537. } else {
  26538. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  26539. }
  26540. $relTarget = substr($to, strlen($commonPath));
  26541. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  26542. }
  26543. public function isAbsolutePath($path)
  26544. {
  26545. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  26546. }
  26547. public function size($path)
  26548. {
  26549. if (!file_exists($path)) {
  26550. throw new \RuntimeException("$path does not exist.");
  26551. }
  26552. if (is_dir($path)) {
  26553. return $this->directorySize($path);
  26554. }
  26555. return filesize($path);
  26556. }
  26557. public function normalizePath($path)
  26558. {
  26559. $parts = array();
  26560. $path = strtr($path, '\\', '/');
  26561. $prefix = '';
  26562. $absolute = false;
  26563. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  26564. $prefix = $match[1];
  26565. $path = substr($path, strlen($prefix));
  26566. }
  26567. if (substr($path, 0, 1) === '/') {
  26568. $absolute = true;
  26569. $path = substr($path, 1);
  26570. }
  26571. $up = false;
  26572. foreach (explode('/', $path) as $chunk) {
  26573. if ('..' === $chunk && ($absolute || $up)) {
  26574. array_pop($parts);
  26575. $up = !(empty($parts) || '..' === end($parts));
  26576. } elseif ('.' !== $chunk && '' !== $chunk) {
  26577. $parts[] = $chunk;
  26578. $up = '..' !== $chunk;
  26579. }
  26580. }
  26581. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  26582. }
  26583. public static function isLocalPath($path)
  26584. {
  26585. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  26586. }
  26587. public static function getPlatformPath($path)
  26588. {
  26589. if (Platform::isWindows()) {
  26590. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  26591. }
  26592. return preg_replace('{^file://}i', '', $path);
  26593. }
  26594. protected function directorySize($directory)
  26595. {
  26596. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  26597. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  26598. $size = 0;
  26599. foreach ($ri as $file) {
  26600. if ($file->isFile()) {
  26601. $size += $file->getSize();
  26602. }
  26603. }
  26604. return $size;
  26605. }
  26606. protected function getProcess()
  26607. {
  26608. return $this->processExecutor;
  26609. }
  26610. private function unlinkImplementation($path)
  26611. {
  26612. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  26613. return rmdir($path);
  26614. }
  26615. return unlink($path);
  26616. }
  26617. public function relativeSymlink($target, $link)
  26618. {
  26619. $cwd = getcwd();
  26620. $relativePath = $this->findShortestPath($link, $target);
  26621. chdir(dirname($link));
  26622. $result = @symlink($relativePath, $link);
  26623. chdir($cwd);
  26624. return $result;
  26625. }
  26626. public function isSymlinkedDirectory($directory)
  26627. {
  26628. if (!is_dir($directory)) {
  26629. return false;
  26630. }
  26631. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26632. return is_link($resolved);
  26633. }
  26634. private function unlinkSymlinkedDirectory($directory)
  26635. {
  26636. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  26637. return $this->unlink($resolved);
  26638. }
  26639. private function resolveSymlinkedDirectorySymlink($pathname)
  26640. {
  26641. if (!is_dir($pathname)) {
  26642. return $pathname;
  26643. }
  26644. $resolved = rtrim($pathname, '/');
  26645. if (!strlen($resolved)) {
  26646. return $pathname;
  26647. }
  26648. return $resolved;
  26649. }
  26650. public function junction($target, $junction)
  26651. {
  26652. if (!Platform::isWindows()) {
  26653. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  26654. }
  26655. if (!is_dir($target)) {
  26656. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  26657. }
  26658. $cmd = sprintf(
  26659. 'mklink /J %s %s',
  26660. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  26661. ProcessExecutor::escape(realpath($target))
  26662. );
  26663. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  26664. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  26665. }
  26666. clearstatcache(true, $junction);
  26667. }
  26668. public function isJunction($junction)
  26669. {
  26670. if (!Platform::isWindows()) {
  26671. return false;
  26672. }
  26673. clearstatcache(true, $junction);
  26674. if (!is_dir($junction) || is_link($junction)) {
  26675. return false;
  26676. }
  26677. $stat = lstat($junction);
  26678. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  26679. }
  26680. public function removeJunction($junction)
  26681. {
  26682. if (!Platform::isWindows()) {
  26683. return false;
  26684. }
  26685. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  26686. if (!$this->isJunction($junction)) {
  26687. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  26688. }
  26689. return $this->rmdir($junction);
  26690. }
  26691. }
  26692. <?php
  26693. namespace Composer\Util;
  26694. use Composer\Config;
  26695. use Composer\IO\IOInterface;
  26696. class Git
  26697. {
  26698. private static $version = false;
  26699. protected $io;
  26700. protected $config;
  26701. protected $process;
  26702. protected $filesystem;
  26703. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  26704. {
  26705. $this->io = $io;
  26706. $this->config = $config;
  26707. $this->process = $process;
  26708. $this->filesystem = $fs;
  26709. }
  26710. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  26711. {
  26712. $this->config->prohibitUrlByConfig($url, $this->io);
  26713. if ($initialClone) {
  26714. $origCwd = $cwd;
  26715. $cwd = null;
  26716. }
  26717. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  26718. throw new \InvalidArgumentException('The source URL ' . $url . ' is invalid, ssh URLs should have a port number after ":".' . "\n" . 'Use ssh://git@example.com:22/path or just git@example.com:path if you do not want to provide a password or custom port.');
  26719. }
  26720. if (!$initialClone) {
  26721. $this->process->execute('git remote -v', $output, $cwd);
  26722. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  26723. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  26724. }
  26725. }
  26726. $protocols = $this->config->get('github-protocols');
  26727. if (!is_array($protocols)) {
  26728. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  26729. }
  26730. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  26731. $messages = array();
  26732. foreach ($protocols as $protocol) {
  26733. if ('ssh' === $protocol) {
  26734. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  26735. } else {
  26736. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  26737. }
  26738. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  26739. return;
  26740. }
  26741. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  26742. if ($initialClone) {
  26743. $this->filesystem->removeDirectory($origCwd);
  26744. }
  26745. }
  26746. if (!$this->io->hasAuthentication($match[1]) && !$this->io->isInteractive()) {
  26747. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  26748. }
  26749. }
  26750. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  26751. $command = call_user_func($commandCallable, $url);
  26752. $auth = null;
  26753. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  26754. $errorMsg = $this->process->getErrorOutput();
  26755. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  26756. || preg_match('{^https?://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26757. ) {
  26758. if (!$this->io->hasAuthentication($match[1])) {
  26759. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  26760. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  26761. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26762. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  26763. }
  26764. }
  26765. if ($this->io->hasAuthentication($match[1])) {
  26766. $auth = $this->io->getAuthentication($match[1]);
  26767. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26768. $command = call_user_func($commandCallable, $authUrl);
  26769. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26770. return;
  26771. }
  26772. $errorMsg = $this->process->getErrorOutput();
  26773. }
  26774. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  26775. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  26776. if (!$this->io->hasAuthentication($match[1])) {
  26777. $message = 'Enter your Bitbucket credentials to access private repos';
  26778. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  26779. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  26780. $accessToken = $bitbucketUtil->getToken();
  26781. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26782. }
  26783. } else {
  26784. $auth = $this->io->getAuthentication($match[1]);
  26785. if ($auth['username'] !== 'x-token-auth') {
  26786. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  26787. if (! empty($accessToken)) {
  26788. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  26789. }
  26790. }
  26791. }
  26792. if ($this->io->hasAuthentication($match[1])) {
  26793. $auth = $this->io->getAuthentication($match[1]);
  26794. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  26795. $command = call_user_func($commandCallable, $authUrl);
  26796. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26797. return;
  26798. }
  26799. $errorMsg = $this->process->getErrorOutput();
  26800. } else {
  26801. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  26802. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  26803. $command = call_user_func($commandCallable, $sshUrl);
  26804. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26805. return;
  26806. }
  26807. $errorMsg = $this->process->getErrorOutput();
  26808. }
  26809. } elseif (
  26810. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?\.git)$}i', $url, $match)
  26811. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  26812. ) {
  26813. if ($match[1] === 'git') {
  26814. $match[1] = 'https';
  26815. }
  26816. if (!$this->io->hasAuthentication($match[2])) {
  26817. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  26818. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  26819. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  26820. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  26821. }
  26822. }
  26823. if ($this->io->hasAuthentication($match[2])) {
  26824. $auth = $this->io->getAuthentication($match[2]);
  26825. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  26826. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  26827. } else {
  26828. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  26829. }
  26830. $command = call_user_func($commandCallable, $authUrl);
  26831. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26832. return;
  26833. }
  26834. $errorMsg = $this->process->getErrorOutput();
  26835. }
  26836. } elseif ($this->isAuthenticationFailure($url, $match)) {
  26837. if (strpos($match[2], '@')) {
  26838. list($authParts, $match[2]) = explode('@', $match[2], 2);
  26839. }
  26840. $storeAuth = false;
  26841. if ($this->io->hasAuthentication($match[2])) {
  26842. $auth = $this->io->getAuthentication($match[2]);
  26843. } elseif ($this->io->isInteractive()) {
  26844. $defaultUsername = null;
  26845. if (isset($authParts) && $authParts) {
  26846. if (false !== strpos($authParts, ':')) {
  26847. list($defaultUsername, ) = explode(':', $authParts, 2);
  26848. } else {
  26849. $defaultUsername = $authParts;
  26850. }
  26851. }
  26852. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  26853. $auth = array(
  26854. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  26855. 'password' => $this->io->askAndHideAnswer(' Password: '),
  26856. );
  26857. $storeAuth = $this->config->get('store-auths');
  26858. }
  26859. if ($auth) {
  26860. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  26861. $command = call_user_func($commandCallable, $authUrl);
  26862. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26863. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  26864. $authHelper = new AuthHelper($this->io, $this->config);
  26865. $authHelper->storeAuth($match[2], $storeAuth);
  26866. return;
  26867. }
  26868. $errorMsg = $this->process->getErrorOutput();
  26869. }
  26870. }
  26871. if ($initialClone) {
  26872. $this->filesystem->removeDirectory($origCwd);
  26873. }
  26874. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  26875. }
  26876. }
  26877. public function syncMirror($url, $dir)
  26878. {
  26879. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26880. try {
  26881. $commandCallable = function ($url) {
  26882. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  26883. return sprintf('git remote set-url origin %s && git remote update --prune origin && git remote set-url origin %s', ProcessExecutor::escape($url), ProcessExecutor::escape($sanitizedUrl));
  26884. };
  26885. $this->runCommand($commandCallable, $url, $dir);
  26886. } catch (\Exception $e) {
  26887. $this->io->writeError('<error>Sync mirror failed: ' . $e->getMessage() . '</error>', true, IOInterface::DEBUG);
  26888. return false;
  26889. }
  26890. return true;
  26891. }
  26892. $this->filesystem->removeDirectory($dir);
  26893. $commandCallable = function ($url) use ($dir) {
  26894. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  26895. };
  26896. $this->runCommand($commandCallable, $url, $dir, true);
  26897. return true;
  26898. }
  26899. public function fetchRefOrSyncMirror($url, $dir, $ref)
  26900. {
  26901. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  26902. return true;
  26903. }
  26904. if ($this->syncMirror($url, $dir)) {
  26905. return $this->checkRefIsInMirror($url, $dir, $ref);
  26906. }
  26907. return false;
  26908. }
  26909. public static function getNoShowSignatureFlag(ProcessExecutor $process)
  26910. {
  26911. $gitVersion = self::getVersion($process);
  26912. if ($gitVersion && version_compare($gitVersion, '2.10.0-rc0', '>=')) {
  26913. return ' --no-show-signature';
  26914. }
  26915. return '';
  26916. }
  26917. private function checkRefIsInMirror($url, $dir, $ref)
  26918. {
  26919. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  26920. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  26921. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  26922. if ($exitCode === 0) {
  26923. return true;
  26924. }
  26925. }
  26926. return false;
  26927. }
  26928. private function isAuthenticationFailure($url, &$match)
  26929. {
  26930. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  26931. return false;
  26932. }
  26933. $authFailures = array(
  26934. 'fatal: Authentication failed',
  26935. 'remote error: Invalid username or password.',
  26936. 'error: 401 Unauthorized',
  26937. 'fatal: unable to access',
  26938. 'fatal: could not read Username',
  26939. );
  26940. $errorOutput = $this->process->getErrorOutput();
  26941. foreach ($authFailures as $authFailure) {
  26942. if (strpos($errorOutput, $authFailure) !== false) {
  26943. return true;
  26944. }
  26945. }
  26946. return false;
  26947. }
  26948. public static function cleanEnv()
  26949. {
  26950. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  26951. throw new \RuntimeException('safe_mode is enabled and safe_mode_allowed_env_vars does not contain GIT_ASKPASS, can not set env var. You can disable safe_mode with "-dsafe_mode=0" when running composer');
  26952. }
  26953. if (getenv('GIT_ASKPASS') !== 'echo') {
  26954. putenv('GIT_ASKPASS=echo');
  26955. unset($_SERVER['GIT_ASKPASS']);
  26956. }
  26957. if (getenv('GIT_DIR')) {
  26958. putenv('GIT_DIR');
  26959. unset($_SERVER['GIT_DIR']);
  26960. }
  26961. if (getenv('GIT_WORK_TREE')) {
  26962. putenv('GIT_WORK_TREE');
  26963. unset($_SERVER['GIT_WORK_TREE']);
  26964. }
  26965. if (getenv('LANGUAGE') !== 'C') {
  26966. putenv('LANGUAGE=C');
  26967. }
  26968. putenv("DYLD_LIBRARY_PATH");
  26969. unset($_SERVER['DYLD_LIBRARY_PATH']);
  26970. }
  26971. public static function getGitHubDomainsRegex(Config $config)
  26972. {
  26973. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  26974. }
  26975. public static function getGitLabDomainsRegex(Config $config)
  26976. {
  26977. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  26978. }
  26979. public static function sanitizeUrl($message)
  26980. {
  26981. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26982. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26983. return '://***:***@';
  26984. }
  26985. return '://' . $m[1] . ':***@';
  26986. }, $message);
  26987. }
  26988. private function throwException($message, $url)
  26989. {
  26990. clearstatcache();
  26991. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  26992. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', git was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  26993. }
  26994. throw new \RuntimeException(self::sanitizeUrl($message));
  26995. }
  26996. public static function getVersion(ProcessExecutor $process = null)
  26997. {
  26998. if (false === self::$version) {
  26999. self::$version = null;
  27000. if (!$process) {
  27001. $process = new ProcessExecutor;
  27002. }
  27003. if (0 === $process->execute('git --version', $output) && preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  27004. self::$version = $matches[1];
  27005. }
  27006. }
  27007. return self::$version;
  27008. }
  27009. }
  27010. <?php
  27011. namespace Composer\Util;
  27012. use Composer\Factory;
  27013. use Composer\IO\IOInterface;
  27014. use Composer\Config;
  27015. use Composer\Downloader\TransportException;
  27016. class GitHub
  27017. {
  27018. protected $io;
  27019. protected $config;
  27020. protected $process;
  27021. protected $remoteFilesystem;
  27022. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  27023. {
  27024. $this->io = $io;
  27025. $this->config = $config;
  27026. $this->process = $process ?: new ProcessExecutor($io);
  27027. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27028. }
  27029. public function authorizeOAuth($originUrl)
  27030. {
  27031. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  27032. return false;
  27033. }
  27034. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  27035. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  27036. return true;
  27037. }
  27038. return false;
  27039. }
  27040. public function authorizeOAuthInteractively($originUrl, $message = null)
  27041. {
  27042. if ($message) {
  27043. $this->io->writeError($message);
  27044. }
  27045. $note = 'Composer';
  27046. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  27047. $note .= ' on ' . trim($output);
  27048. }
  27049. $note .= ' ' . date('Y-m-d Hi');
  27050. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  27051. $this->io->writeError(sprintf('Head to %s', $url));
  27052. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  27053. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  27054. if (!$token) {
  27055. $this->io->writeError('<warning>No token given, aborting.</warning>');
  27056. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27057. return false;
  27058. }
  27059. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  27060. try {
  27061. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  27062. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  27063. 'retry-auth-failure' => false,
  27064. ));
  27065. } catch (TransportException $e) {
  27066. if (in_array($e->getCode(), array(403, 401))) {
  27067. $this->io->writeError('<error>Invalid token provided.</error>');
  27068. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  27069. return false;
  27070. }
  27071. throw $e;
  27072. }
  27073. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  27074. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  27075. $this->io->writeError('<info>Token stored successfully.</info>');
  27076. return true;
  27077. }
  27078. public function getRateLimit(array $headers)
  27079. {
  27080. $rateLimit = array(
  27081. 'limit' => '?',
  27082. 'reset' => '?',
  27083. );
  27084. foreach ($headers as $header) {
  27085. $header = trim($header);
  27086. if (false === strpos($header, 'X-RateLimit-')) {
  27087. continue;
  27088. }
  27089. list($type, $value) = explode(':', $header, 2);
  27090. switch ($type) {
  27091. case 'X-RateLimit-Limit':
  27092. $rateLimit['limit'] = (int) trim($value);
  27093. break;
  27094. case 'X-RateLimit-Reset':
  27095. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  27096. break;
  27097. }
  27098. }
  27099. return $rateLimit;
  27100. }
  27101. public function isRateLimited(array $headers)
  27102. {
  27103. foreach ($headers as $header) {
  27104. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  27105. return true;
  27106. }
  27107. }
  27108. return false;
  27109. }
  27110. }
  27111. <?php
  27112. namespace Composer\Util;
  27113. use Composer\IO\IOInterface;
  27114. use Composer\Config;
  27115. use Composer\Factory;
  27116. use Composer\Downloader\TransportException;
  27117. use Composer\Json\JsonFile;
  27118. class GitLab
  27119. {
  27120. protected $io;
  27121. protected $config;
  27122. protected $process;
  27123. protected $remoteFilesystem;
  27124. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  27125. {
  27126. $this->io = $io;
  27127. $this->config = $config;
  27128. $this->process = $process ?: new ProcessExecutor($io);
  27129. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  27130. }
  27131. public function authorizeOAuth($originUrl)
  27132. {
  27133. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  27134. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  27135. return false;
  27136. }
  27137. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  27138. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  27139. return true;
  27140. }
  27141. $authTokens = $this->config->get('gitlab-token');
  27142. if (isset($authTokens[$originUrl])) {
  27143. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  27144. return true;
  27145. }
  27146. if (isset($authTokens[$bcOriginUrl])) {
  27147. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  27148. return true;
  27149. }
  27150. return false;
  27151. }
  27152. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  27153. {
  27154. if ($message) {
  27155. $this->io->writeError($message);
  27156. }
  27157. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  27158. $this->io->writeError('To revoke access to this token you can visit '.$scheme.'://'.$originUrl.'/profile/applications');
  27159. $attemptCounter = 0;
  27160. while ($attemptCounter++ < 5) {
  27161. try {
  27162. $response = $this->createToken($scheme, $originUrl);
  27163. } catch (TransportException $e) {
  27164. if (in_array($e->getCode(), array(403, 401))) {
  27165. if (401 === $e->getCode()) {
  27166. $response = json_decode($e->getResponse(), true);
  27167. if (isset($response['error']) && $response['error'] === 'invalid_grant') {
  27168. $this->io->writeError('Bad credentials. If you have two factor authentication enabled you will have to manually create a personal access token');
  27169. } else {
  27170. $this->io->writeError('Bad credentials.');
  27171. }
  27172. } else {
  27173. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  27174. }
  27175. $this->io->writeError('You can also manually create a personal access token enabling the "read_api" scope at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  27176. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  27177. continue;
  27178. }
  27179. throw $e;
  27180. }
  27181. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  27182. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  27183. return true;
  27184. }
  27185. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  27186. }
  27187. private function createToken($scheme, $originUrl)
  27188. {
  27189. $username = $this->io->ask('Username: ');
  27190. $password = $this->io->askAndHideAnswer('Password: ');
  27191. $headers = array('Content-Type: application/x-www-form-urlencoded');
  27192. $apiUrl = $originUrl;
  27193. $data = http_build_query(array(
  27194. 'username' => $username,
  27195. 'password' => $password,
  27196. 'grant_type' => 'password',
  27197. ), null, '&');
  27198. $options = array(
  27199. 'retry-auth-failure' => false,
  27200. 'http' => array(
  27201. 'method' => 'POST',
  27202. 'header' => $headers,
  27203. 'content' => $data,
  27204. ),
  27205. );
  27206. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  27207. $this->io->writeError('Token successfully created');
  27208. return JsonFile::parseJson($json);
  27209. }
  27210. }
  27211. <?php
  27212. namespace Composer\Util;
  27213. use Composer\Config;
  27214. use Composer\IO\IOInterface;
  27215. class Hg
  27216. {
  27217. private $io;
  27218. private $config;
  27219. private $process;
  27220. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  27221. {
  27222. $this->io = $io;
  27223. $this->config = $config;
  27224. $this->process = $process;
  27225. }
  27226. public function runCommand($commandCallable, $url, $cwd)
  27227. {
  27228. $this->config->prohibitUrlByConfig($url, $this->io);
  27229. $command = call_user_func($commandCallable, $url);
  27230. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27231. return;
  27232. }
  27233. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  27234. $auth = $this->io->getAuthentication($match[5]);
  27235. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  27236. $command = call_user_func($commandCallable, $authenticatedUrl);
  27237. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  27238. return;
  27239. }
  27240. $error = $this->process->getErrorOutput();
  27241. } else {
  27242. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  27243. }
  27244. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  27245. }
  27246. public static function sanitizeUrl($message)
  27247. {
  27248. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  27249. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  27250. return '://***:***@';
  27251. }
  27252. return '://' . $m[1] . ':***@';
  27253. }, $message);
  27254. }
  27255. private function throwException($message, $url)
  27256. {
  27257. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  27258. throw new \RuntimeException(self::sanitizeUrl('Failed to clone ' . $url . ', hg was not found, check that it is installed and in your PATH env.' . "\n\n" . $this->process->getErrorOutput()));
  27259. }
  27260. throw new \RuntimeException(self::sanitizeUrl($message));
  27261. }
  27262. }
  27263. <?php
  27264. namespace Composer\Util;
  27265. use Composer\XdebugHandler\XdebugHandler;
  27266. class IniHelper
  27267. {
  27268. public static function getAll()
  27269. {
  27270. return XdebugHandler::getAllIniFiles();
  27271. }
  27272. public static function getMessage()
  27273. {
  27274. $paths = self::getAll();
  27275. if (empty($paths[0])) {
  27276. array_shift($paths);
  27277. }
  27278. $ini = array_shift($paths);
  27279. if (empty($ini)) {
  27280. return 'A php.ini file does not exist. You will have to create one.';
  27281. }
  27282. if (!empty($paths)) {
  27283. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  27284. }
  27285. return 'The php.ini used by your command-line PHP is: '.$ini;
  27286. }
  27287. }
  27288. <?php
  27289. namespace Composer\Util;
  27290. use stdClass;
  27291. class NoProxyPattern
  27292. {
  27293. protected $hostNames = array();
  27294. protected $rules = array();
  27295. protected $noproxy;
  27296. public function __construct($pattern)
  27297. {
  27298. $this->hostNames = preg_split('{[\s,]+}', $pattern, null, PREG_SPLIT_NO_EMPTY);
  27299. $this->noproxy = empty($this->hostNames) || '*' === $this->hostNames[0];
  27300. }
  27301. public function test($url)
  27302. {
  27303. if ($this->noproxy) {
  27304. return true;
  27305. }
  27306. if (!$urlData = $this->getUrlData($url)) {
  27307. return false;
  27308. }
  27309. foreach ($this->hostNames as $index => $hostName) {
  27310. if ($this->match($index, $hostName, $urlData)) {
  27311. return true;
  27312. }
  27313. }
  27314. return false;
  27315. }
  27316. protected function getUrlData($url)
  27317. {
  27318. if (!$host = parse_url($url, PHP_URL_HOST)) {
  27319. return false;
  27320. }
  27321. $port = parse_url($url, PHP_URL_PORT);
  27322. if (empty($port)) {
  27323. switch (parse_url($url, PHP_URL_SCHEME)) {
  27324. case 'http':
  27325. $port = 80;
  27326. break;
  27327. case 'https':
  27328. $port = 443;
  27329. break;
  27330. }
  27331. }
  27332. $hostName = $host . ($port ? ':' . $port : '');
  27333. list($host, $port, $err) = $this->splitHostPort($hostName);
  27334. if ($err || !$this->ipCheckData($host, $ipdata)) {
  27335. return false;
  27336. }
  27337. return $this->makeData($host, $port, $ipdata);
  27338. }
  27339. protected function match($index, $hostName, $url)
  27340. {
  27341. if (!$rule = $this->getRule($index, $hostName)) {
  27342. return false;
  27343. }
  27344. if ($rule->ipdata) {
  27345. if (!$url->ipdata) {
  27346. return false;
  27347. }
  27348. if ($rule->ipdata->netmask) {
  27349. return $this->matchRange($rule->ipdata, $url->ipdata);
  27350. }
  27351. $match = $rule->ipdata->ip === $url->ipdata->ip;
  27352. } else {
  27353. $haystack = substr($url->name, - strlen($rule->name));
  27354. $match = stripos($haystack, $rule->name) === 0;
  27355. }
  27356. if ($match && $rule->port) {
  27357. $match = $rule->port === $url->port;
  27358. }
  27359. return $match;
  27360. }
  27361. protected function matchRange(stdClass $network, stdClass $target)
  27362. {
  27363. $net = unpack('C*', $network->ip);
  27364. $mask = unpack('C*', $network->netmask);
  27365. $ip = unpack('C*', $target->ip);
  27366. for ($i = 1; $i < 17; ++$i) {
  27367. if (($net[$i] & $mask[$i]) !== ($ip[$i] & $mask[$i])) {
  27368. return false;
  27369. }
  27370. }
  27371. return true;
  27372. }
  27373. private function getRule($index, $hostName)
  27374. {
  27375. if (array_key_exists($index, $this->rules)) {
  27376. return $this->rules[$index];
  27377. }
  27378. $this->rules[$index] = null;
  27379. list($host, $port, $err) = $this->splitHostPort($hostName);
  27380. if ($err || !$this->ipCheckData($host, $ipdata, true)) {
  27381. return null;
  27382. }
  27383. $this->rules[$index] = $this->makeData($host, $port, $ipdata);
  27384. return $this->rules[$index];
  27385. }
  27386. private function ipCheckData($host, &$ipdata, $allowPrefix = false)
  27387. {
  27388. $ipdata = null;
  27389. $netmask = null;
  27390. $prefix = null;
  27391. $modified = false;
  27392. if (strpos($host, '/') !== false) {
  27393. list($host, $prefix) = explode('/', $host);
  27394. if (!$allowPrefix || !$this->validateInt($prefix, 0, 128)) {
  27395. return false;
  27396. }
  27397. $prefix = (int) $prefix;
  27398. $modified = true;
  27399. }
  27400. if (!filter_var($host, FILTER_VALIDATE_IP)) {
  27401. return !$modified;
  27402. }
  27403. list($ip, $size) = $this->ipGetAddr($host);
  27404. if ($prefix !== null) {
  27405. if ($prefix > $size * 8) {
  27406. return false;
  27407. }
  27408. list($ip, $netmask) = $this->ipGetNetwork($ip, $size, $prefix);
  27409. }
  27410. $ipdata = $this->makeIpData($ip, $size, $netmask);
  27411. return true;
  27412. }
  27413. private function ipGetAddr($host)
  27414. {
  27415. $ip = inet_pton($host);
  27416. $size = strlen($ip);
  27417. $mapped = $this->ipMapTo6($ip, $size);
  27418. return array($mapped, $size);
  27419. }
  27420. private function ipGetMask($prefix, $size)
  27421. {
  27422. $mask = '';
  27423. if ($ones = floor($prefix / 8)) {
  27424. $mask = str_repeat(chr(255), $ones);
  27425. }
  27426. if ($remainder = $prefix % 8) {
  27427. $mask .= chr(0xff ^ (0xff >> $remainder));
  27428. }
  27429. $mask = str_pad($mask, $size, chr(0));
  27430. return $this->ipMapTo6($mask, $size);
  27431. }
  27432. private function ipGetNetwork($rangeIp, $size, $prefix)
  27433. {
  27434. $netmask = $this->ipGetMask($prefix, $size);
  27435. $mask = unpack('C*', $netmask);
  27436. $ip = unpack('C*', $rangeIp);
  27437. $net = '';
  27438. for ($i = 1; $i < 17; ++$i) {
  27439. $net .= chr($ip[$i] & $mask[$i]);
  27440. }
  27441. return array($net, $netmask);
  27442. }
  27443. private function ipMapTo6($binary, $size)
  27444. {
  27445. if ($size === 4) {
  27446. $prefix = str_repeat(chr(0), 10) . str_repeat(chr(255), 2);
  27447. $binary = $prefix . $binary;
  27448. }
  27449. return $binary;
  27450. }
  27451. private function makeData($host, $port, $ipdata)
  27452. {
  27453. return (object) array(
  27454. 'host' => $host,
  27455. 'name' => '.' . ltrim($host, '.'),
  27456. 'port' => $port,
  27457. 'ipdata' => $ipdata,
  27458. );
  27459. }
  27460. private function makeIpData($ip, $size, $netmask)
  27461. {
  27462. return (object) array(
  27463. 'ip' => $ip,
  27464. 'size' => $size,
  27465. 'netmask' => $netmask,
  27466. );
  27467. }
  27468. private function splitHostPort($hostName)
  27469. {
  27470. $error = array('', '', true);
  27471. $port = 0;
  27472. $ip6 = '';
  27473. if ($hostName[0] === '[') {
  27474. $index = strpos($hostName, ']');
  27475. if (false === $index || $index < 3) {
  27476. return $error;
  27477. }
  27478. $ip6 = substr($hostName, 1, $index - 1);
  27479. $hostName = substr($hostName, $index + 1);
  27480. if (strpbrk($hostName, '[]') !== false
  27481. || substr_count($hostName, ':') > 1) {
  27482. return $error;
  27483. }
  27484. }
  27485. if (substr_count($hostName, ':') === 1) {
  27486. $index = strpos($hostName, ':');
  27487. $port = substr($hostName, $index + 1);
  27488. $hostName = substr($hostName, 0, $index);
  27489. if (!$this->validateInt($port, 1, 65535)) {
  27490. return $error;
  27491. }
  27492. $port = (int) $port;
  27493. }
  27494. $host = $ip6 . $hostName;
  27495. return array($host, $port, false);
  27496. }
  27497. private function validateInt($int, $min, $max)
  27498. {
  27499. $options = array(
  27500. 'options' => array(
  27501. 'min_range' => $min,
  27502. 'max_range' => $max)
  27503. );
  27504. return false !== filter_var($int, FILTER_VALIDATE_INT, $options);
  27505. }
  27506. }
  27507. <?php
  27508. namespace Composer\Util;
  27509. use Composer\Package\Link;
  27510. use Composer\Package\PackageInterface;
  27511. class PackageSorter
  27512. {
  27513. public static function sortPackages(array $packages) {
  27514. $usageList = array();
  27515. foreach ($packages as $package) {
  27516. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  27517. $target = $link->getTarget();
  27518. $usageList[$target][] = $package->getName();
  27519. }
  27520. }
  27521. $computing = array();
  27522. $computed = array();
  27523. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  27524. if (isset($computed[$name])) {
  27525. return $computed[$name];
  27526. }
  27527. if (isset($computing[$name])) {
  27528. return 0;
  27529. }
  27530. $computing[$name] = true;
  27531. $weight = 0;
  27532. if (isset($usageList[$name])) {
  27533. foreach ($usageList[$name] as $user) {
  27534. $weight -= 1 - $computeImportance($user);
  27535. }
  27536. }
  27537. unset($computing[$name]);
  27538. $computed[$name] = $weight;
  27539. return $weight;
  27540. };
  27541. $weightList = array();
  27542. foreach ($packages as $name => $package) {
  27543. $weight = $computeImportance($name);
  27544. $weightList[$name] = $weight;
  27545. }
  27546. $stable_sort = function (&$array) {
  27547. static $transform, $restore;
  27548. $i = 0;
  27549. if (!$transform) {
  27550. $transform = function (&$v, $k) use (&$i) {
  27551. $v = array($v, ++$i, $k, $v);
  27552. };
  27553. $restore = function (&$v) {
  27554. $v = $v[3];
  27555. };
  27556. }
  27557. array_walk($array, $transform);
  27558. asort($array);
  27559. array_walk($array, $restore);
  27560. };
  27561. $stable_sort($weightList);
  27562. $sortedPackages = array();
  27563. foreach (array_keys($weightList) as $name) {
  27564. $sortedPackages[] = $packages[$name];
  27565. }
  27566. return $sortedPackages;
  27567. }
  27568. }
  27569. <?php
  27570. namespace Composer\Util;
  27571. use Composer\IO\IOInterface;
  27572. use Symfony\Component\Process\Process;
  27573. class Perforce
  27574. {
  27575. protected $path;
  27576. protected $p4Depot;
  27577. protected $p4Client;
  27578. protected $p4User;
  27579. protected $p4Password;
  27580. protected $p4Port;
  27581. protected $p4Stream;
  27582. protected $p4ClientSpec;
  27583. protected $p4DepotType;
  27584. protected $p4Branch;
  27585. protected $process;
  27586. protected $uniquePerforceClientName;
  27587. protected $windowsFlag;
  27588. protected $commandResult;
  27589. protected $io;
  27590. protected $filesystem;
  27591. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  27592. {
  27593. $this->windowsFlag = $isWindows;
  27594. $this->p4Port = $port;
  27595. $this->initializePath($path);
  27596. $this->process = $process;
  27597. $this->initialize($repoConfig);
  27598. $this->io = $io;
  27599. }
  27600. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  27601. {
  27602. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  27603. }
  27604. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  27605. {
  27606. $output = null;
  27607. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  27608. }
  27609. public function initialize($repoConfig)
  27610. {
  27611. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  27612. if (!$repoConfig) {
  27613. return;
  27614. }
  27615. if (isset($repoConfig['unique_perforce_client_name'])) {
  27616. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  27617. }
  27618. if (isset($repoConfig['depot'])) {
  27619. $this->p4Depot = $repoConfig['depot'];
  27620. }
  27621. if (isset($repoConfig['branch'])) {
  27622. $this->p4Branch = $repoConfig['branch'];
  27623. }
  27624. if (isset($repoConfig['p4user'])) {
  27625. $this->p4User = $repoConfig['p4user'];
  27626. } else {
  27627. $this->p4User = $this->getP4variable('P4USER');
  27628. }
  27629. if (isset($repoConfig['p4password'])) {
  27630. $this->p4Password = $repoConfig['p4password'];
  27631. }
  27632. }
  27633. public function initializeDepotAndBranch($depot, $branch)
  27634. {
  27635. if (isset($depot)) {
  27636. $this->p4Depot = $depot;
  27637. }
  27638. if (isset($branch)) {
  27639. $this->p4Branch = $branch;
  27640. }
  27641. }
  27642. public function generateUniquePerforceClientName()
  27643. {
  27644. return gethostname() . "_" . time();
  27645. }
  27646. public function cleanupClientSpec()
  27647. {
  27648. $client = $this->getClient();
  27649. $task = 'client -d ' . ProcessExecutor::escape($client);
  27650. $useP4Client = false;
  27651. $command = $this->generateP4Command($task, $useP4Client);
  27652. $this->executeCommand($command);
  27653. $clientSpec = $this->getP4ClientSpec();
  27654. $fileSystem = $this->getFilesystem();
  27655. $fileSystem->remove($clientSpec);
  27656. }
  27657. protected function executeCommand($command)
  27658. {
  27659. $this->commandResult = '';
  27660. return $this->process->execute($command, $this->commandResult);
  27661. }
  27662. public function getClient()
  27663. {
  27664. if (!isset($this->p4Client)) {
  27665. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  27666. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  27667. }
  27668. return $this->p4Client;
  27669. }
  27670. protected function getPath()
  27671. {
  27672. return $this->path;
  27673. }
  27674. public function initializePath($path)
  27675. {
  27676. $this->path = $path;
  27677. $fs = $this->getFilesystem();
  27678. $fs->ensureDirectoryExists($path);
  27679. }
  27680. protected function getPort()
  27681. {
  27682. return $this->p4Port;
  27683. }
  27684. public function setStream($stream)
  27685. {
  27686. $this->p4Stream = $stream;
  27687. $index = strrpos($stream, '/');
  27688. if ($index > 2) {
  27689. $this->p4DepotType = 'stream';
  27690. }
  27691. }
  27692. public function isStream()
  27693. {
  27694. return (strcmp($this->p4DepotType, 'stream') === 0);
  27695. }
  27696. public function getStream()
  27697. {
  27698. if (!isset($this->p4Stream)) {
  27699. if ($this->isStream()) {
  27700. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  27701. } else {
  27702. $this->p4Stream = '//' . $this->p4Depot;
  27703. }
  27704. }
  27705. return $this->p4Stream;
  27706. }
  27707. public function getStreamWithoutLabel($stream)
  27708. {
  27709. $index = strpos($stream, '@');
  27710. if ($index === false) {
  27711. return $stream;
  27712. }
  27713. return substr($stream, 0, $index);
  27714. }
  27715. public function getP4ClientSpec()
  27716. {
  27717. return $this->path . '/' . $this->getClient() . '.p4.spec';
  27718. }
  27719. public function getUser()
  27720. {
  27721. return $this->p4User;
  27722. }
  27723. public function setUser($user)
  27724. {
  27725. $this->p4User = $user;
  27726. }
  27727. public function queryP4User()
  27728. {
  27729. $this->getUser();
  27730. if (strlen($this->p4User) > 0) {
  27731. return;
  27732. }
  27733. $this->p4User = $this->getP4variable('P4USER');
  27734. if (strlen($this->p4User) > 0) {
  27735. return;
  27736. }
  27737. $this->p4User = $this->io->ask('Enter P4 User:');
  27738. if ($this->windowsFlag) {
  27739. $command = 'p4 set P4USER=' . $this->p4User;
  27740. } else {
  27741. $command = 'export P4USER=' . $this->p4User;
  27742. }
  27743. $this->executeCommand($command);
  27744. }
  27745. protected function getP4variable($name)
  27746. {
  27747. if ($this->windowsFlag) {
  27748. $command = 'p4 set';
  27749. $this->executeCommand($command);
  27750. $result = trim($this->commandResult);
  27751. $resArray = explode(PHP_EOL, $result);
  27752. foreach ($resArray as $line) {
  27753. $fields = explode('=', $line);
  27754. if (strcmp($name, $fields[0]) == 0) {
  27755. $index = strpos($fields[1], ' ');
  27756. if ($index === false) {
  27757. $value = $fields[1];
  27758. } else {
  27759. $value = substr($fields[1], 0, $index);
  27760. }
  27761. $value = trim($value);
  27762. return $value;
  27763. }
  27764. }
  27765. return null;
  27766. }
  27767. $command = 'echo $' . $name;
  27768. $this->executeCommand($command);
  27769. $result = trim($this->commandResult);
  27770. return $result;
  27771. }
  27772. public function queryP4Password()
  27773. {
  27774. if (isset($this->p4Password)) {
  27775. return $this->p4Password;
  27776. }
  27777. $password = $this->getP4variable('P4PASSWD');
  27778. if (strlen($password) <= 0) {
  27779. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  27780. }
  27781. $this->p4Password = $password;
  27782. return $password;
  27783. }
  27784. public function generateP4Command($command, $useClient = true)
  27785. {
  27786. $p4Command = 'p4 ';
  27787. $p4Command .= '-u ' . $this->getUser() . ' ';
  27788. if ($useClient) {
  27789. $p4Command .= '-c ' . $this->getClient() . ' ';
  27790. }
  27791. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  27792. return $p4Command;
  27793. }
  27794. public function isLoggedIn()
  27795. {
  27796. $command = $this->generateP4Command('login -s', false);
  27797. $exitCode = $this->executeCommand($command);
  27798. if ($exitCode) {
  27799. $errorOutput = $this->process->getErrorOutput();
  27800. $index = strpos($errorOutput, $this->getUser());
  27801. if ($index === false) {
  27802. $index = strpos($errorOutput, 'p4');
  27803. if ($index === false) {
  27804. return false;
  27805. }
  27806. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  27807. }
  27808. throw new \Exception('Invalid user name: ' . $this->getUser());
  27809. }
  27810. return true;
  27811. }
  27812. public function connectClient()
  27813. {
  27814. $p4CreateClientCommand = $this->generateP4Command(
  27815. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  27816. );
  27817. $this->executeCommand($p4CreateClientCommand);
  27818. }
  27819. public function syncCodeBase($sourceReference)
  27820. {
  27821. $prevDir = getcwd();
  27822. chdir($this->path);
  27823. $p4SyncCommand = $this->generateP4Command('sync -f ');
  27824. if (null !== $sourceReference) {
  27825. $p4SyncCommand .= '@' . $sourceReference;
  27826. }
  27827. $this->executeCommand($p4SyncCommand);
  27828. chdir($prevDir);
  27829. }
  27830. public function writeClientSpecToFile($spec)
  27831. {
  27832. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  27833. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  27834. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  27835. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  27836. fwrite($spec, 'Description:' . PHP_EOL);
  27837. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  27838. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  27839. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  27840. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  27841. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  27842. if ($this->isStream()) {
  27843. fwrite($spec, 'Stream:' . PHP_EOL);
  27844. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  27845. } else {
  27846. fwrite(
  27847. $spec,
  27848. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  27849. );
  27850. }
  27851. }
  27852. public function writeP4ClientSpec()
  27853. {
  27854. $clientSpec = $this->getP4ClientSpec();
  27855. $spec = fopen($clientSpec, 'w');
  27856. try {
  27857. $this->writeClientSpecToFile($spec);
  27858. } catch (\Exception $e) {
  27859. fclose($spec);
  27860. throw $e;
  27861. }
  27862. fclose($spec);
  27863. }
  27864. protected function read($pipe, $name)
  27865. {
  27866. if (feof($pipe)) {
  27867. return;
  27868. }
  27869. $line = fgets($pipe);
  27870. while ($line !== false) {
  27871. $line = fgets($pipe);
  27872. }
  27873. }
  27874. public function windowsLogin($password)
  27875. {
  27876. $command = $this->generateP4Command(' login -a');
  27877. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  27878. $process = Process::fromShellCommandline($command, null, null, $password);
  27879. } else {
  27880. $process = new Process($command, null, null, $password);
  27881. }
  27882. return $process->run();
  27883. }
  27884. public function p4Login()
  27885. {
  27886. $this->queryP4User();
  27887. if (!$this->isLoggedIn()) {
  27888. $password = $this->queryP4Password();
  27889. if ($this->windowsFlag) {
  27890. $this->windowsLogin($password);
  27891. } else {
  27892. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  27893. $exitCode = $this->executeCommand($command);
  27894. $result = trim($this->commandResult);
  27895. if ($exitCode) {
  27896. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  27897. }
  27898. }
  27899. }
  27900. }
  27901. public function getComposerInformation($identifier)
  27902. {
  27903. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  27904. if (!$composerFileContent) {
  27905. return;
  27906. }
  27907. return json_decode($composerFileContent, true);
  27908. }
  27909. public function getFileContent($file, $identifier)
  27910. {
  27911. $path = $this->getFilePath($file, $identifier);
  27912. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  27913. $this->executeCommand($command);
  27914. $result = $this->commandResult;
  27915. if (!trim($result)) {
  27916. return null;
  27917. }
  27918. return $result;
  27919. }
  27920. public function getFilePath($file, $identifier)
  27921. {
  27922. $index = strpos($identifier, '@');
  27923. if ($index === false) {
  27924. $path = $identifier. '/' . $file;
  27925. return $path;
  27926. }
  27927. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  27928. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  27929. $this->executeCommand($command);
  27930. $result = $this->commandResult;
  27931. $index2 = strpos($result, 'no such file(s).');
  27932. if ($index2 === false) {
  27933. $index3 = strpos($result, 'change');
  27934. if ($index3 !== false) {
  27935. $phrase = trim(substr($result, $index3));
  27936. $fields = explode(' ', $phrase);
  27937. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  27938. }
  27939. }
  27940. return null;
  27941. }
  27942. public function getBranches()
  27943. {
  27944. $possibleBranches = array();
  27945. if (!$this->isStream()) {
  27946. $possibleBranches[$this->p4Branch] = $this->getStream();
  27947. } else {
  27948. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  27949. $this->executeCommand($command);
  27950. $result = $this->commandResult;
  27951. $resArray = explode(PHP_EOL, $result);
  27952. foreach ($resArray as $line) {
  27953. $resBits = explode(' ', $line);
  27954. if (count($resBits) > 4) {
  27955. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  27956. $possibleBranches[$branch] = $resBits[1];
  27957. }
  27958. }
  27959. }
  27960. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  27961. $this->executeCommand($command);
  27962. $result = $this->commandResult;
  27963. $resArray = explode(PHP_EOL, $result);
  27964. $lastCommit = $resArray[0];
  27965. $lastCommitArr = explode(' ', $lastCommit);
  27966. $lastCommitNum = $lastCommitArr[1];
  27967. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  27968. return $branches;
  27969. }
  27970. public function getTags()
  27971. {
  27972. $command = $this->generateP4Command('labels');
  27973. $this->executeCommand($command);
  27974. $result = $this->commandResult;
  27975. $resArray = explode(PHP_EOL, $result);
  27976. $tags = array();
  27977. foreach ($resArray as $line) {
  27978. if (strpos($line, 'Label') !== false) {
  27979. $fields = explode(' ', $line);
  27980. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  27981. }
  27982. }
  27983. return $tags;
  27984. }
  27985. public function checkStream()
  27986. {
  27987. $command = $this->generateP4Command('depots', false);
  27988. $this->executeCommand($command);
  27989. $result = $this->commandResult;
  27990. $resArray = explode(PHP_EOL, $result);
  27991. foreach ($resArray as $line) {
  27992. if (strpos($line, 'Depot') !== false) {
  27993. $fields = explode(' ', $line);
  27994. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  27995. $this->p4DepotType = $fields[3];
  27996. return $this->isStream();
  27997. }
  27998. }
  27999. }
  28000. return false;
  28001. }
  28002. protected function getChangeList($reference)
  28003. {
  28004. $index = strpos($reference, '@');
  28005. if ($index === false) {
  28006. return null;
  28007. }
  28008. $label = substr($reference, $index);
  28009. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  28010. $this->executeCommand($command);
  28011. $changes = $this->commandResult;
  28012. if (strpos($changes, 'Change') !== 0) {
  28013. return null;
  28014. }
  28015. $fields = explode(' ', $changes);
  28016. return $fields[1];
  28017. }
  28018. public function getCommitLogs($fromReference, $toReference)
  28019. {
  28020. $fromChangeList = $this->getChangeList($fromReference);
  28021. if ($fromChangeList === null) {
  28022. return null;
  28023. }
  28024. $toChangeList = $this->getChangeList($toReference);
  28025. if ($toChangeList === null) {
  28026. return null;
  28027. }
  28028. $index = strpos($fromReference, '@');
  28029. $main = substr($fromReference, 0, $index) . '/...';
  28030. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  28031. $this->executeCommand($command);
  28032. return $this->commandResult;
  28033. }
  28034. public function getFilesystem()
  28035. {
  28036. if (empty($this->filesystem)) {
  28037. $this->filesystem = new Filesystem($this->process);
  28038. }
  28039. return $this->filesystem;
  28040. }
  28041. public function setFilesystem(Filesystem $fs)
  28042. {
  28043. $this->filesystem = $fs;
  28044. }
  28045. }
  28046. <?php
  28047. namespace Composer\Util;
  28048. class Platform
  28049. {
  28050. public static function expandPath($path)
  28051. {
  28052. if (preg_match('#^~[\\/]#', $path)) {
  28053. return self::getUserDirectory() . substr($path, 1);
  28054. }
  28055. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  28056. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  28057. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  28058. }
  28059. return getenv($matches['var']) . $matches['path'];
  28060. }, $path);
  28061. }
  28062. public static function getUserDirectory()
  28063. {
  28064. if (false !== ($home = getenv('HOME'))) {
  28065. return $home;
  28066. }
  28067. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  28068. return $home;
  28069. }
  28070. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  28071. $info = posix_getpwuid(posix_getuid());
  28072. return $info['dir'];
  28073. }
  28074. throw new \RuntimeException('Could not determine user directory');
  28075. }
  28076. public static function isWindows()
  28077. {
  28078. return defined('PHP_WINDOWS_VERSION_BUILD');
  28079. }
  28080. public static function strlen($str)
  28081. {
  28082. static $useMbString = null;
  28083. if (null === $useMbString) {
  28084. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  28085. }
  28086. if ($useMbString) {
  28087. return mb_strlen($str, '8bit');
  28088. }
  28089. return strlen($str);
  28090. }
  28091. }
  28092. <?php
  28093. namespace Composer\Util;
  28094. use Composer\IO\IOInterface;
  28095. use Symfony\Component\Process\Process;
  28096. use Symfony\Component\Process\ProcessUtils;
  28097. class ProcessExecutor
  28098. {
  28099. protected static $timeout = 300;
  28100. protected $captureOutput;
  28101. protected $errorOutput;
  28102. protected $io;
  28103. public function __construct(IOInterface $io = null)
  28104. {
  28105. $this->io = $io;
  28106. }
  28107. public function execute($command, &$output = null, $cwd = null)
  28108. {
  28109. if ($this->io && $this->io->isDebug()) {
  28110. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  28111. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  28112. return '://***:***@';
  28113. }
  28114. return '://'.$m['user'].':***@';
  28115. }, $command);
  28116. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  28117. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  28118. }
  28119. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  28120. $cwd = realpath(getcwd());
  28121. }
  28122. $this->captureOutput = func_num_args() > 1;
  28123. $this->errorOutput = null;
  28124. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  28125. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  28126. } else {
  28127. $process = new Process($command, $cwd, null, null, static::getTimeout());
  28128. }
  28129. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  28130. $process->run($callback);
  28131. if ($this->captureOutput && !is_callable($output)) {
  28132. $output = $process->getOutput();
  28133. }
  28134. $this->errorOutput = $process->getErrorOutput();
  28135. return $process->getExitCode();
  28136. }
  28137. public function splitLines($output)
  28138. {
  28139. $output = trim($output);
  28140. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  28141. }
  28142. public function getErrorOutput()
  28143. {
  28144. return $this->errorOutput;
  28145. }
  28146. public function outputHandler($type, $buffer)
  28147. {
  28148. if ($this->captureOutput) {
  28149. return;
  28150. }
  28151. if (null === $this->io) {
  28152. echo $buffer;
  28153. return;
  28154. }
  28155. if (method_exists($this->io, 'writeRaw')) {
  28156. if (Process::ERR === $type) {
  28157. $this->io->writeErrorRaw($buffer, false);
  28158. } else {
  28159. $this->io->writeRaw($buffer, false);
  28160. }
  28161. } else {
  28162. if (Process::ERR === $type) {
  28163. $this->io->writeError($buffer, false);
  28164. } else {
  28165. $this->io->write($buffer, false);
  28166. }
  28167. }
  28168. }
  28169. public static function getTimeout()
  28170. {
  28171. return static::$timeout;
  28172. }
  28173. public static function setTimeout($timeout)
  28174. {
  28175. static::$timeout = $timeout;
  28176. }
  28177. public static function escape($argument)
  28178. {
  28179. return self::escapeArgument($argument);
  28180. }
  28181. private static function escapeArgument($argument)
  28182. {
  28183. if ('\\' === DIRECTORY_SEPARATOR) {
  28184. if ((string) $argument === '') {
  28185. return escapeshellarg($argument);
  28186. }
  28187. $escapedArgument = '';
  28188. $quote = false;
  28189. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  28190. if ('"' === $part) {
  28191. $escapedArgument .= '\\"';
  28192. } elseif (self::isSurroundedBy($part, '%')) {
  28193. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  28194. } else {
  28195. if ('\\' === substr($part, -1)) {
  28196. $part .= '\\';
  28197. }
  28198. $quote = true;
  28199. $escapedArgument .= $part;
  28200. }
  28201. }
  28202. if ($quote) {
  28203. $escapedArgument = '"'.$escapedArgument.'"';
  28204. }
  28205. return $escapedArgument;
  28206. }
  28207. return "'".str_replace("'", "'\\''", $argument)."'";
  28208. }
  28209. private static function isSurroundedBy($arg, $char)
  28210. {
  28211. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  28212. }
  28213. }
  28214. <?php
  28215. namespace Composer\Util;
  28216. use Composer\Config;
  28217. use Composer\Composer;
  28218. use Composer\Semver\Constraint\Constraint;
  28219. use Composer\Package\Version\VersionParser;
  28220. use Composer\IO\IOInterface;
  28221. use Composer\Downloader\TransportException;
  28222. use Composer\CaBundle\CaBundle;
  28223. use Psr\Log\LoggerInterface;
  28224. class RemoteFilesystem
  28225. {
  28226. private $io;
  28227. private $config;
  28228. private $scheme;
  28229. private $bytesMax;
  28230. private $originUrl;
  28231. private $fileUrl;
  28232. private $fileName;
  28233. private $retry;
  28234. private $progress;
  28235. private $lastProgress;
  28236. private $options = array();
  28237. private $peerCertificateMap = array();
  28238. private $disableTls = false;
  28239. private $retryAuthFailure;
  28240. private $lastHeaders;
  28241. private $storeAuth;
  28242. private $degradedMode = false;
  28243. private $redirects;
  28244. private $maxRedirects = 20;
  28245. private $displayedOriginAuthentications = array();
  28246. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  28247. {
  28248. $this->io = $io;
  28249. if ($disableTls === false) {
  28250. $this->options = $this->getTlsDefaults($options);
  28251. } else {
  28252. $this->disableTls = true;
  28253. }
  28254. $this->options = array_replace_recursive($this->options, $options);
  28255. $this->config = $config;
  28256. }
  28257. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  28258. {
  28259. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  28260. }
  28261. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  28262. {
  28263. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  28264. }
  28265. public function getOptions()
  28266. {
  28267. return $this->options;
  28268. }
  28269. public function setOptions(array $options)
  28270. {
  28271. $this->options = array_replace_recursive($this->options, $options);
  28272. }
  28273. public function isTlsDisabled()
  28274. {
  28275. return $this->disableTls === true;
  28276. }
  28277. public function getLastHeaders()
  28278. {
  28279. return $this->lastHeaders;
  28280. }
  28281. public function findHeaderValue(array $headers, $name)
  28282. {
  28283. $value = null;
  28284. foreach ($headers as $header) {
  28285. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  28286. $value = $match[1];
  28287. } elseif (preg_match('{^HTTP/}i', $header)) {
  28288. $value = null;
  28289. }
  28290. }
  28291. return $value;
  28292. }
  28293. public function findStatusCode(array $headers)
  28294. {
  28295. $value = null;
  28296. foreach ($headers as $header) {
  28297. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  28298. $value = (int) $match[1];
  28299. }
  28300. }
  28301. return $value;
  28302. }
  28303. public function findStatusMessage(array $headers)
  28304. {
  28305. $value = null;
  28306. foreach ($headers as $header) {
  28307. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  28308. $value = $header;
  28309. }
  28310. }
  28311. return $value;
  28312. }
  28313. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  28314. {
  28315. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  28316. $originUrl = 'github.com';
  28317. }
  28318. if (
  28319. $this->config
  28320. && is_array($this->config->get('gitlab-domains'))
  28321. && false === strpos($originUrl, '/')
  28322. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  28323. ) {
  28324. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  28325. if (0 === strpos($gitlabDomain, $originUrl)) {
  28326. $originUrl = $gitlabDomain;
  28327. break;
  28328. }
  28329. }
  28330. unset($gitlabDomain);
  28331. }
  28332. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  28333. $this->bytesMax = 0;
  28334. $this->originUrl = $originUrl;
  28335. $this->fileUrl = $fileUrl;
  28336. $this->fileName = $fileName;
  28337. $this->progress = $progress;
  28338. $this->lastProgress = null;
  28339. $this->retryAuthFailure = true;
  28340. $this->lastHeaders = array();
  28341. $this->redirects = 1;
  28342. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  28343. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  28344. }
  28345. $tempAdditionalOptions = $additionalOptions;
  28346. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  28347. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  28348. unset($tempAdditionalOptions['retry-auth-failure']);
  28349. }
  28350. $isRedirect = false;
  28351. if (isset($tempAdditionalOptions['redirects'])) {
  28352. $this->redirects = $tempAdditionalOptions['redirects'];
  28353. $isRedirect = true;
  28354. unset($tempAdditionalOptions['redirects']);
  28355. }
  28356. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  28357. unset($tempAdditionalOptions);
  28358. $origFileUrl = $fileUrl;
  28359. if (isset($options['github-token'])) {
  28360. if (preg_match('{^https?://api\.github\.com/}', $fileUrl)) {
  28361. $options['http']['header'][] = 'Authorization: token '.$options['github-token'];
  28362. }
  28363. unset($options['github-token']);
  28364. }
  28365. if (isset($options['gitlab-token'])) {
  28366. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  28367. unset($options['gitlab-token']);
  28368. }
  28369. if (isset($options['http'])) {
  28370. $options['http']['ignore_errors'] = true;
  28371. }
  28372. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  28373. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  28374. $degradedPackagist = true;
  28375. }
  28376. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  28377. $actualContextOptions = stream_context_get_options($ctx);
  28378. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  28379. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  28380. unset($origFileUrl, $actualContextOptions);
  28381. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  28382. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  28383. }
  28384. if ($this->progress && !$isRedirect) {
  28385. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  28386. }
  28387. $errorMessage = '';
  28388. $errorCode = 0;
  28389. $result = false;
  28390. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28391. if ($errorMessage) {
  28392. $errorMessage .= "\n";
  28393. }
  28394. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  28395. return true;
  28396. });
  28397. try {
  28398. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  28399. if (!empty($http_response_header[0])) {
  28400. $statusCode = $this->findStatusCode($http_response_header);
  28401. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  28402. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  28403. }
  28404. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  28405. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  28406. }
  28407. }
  28408. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  28409. if ($contentLength && Platform::strlen($result) < $contentLength) {
  28410. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  28411. $e->setHeaders($http_response_header);
  28412. $e->setStatusCode($this->findStatusCode($http_response_header));
  28413. $e->setResponse($result);
  28414. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  28415. throw $e;
  28416. }
  28417. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  28418. $params = stream_context_get_params($ctx);
  28419. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  28420. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  28421. if ($expectedPeerFingerprint !== $peerFingerprint) {
  28422. throw new TransportException('Peer fingerprint did not match');
  28423. }
  28424. }
  28425. } catch (\Exception $e) {
  28426. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  28427. $e->setHeaders($http_response_header);
  28428. $e->setStatusCode($this->findStatusCode($http_response_header));
  28429. }
  28430. if ($e instanceof TransportException && $result !== false) {
  28431. $e->setResponse($result);
  28432. }
  28433. $result = false;
  28434. }
  28435. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  28436. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  28437. }
  28438. restore_error_handler();
  28439. if (isset($e) && !$this->retry) {
  28440. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28441. $this->degradedMode = true;
  28442. $this->io->writeError('');
  28443. $this->io->writeError(array(
  28444. '<error>'.$e->getMessage().'</error>',
  28445. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28446. ));
  28447. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28448. }
  28449. throw $e;
  28450. }
  28451. $statusCode = null;
  28452. $contentType = null;
  28453. $locationHeader = null;
  28454. if (!empty($http_response_header[0])) {
  28455. $statusCode = $this->findStatusCode($http_response_header);
  28456. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  28457. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  28458. }
  28459. if ($originUrl === 'bitbucket.org'
  28460. && !$this->isPublicBitBucketDownload($fileUrl)
  28461. && substr($fileUrl, -4) === '.zip'
  28462. && (!$locationHeader || substr(parse_url($locationHeader, PHP_URL_PATH), -4) !== '.zip')
  28463. && $contentType && preg_match('{^text/html\b}i', $contentType)
  28464. ) {
  28465. $result = false;
  28466. if ($this->retryAuthFailure) {
  28467. $this->promptAuthAndRetry(401);
  28468. }
  28469. }
  28470. if ($statusCode === 404
  28471. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  28472. && false !== strpos($fileUrl, 'archive.zip')
  28473. ) {
  28474. $result = false;
  28475. if ($this->retryAuthFailure) {
  28476. $this->promptAuthAndRetry(401);
  28477. }
  28478. }
  28479. $hasFollowedRedirect = false;
  28480. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  28481. $hasFollowedRedirect = true;
  28482. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  28483. }
  28484. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  28485. if (!$this->retry) {
  28486. if ($this->progress && !$this->retry && !$isRedirect) {
  28487. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  28488. }
  28489. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  28490. $e->setHeaders($http_response_header);
  28491. $e->setResponse($result);
  28492. $e->setStatusCode($statusCode);
  28493. throw $e;
  28494. }
  28495. $result = false;
  28496. }
  28497. if ($this->progress && !$this->retry && !$isRedirect) {
  28498. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  28499. }
  28500. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  28501. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  28502. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  28503. if ($decode) {
  28504. try {
  28505. if (PHP_VERSION_ID >= 50400) {
  28506. $result = zlib_decode($result);
  28507. } else {
  28508. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  28509. }
  28510. if (!$result) {
  28511. throw new TransportException('Failed to decode zlib stream');
  28512. }
  28513. } catch (\Exception $e) {
  28514. if ($this->degradedMode) {
  28515. throw $e;
  28516. }
  28517. $this->degradedMode = true;
  28518. $this->io->writeError(array(
  28519. '',
  28520. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  28521. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28522. ));
  28523. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28524. }
  28525. }
  28526. }
  28527. if (false !== $result && null !== $fileName && !$isRedirect) {
  28528. if ('' === $result) {
  28529. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  28530. }
  28531. $errorMessage = '';
  28532. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  28533. if ($errorMessage) {
  28534. $errorMessage .= "\n";
  28535. }
  28536. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  28537. return true;
  28538. });
  28539. $result = (bool) file_put_contents($fileName, $result);
  28540. restore_error_handler();
  28541. if (false === $result) {
  28542. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  28543. }
  28544. }
  28545. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  28546. if (CaBundle::isOpensslParseSafe()) {
  28547. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  28548. if ($certDetails) {
  28549. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  28550. $this->retry = true;
  28551. }
  28552. } else {
  28553. $this->io->writeError('');
  28554. $this->io->writeError(sprintf(
  28555. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  28556. PHP_VERSION
  28557. ));
  28558. }
  28559. }
  28560. if ($this->retry) {
  28561. $this->retry = false;
  28562. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28563. if ($this->storeAuth && $this->config) {
  28564. $authHelper = new AuthHelper($this->io, $this->config);
  28565. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  28566. $this->storeAuth = false;
  28567. }
  28568. return $result;
  28569. }
  28570. if (false === $result) {
  28571. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  28572. if (!empty($http_response_header[0])) {
  28573. $e->setHeaders($http_response_header);
  28574. }
  28575. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  28576. $this->degradedMode = true;
  28577. $this->io->writeError('');
  28578. $this->io->writeError(array(
  28579. '<error>'.$e->getMessage().'</error>',
  28580. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  28581. ));
  28582. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  28583. }
  28584. throw $e;
  28585. }
  28586. if (!empty($http_response_header[0])) {
  28587. $this->lastHeaders = $http_response_header;
  28588. }
  28589. return $result;
  28590. }
  28591. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  28592. {
  28593. try {
  28594. $e = null;
  28595. $result = file_get_contents($fileUrl, false, $context);
  28596. } catch (\Throwable $e) {
  28597. } catch (\Exception $e) {
  28598. }
  28599. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  28600. if (null !== $e) {
  28601. throw $e;
  28602. }
  28603. return $result;
  28604. }
  28605. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  28606. {
  28607. switch ($notificationCode) {
  28608. case STREAM_NOTIFY_FAILURE:
  28609. if (400 === $messageCode) {
  28610. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  28611. }
  28612. break;
  28613. case STREAM_NOTIFY_FILE_SIZE_IS:
  28614. $this->bytesMax = $bytesMax;
  28615. break;
  28616. case STREAM_NOTIFY_PROGRESS:
  28617. if ($this->bytesMax > 0 && $this->progress) {
  28618. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  28619. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  28620. $this->lastProgress = $progression;
  28621. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  28622. }
  28623. }
  28624. break;
  28625. default:
  28626. break;
  28627. }
  28628. }
  28629. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  28630. {
  28631. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  28632. $gitHubUtil = new GitHub($this->io, $this->config, null);
  28633. $message = "\n";
  28634. $rateLimited = $gitHubUtil->isRateLimited($headers);
  28635. if ($rateLimited) {
  28636. $rateLimit = $gitHubUtil->getRateLimit($headers);
  28637. if ($this->io->hasAuthentication($this->originUrl)) {
  28638. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  28639. } else {
  28640. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  28641. }
  28642. $message = sprintf(
  28643. 'GitHub API limit (%d calls/hr) is exhausted, could not fetch '.$this->fileUrl.'. '.$message.' You can also wait until %s for the rate limit to reset.',
  28644. $rateLimit['limit'],
  28645. $rateLimit['reset']
  28646. )."\n";
  28647. } else {
  28648. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  28649. if ($this->io->hasAuthentication($this->originUrl)) {
  28650. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  28651. } else {
  28652. $message .= 'create a GitHub OAuth token to access private repos';
  28653. }
  28654. }
  28655. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  28656. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28657. ) {
  28658. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28659. }
  28660. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  28661. $message = "\n".'Could not fetch '.$this->fileUrl.', enter your ' . $this->originUrl . ' credentials ' .($httpStatus === 401 ? 'to access private repos' : 'to go over the API rate limit');
  28662. $gitLabUtil = new GitLab($this->io, $this->config, null);
  28663. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token', 'oauth2'), true)) {
  28664. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28665. }
  28666. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  28667. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  28668. ) {
  28669. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  28670. }
  28671. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  28672. $askForOAuthToken = true;
  28673. if ($this->io->hasAuthentication($this->originUrl)) {
  28674. $auth = $this->io->getAuthentication($this->originUrl);
  28675. if ($auth['username'] !== 'x-token-auth') {
  28676. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  28677. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  28678. if (!empty($accessToken)) {
  28679. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  28680. $askForOAuthToken = false;
  28681. }
  28682. } else {
  28683. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28684. }
  28685. }
  28686. if ($askForOAuthToken) {
  28687. $message = "\n".'Could not fetch ' . $this->fileUrl . ', please create a bitbucket OAuth token to ' . (($httpStatus === 401 || $httpStatus === 403) ? 'access private repos' : 'go over the API rate limit');
  28688. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  28689. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  28690. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  28691. ) {
  28692. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  28693. }
  28694. }
  28695. } else {
  28696. if ($httpStatus === 404) {
  28697. return;
  28698. }
  28699. if (!$this->io->isInteractive()) {
  28700. if ($httpStatus === 401) {
  28701. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  28702. }
  28703. if ($httpStatus === 403) {
  28704. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  28705. }
  28706. throw new TransportException($message, $httpStatus);
  28707. }
  28708. if ($this->io->hasAuthentication($this->originUrl)) {
  28709. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  28710. }
  28711. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  28712. $username = $this->io->ask(' Username: ');
  28713. $password = $this->io->askAndHideAnswer(' Password: ');
  28714. $this->io->setAuthentication($this->originUrl, $username, $password);
  28715. $this->storeAuth = $this->config->get('store-auths');
  28716. }
  28717. $this->retry = true;
  28718. throw new TransportException('RETRY');
  28719. }
  28720. protected function getOptionsForUrl($originUrl, $additionalOptions)
  28721. {
  28722. $tlsOptions = array();
  28723. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  28724. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  28725. if (PHP_VERSION_ID < 50304) {
  28726. if ($host === 'github.com' || $host === 'api.github.com') {
  28727. $host = '*.github.com';
  28728. }
  28729. }
  28730. $tlsOptions['ssl']['CN_match'] = $host;
  28731. $tlsOptions['ssl']['SNI_server_name'] = $host;
  28732. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  28733. if (isset($this->peerCertificateMap[$urlAuthority])) {
  28734. $certMap = $this->peerCertificateMap[$urlAuthority];
  28735. $this->io->writeError('', true, IOInterface::DEBUG);
  28736. $this->io->writeError(sprintf(
  28737. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  28738. $certMap['cn'],
  28739. $urlAuthority
  28740. ), true, IOInterface::DEBUG);
  28741. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  28742. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  28743. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  28744. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  28745. }
  28746. }
  28747. $headers = array();
  28748. if (extension_loaded('zlib')) {
  28749. $headers[] = 'Accept-Encoding: gzip';
  28750. }
  28751. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  28752. if (!$this->degradedMode) {
  28753. $options['http']['protocol_version'] = 1.1;
  28754. $headers[] = 'Connection: close';
  28755. }
  28756. if ($this->io->hasAuthentication($originUrl)) {
  28757. $authenticationDisplayMessage = null;
  28758. $auth = $this->io->getAuthentication($originUrl);
  28759. if ($auth['password'] === 'bearer') {
  28760. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28761. } elseif ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  28762. $options['github-token'] = $auth['username'];
  28763. $authenticationDisplayMessage = 'Using GitHub token authentication';
  28764. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  28765. if ($auth['password'] === 'oauth2') {
  28766. $headers[] = 'Authorization: Bearer '.$auth['username'];
  28767. $authenticationDisplayMessage = 'Using GitLab OAuth token authentication';
  28768. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  28769. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  28770. $authenticationDisplayMessage = 'Using GitLab private token authentication';
  28771. }
  28772. } elseif ('bitbucket.org' === $originUrl
  28773. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  28774. ) {
  28775. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  28776. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  28777. $authenticationDisplayMessage = 'Using Bitbucket OAuth token authentication';
  28778. }
  28779. } else {
  28780. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  28781. $headers[] = 'Authorization: Basic '.$authStr;
  28782. $authenticationDisplayMessage = 'Using HTTP basic authentication with username "' . $auth['username'] . '"';
  28783. }
  28784. if ($authenticationDisplayMessage && !in_array($originUrl, $this->displayedOriginAuthentications, true)) {
  28785. $this->io->writeError($authenticationDisplayMessage, true, IOInterface::DEBUG);
  28786. $this->displayedOriginAuthentications[] = $originUrl;
  28787. }
  28788. }
  28789. $options['http']['follow_location'] = 0;
  28790. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  28791. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  28792. }
  28793. foreach ($headers as $header) {
  28794. $options['http']['header'][] = $header;
  28795. }
  28796. return $options;
  28797. }
  28798. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  28799. {
  28800. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  28801. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  28802. $targetUrl = $locationHeader;
  28803. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  28804. $targetUrl = $this->scheme.':'.$locationHeader;
  28805. } elseif ('/' === $locationHeader[0]) {
  28806. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  28807. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28808. } else {
  28809. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  28810. }
  28811. }
  28812. if (!empty($targetUrl)) {
  28813. $this->redirects++;
  28814. $this->io->writeError('', true, IOInterface::DEBUG);
  28815. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  28816. $additionalOptions['redirects'] = $this->redirects;
  28817. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  28818. }
  28819. if (!$this->retry) {
  28820. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  28821. $e->setHeaders($http_response_header);
  28822. $e->setResponse($result);
  28823. throw $e;
  28824. }
  28825. return false;
  28826. }
  28827. private function getTlsDefaults(array $options)
  28828. {
  28829. $ciphers = implode(':', array(
  28830. 'ECDHE-RSA-AES128-GCM-SHA256',
  28831. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  28832. 'ECDHE-RSA-AES256-GCM-SHA384',
  28833. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  28834. 'DHE-RSA-AES128-GCM-SHA256',
  28835. 'DHE-DSS-AES128-GCM-SHA256',
  28836. 'kEDH+AESGCM',
  28837. 'ECDHE-RSA-AES128-SHA256',
  28838. 'ECDHE-ECDSA-AES128-SHA256',
  28839. 'ECDHE-RSA-AES128-SHA',
  28840. 'ECDHE-ECDSA-AES128-SHA',
  28841. 'ECDHE-RSA-AES256-SHA384',
  28842. 'ECDHE-ECDSA-AES256-SHA384',
  28843. 'ECDHE-RSA-AES256-SHA',
  28844. 'ECDHE-ECDSA-AES256-SHA',
  28845. 'DHE-RSA-AES128-SHA256',
  28846. 'DHE-RSA-AES128-SHA',
  28847. 'DHE-DSS-AES128-SHA256',
  28848. 'DHE-RSA-AES256-SHA256',
  28849. 'DHE-DSS-AES256-SHA',
  28850. 'DHE-RSA-AES256-SHA',
  28851. 'AES128-GCM-SHA256',
  28852. 'AES256-GCM-SHA384',
  28853. 'AES128-SHA256',
  28854. 'AES256-SHA256',
  28855. 'AES128-SHA',
  28856. 'AES256-SHA',
  28857. 'AES',
  28858. 'CAMELLIA',
  28859. 'DES-CBC3-SHA',
  28860. '!aNULL',
  28861. '!eNULL',
  28862. '!EXPORT',
  28863. '!DES',
  28864. '!RC4',
  28865. '!MD5',
  28866. '!PSK',
  28867. '!aECDH',
  28868. '!EDH-DSS-DES-CBC3-SHA',
  28869. '!EDH-RSA-DES-CBC3-SHA',
  28870. '!KRB5-DES-CBC3-SHA',
  28871. ));
  28872. $defaults = array(
  28873. 'ssl' => array(
  28874. 'ciphers' => $ciphers,
  28875. 'verify_peer' => true,
  28876. 'verify_depth' => 7,
  28877. 'SNI_enabled' => true,
  28878. 'capture_peer_cert' => true,
  28879. ),
  28880. );
  28881. if (isset($options['ssl'])) {
  28882. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  28883. }
  28884. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  28885. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  28886. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  28887. if (is_dir($result)) {
  28888. $defaults['ssl']['capath'] = $result;
  28889. } else {
  28890. $defaults['ssl']['cafile'] = $result;
  28891. }
  28892. }
  28893. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  28894. throw new TransportException('The configured cafile was not valid or could not be read.');
  28895. }
  28896. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  28897. throw new TransportException('The configured capath was not valid or could not be read.');
  28898. }
  28899. if (PHP_VERSION_ID >= 50413) {
  28900. $defaults['ssl']['disable_compression'] = true;
  28901. }
  28902. return $defaults;
  28903. }
  28904. private function getCertificateCnAndFp($url, $options)
  28905. {
  28906. if (PHP_VERSION_ID >= 50600) {
  28907. throw new \BadMethodCallException(sprintf(
  28908. '%s must not be used on PHP >= 5.6',
  28909. __METHOD__
  28910. ));
  28911. }
  28912. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  28913. 'ssl' => array(
  28914. 'capture_peer_cert' => true,
  28915. 'verify_peer' => false,
  28916. ), ),
  28917. ));
  28918. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  28919. return;
  28920. }
  28921. fclose($handle);
  28922. $handle = null;
  28923. $params = stream_context_get_params($context);
  28924. if (!empty($params['options']['ssl']['peer_certificate'])) {
  28925. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  28926. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  28927. return array(
  28928. 'cn' => $commonName,
  28929. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  28930. );
  28931. }
  28932. }
  28933. }
  28934. private function getUrlAuthority($url)
  28935. {
  28936. $defaultPorts = array(
  28937. 'ftp' => 21,
  28938. 'http' => 80,
  28939. 'https' => 443,
  28940. 'ssh2.sftp' => 22,
  28941. 'ssh2.scp' => 22,
  28942. );
  28943. $scheme = parse_url($url, PHP_URL_SCHEME);
  28944. if (!isset($defaultPorts[$scheme])) {
  28945. throw new \InvalidArgumentException(sprintf(
  28946. 'Could not get default port for unknown scheme: %s',
  28947. $scheme
  28948. ));
  28949. }
  28950. $defaultPort = $defaultPorts[$scheme];
  28951. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  28952. return parse_url($url, PHP_URL_HOST).':'.$port;
  28953. }
  28954. private function isPublicBitBucketDownload($urlToBitBucketFile)
  28955. {
  28956. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  28957. if (strpos($domain, 'bitbucket.org') === false) {
  28958. return true;
  28959. }
  28960. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  28961. $pathParts = explode('/', $path);
  28962. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  28963. }
  28964. public static function outputWarnings(IOInterface $io, $url, $data)
  28965. {
  28966. foreach (array('warning', 'info') as $type) {
  28967. if (empty($data[$type])) {
  28968. continue;
  28969. }
  28970. if (!empty($data[$type . '-versions'])) {
  28971. $versionParser = new VersionParser();
  28972. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  28973. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  28974. if (!$constraint->matches($composer)) {
  28975. continue;
  28976. }
  28977. }
  28978. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  28979. }
  28980. }
  28981. public static function getOrigin($urlOrPath)
  28982. {
  28983. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  28984. if (!$hostPort) {
  28985. return $urlOrPath;
  28986. }
  28987. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  28988. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  28989. }
  28990. return $hostPort;
  28991. }
  28992. private function stripCredentialsFromUrl($url)
  28993. {
  28994. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  28995. }
  28996. }
  28997. <?php
  28998. namespace Composer\Util;
  28999. class Silencer
  29000. {
  29001. private static $stack = array();
  29002. public static function suppress($mask = null)
  29003. {
  29004. if (!isset($mask)) {
  29005. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  29006. }
  29007. $old = error_reporting();
  29008. self::$stack[] = $old;
  29009. error_reporting($old & ~$mask);
  29010. return $old;
  29011. }
  29012. public static function restore()
  29013. {
  29014. if (!empty(self::$stack)) {
  29015. error_reporting(array_pop(self::$stack));
  29016. }
  29017. }
  29018. public static function call($callable )
  29019. {
  29020. try {
  29021. self::suppress();
  29022. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  29023. self::restore();
  29024. return $result;
  29025. } catch (\Exception $e) {
  29026. self::restore();
  29027. throw $e;
  29028. }
  29029. }
  29030. }
  29031. <?php
  29032. namespace Composer\Util;
  29033. use Composer\Spdx\SpdxLicenses;
  29034. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  29035. class SpdxLicense extends SpdxLicenses
  29036. {
  29037. }
  29038. <?php
  29039. namespace Composer\Util;
  29040. use Composer\Composer;
  29041. final class StreamContextFactory
  29042. {
  29043. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  29044. {
  29045. $options = array('http' => array(
  29046. 'follow_location' => 1,
  29047. 'max_redirects' => 20,
  29048. ));
  29049. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  29050. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  29051. }
  29052. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  29053. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  29054. }
  29055. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  29056. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  29057. }
  29058. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  29059. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  29060. if ($pattern->test($url)) {
  29061. unset($proxy);
  29062. }
  29063. }
  29064. if (!empty($proxy)) {
  29065. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  29066. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  29067. if (isset($proxy['port'])) {
  29068. $proxyURL .= ":" . $proxy['port'];
  29069. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  29070. $proxyURL .= ":80";
  29071. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  29072. $proxyURL .= ":443";
  29073. }
  29074. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  29075. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  29076. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  29077. }
  29078. $options['http']['proxy'] = $proxyURL;
  29079. switch (parse_url($url, PHP_URL_SCHEME)) {
  29080. case 'http':
  29081. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  29082. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29083. $options['http']['request_fulluri'] = true;
  29084. }
  29085. break;
  29086. case 'https':
  29087. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  29088. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  29089. $options['http']['request_fulluri'] = true;
  29090. }
  29091. break;
  29092. }
  29093. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  29094. $options['ssl']['SNI_enabled'] = true;
  29095. if (PHP_VERSION_ID < 50600) {
  29096. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  29097. }
  29098. }
  29099. if (isset($proxy['user'])) {
  29100. $auth = rawurldecode($proxy['user']);
  29101. if (isset($proxy['pass'])) {
  29102. $auth .= ':' . rawurldecode($proxy['pass']);
  29103. }
  29104. $auth = base64_encode($auth);
  29105. if (isset($defaultOptions['http']['header'])) {
  29106. if (is_string($defaultOptions['http']['header'])) {
  29107. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  29108. }
  29109. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  29110. } else {
  29111. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  29112. }
  29113. }
  29114. }
  29115. $options = array_replace_recursive($options, $defaultOptions);
  29116. if (isset($options['http']['header'])) {
  29117. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  29118. }
  29119. if (defined('HHVM_VERSION')) {
  29120. $phpVersion = 'HHVM ' . HHVM_VERSION;
  29121. } else {
  29122. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  29123. }
  29124. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  29125. $options['http']['header'][] = sprintf(
  29126. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  29127. Composer::getVersion(),
  29128. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  29129. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  29130. $phpVersion,
  29131. getenv('CI') ? '; CI' : ''
  29132. );
  29133. }
  29134. return stream_context_create($options, $defaultParams);
  29135. }
  29136. private static function fixHttpHeaderField($header)
  29137. {
  29138. if (!is_array($header)) {
  29139. $header = explode("\r\n", $header);
  29140. }
  29141. uasort($header, function ($el) {
  29142. return stripos($el, 'content-type') === 0 ? 1 : -1;
  29143. });
  29144. return $header;
  29145. }
  29146. }
  29147. <?php
  29148. namespace Composer\Util;
  29149. use Composer\Config;
  29150. use Composer\IO\IOInterface;
  29151. class Svn
  29152. {
  29153. const MAX_QTY_AUTH_TRIES = 5;
  29154. protected $credentials;
  29155. protected $hasAuth;
  29156. protected $io;
  29157. protected $url;
  29158. protected $cacheCredentials = true;
  29159. protected $process;
  29160. protected $qtyAuthTries = 0;
  29161. protected $config;
  29162. private static $version;
  29163. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  29164. {
  29165. $this->url = $url;
  29166. $this->io = $io;
  29167. $this->config = $config;
  29168. $this->process = $process ?: new ProcessExecutor($io);
  29169. }
  29170. public static function cleanEnv()
  29171. {
  29172. putenv("DYLD_LIBRARY_PATH");
  29173. unset($_SERVER['DYLD_LIBRARY_PATH']);
  29174. }
  29175. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  29176. {
  29177. $this->config->prohibitUrlByConfig($url, $this->io);
  29178. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  29179. }
  29180. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  29181. {
  29182. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  29183. }
  29184. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  29185. {
  29186. $command = $this->getCommand($svnCommand, $url, $path);
  29187. $output = null;
  29188. $io = $this->io;
  29189. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  29190. if ($type !== 'out') {
  29191. return;
  29192. }
  29193. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  29194. return;
  29195. }
  29196. $output .= $buffer;
  29197. if ($verbose) {
  29198. $io->writeError($buffer, false);
  29199. }
  29200. };
  29201. $status = $this->process->execute($command, $handler, $cwd);
  29202. if (0 === $status) {
  29203. return $output;
  29204. }
  29205. $errorOutput = $this->process->getErrorOutput();
  29206. $fullOutput = implode("\n", array($output, $errorOutput));
  29207. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  29208. && false === stripos($fullOutput, 'authorization failed')
  29209. && false === stripos($fullOutput, 'svn: E170001:')
  29210. && false === stripos($fullOutput, 'svn: E215004:')) {
  29211. throw new \RuntimeException($fullOutput);
  29212. }
  29213. if (!$this->hasAuth()) {
  29214. $this->doAuthDance();
  29215. }
  29216. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  29217. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  29218. }
  29219. throw new \RuntimeException(
  29220. 'wrong credentials provided ('.$fullOutput.')'
  29221. );
  29222. }
  29223. public function setCacheCredentials($cacheCredentials)
  29224. {
  29225. $this->cacheCredentials = $cacheCredentials;
  29226. }
  29227. protected function doAuthDance()
  29228. {
  29229. if (!$this->io->isInteractive()) {
  29230. throw new \RuntimeException(
  29231. 'can not ask for authentication in non interactive mode'
  29232. );
  29233. }
  29234. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  29235. $this->hasAuth = true;
  29236. $this->credentials['username'] = $this->io->ask("Username: ");
  29237. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  29238. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  29239. return $this;
  29240. }
  29241. protected function getCommand($cmd, $url, $path = null)
  29242. {
  29243. $cmd = sprintf(
  29244. '%s %s%s %s',
  29245. $cmd,
  29246. '--non-interactive ',
  29247. $this->getCredentialString(),
  29248. ProcessExecutor::escape($url)
  29249. );
  29250. if ($path) {
  29251. $cmd .= ' ' . ProcessExecutor::escape($path);
  29252. }
  29253. return $cmd;
  29254. }
  29255. protected function getCredentialString()
  29256. {
  29257. if (!$this->hasAuth()) {
  29258. return '';
  29259. }
  29260. return sprintf(
  29261. ' %s--username %s --password %s ',
  29262. $this->getAuthCache(),
  29263. ProcessExecutor::escape($this->getUsername()),
  29264. ProcessExecutor::escape($this->getPassword())
  29265. );
  29266. }
  29267. protected function getPassword()
  29268. {
  29269. if ($this->credentials === null) {
  29270. throw new \LogicException("No svn auth detected.");
  29271. }
  29272. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  29273. }
  29274. protected function getUsername()
  29275. {
  29276. if ($this->credentials === null) {
  29277. throw new \LogicException("No svn auth detected.");
  29278. }
  29279. return $this->credentials['username'];
  29280. }
  29281. protected function hasAuth()
  29282. {
  29283. if (null !== $this->hasAuth) {
  29284. return $this->hasAuth;
  29285. }
  29286. if (false === $this->createAuthFromConfig()) {
  29287. $this->createAuthFromUrl();
  29288. }
  29289. return $this->hasAuth;
  29290. }
  29291. protected function getAuthCache()
  29292. {
  29293. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  29294. }
  29295. private function createAuthFromConfig()
  29296. {
  29297. if (!$this->config->has('http-basic')) {
  29298. return $this->hasAuth = false;
  29299. }
  29300. $authConfig = $this->config->get('http-basic');
  29301. $host = parse_url($this->url, PHP_URL_HOST);
  29302. if (isset($authConfig[$host])) {
  29303. $this->credentials['username'] = $authConfig[$host]['username'];
  29304. $this->credentials['password'] = $authConfig[$host]['password'];
  29305. return $this->hasAuth = true;
  29306. }
  29307. return $this->hasAuth = false;
  29308. }
  29309. private function createAuthFromUrl()
  29310. {
  29311. $uri = parse_url($this->url);
  29312. if (empty($uri['user'])) {
  29313. return $this->hasAuth = false;
  29314. }
  29315. $this->credentials['username'] = $uri['user'];
  29316. if (!empty($uri['pass'])) {
  29317. $this->credentials['password'] = $uri['pass'];
  29318. }
  29319. return $this->hasAuth = true;
  29320. }
  29321. public function binaryVersion()
  29322. {
  29323. if (!self::$version) {
  29324. if (0 === $this->process->execute('svn --version', $output)) {
  29325. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  29326. self::$version = $match[1];
  29327. }
  29328. }
  29329. }
  29330. return self::$version;
  29331. }
  29332. }
  29333. <?php
  29334. namespace Composer\Util;
  29335. use Composer\CaBundle\CaBundle;
  29336. final class TlsHelper
  29337. {
  29338. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  29339. {
  29340. $names = self::getCertificateNames($certificate);
  29341. if (empty($names)) {
  29342. return false;
  29343. }
  29344. $combinedNames = array_merge($names['san'], array($names['cn']));
  29345. $hostname = strtolower($hostname);
  29346. foreach ($combinedNames as $certName) {
  29347. $matcher = self::certNameMatcher($certName);
  29348. if ($matcher && $matcher($hostname)) {
  29349. $cn = $names['cn'];
  29350. return true;
  29351. }
  29352. }
  29353. return false;
  29354. }
  29355. public static function getCertificateNames($certificate)
  29356. {
  29357. if (is_array($certificate)) {
  29358. $info = $certificate;
  29359. } elseif (CaBundle::isOpensslParseSafe()) {
  29360. $info = openssl_x509_parse($certificate, false);
  29361. }
  29362. if (!isset($info['subject']['commonName'])) {
  29363. return null;
  29364. }
  29365. $commonName = strtolower($info['subject']['commonName']);
  29366. $subjectAltNames = array();
  29367. if (isset($info['extensions']['subjectAltName'])) {
  29368. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  29369. $subjectAltNames = array_filter(array_map(function ($name) {
  29370. if (0 === strpos($name, 'DNS:')) {
  29371. return strtolower(ltrim(substr($name, 4)));
  29372. }
  29373. return null;
  29374. }, $subjectAltNames));
  29375. $subjectAltNames = array_values($subjectAltNames);
  29376. }
  29377. return array(
  29378. 'cn' => $commonName,
  29379. 'san' => $subjectAltNames,
  29380. );
  29381. }
  29382. public static function getCertificateFingerprint($certificate)
  29383. {
  29384. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  29385. $pubkeypem = $pubkeydetails['key'];
  29386. $start = '-----BEGIN PUBLIC KEY-----';
  29387. $end = '-----END PUBLIC KEY-----';
  29388. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  29389. $der = base64_decode($pemtrim);
  29390. return sha1($der);
  29391. }
  29392. public static function isOpensslParseSafe()
  29393. {
  29394. return CaBundle::isOpensslParseSafe();
  29395. }
  29396. private static function certNameMatcher($certName)
  29397. {
  29398. $wildcards = substr_count($certName, '*');
  29399. if (0 === $wildcards) {
  29400. return function ($hostname) use ($certName) {
  29401. return $hostname === $certName;
  29402. };
  29403. }
  29404. if (1 === $wildcards) {
  29405. $components = explode('.', $certName);
  29406. if (3 > count($components)) {
  29407. return;
  29408. }
  29409. $firstComponent = $components[0];
  29410. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  29411. return;
  29412. }
  29413. $wildcardRegex = preg_quote($certName);
  29414. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  29415. $wildcardRegex = "{^{$wildcardRegex}$}";
  29416. return function ($hostname) use ($wildcardRegex) {
  29417. return 1 === preg_match($wildcardRegex, $hostname);
  29418. };
  29419. }
  29420. }
  29421. }
  29422. <?php
  29423. namespace Composer\Util;
  29424. use Composer\Config;
  29425. class Url
  29426. {
  29427. public static function updateDistReference(Config $config, $url, $ref)
  29428. {
  29429. $host = parse_url($url, PHP_URL_HOST);
  29430. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  29431. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  29432. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29433. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  29434. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29435. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  29436. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  29437. }
  29438. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  29439. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  29440. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  29441. }
  29442. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  29443. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  29444. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  29445. }
  29446. } elseif (in_array($host, $config->get('github-domains'), true)) {
  29447. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  29448. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  29449. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  29450. }
  29451. return $url;
  29452. }
  29453. }
  29454. <?php
  29455. namespace Composer\Util;
  29456. class Zip
  29457. {
  29458. public static function getComposerJson($pathToZip)
  29459. {
  29460. if (!extension_loaded('zip')) {
  29461. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  29462. }
  29463. $zip = new \ZipArchive();
  29464. if ($zip->open($pathToZip) !== true) {
  29465. return null;
  29466. }
  29467. if (0 == $zip->numFiles) {
  29468. $zip->close();
  29469. return null;
  29470. }
  29471. $foundFileIndex = self::locateFile($zip, 'composer.json');
  29472. if (false === $foundFileIndex) {
  29473. $zip->close();
  29474. return null;
  29475. }
  29476. $content = null;
  29477. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  29478. $stream = $zip->getStream($configurationFileName);
  29479. if (false !== $stream) {
  29480. $content = stream_get_contents($stream);
  29481. }
  29482. $zip->close();
  29483. return $content;
  29484. }
  29485. private static function locateFile(\ZipArchive $zip, $filename)
  29486. {
  29487. $indexOfShortestMatch = false;
  29488. $lengthOfShortestMatch = -1;
  29489. for ($i = 0; $i < $zip->numFiles; $i++) {
  29490. $stat = $zip->statIndex($i);
  29491. if (strcmp(basename($stat['name']), $filename) === 0) {
  29492. $directoryName = dirname($stat['name']);
  29493. if ($directoryName === '.') {
  29494. return $i;
  29495. }
  29496. if (strpos($directoryName, '\\') !== false ||
  29497. strpos($directoryName, '/') !== false) {
  29498. continue;
  29499. }
  29500. $length = strlen($stat['name']);
  29501. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  29502. $contents = $zip->getFromIndex($i);
  29503. if ($contents !== false) {
  29504. $indexOfShortestMatch = $i;
  29505. $lengthOfShortestMatch = $length;
  29506. }
  29507. }
  29508. }
  29509. }
  29510. return $indexOfShortestMatch;
  29511. }
  29512. }
  29513. <?php
  29514. namespace Composer;
  29515. use Symfony\Component\Console\Output\OutputInterface;
  29516. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  29517. class XdebugHandler extends XdebugHandler\XdebugHandler
  29518. {
  29519. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  29520. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  29521. public function __construct(OutputInterface $output)
  29522. {
  29523. parent::__construct('composer', '--ansi');
  29524. }
  29525. }
  29526. <?php
  29527. function includeIfExists($file)
  29528. {
  29529. return file_exists($file) ? include $file : false;
  29530. }
  29531. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  29532. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  29533. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  29534. exit(1);
  29535. }
  29536. return $loader;
  29537. <?php
  29538. /*
  29539. * This file is part of Composer.
  29540. *
  29541. * (c) Nils Adermann <naderman@naderman.de>
  29542. * Jordi Boggiano <j.boggiano@seld.be>
  29543. *
  29544. * For the full copyright and license information, please view the LICENSE
  29545. * file that was distributed with this source code.
  29546. */
  29547. namespace Composer\Autoload;
  29548. /**
  29549. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  29550. *
  29551. * $loader = new \Composer\Autoload\ClassLoader();
  29552. *
  29553. * // register classes with namespaces
  29554. * $loader->add('Symfony\Component', __DIR__.'/component');
  29555. * $loader->add('Symfony', __DIR__.'/framework');
  29556. *
  29557. * // activate the autoloader
  29558. * $loader->register();
  29559. *
  29560. * // to enable searching the include path (eg. for PEAR packages)
  29561. * $loader->setUseIncludePath(true);
  29562. *
  29563. * In this example, if you try to use a class in the Symfony\Component
  29564. * namespace or one of its children (Symfony\Component\Console for instance),
  29565. * the autoloader will first look for the class under the component/
  29566. * directory, and it will then fallback to the framework/ directory if not
  29567. * found before giving up.
  29568. *
  29569. * This class is loosely based on the Symfony UniversalClassLoader.
  29570. *
  29571. * @author Fabien Potencier <fabien@symfony.com>
  29572. * @author Jordi Boggiano <j.boggiano@seld.be>
  29573. * @see http://www.php-fig.org/psr/psr-0/
  29574. * @see http://www.php-fig.org/psr/psr-4/
  29575. */
  29576. class ClassLoader
  29577. {
  29578. // PSR-4
  29579. private $prefixLengthsPsr4 = array();
  29580. private $prefixDirsPsr4 = array();
  29581. private $fallbackDirsPsr4 = array();
  29582. // PSR-0
  29583. private $prefixesPsr0 = array();
  29584. private $fallbackDirsPsr0 = array();
  29585. private $useIncludePath = false;
  29586. private $classMap = array();
  29587. private $classMapAuthoritative = false;
  29588. private $missingClasses = array();
  29589. private $apcuPrefix;
  29590. public function getPrefixes()
  29591. {
  29592. if (!empty($this->prefixesPsr0)) {
  29593. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  29594. }
  29595. return array();
  29596. }
  29597. public function getPrefixesPsr4()
  29598. {
  29599. return $this->prefixDirsPsr4;
  29600. }
  29601. public function getFallbackDirs()
  29602. {
  29603. return $this->fallbackDirsPsr0;
  29604. }
  29605. public function getFallbackDirsPsr4()
  29606. {
  29607. return $this->fallbackDirsPsr4;
  29608. }
  29609. public function getClassMap()
  29610. {
  29611. return $this->classMap;
  29612. }
  29613. /**
  29614. * @param array $classMap Class to filename map
  29615. */
  29616. public function addClassMap(array $classMap)
  29617. {
  29618. if ($this->classMap) {
  29619. $this->classMap = array_merge($this->classMap, $classMap);
  29620. } else {
  29621. $this->classMap = $classMap;
  29622. }
  29623. }
  29624. /**
  29625. * Registers a set of PSR-0 directories for a given prefix, either
  29626. * appending or prepending to the ones previously set for this prefix.
  29627. *
  29628. * @param string $prefix The prefix
  29629. * @param array|string $paths The PSR-0 root directories
  29630. * @param bool $prepend Whether to prepend the directories
  29631. */
  29632. public function add($prefix, $paths, $prepend = false)
  29633. {
  29634. if (!$prefix) {
  29635. if ($prepend) {
  29636. $this->fallbackDirsPsr0 = array_merge(
  29637. (array) $paths,
  29638. $this->fallbackDirsPsr0
  29639. );
  29640. } else {
  29641. $this->fallbackDirsPsr0 = array_merge(
  29642. $this->fallbackDirsPsr0,
  29643. (array) $paths
  29644. );
  29645. }
  29646. return;
  29647. }
  29648. $first = $prefix[0];
  29649. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  29650. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  29651. return;
  29652. }
  29653. if ($prepend) {
  29654. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29655. (array) $paths,
  29656. $this->prefixesPsr0[$first][$prefix]
  29657. );
  29658. } else {
  29659. $this->prefixesPsr0[$first][$prefix] = array_merge(
  29660. $this->prefixesPsr0[$first][$prefix],
  29661. (array) $paths
  29662. );
  29663. }
  29664. }
  29665. /**
  29666. * Registers a set of PSR-4 directories for a given namespace, either
  29667. * appending or prepending to the ones previously set for this namespace.
  29668. *
  29669. * @param string $prefix The prefix/namespace, with trailing '\\'
  29670. * @param array|string $paths The PSR-4 base directories
  29671. * @param bool $prepend Whether to prepend the directories
  29672. *
  29673. * @throws \InvalidArgumentException
  29674. */
  29675. public function addPsr4($prefix, $paths, $prepend = false)
  29676. {
  29677. if (!$prefix) {
  29678. // Register directories for the root namespace.
  29679. if ($prepend) {
  29680. $this->fallbackDirsPsr4 = array_merge(
  29681. (array) $paths,
  29682. $this->fallbackDirsPsr4
  29683. );
  29684. } else {
  29685. $this->fallbackDirsPsr4 = array_merge(
  29686. $this->fallbackDirsPsr4,
  29687. (array) $paths
  29688. );
  29689. }
  29690. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  29691. // Register directories for a new namespace.
  29692. $length = strlen($prefix);
  29693. if ('\\' !== $prefix[$length - 1]) {
  29694. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29695. }
  29696. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29697. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29698. } elseif ($prepend) {
  29699. // Prepend directories for an already registered namespace.
  29700. $this->prefixDirsPsr4[$prefix] = array_merge(
  29701. (array) $paths,
  29702. $this->prefixDirsPsr4[$prefix]
  29703. );
  29704. } else {
  29705. // Append directories for an already registered namespace.
  29706. $this->prefixDirsPsr4[$prefix] = array_merge(
  29707. $this->prefixDirsPsr4[$prefix],
  29708. (array) $paths
  29709. );
  29710. }
  29711. }
  29712. /**
  29713. * Registers a set of PSR-0 directories for a given prefix,
  29714. * replacing any others previously set for this prefix.
  29715. *
  29716. * @param string $prefix The prefix
  29717. * @param array|string $paths The PSR-0 base directories
  29718. */
  29719. public function set($prefix, $paths)
  29720. {
  29721. if (!$prefix) {
  29722. $this->fallbackDirsPsr0 = (array) $paths;
  29723. } else {
  29724. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  29725. }
  29726. }
  29727. /**
  29728. * Registers a set of PSR-4 directories for a given namespace,
  29729. * replacing any others previously set for this namespace.
  29730. *
  29731. * @param string $prefix The prefix/namespace, with trailing '\\'
  29732. * @param array|string $paths The PSR-4 base directories
  29733. *
  29734. * @throws \InvalidArgumentException
  29735. */
  29736. public function setPsr4($prefix, $paths)
  29737. {
  29738. if (!$prefix) {
  29739. $this->fallbackDirsPsr4 = (array) $paths;
  29740. } else {
  29741. $length = strlen($prefix);
  29742. if ('\\' !== $prefix[$length - 1]) {
  29743. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  29744. }
  29745. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  29746. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  29747. }
  29748. }
  29749. /**
  29750. * Turns on searching the include path for class files.
  29751. *
  29752. * @param bool $useIncludePath
  29753. */
  29754. public function setUseIncludePath($useIncludePath)
  29755. {
  29756. $this->useIncludePath = $useIncludePath;
  29757. }
  29758. /**
  29759. * Can be used to check if the autoloader uses the include path to check
  29760. * for classes.
  29761. *
  29762. * @return bool
  29763. */
  29764. public function getUseIncludePath()
  29765. {
  29766. return $this->useIncludePath;
  29767. }
  29768. /**
  29769. * Turns off searching the prefix and fallback directories for classes
  29770. * that have not been registered with the class map.
  29771. *
  29772. * @param bool $classMapAuthoritative
  29773. */
  29774. public function setClassMapAuthoritative($classMapAuthoritative)
  29775. {
  29776. $this->classMapAuthoritative = $classMapAuthoritative;
  29777. }
  29778. /**
  29779. * Should class lookup fail if not found in the current class map?
  29780. *
  29781. * @return bool
  29782. */
  29783. public function isClassMapAuthoritative()
  29784. {
  29785. return $this->classMapAuthoritative;
  29786. }
  29787. /**
  29788. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  29789. *
  29790. * @param string|null $apcuPrefix
  29791. */
  29792. public function setApcuPrefix($apcuPrefix)
  29793. {
  29794. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  29795. }
  29796. /**
  29797. * The APCu prefix in use, or null if APCu caching is not enabled.
  29798. *
  29799. * @return string|null
  29800. */
  29801. public function getApcuPrefix()
  29802. {
  29803. return $this->apcuPrefix;
  29804. }
  29805. /**
  29806. * Registers this instance as an autoloader.
  29807. *
  29808. * @param bool $prepend Whether to prepend the autoloader or not
  29809. */
  29810. public function register($prepend = false)
  29811. {
  29812. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  29813. }
  29814. /**
  29815. * Unregisters this instance as an autoloader.
  29816. */
  29817. public function unregister()
  29818. {
  29819. spl_autoload_unregister(array($this, 'loadClass'));
  29820. }
  29821. /**
  29822. * Loads the given class or interface.
  29823. *
  29824. * @param string $class The name of the class
  29825. * @return bool|null True if loaded, null otherwise
  29826. */
  29827. public function loadClass($class)
  29828. {
  29829. if ($file = $this->findFile($class)) {
  29830. includeFile($file);
  29831. return true;
  29832. }
  29833. }
  29834. /**
  29835. * Finds the path to the file where the class is defined.
  29836. *
  29837. * @param string $class The name of the class
  29838. *
  29839. * @return string|false The path if found, false otherwise
  29840. */
  29841. public function findFile($class)
  29842. {
  29843. // class map lookup
  29844. if (isset($this->classMap[$class])) {
  29845. return $this->classMap[$class];
  29846. }
  29847. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  29848. return false;
  29849. }
  29850. if (null !== $this->apcuPrefix) {
  29851. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  29852. if ($hit) {
  29853. return $file;
  29854. }
  29855. }
  29856. $file = $this->findFileWithExtension($class, '.php');
  29857. // Search for Hack files if we are running on HHVM
  29858. if (false === $file && defined('HHVM_VERSION')) {
  29859. $file = $this->findFileWithExtension($class, '.hh');
  29860. }
  29861. if (null !== $this->apcuPrefix) {
  29862. apcu_add($this->apcuPrefix.$class, $file);
  29863. }
  29864. if (false === $file) {
  29865. // Remember that this class does not exist.
  29866. $this->missingClasses[$class] = true;
  29867. }
  29868. return $file;
  29869. }
  29870. private function findFileWithExtension($class, $ext)
  29871. {
  29872. // PSR-4 lookup
  29873. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  29874. $first = $class[0];
  29875. if (isset($this->prefixLengthsPsr4[$first])) {
  29876. $subPath = $class;
  29877. while (false !== $lastPos = strrpos($subPath, '\\')) {
  29878. $subPath = substr($subPath, 0, $lastPos);
  29879. $search = $subPath . '\\';
  29880. if (isset($this->prefixDirsPsr4[$search])) {
  29881. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  29882. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  29883. if (file_exists($file = $dir . $pathEnd)) {
  29884. return $file;
  29885. }
  29886. }
  29887. }
  29888. }
  29889. }
  29890. // PSR-4 fallback dirs
  29891. foreach ($this->fallbackDirsPsr4 as $dir) {
  29892. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  29893. return $file;
  29894. }
  29895. }
  29896. // PSR-0 lookup
  29897. if (false !== $pos = strrpos($class, '\\')) {
  29898. // namespaced class name
  29899. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  29900. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  29901. } else {
  29902. // PEAR-like class name
  29903. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  29904. }
  29905. if (isset($this->prefixesPsr0[$first])) {
  29906. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  29907. if (0 === strpos($class, $prefix)) {
  29908. foreach ($dirs as $dir) {
  29909. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29910. return $file;
  29911. }
  29912. }
  29913. }
  29914. }
  29915. }
  29916. // PSR-0 fallback dirs
  29917. foreach ($this->fallbackDirsPsr0 as $dir) {
  29918. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  29919. return $file;
  29920. }
  29921. }
  29922. // PSR-0 include paths.
  29923. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  29924. return $file;
  29925. }
  29926. return false;
  29927. }
  29928. }
  29929. /**
  29930. * Scope isolated include.
  29931. *
  29932. * Prevents access to $this/self from included files.
  29933. */
  29934. function includeFile($file)
  29935. {
  29936. include $file;
  29937. }
  29938. {
  29939. "$schema": "http://json-schema.org/draft-04/schema#",
  29940. "description": "A representation of packages metadata.",
  29941. "type": "object",
  29942. "oneOf": [
  29943. { "required": [ "packages" ] },
  29944. { "required": [ "providers" ] },
  29945. { "required": [ "provider-includes", "providers-url" ] }
  29946. ],
  29947. "properties": {
  29948. "packages": {
  29949. "type": ["object", "array"],
  29950. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29951. "additionalProperties": { "$ref": "#/definitions/versions" }
  29952. },
  29953. "providers-url": {
  29954. "type": "string",
  29955. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  29956. },
  29957. "provider-includes": {
  29958. "type": "object",
  29959. "description": "A hashmap of provider listings.",
  29960. "additionalProperties": { "$ref": "#/definitions/provider" }
  29961. },
  29962. "providers": {
  29963. "type": "object",
  29964. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  29965. "additionalProperties": { "$ref": "#/definitions/provider" }
  29966. },
  29967. "notify-batch": {
  29968. "type": "string",
  29969. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  29970. },
  29971. "search": {
  29972. "type": "string",
  29973. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  29974. },
  29975. "warning": {
  29976. "type": "string",
  29977. "description": "A message that will be output by Composer as a warning when this source is consulted."
  29978. }
  29979. },
  29980. "definitions": {
  29981. "versions": {
  29982. "type": "object",
  29983. "description": "A hashmap of versions and their metadata.",
  29984. "additionalProperties": { "$ref": "#/definitions/version" }
  29985. },
  29986. "version": {
  29987. "type": "object",
  29988. "oneOf": [
  29989. { "$ref": "#/definitions/package" },
  29990. { "$ref": "#/definitions/metapackage" }
  29991. ]
  29992. },
  29993. "package-base": {
  29994. "properties": {
  29995. "name": { "type": "string" },
  29996. "type": { "type": "string" },
  29997. "version": { "type": "string" },
  29998. "version_normalized": {
  29999. "type": "string",
  30000. "description": "Normalized version, optional but can save computational time on client side."
  30001. },
  30002. "autoload": { "type": "object" },
  30003. "require": { "type": "object" },
  30004. "replace": { "type": "object" },
  30005. "conflict": { "type": "object" },
  30006. "provide": { "type": "object" },
  30007. "time": { "type": "string" }
  30008. },
  30009. "additionalProperties": true
  30010. },
  30011. "package": {
  30012. "allOf": [
  30013. { "$ref": "#/definitions/package-base" },
  30014. {
  30015. "properties": {
  30016. "dist": { "type": "object" },
  30017. "source": { "type": "object" }
  30018. }
  30019. },
  30020. { "oneOf": [
  30021. { "required": [ "name", "version", "source" ] },
  30022. { "required": [ "name", "version", "dist" ] }
  30023. ] }
  30024. ]
  30025. },
  30026. "metapackage": {
  30027. "allOf": [
  30028. { "$ref": "#/definitions/package-base" },
  30029. {
  30030. "properties": {
  30031. "type": { "type": "string", "enum": [ "metapackage" ] }
  30032. },
  30033. "required": [ "name", "version", "type" ]
  30034. }
  30035. ]
  30036. },
  30037. "provider": {
  30038. "type": "object",
  30039. "properties": {
  30040. "sha256": {
  30041. "type": "string",
  30042. "description": "Hash value that can be used to validate the resource."
  30043. }
  30044. }
  30045. }
  30046. }
  30047. }
  30048. {
  30049. "$schema": "http://json-schema.org/draft-04/schema#",
  30050. "name": "Package",
  30051. "type": "object",
  30052. "additionalProperties": false,
  30053. "required": [ "name", "description" ],
  30054. "properties": {
  30055. "name": {
  30056. "type": "string",
  30057. "description": "Package name, including 'vendor-name/' prefix."
  30058. },
  30059. "type": {
  30060. "description": "Package type, either 'library' for common packages, 'composer-plugin' for plugins, 'metapackage' for empty packages, or a custom type ([a-z0-9-]+) defined by whatever project this package applies to.",
  30061. "type": "string",
  30062. "pattern": "^[a-z0-9-]+$"
  30063. },
  30064. "target-dir": {
  30065. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  30066. "type": "string"
  30067. },
  30068. "description": {
  30069. "type": "string",
  30070. "description": "Short package description."
  30071. },
  30072. "keywords": {
  30073. "type": "array",
  30074. "items": {
  30075. "type": "string",
  30076. "description": "A tag/keyword that this package relates to."
  30077. }
  30078. },
  30079. "homepage": {
  30080. "type": "string",
  30081. "description": "Homepage URL for the project.",
  30082. "format": "uri"
  30083. },
  30084. "readme": {
  30085. "type": "string",
  30086. "description": "Relative path to the readme document."
  30087. },
  30088. "version": {
  30089. "type": "string",
  30090. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  30091. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?|^dev-"
  30092. },
  30093. "time": {
  30094. "type": "string",
  30095. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  30096. },
  30097. "license": {
  30098. "type": ["string", "array"],
  30099. "description": "License name. Or an array of license names."
  30100. },
  30101. "authors": {
  30102. "$ref": "#/definitions/authors"
  30103. },
  30104. "require": {
  30105. "type": "object",
  30106. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  30107. "additionalProperties": {
  30108. "type": "string"
  30109. }
  30110. },
  30111. "replace": {
  30112. "type": "object",
  30113. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  30114. "additionalProperties": {
  30115. "type": "string"
  30116. }
  30117. },
  30118. "conflict": {
  30119. "type": "object",
  30120. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  30121. "additionalProperties": {
  30122. "type": "string"
  30123. }
  30124. },
  30125. "provide": {
  30126. "type": "object",
  30127. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  30128. "additionalProperties": {
  30129. "type": "string"
  30130. }
  30131. },
  30132. "require-dev": {
  30133. "type": "object",
  30134. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  30135. "additionalProperties": {
  30136. "type": "string"
  30137. }
  30138. },
  30139. "suggest": {
  30140. "type": "object",
  30141. "description": "This is a hash of package name (keys) and descriptions (values) that this package suggests work well with it (this will be suggested to the user during installation).",
  30142. "additionalProperties": {
  30143. "type": "string"
  30144. }
  30145. },
  30146. "config": {
  30147. "type": "object",
  30148. "description": "Composer options.",
  30149. "properties": {
  30150. "process-timeout": {
  30151. "type": "integer",
  30152. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  30153. },
  30154. "use-include-path": {
  30155. "type": "boolean",
  30156. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  30157. },
  30158. "preferred-install": {
  30159. "type": ["string", "object"],
  30160. "description": "The install method Composer will prefer to use, defaults to auto and can be any of source, dist, auto, or a hash of {\"pattern\": \"preference\"}."
  30161. },
  30162. "notify-on-install": {
  30163. "type": "boolean",
  30164. "description": "Composer allows repositories to define a notification URL, so that they get notified whenever a package from that repository is installed. This option allows you to disable that behaviour, defaults to true."
  30165. },
  30166. "github-protocols": {
  30167. "type": "array",
  30168. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  30169. "items": {
  30170. "type": "string"
  30171. }
  30172. },
  30173. "github-oauth": {
  30174. "type": "object",
  30175. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  30176. "additionalProperties": {
  30177. "type": "string"
  30178. }
  30179. },
  30180. "gitlab-oauth": {
  30181. "type": "object",
  30182. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30183. "additionalProperties": {
  30184. "type": "string"
  30185. }
  30186. },
  30187. "gitlab-token": {
  30188. "type": "object",
  30189. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  30190. "additionalProperties": {
  30191. "type": "string"
  30192. }
  30193. },
  30194. "bearer": {
  30195. "type": "object",
  30196. "description": "A hash of domain name => bearer authentication token, for example {\"example.com\":\"<token>\"}.",
  30197. "additionalProperties": {
  30198. "type": "string"
  30199. }
  30200. },
  30201. "disable-tls": {
  30202. "type": "boolean",
  30203. "description": "Defaults to `false`. If set to true all HTTPS URLs will be tried with HTTP instead and no network level encryption is performed. Enabling this is a security risk and is NOT recommended. The better way is to enable the php_openssl extension in php.ini."
  30204. },
  30205. "secure-http": {
  30206. "type": "boolean",
  30207. "description": "Defaults to `true`. If set to true only HTTPS URLs are allowed to be downloaded via Composer. If you really absolutely need HTTP access to something then you can disable it, but using \"Let's Encrypt\" to get a free SSL certificate is generally a better alternative."
  30208. },
  30209. "cafile": {
  30210. "type": "string",
  30211. "description": "A way to set the path to the openssl CA file. In PHP 5.6+ you should rather set this via openssl.cafile in php.ini, although PHP 5.6+ should be able to detect your system CA file automatically."
  30212. },
  30213. "capath": {
  30214. "type": "string",
  30215. "description": "If cafile is not specified or if the certificate is not found there, the directory pointed to by capath is searched for a suitable certificate. capath must be a correctly hashed certificate directory."
  30216. },
  30217. "http-basic": {
  30218. "type": "object",
  30219. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  30220. "additionalProperties": {
  30221. "type": "object",
  30222. "required": ["username", "password"],
  30223. "properties": {
  30224. "username": {
  30225. "type": "string",
  30226. "description": "The username used for HTTP Basic authentication"
  30227. },
  30228. "password": {
  30229. "type": "string",
  30230. "description": "The password used for HTTP Basic authentication"
  30231. }
  30232. }
  30233. }
  30234. },
  30235. "store-auths": {
  30236. "type": ["string", "boolean"],
  30237. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  30238. },
  30239. "platform": {
  30240. "type": "object",
  30241. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  30242. "additionalProperties": {
  30243. "type": "string"
  30244. }
  30245. },
  30246. "vendor-dir": {
  30247. "type": "string",
  30248. "description": "The location where all packages are installed, defaults to \"vendor\"."
  30249. },
  30250. "bin-dir": {
  30251. "type": "string",
  30252. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  30253. },
  30254. "data-dir": {
  30255. "type": "string",
  30256. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  30257. },
  30258. "cache-dir": {
  30259. "type": "string",
  30260. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  30261. },
  30262. "cache-files-dir": {
  30263. "type": "string",
  30264. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  30265. },
  30266. "cache-repo-dir": {
  30267. "type": "string",
  30268. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  30269. },
  30270. "cache-vcs-dir": {
  30271. "type": "string",
  30272. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  30273. },
  30274. "cache-ttl": {
  30275. "type": "integer",
  30276. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  30277. },
  30278. "cache-files-ttl": {
  30279. "type": "integer",
  30280. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  30281. },
  30282. "cache-files-maxsize": {
  30283. "type": ["string", "integer"],
  30284. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  30285. },
  30286. "bin-compat": {
  30287. "enum": ["auto", "full"],
  30288. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  30289. },
  30290. "discard-changes": {
  30291. "type": ["string", "boolean"],
  30292. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  30293. },
  30294. "autoloader-suffix": {
  30295. "type": "string",
  30296. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  30297. },
  30298. "optimize-autoloader": {
  30299. "type": "boolean",
  30300. "description": "Always optimize when dumping the autoloader."
  30301. },
  30302. "prepend-autoloader": {
  30303. "type": "boolean",
  30304. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  30305. },
  30306. "classmap-authoritative": {
  30307. "type": "boolean",
  30308. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  30309. },
  30310. "apcu-autoloader": {
  30311. "type": "boolean",
  30312. "description": "If true, the Composer autoloader will check for APCu and use it to cache found/not-found classes when the extension is enabled, defaults to false."
  30313. },
  30314. "github-domains": {
  30315. "type": "array",
  30316. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  30317. "items": {
  30318. "type": "string"
  30319. }
  30320. },
  30321. "github-expose-hostname": {
  30322. "type": "boolean",
  30323. "description": "Defaults to true. If set to false, the OAuth tokens created to access the github API will have a date instead of the machine hostname."
  30324. },
  30325. "gitlab-domains": {
  30326. "type": "array",
  30327. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  30328. "items": {
  30329. "type": "string"
  30330. }
  30331. },
  30332. "use-github-api": {
  30333. "type": "boolean",
  30334. "description": "Defaults to true. If set to false, globally disables the use of the GitHub API for all GitHub repositories and clones the repository as it would for any other repository."
  30335. },
  30336. "archive-format": {
  30337. "type": "string",
  30338. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  30339. },
  30340. "archive-dir": {
  30341. "type": "string",
  30342. "description": "The default archive path when not provided on cli, defaults to \".\"."
  30343. },
  30344. "htaccess-protect": {
  30345. "type": "boolean",
  30346. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  30347. },
  30348. "sort-packages": {
  30349. "type": "boolean",
  30350. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  30351. },
  30352. "lock": {
  30353. "type": "boolean",
  30354. "description": "Defaults to true. If set to false, Composer will not create a composer.lock file."
  30355. }
  30356. }
  30357. },
  30358. "extra": {
  30359. "type": ["object", "array"],
  30360. "description": "Arbitrary extra data that can be used by plugins, for example, package of type composer-plugin may have a 'class' key defining an installer class name.",
  30361. "additionalProperties": true
  30362. },
  30363. "autoload": {
  30364. "$ref": "#/definitions/autoload"
  30365. },
  30366. "autoload-dev": {
  30367. "type": "object",
  30368. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  30369. "properties": {
  30370. "psr-0": {
  30371. "type": "object",
  30372. "description": "This is a hash of namespaces (keys) and the directories they can be found into (values, can be arrays of paths) by the autoloader.",
  30373. "additionalProperties": {
  30374. "type": ["string", "array"],
  30375. "items": {
  30376. "type": "string"
  30377. }
  30378. }
  30379. },
  30380. "psr-4": {
  30381. "type": "object",
  30382. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30383. "additionalProperties": {
  30384. "type": ["string", "array"],
  30385. "items": {
  30386. "type": "string"
  30387. }
  30388. }
  30389. },
  30390. "classmap": {
  30391. "type": "array",
  30392. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30393. },
  30394. "files": {
  30395. "type": "array",
  30396. "description": "This is an array of files that are always required on every request."
  30397. }
  30398. }
  30399. },
  30400. "archive": {
  30401. "type": ["object"],
  30402. "description": "Options for creating package archives for distribution.",
  30403. "properties": {
  30404. "exclude": {
  30405. "type": "array",
  30406. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  30407. }
  30408. }
  30409. },
  30410. "repositories": {
  30411. "type": ["object", "array"],
  30412. "description": "A set of additional repositories where packages can be found.",
  30413. "additionalProperties": {
  30414. "oneOf": [
  30415. { "$ref": "#/definitions/repository" },
  30416. { "type": "boolean", "enum": [false] }
  30417. ]
  30418. },
  30419. "items": {
  30420. "oneOf": [
  30421. { "$ref": "#/definitions/repository" },
  30422. {
  30423. "type": "object",
  30424. "additionalProperties": { "type": "boolean", "enum": [false] },
  30425. "minProperties": 1,
  30426. "maxProperties": 1
  30427. }
  30428. ]
  30429. }
  30430. },
  30431. "minimum-stability": {
  30432. "type": ["string"],
  30433. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  30434. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  30435. },
  30436. "prefer-stable": {
  30437. "type": ["boolean"],
  30438. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  30439. },
  30440. "bin": {
  30441. "type": ["string", "array"],
  30442. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30443. "items": {
  30444. "type": "string"
  30445. }
  30446. },
  30447. "include-path": {
  30448. "type": ["array"],
  30449. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  30450. "items": {
  30451. "type": "string"
  30452. }
  30453. },
  30454. "scripts": {
  30455. "type": ["object"],
  30456. "description": "Script listeners that will be executed before/after some events.",
  30457. "properties": {
  30458. "pre-install-cmd": {
  30459. "type": ["array", "string"],
  30460. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  30461. },
  30462. "post-install-cmd": {
  30463. "type": ["array", "string"],
  30464. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  30465. },
  30466. "pre-update-cmd": {
  30467. "type": ["array", "string"],
  30468. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  30469. },
  30470. "post-update-cmd": {
  30471. "type": ["array", "string"],
  30472. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  30473. },
  30474. "pre-status-cmd": {
  30475. "type": ["array", "string"],
  30476. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  30477. },
  30478. "post-status-cmd": {
  30479. "type": ["array", "string"],
  30480. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  30481. },
  30482. "pre-package-install": {
  30483. "type": ["array", "string"],
  30484. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  30485. },
  30486. "post-package-install": {
  30487. "type": ["array", "string"],
  30488. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  30489. },
  30490. "pre-package-update": {
  30491. "type": ["array", "string"],
  30492. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  30493. },
  30494. "post-package-update": {
  30495. "type": ["array", "string"],
  30496. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  30497. },
  30498. "pre-package-uninstall": {
  30499. "type": ["array", "string"],
  30500. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30501. },
  30502. "post-package-uninstall": {
  30503. "type": ["array", "string"],
  30504. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  30505. },
  30506. "pre-autoload-dump": {
  30507. "type": ["array", "string"],
  30508. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30509. },
  30510. "post-autoload-dump": {
  30511. "type": ["array", "string"],
  30512. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  30513. },
  30514. "post-root-package-install": {
  30515. "type": ["array", "string"],
  30516. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  30517. },
  30518. "post-create-project-cmd": {
  30519. "type": ["array", "string"],
  30520. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  30521. }
  30522. }
  30523. },
  30524. "scripts-descriptions": {
  30525. "type": ["object"],
  30526. "description": "Descriptions for custom commands, shown in console help.",
  30527. "additionalProperties": {
  30528. "type": "string"
  30529. }
  30530. },
  30531. "support": {
  30532. "type": "object",
  30533. "properties": {
  30534. "email": {
  30535. "type": "string",
  30536. "description": "Email address for support.",
  30537. "format": "email"
  30538. },
  30539. "issues": {
  30540. "type": "string",
  30541. "description": "URL to the issue tracker.",
  30542. "format": "uri"
  30543. },
  30544. "forum": {
  30545. "type": "string",
  30546. "description": "URL to the forum.",
  30547. "format": "uri"
  30548. },
  30549. "wiki": {
  30550. "type": "string",
  30551. "description": "URL to the wiki.",
  30552. "format": "uri"
  30553. },
  30554. "irc": {
  30555. "type": "string",
  30556. "description": "IRC channel for support, as irc://server/channel.",
  30557. "format": "uri"
  30558. },
  30559. "chat": {
  30560. "type": "string",
  30561. "description": "URL to the support chat.",
  30562. "format": "uri"
  30563. },
  30564. "source": {
  30565. "type": "string",
  30566. "description": "URL to browse or download the sources.",
  30567. "format": "uri"
  30568. },
  30569. "docs": {
  30570. "type": "string",
  30571. "description": "URL to the documentation.",
  30572. "format": "uri"
  30573. },
  30574. "rss": {
  30575. "type": "string",
  30576. "description": "URL to the RSS feed.",
  30577. "format": "uri"
  30578. }
  30579. }
  30580. },
  30581. "funding": {
  30582. "type": "array",
  30583. "description": "A list of options to fund the development and maintenance of the package.",
  30584. "items": {
  30585. "type": "object",
  30586. "properties": {
  30587. "type": {
  30588. "type": "string",
  30589. "description": "Type of funding or platform through which funding is possible."
  30590. },
  30591. "url": {
  30592. "type": "string",
  30593. "description": "URL to a website with details on funding and a way to fund the package.",
  30594. "format": "uri"
  30595. }
  30596. }
  30597. }
  30598. },
  30599. "non-feature-branches": {
  30600. "type": ["array"],
  30601. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  30602. "items": {
  30603. "type": "string"
  30604. }
  30605. },
  30606. "abandoned": {
  30607. "type": ["boolean", "string"],
  30608. "description": "Indicates whether this package has been abandoned, it can be boolean or a package name/URL pointing to a recommended alternative. Defaults to false."
  30609. },
  30610. "_comment": {
  30611. "type": ["array", "string"],
  30612. "description": "A key to store comments in"
  30613. }
  30614. },
  30615. "definitions": {
  30616. "authors": {
  30617. "type": "array",
  30618. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  30619. "items": {
  30620. "type": "object",
  30621. "additionalProperties": false,
  30622. "required": [ "name"],
  30623. "properties": {
  30624. "name": {
  30625. "type": "string",
  30626. "description": "Full name of the author."
  30627. },
  30628. "email": {
  30629. "type": "string",
  30630. "description": "Email address of the author.",
  30631. "format": "email"
  30632. },
  30633. "homepage": {
  30634. "type": "string",
  30635. "description": "Homepage URL for the author.",
  30636. "format": "uri"
  30637. },
  30638. "role": {
  30639. "type": "string",
  30640. "description": "Author's role in the project."
  30641. }
  30642. }
  30643. }
  30644. },
  30645. "autoload": {
  30646. "type": "object",
  30647. "description": "Description of how the package can be autoloaded.",
  30648. "properties": {
  30649. "psr-0": {
  30650. "type": "object",
  30651. "description": "This is a hash of namespaces (keys) and the directories they can be found in (values, can be arrays of paths) by the autoloader.",
  30652. "additionalProperties": {
  30653. "type": ["string", "array"],
  30654. "items": {
  30655. "type": "string"
  30656. }
  30657. }
  30658. },
  30659. "psr-4": {
  30660. "type": "object",
  30661. "description": "This is a hash of namespaces (keys) and the PSR-4 directories they can map to (values, can be arrays of paths) by the autoloader.",
  30662. "additionalProperties": {
  30663. "type": ["string", "array"],
  30664. "items": {
  30665. "type": "string"
  30666. }
  30667. }
  30668. },
  30669. "classmap": {
  30670. "type": "array",
  30671. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  30672. },
  30673. "files": {
  30674. "type": "array",
  30675. "description": "This is an array of files that are always required on every request."
  30676. },
  30677. "exclude-from-classmap": {
  30678. "type": "array",
  30679. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  30680. }
  30681. }
  30682. },
  30683. "repository": {
  30684. "type": "object",
  30685. "oneOf": [
  30686. { "$ref": "#/definitions/composer-repository" },
  30687. { "$ref": "#/definitions/vcs-repository" },
  30688. { "$ref": "#/definitions/path-repository" },
  30689. { "$ref": "#/definitions/artifact-repository" },
  30690. { "$ref": "#/definitions/pear-repository" },
  30691. { "$ref": "#/definitions/package-repository" }
  30692. ]
  30693. },
  30694. "composer-repository": {
  30695. "type": "object",
  30696. "required": ["type", "url"],
  30697. "properties": {
  30698. "type": { "type": "string", "enum": ["composer"] },
  30699. "url": { "type": "string" },
  30700. "options": {
  30701. "type": "object",
  30702. "additionalProperties": true
  30703. },
  30704. "allow_ssl_downgrade": { "type": "boolean" },
  30705. "force-lazy-providers": { "type": "boolean" }
  30706. }
  30707. },
  30708. "vcs-repository": {
  30709. "type": "object",
  30710. "required": ["type", "url"],
  30711. "properties": {
  30712. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  30713. "url": { "type": "string" },
  30714. "no-api": { "type": "boolean" },
  30715. "secure-http": { "type": "boolean" },
  30716. "svn-cache-credentials": { "type": "boolean" },
  30717. "trunk-path": { "type": ["string", "boolean"] },
  30718. "branches-path": { "type": ["string", "boolean"] },
  30719. "tags-path": { "type": ["string", "boolean"] },
  30720. "package-path": { "type": "string" },
  30721. "depot": { "type": "string" },
  30722. "branch": { "type": "string" },
  30723. "unique_perforce_client_name": { "type": "string" },
  30724. "p4user": { "type": "string" },
  30725. "p4password": { "type": "string" }
  30726. }
  30727. },
  30728. "path-repository": {
  30729. "type": "object",
  30730. "required": ["type", "url"],
  30731. "properties": {
  30732. "type": { "type": "string", "enum": ["path"] },
  30733. "url": { "type": "string" },
  30734. "options": {
  30735. "type": "object",
  30736. "properties": {
  30737. "symlink": { "type": ["boolean", "null"] }
  30738. },
  30739. "additionalProperties": true
  30740. }
  30741. }
  30742. },
  30743. "artifact-repository": {
  30744. "type": "object",
  30745. "required": ["type", "url"],
  30746. "properties": {
  30747. "type": { "type": "string", "enum": ["artifact"] },
  30748. "url": { "type": "string" }
  30749. }
  30750. },
  30751. "pear-repository": {
  30752. "type": "object",
  30753. "required": ["type", "url"],
  30754. "properties": {
  30755. "type": { "type": "string", "enum": ["pear"] },
  30756. "url": { "type": "string" },
  30757. "vendor-alias": { "type": "string" }
  30758. }
  30759. },
  30760. "package-repository": {
  30761. "type": "object",
  30762. "required": ["type", "package"],
  30763. "properties": {
  30764. "type": { "type": "string", "enum": ["package"] },
  30765. "package": {
  30766. "oneOf": [
  30767. { "$ref": "#/definitions/inline-package" },
  30768. {
  30769. "type": "array",
  30770. "items": { "$ref": "#/definitions/inline-package" }
  30771. }
  30772. ]
  30773. }
  30774. }
  30775. },
  30776. "inline-package": {
  30777. "type": "object",
  30778. "required": ["name", "version"],
  30779. "properties": {
  30780. "name": {
  30781. "type": "string",
  30782. "description": "Package name, including 'vendor-name/' prefix."
  30783. },
  30784. "type": {
  30785. "type": "string"
  30786. },
  30787. "target-dir": {
  30788. "description": "DEPRECATED: Forces the package to be installed into the given subdirectory path. This is used for autoloading PSR-0 packages that do not contain their full path. Use forward slashes for cross-platform compatibility.",
  30789. "type": "string"
  30790. },
  30791. "description": {
  30792. "type": "string"
  30793. },
  30794. "keywords": {
  30795. "type": "array",
  30796. "items": {
  30797. "type": "string"
  30798. }
  30799. },
  30800. "homepage": {
  30801. "type": "string",
  30802. "format": "uri"
  30803. },
  30804. "version": {
  30805. "type": "string"
  30806. },
  30807. "time": {
  30808. "type": "string"
  30809. },
  30810. "license": {
  30811. "type": [
  30812. "string",
  30813. "array"
  30814. ]
  30815. },
  30816. "authors": {
  30817. "$ref": "#/definitions/authors"
  30818. },
  30819. "require": {
  30820. "type": "object",
  30821. "additionalProperties": {
  30822. "type": "string"
  30823. }
  30824. },
  30825. "replace": {
  30826. "type": "object",
  30827. "additionalProperties": {
  30828. "type": "string"
  30829. }
  30830. },
  30831. "conflict": {
  30832. "type": "object",
  30833. "additionalProperties": {
  30834. "type": "string"
  30835. }
  30836. },
  30837. "provide": {
  30838. "type": "object",
  30839. "additionalProperties": {
  30840. "type": "string"
  30841. }
  30842. },
  30843. "require-dev": {
  30844. "type": "object",
  30845. "additionalProperties": {
  30846. "type": "string"
  30847. }
  30848. },
  30849. "suggest": {
  30850. "type": "object",
  30851. "additionalProperties": {
  30852. "type": "string"
  30853. }
  30854. },
  30855. "extra": {
  30856. "type": ["object", "array"],
  30857. "additionalProperties": true
  30858. },
  30859. "autoload": {
  30860. "$ref": "#/definitions/autoload"
  30861. },
  30862. "archive": {
  30863. "type": ["object"],
  30864. "properties": {
  30865. "exclude": {
  30866. "type": "array"
  30867. }
  30868. }
  30869. },
  30870. "bin": {
  30871. "type": ["string", "array"],
  30872. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  30873. "items": {
  30874. "type": "string"
  30875. }
  30876. },
  30877. "include-path": {
  30878. "type": ["array"],
  30879. "description": "DEPRECATED: A list of directories which should get added to PHP's include path. This is only present to support legacy projects, and all new code should preferably use autoloading.",
  30880. "items": {
  30881. "type": "string"
  30882. }
  30883. },
  30884. "source": {
  30885. "type": "object",
  30886. "required": ["type", "url", "reference"],
  30887. "properties": {
  30888. "type": {
  30889. "type": "string"
  30890. },
  30891. "url": {
  30892. "type": "string"
  30893. },
  30894. "reference": {
  30895. "type": "string"
  30896. },
  30897. "mirrors": {
  30898. "type": "array"
  30899. }
  30900. }
  30901. },
  30902. "dist": {
  30903. "type": "object",
  30904. "required": ["type", "url"],
  30905. "properties": {
  30906. "type": {
  30907. "type": "string"
  30908. },
  30909. "url": {
  30910. "type": "string"
  30911. },
  30912. "reference": {
  30913. "type": "string"
  30914. },
  30915. "shasum": {
  30916. "type": "string"
  30917. },
  30918. "mirrors": {
  30919. "type": "array"
  30920. }
  30921. }
  30922. }
  30923. },
  30924. "additionalProperties": true
  30925. }
  30926. }
  30927. }
  30928. {
  30929. "389-exception": [
  30930. "389 Directory Server Exception"
  30931. ],
  30932. "Autoconf-exception-2.0": [
  30933. "Autoconf exception 2.0"
  30934. ],
  30935. "Autoconf-exception-3.0": [
  30936. "Autoconf exception 3.0"
  30937. ],
  30938. "Bison-exception-2.2": [
  30939. "Bison exception 2.2"
  30940. ],
  30941. "Bootloader-exception": [
  30942. "Bootloader Distribution Exception"
  30943. ],
  30944. "Classpath-exception-2.0": [
  30945. "Classpath exception 2.0"
  30946. ],
  30947. "CLISP-exception-2.0": [
  30948. "CLISP exception 2.0"
  30949. ],
  30950. "DigiRule-FOSS-exception": [
  30951. "DigiRule FOSS License Exception"
  30952. ],
  30953. "eCos-exception-2.0": [
  30954. "eCos exception 2.0"
  30955. ],
  30956. "Fawkes-Runtime-exception": [
  30957. "Fawkes Runtime Exception"
  30958. ],
  30959. "FLTK-exception": [
  30960. "FLTK exception"
  30961. ],
  30962. "Font-exception-2.0": [
  30963. "Font exception 2.0"
  30964. ],
  30965. "freertos-exception-2.0": [
  30966. "FreeRTOS Exception 2.0"
  30967. ],
  30968. "GCC-exception-2.0": [
  30969. "GCC Runtime Library exception 2.0"
  30970. ],
  30971. "GCC-exception-3.1": [
  30972. "GCC Runtime Library exception 3.1"
  30973. ],
  30974. "gnu-javamail-exception": [
  30975. "GNU JavaMail exception"
  30976. ],
  30977. "GPL-3.0-linking-exception": [
  30978. "GPL-3.0 Linking Exception"
  30979. ],
  30980. "GPL-3.0-linking-source-exception": [
  30981. "GPL-3.0 Linking Exception (with Corresponding Source)"
  30982. ],
  30983. "GPL-CC-1.0": [
  30984. "GPL Cooperation Commitment 1.0"
  30985. ],
  30986. "i2p-gpl-java-exception": [
  30987. "i2p GPL+Java Exception"
  30988. ],
  30989. "LGPL-3.0-linking-exception": [
  30990. "LGPL-3.0 Linking Exception"
  30991. ],
  30992. "Libtool-exception": [
  30993. "Libtool Exception"
  30994. ],
  30995. "Linux-syscall-note": [
  30996. "Linux Syscall Note"
  30997. ],
  30998. "LLVM-exception": [
  30999. "LLVM Exception"
  31000. ],
  31001. "LZMA-exception": [
  31002. "LZMA exception"
  31003. ],
  31004. "mif-exception": [
  31005. "Macros and Inline Functions Exception"
  31006. ],
  31007. "Nokia-Qt-exception-1.1": [
  31008. "Nokia Qt LGPL exception 1.1"
  31009. ],
  31010. "OCaml-LGPL-linking-exception": [
  31011. "OCaml LGPL Linking Exception"
  31012. ],
  31013. "OCCT-exception-1.0": [
  31014. "Open CASCADE Exception 1.0"
  31015. ],
  31016. "OpenJDK-assembly-exception-1.0": [
  31017. "OpenJDK Assembly exception 1.0"
  31018. ],
  31019. "openvpn-openssl-exception": [
  31020. "OpenVPN OpenSSL Exception"
  31021. ],
  31022. "PS-or-PDF-font-exception-20170817": [
  31023. "PS/PDF font exception (2017-08-17)"
  31024. ],
  31025. "Qt-GPL-exception-1.0": [
  31026. "Qt GPL exception 1.0"
  31027. ],
  31028. "Qt-LGPL-exception-1.1": [
  31029. "Qt LGPL exception 1.1"
  31030. ],
  31031. "Qwt-exception-1.0": [
  31032. "Qwt exception 1.0"
  31033. ],
  31034. "SHL-2.0": [
  31035. "Solderpad Hardware License v2.0"
  31036. ],
  31037. "SHL-2.1": [
  31038. "Solderpad Hardware License v2.1"
  31039. ],
  31040. "Swift-exception": [
  31041. "Swift Exception"
  31042. ],
  31043. "u-boot-exception-2.0": [
  31044. "U-Boot exception 2.0"
  31045. ],
  31046. "Universal-FOSS-exception-1.0": [
  31047. "Universal FOSS Exception, Version 1.0"
  31048. ],
  31049. "WxWindows-exception-3.1": [
  31050. "WxWindows Library Exception 3.1"
  31051. ]
  31052. }{
  31053. "0BSD": [
  31054. "BSD Zero Clause License",
  31055. true,
  31056. false
  31057. ],
  31058. "AAL": [
  31059. "Attribution Assurance License",
  31060. true,
  31061. false
  31062. ],
  31063. "Abstyles": [
  31064. "Abstyles License",
  31065. false,
  31066. false
  31067. ],
  31068. "Adobe-2006": [
  31069. "Adobe Systems Incorporated Source Code License Agreement",
  31070. false,
  31071. false
  31072. ],
  31073. "Adobe-Glyph": [
  31074. "Adobe Glyph List License",
  31075. false,
  31076. false
  31077. ],
  31078. "ADSL": [
  31079. "Amazon Digital Services License",
  31080. false,
  31081. false
  31082. ],
  31083. "AFL-1.1": [
  31084. "Academic Free License v1.1",
  31085. true,
  31086. false
  31087. ],
  31088. "AFL-1.2": [
  31089. "Academic Free License v1.2",
  31090. true,
  31091. false
  31092. ],
  31093. "AFL-2.0": [
  31094. "Academic Free License v2.0",
  31095. true,
  31096. false
  31097. ],
  31098. "AFL-2.1": [
  31099. "Academic Free License v2.1",
  31100. true,
  31101. false
  31102. ],
  31103. "AFL-3.0": [
  31104. "Academic Free License v3.0",
  31105. true,
  31106. false
  31107. ],
  31108. "Afmparse": [
  31109. "Afmparse License",
  31110. false,
  31111. false
  31112. ],
  31113. "AGPL-1.0": [
  31114. "Affero General Public License v1.0",
  31115. false,
  31116. true
  31117. ],
  31118. "AGPL-1.0-only": [
  31119. "Affero General Public License v1.0 only",
  31120. false,
  31121. false
  31122. ],
  31123. "AGPL-1.0-or-later": [
  31124. "Affero General Public License v1.0 or later",
  31125. false,
  31126. false
  31127. ],
  31128. "AGPL-3.0": [
  31129. "GNU Affero General Public License v3.0",
  31130. true,
  31131. true
  31132. ],
  31133. "AGPL-3.0-only": [
  31134. "GNU Affero General Public License v3.0 only",
  31135. true,
  31136. false
  31137. ],
  31138. "AGPL-3.0-or-later": [
  31139. "GNU Affero General Public License v3.0 or later",
  31140. true,
  31141. false
  31142. ],
  31143. "Aladdin": [
  31144. "Aladdin Free Public License",
  31145. false,
  31146. false
  31147. ],
  31148. "AMDPLPA": [
  31149. "AMD's plpa_map.c License",
  31150. false,
  31151. false
  31152. ],
  31153. "AML": [
  31154. "Apple MIT License",
  31155. false,
  31156. false
  31157. ],
  31158. "AMPAS": [
  31159. "Academy of Motion Picture Arts and Sciences BSD",
  31160. false,
  31161. false
  31162. ],
  31163. "ANTLR-PD": [
  31164. "ANTLR Software Rights Notice",
  31165. false,
  31166. false
  31167. ],
  31168. "Apache-1.0": [
  31169. "Apache License 1.0",
  31170. false,
  31171. false
  31172. ],
  31173. "Apache-1.1": [
  31174. "Apache License 1.1",
  31175. true,
  31176. false
  31177. ],
  31178. "Apache-2.0": [
  31179. "Apache License 2.0",
  31180. true,
  31181. false
  31182. ],
  31183. "APAFML": [
  31184. "Adobe Postscript AFM License",
  31185. false,
  31186. false
  31187. ],
  31188. "APL-1.0": [
  31189. "Adaptive Public License 1.0",
  31190. true,
  31191. false
  31192. ],
  31193. "APSL-1.0": [
  31194. "Apple Public Source License 1.0",
  31195. true,
  31196. false
  31197. ],
  31198. "APSL-1.1": [
  31199. "Apple Public Source License 1.1",
  31200. true,
  31201. false
  31202. ],
  31203. "APSL-1.2": [
  31204. "Apple Public Source License 1.2",
  31205. true,
  31206. false
  31207. ],
  31208. "APSL-2.0": [
  31209. "Apple Public Source License 2.0",
  31210. true,
  31211. false
  31212. ],
  31213. "Artistic-1.0": [
  31214. "Artistic License 1.0",
  31215. true,
  31216. false
  31217. ],
  31218. "Artistic-1.0-cl8": [
  31219. "Artistic License 1.0 w/clause 8",
  31220. true,
  31221. false
  31222. ],
  31223. "Artistic-1.0-Perl": [
  31224. "Artistic License 1.0 (Perl)",
  31225. true,
  31226. false
  31227. ],
  31228. "Artistic-2.0": [
  31229. "Artistic License 2.0",
  31230. true,
  31231. false
  31232. ],
  31233. "Bahyph": [
  31234. "Bahyph License",
  31235. false,
  31236. false
  31237. ],
  31238. "Barr": [
  31239. "Barr License",
  31240. false,
  31241. false
  31242. ],
  31243. "Beerware": [
  31244. "Beerware License",
  31245. false,
  31246. false
  31247. ],
  31248. "BitTorrent-1.0": [
  31249. "BitTorrent Open Source License v1.0",
  31250. false,
  31251. false
  31252. ],
  31253. "BitTorrent-1.1": [
  31254. "BitTorrent Open Source License v1.1",
  31255. false,
  31256. false
  31257. ],
  31258. "blessing": [
  31259. "SQLite Blessing",
  31260. false,
  31261. false
  31262. ],
  31263. "BlueOak-1.0.0": [
  31264. "Blue Oak Model License 1.0.0",
  31265. false,
  31266. false
  31267. ],
  31268. "Borceux": [
  31269. "Borceux license",
  31270. false,
  31271. false
  31272. ],
  31273. "BSD-1-Clause": [
  31274. "BSD 1-Clause License",
  31275. true,
  31276. false
  31277. ],
  31278. "BSD-2-Clause": [
  31279. "BSD 2-Clause \"Simplified\" License",
  31280. true,
  31281. false
  31282. ],
  31283. "BSD-2-Clause-FreeBSD": [
  31284. "BSD 2-Clause FreeBSD License",
  31285. false,
  31286. false
  31287. ],
  31288. "BSD-2-Clause-NetBSD": [
  31289. "BSD 2-Clause NetBSD License",
  31290. false,
  31291. true
  31292. ],
  31293. "BSD-2-Clause-Patent": [
  31294. "BSD-2-Clause Plus Patent License",
  31295. true,
  31296. false
  31297. ],
  31298. "BSD-3-Clause": [
  31299. "BSD 3-Clause \"New\" or \"Revised\" License",
  31300. true,
  31301. false
  31302. ],
  31303. "BSD-3-Clause-Attribution": [
  31304. "BSD with attribution",
  31305. false,
  31306. false
  31307. ],
  31308. "BSD-3-Clause-Clear": [
  31309. "BSD 3-Clause Clear License",
  31310. false,
  31311. false
  31312. ],
  31313. "BSD-3-Clause-LBNL": [
  31314. "Lawrence Berkeley National Labs BSD variant license",
  31315. true,
  31316. false
  31317. ],
  31318. "BSD-3-Clause-No-Nuclear-License": [
  31319. "BSD 3-Clause No Nuclear License",
  31320. false,
  31321. false
  31322. ],
  31323. "BSD-3-Clause-No-Nuclear-License-2014": [
  31324. "BSD 3-Clause No Nuclear License 2014",
  31325. false,
  31326. false
  31327. ],
  31328. "BSD-3-Clause-No-Nuclear-Warranty": [
  31329. "BSD 3-Clause No Nuclear Warranty",
  31330. false,
  31331. false
  31332. ],
  31333. "BSD-3-Clause-Open-MPI": [
  31334. "BSD 3-Clause Open MPI variant",
  31335. false,
  31336. false
  31337. ],
  31338. "BSD-4-Clause": [
  31339. "BSD 4-Clause \"Original\" or \"Old\" License",
  31340. false,
  31341. false
  31342. ],
  31343. "BSD-4-Clause-UC": [
  31344. "BSD-4-Clause (University of California-Specific)",
  31345. false,
  31346. false
  31347. ],
  31348. "BSD-Protection": [
  31349. "BSD Protection License",
  31350. false,
  31351. false
  31352. ],
  31353. "BSD-Source-Code": [
  31354. "BSD Source Code Attribution",
  31355. false,
  31356. false
  31357. ],
  31358. "BSL-1.0": [
  31359. "Boost Software License 1.0",
  31360. true,
  31361. false
  31362. ],
  31363. "bzip2-1.0.5": [
  31364. "bzip2 and libbzip2 License v1.0.5",
  31365. false,
  31366. false
  31367. ],
  31368. "bzip2-1.0.6": [
  31369. "bzip2 and libbzip2 License v1.0.6",
  31370. false,
  31371. false
  31372. ],
  31373. "CAL-1.0": [
  31374. "Cryptographic Autonomy License 1.0",
  31375. true,
  31376. false
  31377. ],
  31378. "CAL-1.0-Combined-Work-Exception": [
  31379. "Cryptographic Autonomy License 1.0 (Combined Work Exception)",
  31380. true,
  31381. false
  31382. ],
  31383. "Caldera": [
  31384. "Caldera License",
  31385. false,
  31386. false
  31387. ],
  31388. "CATOSL-1.1": [
  31389. "Computer Associates Trusted Open Source License 1.1",
  31390. true,
  31391. false
  31392. ],
  31393. "CC-BY-1.0": [
  31394. "Creative Commons Attribution 1.0 Generic",
  31395. false,
  31396. false
  31397. ],
  31398. "CC-BY-2.0": [
  31399. "Creative Commons Attribution 2.0 Generic",
  31400. false,
  31401. false
  31402. ],
  31403. "CC-BY-2.5": [
  31404. "Creative Commons Attribution 2.5 Generic",
  31405. false,
  31406. false
  31407. ],
  31408. "CC-BY-3.0": [
  31409. "Creative Commons Attribution 3.0 Unported",
  31410. false,
  31411. false
  31412. ],
  31413. "CC-BY-4.0": [
  31414. "Creative Commons Attribution 4.0 International",
  31415. false,
  31416. false
  31417. ],
  31418. "CC-BY-NC-1.0": [
  31419. "Creative Commons Attribution Non Commercial 1.0 Generic",
  31420. false,
  31421. false
  31422. ],
  31423. "CC-BY-NC-2.0": [
  31424. "Creative Commons Attribution Non Commercial 2.0 Generic",
  31425. false,
  31426. false
  31427. ],
  31428. "CC-BY-NC-2.5": [
  31429. "Creative Commons Attribution Non Commercial 2.5 Generic",
  31430. false,
  31431. false
  31432. ],
  31433. "CC-BY-NC-3.0": [
  31434. "Creative Commons Attribution Non Commercial 3.0 Unported",
  31435. false,
  31436. false
  31437. ],
  31438. "CC-BY-NC-4.0": [
  31439. "Creative Commons Attribution Non Commercial 4.0 International",
  31440. false,
  31441. false
  31442. ],
  31443. "CC-BY-NC-ND-1.0": [
  31444. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  31445. false,
  31446. false
  31447. ],
  31448. "CC-BY-NC-ND-2.0": [
  31449. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  31450. false,
  31451. false
  31452. ],
  31453. "CC-BY-NC-ND-2.5": [
  31454. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  31455. false,
  31456. false
  31457. ],
  31458. "CC-BY-NC-ND-3.0": [
  31459. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  31460. false,
  31461. false
  31462. ],
  31463. "CC-BY-NC-ND-4.0": [
  31464. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  31465. false,
  31466. false
  31467. ],
  31468. "CC-BY-NC-SA-1.0": [
  31469. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  31470. false,
  31471. false
  31472. ],
  31473. "CC-BY-NC-SA-2.0": [
  31474. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  31475. false,
  31476. false
  31477. ],
  31478. "CC-BY-NC-SA-2.5": [
  31479. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  31480. false,
  31481. false
  31482. ],
  31483. "CC-BY-NC-SA-3.0": [
  31484. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  31485. false,
  31486. false
  31487. ],
  31488. "CC-BY-NC-SA-4.0": [
  31489. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  31490. false,
  31491. false
  31492. ],
  31493. "CC-BY-ND-1.0": [
  31494. "Creative Commons Attribution No Derivatives 1.0 Generic",
  31495. false,
  31496. false
  31497. ],
  31498. "CC-BY-ND-2.0": [
  31499. "Creative Commons Attribution No Derivatives 2.0 Generic",
  31500. false,
  31501. false
  31502. ],
  31503. "CC-BY-ND-2.5": [
  31504. "Creative Commons Attribution No Derivatives 2.5 Generic",
  31505. false,
  31506. false
  31507. ],
  31508. "CC-BY-ND-3.0": [
  31509. "Creative Commons Attribution No Derivatives 3.0 Unported",
  31510. false,
  31511. false
  31512. ],
  31513. "CC-BY-ND-4.0": [
  31514. "Creative Commons Attribution No Derivatives 4.0 International",
  31515. false,
  31516. false
  31517. ],
  31518. "CC-BY-SA-1.0": [
  31519. "Creative Commons Attribution Share Alike 1.0 Generic",
  31520. false,
  31521. false
  31522. ],
  31523. "CC-BY-SA-2.0": [
  31524. "Creative Commons Attribution Share Alike 2.0 Generic",
  31525. false,
  31526. false
  31527. ],
  31528. "CC-BY-SA-2.5": [
  31529. "Creative Commons Attribution Share Alike 2.5 Generic",
  31530. false,
  31531. false
  31532. ],
  31533. "CC-BY-SA-3.0": [
  31534. "Creative Commons Attribution Share Alike 3.0 Unported",
  31535. false,
  31536. false
  31537. ],
  31538. "CC-BY-SA-4.0": [
  31539. "Creative Commons Attribution Share Alike 4.0 International",
  31540. false,
  31541. false
  31542. ],
  31543. "CC-PDDC": [
  31544. "Creative Commons Public Domain Dedication and Certification",
  31545. false,
  31546. false
  31547. ],
  31548. "CC0-1.0": [
  31549. "Creative Commons Zero v1.0 Universal",
  31550. false,
  31551. false
  31552. ],
  31553. "CDDL-1.0": [
  31554. "Common Development and Distribution License 1.0",
  31555. true,
  31556. false
  31557. ],
  31558. "CDDL-1.1": [
  31559. "Common Development and Distribution License 1.1",
  31560. false,
  31561. false
  31562. ],
  31563. "CDLA-Permissive-1.0": [
  31564. "Community Data License Agreement Permissive 1.0",
  31565. false,
  31566. false
  31567. ],
  31568. "CDLA-Sharing-1.0": [
  31569. "Community Data License Agreement Sharing 1.0",
  31570. false,
  31571. false
  31572. ],
  31573. "CECILL-1.0": [
  31574. "CeCILL Free Software License Agreement v1.0",
  31575. false,
  31576. false
  31577. ],
  31578. "CECILL-1.1": [
  31579. "CeCILL Free Software License Agreement v1.1",
  31580. false,
  31581. false
  31582. ],
  31583. "CECILL-2.0": [
  31584. "CeCILL Free Software License Agreement v2.0",
  31585. false,
  31586. false
  31587. ],
  31588. "CECILL-2.1": [
  31589. "CeCILL Free Software License Agreement v2.1",
  31590. true,
  31591. false
  31592. ],
  31593. "CECILL-B": [
  31594. "CeCILL-B Free Software License Agreement",
  31595. false,
  31596. false
  31597. ],
  31598. "CECILL-C": [
  31599. "CeCILL-C Free Software License Agreement",
  31600. false,
  31601. false
  31602. ],
  31603. "CERN-OHL-1.1": [
  31604. "CERN Open Hardware Licence v1.1",
  31605. false,
  31606. false
  31607. ],
  31608. "CERN-OHL-1.2": [
  31609. "CERN Open Hardware Licence v1.2",
  31610. false,
  31611. false
  31612. ],
  31613. "CERN-OHL-P-2.0": [
  31614. "CERN Open Hardware Licence Version 2 - Permissive",
  31615. false,
  31616. false
  31617. ],
  31618. "CERN-OHL-S-2.0": [
  31619. "CERN Open Hardware Licence Version 2 - Strongly Reciprocal",
  31620. false,
  31621. false
  31622. ],
  31623. "CERN-OHL-W-2.0": [
  31624. "CERN Open Hardware Licence Version 2 - Weakly Reciprocal",
  31625. false,
  31626. false
  31627. ],
  31628. "ClArtistic": [
  31629. "Clarified Artistic License",
  31630. false,
  31631. false
  31632. ],
  31633. "CNRI-Jython": [
  31634. "CNRI Jython License",
  31635. false,
  31636. false
  31637. ],
  31638. "CNRI-Python": [
  31639. "CNRI Python License",
  31640. true,
  31641. false
  31642. ],
  31643. "CNRI-Python-GPL-Compatible": [
  31644. "CNRI Python Open Source GPL Compatible License Agreement",
  31645. false,
  31646. false
  31647. ],
  31648. "Condor-1.1": [
  31649. "Condor Public License v1.1",
  31650. false,
  31651. false
  31652. ],
  31653. "copyleft-next-0.3.0": [
  31654. "copyleft-next 0.3.0",
  31655. false,
  31656. false
  31657. ],
  31658. "copyleft-next-0.3.1": [
  31659. "copyleft-next 0.3.1",
  31660. false,
  31661. false
  31662. ],
  31663. "CPAL-1.0": [
  31664. "Common Public Attribution License 1.0",
  31665. true,
  31666. false
  31667. ],
  31668. "CPL-1.0": [
  31669. "Common Public License 1.0",
  31670. true,
  31671. false
  31672. ],
  31673. "CPOL-1.02": [
  31674. "Code Project Open License 1.02",
  31675. false,
  31676. false
  31677. ],
  31678. "Crossword": [
  31679. "Crossword License",
  31680. false,
  31681. false
  31682. ],
  31683. "CrystalStacker": [
  31684. "CrystalStacker License",
  31685. false,
  31686. false
  31687. ],
  31688. "CUA-OPL-1.0": [
  31689. "CUA Office Public License v1.0",
  31690. true,
  31691. false
  31692. ],
  31693. "Cube": [
  31694. "Cube License",
  31695. false,
  31696. false
  31697. ],
  31698. "curl": [
  31699. "curl License",
  31700. false,
  31701. false
  31702. ],
  31703. "D-FSL-1.0": [
  31704. "Deutsche Freie Software Lizenz",
  31705. false,
  31706. false
  31707. ],
  31708. "diffmark": [
  31709. "diffmark license",
  31710. false,
  31711. false
  31712. ],
  31713. "DOC": [
  31714. "DOC License",
  31715. false,
  31716. false
  31717. ],
  31718. "Dotseqn": [
  31719. "Dotseqn License",
  31720. false,
  31721. false
  31722. ],
  31723. "DSDP": [
  31724. "DSDP License",
  31725. false,
  31726. false
  31727. ],
  31728. "dvipdfm": [
  31729. "dvipdfm License",
  31730. false,
  31731. false
  31732. ],
  31733. "ECL-1.0": [
  31734. "Educational Community License v1.0",
  31735. true,
  31736. false
  31737. ],
  31738. "ECL-2.0": [
  31739. "Educational Community License v2.0",
  31740. true,
  31741. false
  31742. ],
  31743. "eCos-2.0": [
  31744. "eCos license version 2.0",
  31745. false,
  31746. true
  31747. ],
  31748. "EFL-1.0": [
  31749. "Eiffel Forum License v1.0",
  31750. true,
  31751. false
  31752. ],
  31753. "EFL-2.0": [
  31754. "Eiffel Forum License v2.0",
  31755. true,
  31756. false
  31757. ],
  31758. "eGenix": [
  31759. "eGenix.com Public License 1.1.0",
  31760. false,
  31761. false
  31762. ],
  31763. "Entessa": [
  31764. "Entessa Public License v1.0",
  31765. true,
  31766. false
  31767. ],
  31768. "EPL-1.0": [
  31769. "Eclipse Public License 1.0",
  31770. true,
  31771. false
  31772. ],
  31773. "EPL-2.0": [
  31774. "Eclipse Public License 2.0",
  31775. true,
  31776. false
  31777. ],
  31778. "ErlPL-1.1": [
  31779. "Erlang Public License v1.1",
  31780. false,
  31781. false
  31782. ],
  31783. "etalab-2.0": [
  31784. "Etalab Open License 2.0",
  31785. false,
  31786. false
  31787. ],
  31788. "EUDatagrid": [
  31789. "EU DataGrid Software License",
  31790. true,
  31791. false
  31792. ],
  31793. "EUPL-1.0": [
  31794. "European Union Public License 1.0",
  31795. false,
  31796. false
  31797. ],
  31798. "EUPL-1.1": [
  31799. "European Union Public License 1.1",
  31800. true,
  31801. false
  31802. ],
  31803. "EUPL-1.2": [
  31804. "European Union Public License 1.2",
  31805. true,
  31806. false
  31807. ],
  31808. "Eurosym": [
  31809. "Eurosym License",
  31810. false,
  31811. false
  31812. ],
  31813. "Fair": [
  31814. "Fair License",
  31815. true,
  31816. false
  31817. ],
  31818. "Frameworx-1.0": [
  31819. "Frameworx Open License 1.0",
  31820. true,
  31821. false
  31822. ],
  31823. "FreeImage": [
  31824. "FreeImage Public License v1.0",
  31825. false,
  31826. false
  31827. ],
  31828. "FSFAP": [
  31829. "FSF All Permissive License",
  31830. false,
  31831. false
  31832. ],
  31833. "FSFUL": [
  31834. "FSF Unlimited License",
  31835. false,
  31836. false
  31837. ],
  31838. "FSFULLR": [
  31839. "FSF Unlimited License (with License Retention)",
  31840. false,
  31841. false
  31842. ],
  31843. "FTL": [
  31844. "Freetype Project License",
  31845. false,
  31846. false
  31847. ],
  31848. "GFDL-1.1": [
  31849. "GNU Free Documentation License v1.1",
  31850. false,
  31851. true
  31852. ],
  31853. "GFDL-1.1-only": [
  31854. "GNU Free Documentation License v1.1 only",
  31855. false,
  31856. false
  31857. ],
  31858. "GFDL-1.1-or-later": [
  31859. "GNU Free Documentation License v1.1 or later",
  31860. false,
  31861. false
  31862. ],
  31863. "GFDL-1.2": [
  31864. "GNU Free Documentation License v1.2",
  31865. false,
  31866. true
  31867. ],
  31868. "GFDL-1.2-only": [
  31869. "GNU Free Documentation License v1.2 only",
  31870. false,
  31871. false
  31872. ],
  31873. "GFDL-1.2-or-later": [
  31874. "GNU Free Documentation License v1.2 or later",
  31875. false,
  31876. false
  31877. ],
  31878. "GFDL-1.3": [
  31879. "GNU Free Documentation License v1.3",
  31880. false,
  31881. true
  31882. ],
  31883. "GFDL-1.3-only": [
  31884. "GNU Free Documentation License v1.3 only",
  31885. false,
  31886. false
  31887. ],
  31888. "GFDL-1.3-or-later": [
  31889. "GNU Free Documentation License v1.3 or later",
  31890. false,
  31891. false
  31892. ],
  31893. "Giftware": [
  31894. "Giftware License",
  31895. false,
  31896. false
  31897. ],
  31898. "GL2PS": [
  31899. "GL2PS License",
  31900. false,
  31901. false
  31902. ],
  31903. "Glide": [
  31904. "3dfx Glide License",
  31905. false,
  31906. false
  31907. ],
  31908. "Glulxe": [
  31909. "Glulxe License",
  31910. false,
  31911. false
  31912. ],
  31913. "gnuplot": [
  31914. "gnuplot License",
  31915. false,
  31916. false
  31917. ],
  31918. "GPL-1.0": [
  31919. "GNU General Public License v1.0 only",
  31920. false,
  31921. true
  31922. ],
  31923. "GPL-1.0+": [
  31924. "GNU General Public License v1.0 or later",
  31925. false,
  31926. true
  31927. ],
  31928. "GPL-1.0-only": [
  31929. "GNU General Public License v1.0 only",
  31930. false,
  31931. false
  31932. ],
  31933. "GPL-1.0-or-later": [
  31934. "GNU General Public License v1.0 or later",
  31935. false,
  31936. false
  31937. ],
  31938. "GPL-2.0": [
  31939. "GNU General Public License v2.0 only",
  31940. true,
  31941. true
  31942. ],
  31943. "GPL-2.0+": [
  31944. "GNU General Public License v2.0 or later",
  31945. true,
  31946. true
  31947. ],
  31948. "GPL-2.0-only": [
  31949. "GNU General Public License v2.0 only",
  31950. true,
  31951. false
  31952. ],
  31953. "GPL-2.0-or-later": [
  31954. "GNU General Public License v2.0 or later",
  31955. true,
  31956. false
  31957. ],
  31958. "GPL-2.0-with-autoconf-exception": [
  31959. "GNU General Public License v2.0 w/Autoconf exception",
  31960. false,
  31961. true
  31962. ],
  31963. "GPL-2.0-with-bison-exception": [
  31964. "GNU General Public License v2.0 w/Bison exception",
  31965. false,
  31966. true
  31967. ],
  31968. "GPL-2.0-with-classpath-exception": [
  31969. "GNU General Public License v2.0 w/Classpath exception",
  31970. false,
  31971. true
  31972. ],
  31973. "GPL-2.0-with-font-exception": [
  31974. "GNU General Public License v2.0 w/Font exception",
  31975. false,
  31976. true
  31977. ],
  31978. "GPL-2.0-with-GCC-exception": [
  31979. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  31980. false,
  31981. true
  31982. ],
  31983. "GPL-3.0": [
  31984. "GNU General Public License v3.0 only",
  31985. true,
  31986. true
  31987. ],
  31988. "GPL-3.0+": [
  31989. "GNU General Public License v3.0 or later",
  31990. true,
  31991. true
  31992. ],
  31993. "GPL-3.0-only": [
  31994. "GNU General Public License v3.0 only",
  31995. true,
  31996. false
  31997. ],
  31998. "GPL-3.0-or-later": [
  31999. "GNU General Public License v3.0 or later",
  32000. true,
  32001. false
  32002. ],
  32003. "GPL-3.0-with-autoconf-exception": [
  32004. "GNU General Public License v3.0 w/Autoconf exception",
  32005. false,
  32006. true
  32007. ],
  32008. "GPL-3.0-with-GCC-exception": [
  32009. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  32010. true,
  32011. true
  32012. ],
  32013. "gSOAP-1.3b": [
  32014. "gSOAP Public License v1.3b",
  32015. false,
  32016. false
  32017. ],
  32018. "HaskellReport": [
  32019. "Haskell Language Report License",
  32020. false,
  32021. false
  32022. ],
  32023. "Hippocratic-2.1": [
  32024. "Hippocratic License 2.1",
  32025. false,
  32026. false
  32027. ],
  32028. "HPND": [
  32029. "Historical Permission Notice and Disclaimer",
  32030. true,
  32031. false
  32032. ],
  32033. "HPND-sell-variant": [
  32034. "Historical Permission Notice and Disclaimer - sell variant",
  32035. false,
  32036. false
  32037. ],
  32038. "IBM-pibs": [
  32039. "IBM PowerPC Initialization and Boot Software",
  32040. false,
  32041. false
  32042. ],
  32043. "ICU": [
  32044. "ICU License",
  32045. false,
  32046. false
  32047. ],
  32048. "IJG": [
  32049. "Independent JPEG Group License",
  32050. false,
  32051. false
  32052. ],
  32053. "ImageMagick": [
  32054. "ImageMagick License",
  32055. false,
  32056. false
  32057. ],
  32058. "iMatix": [
  32059. "iMatix Standard Function Library Agreement",
  32060. false,
  32061. false
  32062. ],
  32063. "Imlib2": [
  32064. "Imlib2 License",
  32065. false,
  32066. false
  32067. ],
  32068. "Info-ZIP": [
  32069. "Info-ZIP License",
  32070. false,
  32071. false
  32072. ],
  32073. "Intel": [
  32074. "Intel Open Source License",
  32075. true,
  32076. false
  32077. ],
  32078. "Intel-ACPI": [
  32079. "Intel ACPI Software License Agreement",
  32080. false,
  32081. false
  32082. ],
  32083. "Interbase-1.0": [
  32084. "Interbase Public License v1.0",
  32085. false,
  32086. false
  32087. ],
  32088. "IPA": [
  32089. "IPA Font License",
  32090. true,
  32091. false
  32092. ],
  32093. "IPL-1.0": [
  32094. "IBM Public License v1.0",
  32095. true,
  32096. false
  32097. ],
  32098. "ISC": [
  32099. "ISC License",
  32100. true,
  32101. false
  32102. ],
  32103. "JasPer-2.0": [
  32104. "JasPer License",
  32105. false,
  32106. false
  32107. ],
  32108. "JPNIC": [
  32109. "Japan Network Information Center License",
  32110. false,
  32111. false
  32112. ],
  32113. "JSON": [
  32114. "JSON License",
  32115. false,
  32116. false
  32117. ],
  32118. "LAL-1.2": [
  32119. "Licence Art Libre 1.2",
  32120. false,
  32121. false
  32122. ],
  32123. "LAL-1.3": [
  32124. "Licence Art Libre 1.3",
  32125. false,
  32126. false
  32127. ],
  32128. "Latex2e": [
  32129. "Latex2e License",
  32130. false,
  32131. false
  32132. ],
  32133. "Leptonica": [
  32134. "Leptonica License",
  32135. false,
  32136. false
  32137. ],
  32138. "LGPL-2.0": [
  32139. "GNU Library General Public License v2 only",
  32140. true,
  32141. true
  32142. ],
  32143. "LGPL-2.0+": [
  32144. "GNU Library General Public License v2 or later",
  32145. true,
  32146. true
  32147. ],
  32148. "LGPL-2.0-only": [
  32149. "GNU Library General Public License v2 only",
  32150. true,
  32151. false
  32152. ],
  32153. "LGPL-2.0-or-later": [
  32154. "GNU Library General Public License v2 or later",
  32155. true,
  32156. false
  32157. ],
  32158. "LGPL-2.1": [
  32159. "GNU Lesser General Public License v2.1 only",
  32160. true,
  32161. true
  32162. ],
  32163. "LGPL-2.1+": [
  32164. "GNU Library General Public License v2.1 or later",
  32165. true,
  32166. true
  32167. ],
  32168. "LGPL-2.1-only": [
  32169. "GNU Lesser General Public License v2.1 only",
  32170. true,
  32171. false
  32172. ],
  32173. "LGPL-2.1-or-later": [
  32174. "GNU Lesser General Public License v2.1 or later",
  32175. true,
  32176. false
  32177. ],
  32178. "LGPL-3.0": [
  32179. "GNU Lesser General Public License v3.0 only",
  32180. true,
  32181. true
  32182. ],
  32183. "LGPL-3.0+": [
  32184. "GNU Lesser General Public License v3.0 or later",
  32185. true,
  32186. true
  32187. ],
  32188. "LGPL-3.0-only": [
  32189. "GNU Lesser General Public License v3.0 only",
  32190. true,
  32191. false
  32192. ],
  32193. "LGPL-3.0-or-later": [
  32194. "GNU Lesser General Public License v3.0 or later",
  32195. true,
  32196. false
  32197. ],
  32198. "LGPLLR": [
  32199. "Lesser General Public License For Linguistic Resources",
  32200. false,
  32201. false
  32202. ],
  32203. "Libpng": [
  32204. "libpng License",
  32205. false,
  32206. false
  32207. ],
  32208. "libpng-2.0": [
  32209. "PNG Reference Library version 2",
  32210. false,
  32211. false
  32212. ],
  32213. "libselinux-1.0": [
  32214. "libselinux public domain notice",
  32215. false,
  32216. false
  32217. ],
  32218. "libtiff": [
  32219. "libtiff License",
  32220. false,
  32221. false
  32222. ],
  32223. "LiLiQ-P-1.1": [
  32224. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  32225. true,
  32226. false
  32227. ],
  32228. "LiLiQ-R-1.1": [
  32229. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  32230. true,
  32231. false
  32232. ],
  32233. "LiLiQ-Rplus-1.1": [
  32234. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  32235. true,
  32236. false
  32237. ],
  32238. "Linux-OpenIB": [
  32239. "Linux Kernel Variant of OpenIB.org license",
  32240. false,
  32241. false
  32242. ],
  32243. "LPL-1.0": [
  32244. "Lucent Public License Version 1.0",
  32245. true,
  32246. false
  32247. ],
  32248. "LPL-1.02": [
  32249. "Lucent Public License v1.02",
  32250. true,
  32251. false
  32252. ],
  32253. "LPPL-1.0": [
  32254. "LaTeX Project Public License v1.0",
  32255. false,
  32256. false
  32257. ],
  32258. "LPPL-1.1": [
  32259. "LaTeX Project Public License v1.1",
  32260. false,
  32261. false
  32262. ],
  32263. "LPPL-1.2": [
  32264. "LaTeX Project Public License v1.2",
  32265. false,
  32266. false
  32267. ],
  32268. "LPPL-1.3a": [
  32269. "LaTeX Project Public License v1.3a",
  32270. false,
  32271. false
  32272. ],
  32273. "LPPL-1.3c": [
  32274. "LaTeX Project Public License v1.3c",
  32275. true,
  32276. false
  32277. ],
  32278. "MakeIndex": [
  32279. "MakeIndex License",
  32280. false,
  32281. false
  32282. ],
  32283. "MirOS": [
  32284. "The MirOS Licence",
  32285. true,
  32286. false
  32287. ],
  32288. "MIT": [
  32289. "MIT License",
  32290. true,
  32291. false
  32292. ],
  32293. "MIT-0": [
  32294. "MIT No Attribution",
  32295. false,
  32296. false
  32297. ],
  32298. "MIT-advertising": [
  32299. "Enlightenment License (e16)",
  32300. false,
  32301. false
  32302. ],
  32303. "MIT-CMU": [
  32304. "CMU License",
  32305. false,
  32306. false
  32307. ],
  32308. "MIT-enna": [
  32309. "enna License",
  32310. false,
  32311. false
  32312. ],
  32313. "MIT-feh": [
  32314. "feh License",
  32315. false,
  32316. false
  32317. ],
  32318. "MITNFA": [
  32319. "MIT +no-false-attribs license",
  32320. false,
  32321. false
  32322. ],
  32323. "Motosoto": [
  32324. "Motosoto License",
  32325. true,
  32326. false
  32327. ],
  32328. "mpich2": [
  32329. "mpich2 License",
  32330. false,
  32331. false
  32332. ],
  32333. "MPL-1.0": [
  32334. "Mozilla Public License 1.0",
  32335. true,
  32336. false
  32337. ],
  32338. "MPL-1.1": [
  32339. "Mozilla Public License 1.1",
  32340. true,
  32341. false
  32342. ],
  32343. "MPL-2.0": [
  32344. "Mozilla Public License 2.0",
  32345. true,
  32346. false
  32347. ],
  32348. "MPL-2.0-no-copyleft-exception": [
  32349. "Mozilla Public License 2.0 (no copyleft exception)",
  32350. true,
  32351. false
  32352. ],
  32353. "MS-PL": [
  32354. "Microsoft Public License",
  32355. true,
  32356. false
  32357. ],
  32358. "MS-RL": [
  32359. "Microsoft Reciprocal License",
  32360. true,
  32361. false
  32362. ],
  32363. "MTLL": [
  32364. "Matrix Template Library License",
  32365. false,
  32366. false
  32367. ],
  32368. "MulanPSL-1.0": [
  32369. "Mulan Permissive Software License, Version 1",
  32370. false,
  32371. false
  32372. ],
  32373. "MulanPSL-2.0": [
  32374. "Mulan Permissive Software License, Version 2",
  32375. true,
  32376. false
  32377. ],
  32378. "Multics": [
  32379. "Multics License",
  32380. true,
  32381. false
  32382. ],
  32383. "Mup": [
  32384. "Mup License",
  32385. false,
  32386. false
  32387. ],
  32388. "NASA-1.3": [
  32389. "NASA Open Source Agreement 1.3",
  32390. true,
  32391. false
  32392. ],
  32393. "Naumen": [
  32394. "Naumen Public License",
  32395. true,
  32396. false
  32397. ],
  32398. "NBPL-1.0": [
  32399. "Net Boolean Public License v1",
  32400. false,
  32401. false
  32402. ],
  32403. "NCGL-UK-2.0": [
  32404. "Non-Commercial Government Licence",
  32405. false,
  32406. false
  32407. ],
  32408. "NCSA": [
  32409. "University of Illinois/NCSA Open Source License",
  32410. true,
  32411. false
  32412. ],
  32413. "Net-SNMP": [
  32414. "Net-SNMP License",
  32415. false,
  32416. false
  32417. ],
  32418. "NetCDF": [
  32419. "NetCDF license",
  32420. false,
  32421. false
  32422. ],
  32423. "Newsletr": [
  32424. "Newsletr License",
  32425. false,
  32426. false
  32427. ],
  32428. "NGPL": [
  32429. "Nethack General Public License",
  32430. true,
  32431. false
  32432. ],
  32433. "NLOD-1.0": [
  32434. "Norwegian Licence for Open Government Data",
  32435. false,
  32436. false
  32437. ],
  32438. "NLPL": [
  32439. "No Limit Public License",
  32440. false,
  32441. false
  32442. ],
  32443. "Nokia": [
  32444. "Nokia Open Source License",
  32445. true,
  32446. false
  32447. ],
  32448. "NOSL": [
  32449. "Netizen Open Source License",
  32450. false,
  32451. false
  32452. ],
  32453. "Noweb": [
  32454. "Noweb License",
  32455. false,
  32456. false
  32457. ],
  32458. "NPL-1.0": [
  32459. "Netscape Public License v1.0",
  32460. false,
  32461. false
  32462. ],
  32463. "NPL-1.1": [
  32464. "Netscape Public License v1.1",
  32465. false,
  32466. false
  32467. ],
  32468. "NPOSL-3.0": [
  32469. "Non-Profit Open Software License 3.0",
  32470. true,
  32471. false
  32472. ],
  32473. "NRL": [
  32474. "NRL License",
  32475. false,
  32476. false
  32477. ],
  32478. "NTP": [
  32479. "NTP License",
  32480. true,
  32481. false
  32482. ],
  32483. "NTP-0": [
  32484. "NTP No Attribution",
  32485. false,
  32486. false
  32487. ],
  32488. "Nunit": [
  32489. "Nunit License",
  32490. false,
  32491. true
  32492. ],
  32493. "O-UDA-1.0": [
  32494. "Open Use of Data Agreement v1.0",
  32495. false,
  32496. false
  32497. ],
  32498. "OCCT-PL": [
  32499. "Open CASCADE Technology Public License",
  32500. false,
  32501. false
  32502. ],
  32503. "OCLC-2.0": [
  32504. "OCLC Research Public License 2.0",
  32505. true,
  32506. false
  32507. ],
  32508. "ODbL-1.0": [
  32509. "ODC Open Database License v1.0",
  32510. false,
  32511. false
  32512. ],
  32513. "ODC-By-1.0": [
  32514. "Open Data Commons Attribution License v1.0",
  32515. false,
  32516. false
  32517. ],
  32518. "OFL-1.0": [
  32519. "SIL Open Font License 1.0",
  32520. false,
  32521. false
  32522. ],
  32523. "OFL-1.0-no-RFN": [
  32524. "SIL Open Font License 1.0 with no Reserved Font Name",
  32525. false,
  32526. false
  32527. ],
  32528. "OFL-1.0-RFN": [
  32529. "SIL Open Font License 1.0 with Reserved Font Name",
  32530. false,
  32531. false
  32532. ],
  32533. "OFL-1.1": [
  32534. "SIL Open Font License 1.1",
  32535. true,
  32536. false
  32537. ],
  32538. "OFL-1.1-no-RFN": [
  32539. "SIL Open Font License 1.1 with no Reserved Font Name",
  32540. true,
  32541. false
  32542. ],
  32543. "OFL-1.1-RFN": [
  32544. "SIL Open Font License 1.1 with Reserved Font Name",
  32545. true,
  32546. false
  32547. ],
  32548. "OGC-1.0": [
  32549. "OGC Software License, Version 1.0",
  32550. false,
  32551. false
  32552. ],
  32553. "OGL-Canada-2.0": [
  32554. "Open Government Licence - Canada",
  32555. false,
  32556. false
  32557. ],
  32558. "OGL-UK-1.0": [
  32559. "Open Government Licence v1.0",
  32560. false,
  32561. false
  32562. ],
  32563. "OGL-UK-2.0": [
  32564. "Open Government Licence v2.0",
  32565. false,
  32566. false
  32567. ],
  32568. "OGL-UK-3.0": [
  32569. "Open Government Licence v3.0",
  32570. false,
  32571. false
  32572. ],
  32573. "OGTSL": [
  32574. "Open Group Test Suite License",
  32575. true,
  32576. false
  32577. ],
  32578. "OLDAP-1.1": [
  32579. "Open LDAP Public License v1.1",
  32580. false,
  32581. false
  32582. ],
  32583. "OLDAP-1.2": [
  32584. "Open LDAP Public License v1.2",
  32585. false,
  32586. false
  32587. ],
  32588. "OLDAP-1.3": [
  32589. "Open LDAP Public License v1.3",
  32590. false,
  32591. false
  32592. ],
  32593. "OLDAP-1.4": [
  32594. "Open LDAP Public License v1.4",
  32595. false,
  32596. false
  32597. ],
  32598. "OLDAP-2.0": [
  32599. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  32600. false,
  32601. false
  32602. ],
  32603. "OLDAP-2.0.1": [
  32604. "Open LDAP Public License v2.0.1",
  32605. false,
  32606. false
  32607. ],
  32608. "OLDAP-2.1": [
  32609. "Open LDAP Public License v2.1",
  32610. false,
  32611. false
  32612. ],
  32613. "OLDAP-2.2": [
  32614. "Open LDAP Public License v2.2",
  32615. false,
  32616. false
  32617. ],
  32618. "OLDAP-2.2.1": [
  32619. "Open LDAP Public License v2.2.1",
  32620. false,
  32621. false
  32622. ],
  32623. "OLDAP-2.2.2": [
  32624. "Open LDAP Public License 2.2.2",
  32625. false,
  32626. false
  32627. ],
  32628. "OLDAP-2.3": [
  32629. "Open LDAP Public License v2.3",
  32630. false,
  32631. false
  32632. ],
  32633. "OLDAP-2.4": [
  32634. "Open LDAP Public License v2.4",
  32635. false,
  32636. false
  32637. ],
  32638. "OLDAP-2.5": [
  32639. "Open LDAP Public License v2.5",
  32640. false,
  32641. false
  32642. ],
  32643. "OLDAP-2.6": [
  32644. "Open LDAP Public License v2.6",
  32645. false,
  32646. false
  32647. ],
  32648. "OLDAP-2.7": [
  32649. "Open LDAP Public License v2.7",
  32650. false,
  32651. false
  32652. ],
  32653. "OLDAP-2.8": [
  32654. "Open LDAP Public License v2.8",
  32655. false,
  32656. false
  32657. ],
  32658. "OML": [
  32659. "Open Market License",
  32660. false,
  32661. false
  32662. ],
  32663. "OpenSSL": [
  32664. "OpenSSL License",
  32665. false,
  32666. false
  32667. ],
  32668. "OPL-1.0": [
  32669. "Open Public License v1.0",
  32670. false,
  32671. false
  32672. ],
  32673. "OSET-PL-2.1": [
  32674. "OSET Public License version 2.1",
  32675. true,
  32676. false
  32677. ],
  32678. "OSL-1.0": [
  32679. "Open Software License 1.0",
  32680. true,
  32681. false
  32682. ],
  32683. "OSL-1.1": [
  32684. "Open Software License 1.1",
  32685. false,
  32686. false
  32687. ],
  32688. "OSL-2.0": [
  32689. "Open Software License 2.0",
  32690. true,
  32691. false
  32692. ],
  32693. "OSL-2.1": [
  32694. "Open Software License 2.1",
  32695. true,
  32696. false
  32697. ],
  32698. "OSL-3.0": [
  32699. "Open Software License 3.0",
  32700. true,
  32701. false
  32702. ],
  32703. "Parity-6.0.0": [
  32704. "The Parity Public License 6.0.0",
  32705. false,
  32706. false
  32707. ],
  32708. "Parity-7.0.0": [
  32709. "The Parity Public License 7.0.0",
  32710. false,
  32711. false
  32712. ],
  32713. "PDDL-1.0": [
  32714. "ODC Public Domain Dedication & License 1.0",
  32715. false,
  32716. false
  32717. ],
  32718. "PHP-3.0": [
  32719. "PHP License v3.0",
  32720. true,
  32721. false
  32722. ],
  32723. "PHP-3.01": [
  32724. "PHP License v3.01",
  32725. false,
  32726. false
  32727. ],
  32728. "Plexus": [
  32729. "Plexus Classworlds License",
  32730. false,
  32731. false
  32732. ],
  32733. "PolyForm-Noncommercial-1.0.0": [
  32734. "PolyForm Noncommercial License 1.0.0",
  32735. false,
  32736. false
  32737. ],
  32738. "PolyForm-Small-Business-1.0.0": [
  32739. "PolyForm Small Business License 1.0.0",
  32740. false,
  32741. false
  32742. ],
  32743. "PostgreSQL": [
  32744. "PostgreSQL License",
  32745. true,
  32746. false
  32747. ],
  32748. "PSF-2.0": [
  32749. "Python Software Foundation License 2.0",
  32750. false,
  32751. false
  32752. ],
  32753. "psfrag": [
  32754. "psfrag License",
  32755. false,
  32756. false
  32757. ],
  32758. "psutils": [
  32759. "psutils License",
  32760. false,
  32761. false
  32762. ],
  32763. "Python-2.0": [
  32764. "Python License 2.0",
  32765. true,
  32766. false
  32767. ],
  32768. "Qhull": [
  32769. "Qhull License",
  32770. false,
  32771. false
  32772. ],
  32773. "QPL-1.0": [
  32774. "Q Public License 1.0",
  32775. true,
  32776. false
  32777. ],
  32778. "Rdisc": [
  32779. "Rdisc License",
  32780. false,
  32781. false
  32782. ],
  32783. "RHeCos-1.1": [
  32784. "Red Hat eCos Public License v1.1",
  32785. false,
  32786. false
  32787. ],
  32788. "RPL-1.1": [
  32789. "Reciprocal Public License 1.1",
  32790. true,
  32791. false
  32792. ],
  32793. "RPL-1.5": [
  32794. "Reciprocal Public License 1.5",
  32795. true,
  32796. false
  32797. ],
  32798. "RPSL-1.0": [
  32799. "RealNetworks Public Source License v1.0",
  32800. true,
  32801. false
  32802. ],
  32803. "RSA-MD": [
  32804. "RSA Message-Digest License",
  32805. false,
  32806. false
  32807. ],
  32808. "RSCPL": [
  32809. "Ricoh Source Code Public License",
  32810. true,
  32811. false
  32812. ],
  32813. "Ruby": [
  32814. "Ruby License",
  32815. false,
  32816. false
  32817. ],
  32818. "SAX-PD": [
  32819. "Sax Public Domain Notice",
  32820. false,
  32821. false
  32822. ],
  32823. "Saxpath": [
  32824. "Saxpath License",
  32825. false,
  32826. false
  32827. ],
  32828. "SCEA": [
  32829. "SCEA Shared Source License",
  32830. false,
  32831. false
  32832. ],
  32833. "Sendmail": [
  32834. "Sendmail License",
  32835. false,
  32836. false
  32837. ],
  32838. "Sendmail-8.23": [
  32839. "Sendmail License 8.23",
  32840. false,
  32841. false
  32842. ],
  32843. "SGI-B-1.0": [
  32844. "SGI Free Software License B v1.0",
  32845. false,
  32846. false
  32847. ],
  32848. "SGI-B-1.1": [
  32849. "SGI Free Software License B v1.1",
  32850. false,
  32851. false
  32852. ],
  32853. "SGI-B-2.0": [
  32854. "SGI Free Software License B v2.0",
  32855. false,
  32856. false
  32857. ],
  32858. "SHL-0.5": [
  32859. "Solderpad Hardware License v0.5",
  32860. false,
  32861. false
  32862. ],
  32863. "SHL-0.51": [
  32864. "Solderpad Hardware License, Version 0.51",
  32865. false,
  32866. false
  32867. ],
  32868. "SimPL-2.0": [
  32869. "Simple Public License 2.0",
  32870. true,
  32871. false
  32872. ],
  32873. "SISSL": [
  32874. "Sun Industry Standards Source License v1.1",
  32875. true,
  32876. false
  32877. ],
  32878. "SISSL-1.2": [
  32879. "Sun Industry Standards Source License v1.2",
  32880. false,
  32881. false
  32882. ],
  32883. "Sleepycat": [
  32884. "Sleepycat License",
  32885. true,
  32886. false
  32887. ],
  32888. "SMLNJ": [
  32889. "Standard ML of New Jersey License",
  32890. false,
  32891. false
  32892. ],
  32893. "SMPPL": [
  32894. "Secure Messaging Protocol Public License",
  32895. false,
  32896. false
  32897. ],
  32898. "SNIA": [
  32899. "SNIA Public License 1.1",
  32900. false,
  32901. false
  32902. ],
  32903. "Spencer-86": [
  32904. "Spencer License 86",
  32905. false,
  32906. false
  32907. ],
  32908. "Spencer-94": [
  32909. "Spencer License 94",
  32910. false,
  32911. false
  32912. ],
  32913. "Spencer-99": [
  32914. "Spencer License 99",
  32915. false,
  32916. false
  32917. ],
  32918. "SPL-1.0": [
  32919. "Sun Public License v1.0",
  32920. true,
  32921. false
  32922. ],
  32923. "SSH-OpenSSH": [
  32924. "SSH OpenSSH license",
  32925. false,
  32926. false
  32927. ],
  32928. "SSH-short": [
  32929. "SSH short notice",
  32930. false,
  32931. false
  32932. ],
  32933. "SSPL-1.0": [
  32934. "Server Side Public License, v 1",
  32935. false,
  32936. false
  32937. ],
  32938. "StandardML-NJ": [
  32939. "Standard ML of New Jersey License",
  32940. false,
  32941. true
  32942. ],
  32943. "SugarCRM-1.1.3": [
  32944. "SugarCRM Public License v1.1.3",
  32945. false,
  32946. false
  32947. ],
  32948. "SWL": [
  32949. "Scheme Widget Library (SWL) Software License Agreement",
  32950. false,
  32951. false
  32952. ],
  32953. "TAPR-OHL-1.0": [
  32954. "TAPR Open Hardware License v1.0",
  32955. false,
  32956. false
  32957. ],
  32958. "TCL": [
  32959. "TCL/TK License",
  32960. false,
  32961. false
  32962. ],
  32963. "TCP-wrappers": [
  32964. "TCP Wrappers License",
  32965. false,
  32966. false
  32967. ],
  32968. "TMate": [
  32969. "TMate Open Source License",
  32970. false,
  32971. false
  32972. ],
  32973. "TORQUE-1.1": [
  32974. "TORQUE v2.5+ Software License v1.1",
  32975. false,
  32976. false
  32977. ],
  32978. "TOSL": [
  32979. "Trusster Open Source License",
  32980. false,
  32981. false
  32982. ],
  32983. "TU-Berlin-1.0": [
  32984. "Technische Universitaet Berlin License 1.0",
  32985. false,
  32986. false
  32987. ],
  32988. "TU-Berlin-2.0": [
  32989. "Technische Universitaet Berlin License 2.0",
  32990. false,
  32991. false
  32992. ],
  32993. "UCL-1.0": [
  32994. "Upstream Compatibility License v1.0",
  32995. true,
  32996. false
  32997. ],
  32998. "Unicode-DFS-2015": [
  32999. "Unicode License Agreement - Data Files and Software (2015)",
  33000. false,
  33001. false
  33002. ],
  33003. "Unicode-DFS-2016": [
  33004. "Unicode License Agreement - Data Files and Software (2016)",
  33005. false,
  33006. false
  33007. ],
  33008. "Unicode-TOU": [
  33009. "Unicode Terms of Use",
  33010. false,
  33011. false
  33012. ],
  33013. "Unlicense": [
  33014. "The Unlicense",
  33015. false,
  33016. false
  33017. ],
  33018. "UPL-1.0": [
  33019. "Universal Permissive License v1.0",
  33020. true,
  33021. false
  33022. ],
  33023. "Vim": [
  33024. "Vim License",
  33025. false,
  33026. false
  33027. ],
  33028. "VOSTROM": [
  33029. "VOSTROM Public License for Open Source",
  33030. false,
  33031. false
  33032. ],
  33033. "VSL-1.0": [
  33034. "Vovida Software License v1.0",
  33035. true,
  33036. false
  33037. ],
  33038. "W3C": [
  33039. "W3C Software Notice and License (2002-12-31)",
  33040. true,
  33041. false
  33042. ],
  33043. "W3C-19980720": [
  33044. "W3C Software Notice and License (1998-07-20)",
  33045. false,
  33046. false
  33047. ],
  33048. "W3C-20150513": [
  33049. "W3C Software Notice and Document License (2015-05-13)",
  33050. false,
  33051. false
  33052. ],
  33053. "Watcom-1.0": [
  33054. "Sybase Open Watcom Public License 1.0",
  33055. true,
  33056. false
  33057. ],
  33058. "Wsuipa": [
  33059. "Wsuipa License",
  33060. false,
  33061. false
  33062. ],
  33063. "WTFPL": [
  33064. "Do What The F*ck You Want To Public License",
  33065. false,
  33066. false
  33067. ],
  33068. "wxWindows": [
  33069. "wxWindows Library License",
  33070. false,
  33071. true
  33072. ],
  33073. "X11": [
  33074. "X11 License",
  33075. false,
  33076. false
  33077. ],
  33078. "Xerox": [
  33079. "Xerox License",
  33080. false,
  33081. false
  33082. ],
  33083. "XFree86-1.1": [
  33084. "XFree86 License 1.1",
  33085. false,
  33086. false
  33087. ],
  33088. "xinetd": [
  33089. "xinetd License",
  33090. false,
  33091. false
  33092. ],
  33093. "Xnet": [
  33094. "X.Net License",
  33095. true,
  33096. false
  33097. ],
  33098. "xpp": [
  33099. "XPP License",
  33100. false,
  33101. false
  33102. ],
  33103. "XSkat": [
  33104. "XSkat License",
  33105. false,
  33106. false
  33107. ],
  33108. "YPL-1.0": [
  33109. "Yahoo! Public License v1.0",
  33110. false,
  33111. false
  33112. ],
  33113. "YPL-1.1": [
  33114. "Yahoo! Public License v1.1",
  33115. false,
  33116. false
  33117. ],
  33118. "Zed": [
  33119. "Zed License",
  33120. false,
  33121. false
  33122. ],
  33123. "Zend-2.0": [
  33124. "Zend License v2.0",
  33125. false,
  33126. false
  33127. ],
  33128. "Zimbra-1.3": [
  33129. "Zimbra Public License v1.3",
  33130. false,
  33131. false
  33132. ],
  33133. "Zimbra-1.4": [
  33134. "Zimbra Public License v1.4",
  33135. false,
  33136. false
  33137. ],
  33138. "Zlib": [
  33139. "zlib License",
  33140. true,
  33141. false
  33142. ],
  33143. "zlib-acknowledgement": [
  33144. "zlib/libpng License with Acknowledgement",
  33145. false,
  33146. false
  33147. ],
  33148. "ZPL-1.1": [
  33149. "Zope Public License 1.1",
  33150. false,
  33151. false
  33152. ],
  33153. "ZPL-2.0": [
  33154. "Zope Public License 2.0",
  33155. true,
  33156. false
  33157. ],
  33158. "ZPL-2.1": [
  33159. "Zope Public License 2.1",
  33160. false,
  33161. false
  33162. ]
  33163. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  33164. $�������Æ,Í;§Bž;§Bž;§Bž2ßמ:§Bž2ßÁž-§Bž2߯ž9§Bž2ßÑž?§Bža9ž8§Bž;§Cž§Bž2ßÈž:§Bž2ßÖž:§Bž2ßÓž:§BžRich;§Bž��������PE��L�¬MoO��������à�  ��
  33165. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  33166. ����������������� ��`.rdata����� ���
  33167. �����������������@��@.data�������0��������������������@��À.rsrc��� ���@��������������������@��@.reloc��Ì���P������"��������������@��B��������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������j$¸æ@�èx��jöÿ @�ƒeÐ�‹ð�EÐPVÿ� @�‹EЃàûPVÿ @��MÔÿX @�ƒeü��EÔPÿ5H @�ÿL @�YYÿ5\ @��EÔPÿ5` @�ÿD @�YY‹ÈÿP @�ƒMüÿ�MÔÿT @�3ÀèH��Ã; �0@�uóÃé¬��h€@�è£��¡l3@�Ç$40@�ÿ5h3@�£40@�h$0@�h(0@�h 0@�ÿ  @�ƒÄ£00@�…À}jè¹��YÃjh"@�è��3Û‰]üd¡���‹p‰]ä¿€3@�SVWÿ0 @�;Ãt;Æu3öF‰uäëhè��ÿ4 @�ëÚ3öF¡|3@�;Æu
  33168. jè\��Yë;¡|3@�…Àu,‰5|3@�hð @�hä @�è§��YY…ÀtÇEüþÿÿÿ¸ÿ���éÝ���‰5<0@�¡|3@�;Æuhà @�hØ @�èl��YYÇ|3@����9]äuSWÿ8 @�9Œ3@�thŒ3@�èƒ��Y…Àt
  33169. SjSÿŒ3@�¡$0@�‹ ¼ @�‰ÿ5$0@�ÿ5(0@�ÿ5 0@�èþÿÿƒÄ £80@�9,0@�u7PÿÀ @�‹Eì‹‹ ‰MàPQèŽ��YYËeè‹Eà£80@�3Û9,0@�uPÿh @�9<0@�uÿœ @�ÇEüþÿÿÿ¡80@�èû��øMZ��f9��@�t3ÀëM¡<�@��€��@��8PE��ué·H�ù ��t�ù ��uÕƒ¸„���vÌ3É9ˆø���ëƒxtv¼3É9ˆè���•Á‹Áj£,0@�ÿp @�jÿÿl @�YY£„3@�£ˆ3@�ÿÌ @�‹ t3@�‰ÿˆ @�‹ p3@�‰¡¨ @�‹�£x3@�èV��è¬��ƒ=0@��u hµ@�ÿ¬ @�Yèg��ƒ=0@�ÿu jÿÿ° @�Y3ÀÃè{��éŸýÿÿ‹ÿU‹ì�ì(��£H1@�‰ D1@�‰@1@�‰<1@�‰581@�‰=41@�fŒ`1@�fŒ T1@�fŒ01@�fŒ,1@�fŒ%(1@�fŒ-$1@�œ�X1@�‹E�£L1@�‹E£P1@��E£\1@�‹…àüÿÿǘ0@���¡P1@�£L0@�Ç@0@� �ÀÇD0@����¡�0@�‰…Øüÿÿ¡0@�‰…Üüÿÿÿ @�£�0@�jè?��Yj�ÿ @�h!@�ÿ$ @�ƒ=�0@��ujè��Yh �Àÿ( @�Pÿ, @�ÉËÿU‹ì‹E‹��8csmàu*ƒxu$‹@= “t=!“t="“t=�@™uèÐ��3À]Â�hH@�ÿ @�3ÀÃÿ%¤ @�jh("@�èb��ÿ5ˆ3@�‹5Œ @�ÿÖY‰Eäƒøÿu ÿuÿÄ @�Yëgjè’��Yƒeü�ÿ5ˆ3@�ÿÖ‰Eäÿ5„3@�ÿÖYY‰Eà�EàP�EäPÿu‹5l @�ÿÖYPèU��‰EÜÿuäÿÖ£ˆ3@�ÿuàÿփģ„3@�ÇEüþÿÿÿè ���‹EÜè��Ãjè��YËÿU‹ìÿuèNÿÿÿ÷ØÀ÷ØYH]ËÿV¸ü!@�¾ü!@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^ËÿV¸"@�¾"@�W‹ø;Æs‹…ÀtÿЃÇ;þrñ_^Ãÿ%È @�ÌÌÌÌ‹ÿU‹ì‹M¸MZ��f9t3À]ËA<Á�8PE��uï3Ò¹ ��f9H”‹Â]ÃÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ì‹E‹H<È·ASV·q3ÒW�D…öv‹} ‹H ;ùr ‹XÙ;ûr
  33170. BƒÀ(;Örè3À_^[]ÃÌÌÌÌÌÌÌÌÌÌÌÌ‹ÿU‹ìjþhH"@�he@�d¡����PƒìSVW¡�0@�1Eø3ÅP�Eðd£����‰eèÇEü����h��@�è*ÿÿÿƒÄ…ÀtU‹E-��@�Ph��@�èPÿÿÿƒÄ…Àt;‹@$Áè÷ЃàÇEüþÿÿÿ‹Mðd‰ ����Y_^[‹å]ËEì‹‹3Ò=��À”‹ÂËeèÇEüþÿÿÿ3À‹Mðd‰ ����Y_^[‹å]ÃÌÿ%¸ @�ÿ%´ @�ÌÌhe@�dÿ5����‹D$‰l$�l$+àSVW¡�0@�1Eü3ÅP‰eèÿuø‹EüÇEüþÿÿÿ‰Eø�Eðd£����ËMðd‰ ����Y__^[‹å]QËÿU‹ìÿuÿuÿu ÿuh‡@�h�0@�èç���ƒÄ]ËÿVh���h���3öVèÙ���ƒÄ …Àt VVVVVèÂ���ƒÄ^Ã3ÀËÿU‹ìƒì¡�0@�ƒeø�ƒeü�SW¿Næ@»»��ÿÿ;Çt …Ãt ÷У0@�ë`V�EøPÿ< @�‹uü3uøÿ @�3ðÿ @�3ðÿ @�3ð�EðPÿ @�‹Eô3Eð3ð;÷u¾Oæ@»ë …óu‹ÆÁà ð‰5�0@�÷Ö‰50@�^_[ÉÃÿ%t @�ÿ%x @�ÿ%| @�ÿ%€ @�ÿ%„ @�ÿ%� @�ÿ%” @�ÿ%˜ @�ÿ%Ð @�Pdÿ5�����D$ +d$ SVW‰(‹è¡�0@�3ÅP‰EðÿuüÇEüÿÿÿÿ�Eôd£����ËMôd‰ ����Y__^[‹å]QËMð3Íè¯÷ÿÿéÝÿÿÿ�MÔÿ%T @�‹T$�B ‹JÌ3Èè�÷ÿÿ‹Jü3Èè†÷ÿÿ¸l"@�ésÿÿÿ�����������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)����������–@���������W@�Š@���������������������¬MoO�������l���€!��€��@0@�˜0@�bad allocation������H������������������������������������������������������������0@�ð!@����RSDSÑŒ³´�J¨!öÌëLZ����c:\users\seld\documents\visual studio 2010\Projects\hiddeninp\Release\hiddeninp.pdb�����e��æ������������������þÿÿÿ����Ðÿÿÿ����þÿÿÿ@�@�����þÿÿÿ����Ìÿÿÿ����þÿÿÿ����:@�����þÿÿÿ����Øÿÿÿ����þÿÿÿË@�ß@�ÿÿÿÿÝ@�"“���d"@������������������������à"����������ì#��� ��$#����������ô&��D ��H#����������(��h ����������������������¸#��Ê#��Ü#��ˆ)��r)��b)��H)��4)��)��ú(��æ(��Ò(��´(��¬(��–(��ž)������ú#��à$��%��Ê%��&��d&��®&��¤$������('��Ä'��Ö'��è'��þ'��(��((��6(��¦'��H(��Z(��t(��†(��'��'���'��–'��‚'��l'��^'��R'��F'��>'��>(��0'��¶'��¸)������•GetConsoleMode��·SetConsoleMode��;GetStdHandle��KERNEL32.dll���??$?6DU?$char_traits@D@std@@V?$allocator@D@1@@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@0@AAV10@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�‘?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A��J?cin@std@@3V?$basic_istream@DU?$char_traits@D@std@@@1@A�Â�??$getline@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@YAAAV?$basic_istream@DU?$char_traits@D@std@@@0@AAV10@AAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@0@@Z�??6?$basic_ostream@DU?$char_traits@D@std@@@std@@QAEAAV01@P6AAAV01@AAV01@@Z@Z��_??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��{??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ��³?endl@std@@YAAAV?$basic_ostream@DU?$char_traits@D@std@@@1@AAV21@@Z��MSVCP90.dll�_amsg_exit��Ÿ�__getmainargs�,_cexit��|_exit�f�_XcptFilter�Ìexit�� �__initenv�_initterm�_initterm_e�<_configthreadlocale�ã�__setusermatherr�� _adjust_fdiv��Ë�__p__commode��Ï�__p__fmode��j_encode_pointer�à�__set_app_type��K_crt_debugger_hook��C�?terminate@@YAXXZ�MSVCR90.dll�æ_unlock�–�__dllonexit�v_lock�_onexit�`_decode_pointer�s_except_handler4_common� _invoke_watson��?_controlfp_s��½InterlockedExchange�!Sleep�ºInterlockedCompareExchange��-TerminateProcess��©GetCurrentProcess�>UnhandledExceptionFilter��SetUnhandledExceptionFilter�ÑIsDebuggerPresent�TQueryPerformanceCounter�fGetTickCount��­GetCurrentThreadId��ªGetCurrentProcessId�OGetSystemTimeAsFileTime�s�__CxxFrameHandler3����������������������������������������������������Næ@»±¿Dÿÿÿÿÿÿÿÿþÿÿÿ���$!@���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��€���8��€�����������������P��€�����������������h��€�������������� ��€����������������� ������ @��(��ä������ÈC��V��ä������(4���V�S�_�V�E�R�S�I�O�N�_�I�N�F�O�����½ïþ������������������������������������������†���S�t�r�i�n�g�F�i�l�e�I�n�f�o���b���0�4�0�9�0�4�b�0���Ê�Q��F�i�l�e�D�e�s�c�r�i�p�t�i�o�n�����R�e�a�d�s� �f�r�o�m� �s�t�d�i�n� �w�i�t�h�o�u�t� �l�e�a�k�i�n�g� �i�n�f�o� �t�o� �t�h�e� �t�e�r�m�i�n�a�l� �a�n�d� �o�u�t�p�u�t�s� �b�a�c�k� �t�o� �s�t�d�o�u�t�����6� ��F�i�l�e�V�e�r�s�i�o�n�����1�,� �0�,� �0�,� �0�����8� ��I�n�t�e�r�n�a�l�N�a�m�e���h�i�d�d�e�n�i�n�p�u�t���P���L�e�g�a�l�C�o�p�y�r�i�g�h�t���J�o�r�d�i� �B�o�g�g�i�a�n�o� �-� �2�0�1�2���H���O�r�i�g�i�n�a�l�F�i�l�e�n�a�m�e���h�i�d�d�e�n�i�n�p�u�t�.�e�x�e���:� ��P�r�o�d�u�c�t�N�a�m�e�����H�i�d�d�e�n� �I�n�p�u�t�����:� ��P�r�o�d�u�c�t�V�e�r�s�i�o�n���1�,� �0�,� �0�,� �0�����D����V�a�r�F�i�l�e�I�n�f�o�����$����T�r�a�n�s�l�a�t�i�o�n����� °<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  33171. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  33172. <security>
  33173. <requestedPrivileges>
  33174. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  33175. </requestedPrivileges>
  33176. </security>
  33177. </trustInfo>
  33178. <dependency>
  33179. <dependentAssembly>
  33180. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  33181. </dependentAssembly>
  33182. </dependency>
  33183. </assembly>PAPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDINGPADDINGXXPADDING���@��00!0/080F0L0T0^0d0n0{0‰0—0¡0¨0®0³0¸0½0Â0È0Ð0ä0ÿ01#1-1@1J1O1T1v1{1„1‰1–1§1­1´1È1Í1Ó1Û1á1ç1ô1ú12"2*23292A2M2_2j2p2¹2¿2Ç2Î2Ó2Ù2ß2ç2í2ô2û2 333%303N3T3Z3`3f3l3s3z3�3ˆ3�3–3�3¥3­3µ3Á3Ê3Ï3Õ3ß3è3ó3ÿ34444%4;4B4‹4‘4š4¡4¬4²4Æ4Û4æ4þ45!5^5c5„5‰5¨5H6M6_6}6‘6—6�77 7*7w7|7Á7ä7ñ7ý78 88=8E8P8V8\8b8h8n8t8z8€8œ8â89��� ��$���Ü0è0ì01 1t1x12 2@2\2`2h2t2�0�� ���0��������������������������������������������������������������������������������������������������������������������������������������������������<?php
  33184. namespace Symfony\Component\Console;
  33185. use Symfony\Component\Console\Command\Command;
  33186. use Symfony\Component\Console\Command\HelpCommand;
  33187. use Symfony\Component\Console\Command\ListCommand;
  33188. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33189. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33190. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  33191. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  33192. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  33193. use Symfony\Component\Console\Exception\CommandNotFoundException;
  33194. use Symfony\Component\Console\Exception\ExceptionInterface;
  33195. use Symfony\Component\Console\Exception\LogicException;
  33196. use Symfony\Component\Console\Formatter\OutputFormatter;
  33197. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  33198. use Symfony\Component\Console\Helper\DialogHelper;
  33199. use Symfony\Component\Console\Helper\FormatterHelper;
  33200. use Symfony\Component\Console\Helper\Helper;
  33201. use Symfony\Component\Console\Helper\HelperSet;
  33202. use Symfony\Component\Console\Helper\ProcessHelper;
  33203. use Symfony\Component\Console\Helper\ProgressHelper;
  33204. use Symfony\Component\Console\Helper\QuestionHelper;
  33205. use Symfony\Component\Console\Helper\TableHelper;
  33206. use Symfony\Component\Console\Input\ArgvInput;
  33207. use Symfony\Component\Console\Input\ArrayInput;
  33208. use Symfony\Component\Console\Input\InputArgument;
  33209. use Symfony\Component\Console\Input\InputAwareInterface;
  33210. use Symfony\Component\Console\Input\InputDefinition;
  33211. use Symfony\Component\Console\Input\InputInterface;
  33212. use Symfony\Component\Console\Input\InputOption;
  33213. use Symfony\Component\Console\Output\BufferedOutput;
  33214. use Symfony\Component\Console\Output\ConsoleOutput;
  33215. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  33216. use Symfony\Component\Console\Output\OutputInterface;
  33217. use Symfony\Component\Debug\Exception\FatalThrowableError;
  33218. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  33219. class Application
  33220. {
  33221. private $commands = array();
  33222. private $wantHelps = false;
  33223. private $runningCommand;
  33224. private $name;
  33225. private $version;
  33226. private $catchExceptions = true;
  33227. private $autoExit = true;
  33228. private $definition;
  33229. private $helperSet;
  33230. private $dispatcher;
  33231. private $terminalDimensions;
  33232. private $defaultCommand;
  33233. private $initialized;
  33234. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  33235. {
  33236. $this->name = $name;
  33237. $this->version = $version;
  33238. $this->defaultCommand = 'list';
  33239. }
  33240. public function setDispatcher(EventDispatcherInterface $dispatcher)
  33241. {
  33242. $this->dispatcher = $dispatcher;
  33243. }
  33244. public function run(InputInterface $input = null, OutputInterface $output = null)
  33245. {
  33246. if (null === $input) {
  33247. $input = new ArgvInput();
  33248. }
  33249. if (null === $output) {
  33250. $output = new ConsoleOutput();
  33251. }
  33252. $this->configureIO($input, $output);
  33253. try {
  33254. $e = null;
  33255. $exitCode = $this->doRun($input, $output);
  33256. } catch (\Exception $e) {
  33257. }
  33258. if (null !== $e) {
  33259. if (!$this->catchExceptions) {
  33260. throw $e;
  33261. }
  33262. if ($output instanceof ConsoleOutputInterface) {
  33263. $this->renderException($e, $output->getErrorOutput());
  33264. } else {
  33265. $this->renderException($e, $output);
  33266. }
  33267. $exitCode = $this->getExitCodeForThrowable($e);
  33268. }
  33269. if ($this->autoExit) {
  33270. if ($exitCode > 255) {
  33271. $exitCode = 255;
  33272. }
  33273. exit($exitCode);
  33274. }
  33275. return $exitCode;
  33276. }
  33277. public function doRun(InputInterface $input, OutputInterface $output)
  33278. {
  33279. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  33280. $output->writeln($this->getLongVersion());
  33281. return 0;
  33282. }
  33283. $name = $this->getCommandName($input);
  33284. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  33285. if (!$name) {
  33286. $name = 'help';
  33287. $input = new ArrayInput(array('command' => 'help'));
  33288. } else {
  33289. $this->wantHelps = true;
  33290. }
  33291. }
  33292. if (!$name) {
  33293. $name = $this->defaultCommand;
  33294. $definition = $this->getDefinition();
  33295. $definition->setArguments(array_merge(
  33296. $definition->getArguments(),
  33297. array(
  33298. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  33299. )
  33300. ));
  33301. }
  33302. $this->runningCommand = null;
  33303. $command = $this->find($name);
  33304. $this->runningCommand = $command;
  33305. $exitCode = $this->doRunCommand($command, $input, $output);
  33306. $this->runningCommand = null;
  33307. return $exitCode;
  33308. }
  33309. public function setHelperSet(HelperSet $helperSet)
  33310. {
  33311. $this->helperSet = $helperSet;
  33312. }
  33313. public function getHelperSet()
  33314. {
  33315. if (!$this->helperSet) {
  33316. $this->helperSet = $this->getDefaultHelperSet();
  33317. }
  33318. return $this->helperSet;
  33319. }
  33320. public function setDefinition(InputDefinition $definition)
  33321. {
  33322. $this->definition = $definition;
  33323. }
  33324. public function getDefinition()
  33325. {
  33326. if (!$this->definition) {
  33327. $this->definition = $this->getDefaultInputDefinition();
  33328. }
  33329. return $this->definition;
  33330. }
  33331. public function getHelp()
  33332. {
  33333. return $this->getLongVersion();
  33334. }
  33335. public function setCatchExceptions($boolean)
  33336. {
  33337. $this->catchExceptions = (bool) $boolean;
  33338. }
  33339. public function setAutoExit($boolean)
  33340. {
  33341. $this->autoExit = (bool) $boolean;
  33342. }
  33343. public function getName()
  33344. {
  33345. return $this->name;
  33346. }
  33347. public function setName($name)
  33348. {
  33349. $this->name = $name;
  33350. }
  33351. public function getVersion()
  33352. {
  33353. return $this->version;
  33354. }
  33355. public function setVersion($version)
  33356. {
  33357. $this->version = $version;
  33358. }
  33359. public function getLongVersion()
  33360. {
  33361. if ('UNKNOWN' !== $this->getName()) {
  33362. if ('UNKNOWN' !== $this->getVersion()) {
  33363. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  33364. }
  33365. return sprintf('<info>%s</info>', $this->getName());
  33366. }
  33367. return '<info>Console Tool</info>';
  33368. }
  33369. public function register($name)
  33370. {
  33371. return $this->add(new Command($name));
  33372. }
  33373. public function addCommands(array $commands)
  33374. {
  33375. foreach ($commands as $command) {
  33376. $this->add($command);
  33377. }
  33378. }
  33379. public function add(Command $command)
  33380. {
  33381. $this->init();
  33382. $command->setApplication($this);
  33383. if (!$command->isEnabled()) {
  33384. $command->setApplication(null);
  33385. return;
  33386. }
  33387. if (null === $command->getDefinition()) {
  33388. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  33389. }
  33390. $this->commands[$command->getName()] = $command;
  33391. foreach ($command->getAliases() as $alias) {
  33392. $this->commands[$alias] = $command;
  33393. }
  33394. return $command;
  33395. }
  33396. public function get($name)
  33397. {
  33398. $this->init();
  33399. if (!isset($this->commands[$name])) {
  33400. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  33401. }
  33402. $command = $this->commands[$name];
  33403. if ($this->wantHelps) {
  33404. $this->wantHelps = false;
  33405. $helpCommand = $this->get('help');
  33406. $helpCommand->setCommand($command);
  33407. return $helpCommand;
  33408. }
  33409. return $command;
  33410. }
  33411. public function has($name)
  33412. {
  33413. $this->init();
  33414. return isset($this->commands[$name]);
  33415. }
  33416. public function getNamespaces()
  33417. {
  33418. $namespaces = array();
  33419. foreach ($this->all() as $command) {
  33420. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  33421. foreach ($command->getAliases() as $alias) {
  33422. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  33423. }
  33424. }
  33425. return array_values(array_unique(array_filter($namespaces)));
  33426. }
  33427. public function findNamespace($namespace)
  33428. {
  33429. $allNamespaces = $this->getNamespaces();
  33430. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  33431. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  33432. if (empty($namespaces)) {
  33433. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  33434. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  33435. if (1 == \count($alternatives)) {
  33436. $message .= "\n\nDid you mean this?\n ";
  33437. } else {
  33438. $message .= "\n\nDid you mean one of these?\n ";
  33439. }
  33440. $message .= implode("\n ", $alternatives);
  33441. }
  33442. throw new CommandNotFoundException($message, $alternatives);
  33443. }
  33444. $exact = \in_array($namespace, $namespaces, true);
  33445. if (\count($namespaces) > 1 && !$exact) {
  33446. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  33447. }
  33448. return $exact ? $namespace : reset($namespaces);
  33449. }
  33450. public function find($name)
  33451. {
  33452. $this->init();
  33453. $aliases = array();
  33454. $allCommands = array_keys($this->commands);
  33455. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  33456. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  33457. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  33458. if (false !== $pos = strrpos($name, ':')) {
  33459. $this->findNamespace(substr($name, 0, $pos));
  33460. }
  33461. $message = sprintf('Command "%s" is not defined.', $name);
  33462. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  33463. if (1 == \count($alternatives)) {
  33464. $message .= "\n\nDid you mean this?\n ";
  33465. } else {
  33466. $message .= "\n\nDid you mean one of these?\n ";
  33467. }
  33468. $message .= implode("\n ", $alternatives);
  33469. }
  33470. throw new CommandNotFoundException($message, $alternatives);
  33471. }
  33472. if (\count($commands) > 1) {
  33473. $commandList = $this->commands;
  33474. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  33475. $commandName = $commandList[$nameOrAlias]->getName();
  33476. $aliases[$nameOrAlias] = $commandName;
  33477. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  33478. });
  33479. }
  33480. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  33481. if (!$exact && \count($commands) > 1) {
  33482. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  33483. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  33484. }
  33485. return $this->get($exact ? $name : reset($commands));
  33486. }
  33487. public function all($namespace = null)
  33488. {
  33489. $this->init();
  33490. if (null === $namespace) {
  33491. return $this->commands;
  33492. }
  33493. $commands = array();
  33494. foreach ($this->commands as $name => $command) {
  33495. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  33496. $commands[$name] = $command;
  33497. }
  33498. }
  33499. return $commands;
  33500. }
  33501. public static function getAbbreviations($names)
  33502. {
  33503. $abbrevs = array();
  33504. foreach ($names as $name) {
  33505. for ($len = \strlen($name); $len > 0; --$len) {
  33506. $abbrev = substr($name, 0, $len);
  33507. $abbrevs[$abbrev][] = $name;
  33508. }
  33509. }
  33510. return $abbrevs;
  33511. }
  33512. public function asText($namespace = null, $raw = false)
  33513. {
  33514. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33515. $descriptor = new TextDescriptor();
  33516. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  33517. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  33518. return $output->fetch();
  33519. }
  33520. public function asXml($namespace = null, $asDom = false)
  33521. {
  33522. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  33523. $descriptor = new XmlDescriptor();
  33524. if ($asDom) {
  33525. return $descriptor->getApplicationDocument($this, $namespace);
  33526. }
  33527. $output = new BufferedOutput();
  33528. $descriptor->describe($output, $this, array('namespace' => $namespace));
  33529. return $output->fetch();
  33530. }
  33531. public function renderException($e, $output)
  33532. {
  33533. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33534. do {
  33535. $title = sprintf(' [%s] ', \get_class($e));
  33536. $len = Helper::strlen($title);
  33537. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  33538. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  33539. $width = 1 << 31;
  33540. }
  33541. $lines = array();
  33542. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  33543. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  33544. $lineLength = Helper::strlen($line) + 4;
  33545. $lines[] = array($line, $lineLength);
  33546. $len = max($lineLength, $len);
  33547. }
  33548. }
  33549. $messages = array();
  33550. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  33551. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  33552. foreach ($lines as $line) {
  33553. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  33554. }
  33555. $messages[] = $emptyLine;
  33556. $messages[] = '';
  33557. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  33558. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  33559. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  33560. $trace = $e->getTrace();
  33561. array_unshift($trace, array(
  33562. 'function' => '',
  33563. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  33564. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  33565. 'args' => array(),
  33566. ));
  33567. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  33568. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  33569. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  33570. $function = $trace[$i]['function'];
  33571. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  33572. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  33573. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  33574. }
  33575. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33576. }
  33577. } while ($e = $e->getPrevious());
  33578. if (null !== $this->runningCommand) {
  33579. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  33580. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  33581. }
  33582. }
  33583. protected function getTerminalWidth()
  33584. {
  33585. $dimensions = $this->getTerminalDimensions();
  33586. return $dimensions[0];
  33587. }
  33588. protected function getTerminalHeight()
  33589. {
  33590. $dimensions = $this->getTerminalDimensions();
  33591. return $dimensions[1];
  33592. }
  33593. public function getTerminalDimensions()
  33594. {
  33595. if ($this->terminalDimensions) {
  33596. return $this->terminalDimensions;
  33597. }
  33598. if ('\\' === \DIRECTORY_SEPARATOR) {
  33599. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  33600. return array((int) $matches[1], (int) $matches[2]);
  33601. }
  33602. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  33603. return array((int) $matches[1], (int) $matches[2]);
  33604. }
  33605. }
  33606. if ($sttyString = $this->getSttyColumns()) {
  33607. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  33608. return array((int) $matches[2], (int) $matches[1]);
  33609. }
  33610. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  33611. return array((int) $matches[2], (int) $matches[1]);
  33612. }
  33613. }
  33614. return array(null, null);
  33615. }
  33616. public function setTerminalDimensions($width, $height)
  33617. {
  33618. $this->terminalDimensions = array($width, $height);
  33619. return $this;
  33620. }
  33621. protected function configureIO(InputInterface $input, OutputInterface $output)
  33622. {
  33623. if (true === $input->hasParameterOption(array('--ansi'))) {
  33624. $output->setDecorated(true);
  33625. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  33626. $output->setDecorated(false);
  33627. }
  33628. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  33629. $input->setInteractive(false);
  33630. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  33631. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  33632. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  33633. $input->setInteractive(false);
  33634. }
  33635. }
  33636. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  33637. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  33638. $input->setInteractive(false);
  33639. } else {
  33640. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  33641. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  33642. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  33643. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  33644. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  33645. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  33646. }
  33647. }
  33648. }
  33649. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  33650. {
  33651. foreach ($command->getHelperSet() as $helper) {
  33652. if ($helper instanceof InputAwareInterface) {
  33653. $helper->setInput($input);
  33654. }
  33655. }
  33656. if (null === $this->dispatcher) {
  33657. return $command->run($input, $output);
  33658. }
  33659. try {
  33660. $command->mergeApplicationDefinition();
  33661. $input->bind($command->getDefinition());
  33662. } catch (ExceptionInterface $e) {
  33663. }
  33664. $event = new ConsoleCommandEvent($command, $input, $output);
  33665. $e = null;
  33666. try {
  33667. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  33668. if ($event->commandShouldRun()) {
  33669. $exitCode = $command->run($input, $output);
  33670. } else {
  33671. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  33672. }
  33673. } catch (\Exception $e) {
  33674. } catch (\Throwable $e) {
  33675. }
  33676. if (null !== $e) {
  33677. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  33678. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  33679. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  33680. if ($x !== $event->getException()) {
  33681. $e = $event->getException();
  33682. }
  33683. $exitCode = $this->getExitCodeForThrowable($e);
  33684. }
  33685. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  33686. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  33687. if (null !== $e) {
  33688. throw $e;
  33689. }
  33690. return $event->getExitCode();
  33691. }
  33692. protected function getCommandName(InputInterface $input)
  33693. {
  33694. return $input->getFirstArgument();
  33695. }
  33696. protected function getDefaultInputDefinition()
  33697. {
  33698. return new InputDefinition(array(
  33699. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  33700. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  33701. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  33702. new InputOption('--verbose', '-v|vv|vvv', InputOption::VALUE_NONE, 'Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug'),
  33703. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  33704. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  33705. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  33706. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  33707. ));
  33708. }
  33709. protected function getDefaultCommands()
  33710. {
  33711. return array(new HelpCommand(), new ListCommand());
  33712. }
  33713. protected function getDefaultHelperSet()
  33714. {
  33715. return new HelperSet(array(
  33716. new FormatterHelper(),
  33717. new DialogHelper(false),
  33718. new ProgressHelper(false),
  33719. new TableHelper(false),
  33720. new DebugFormatterHelper(),
  33721. new ProcessHelper(),
  33722. new QuestionHelper(),
  33723. ));
  33724. }
  33725. private function getSttyColumns()
  33726. {
  33727. if (!\function_exists('proc_open')) {
  33728. return;
  33729. }
  33730. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33731. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33732. if (\is_resource($process)) {
  33733. $info = stream_get_contents($pipes[1]);
  33734. fclose($pipes[1]);
  33735. fclose($pipes[2]);
  33736. proc_close($process);
  33737. return $info;
  33738. }
  33739. }
  33740. private function getConsoleMode()
  33741. {
  33742. if (!\function_exists('proc_open')) {
  33743. return;
  33744. }
  33745. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  33746. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  33747. if (\is_resource($process)) {
  33748. $info = stream_get_contents($pipes[1]);
  33749. fclose($pipes[1]);
  33750. fclose($pipes[2]);
  33751. proc_close($process);
  33752. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  33753. return $matches[2].'x'.$matches[1];
  33754. }
  33755. }
  33756. }
  33757. private function getAbbreviationSuggestions($abbrevs)
  33758. {
  33759. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  33760. }
  33761. public function extractNamespace($name, $limit = null)
  33762. {
  33763. $parts = explode(':', $name);
  33764. array_pop($parts);
  33765. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  33766. }
  33767. private function findAlternatives($name, $collection)
  33768. {
  33769. $threshold = 1e3;
  33770. $alternatives = array();
  33771. $collectionParts = array();
  33772. foreach ($collection as $item) {
  33773. $collectionParts[$item] = explode(':', $item);
  33774. }
  33775. foreach (explode(':', $name) as $i => $subname) {
  33776. foreach ($collectionParts as $collectionName => $parts) {
  33777. $exists = isset($alternatives[$collectionName]);
  33778. if (!isset($parts[$i]) && $exists) {
  33779. $alternatives[$collectionName] += $threshold;
  33780. continue;
  33781. } elseif (!isset($parts[$i])) {
  33782. continue;
  33783. }
  33784. $lev = levenshtein($subname, $parts[$i]);
  33785. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  33786. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  33787. } elseif ($exists) {
  33788. $alternatives[$collectionName] += $threshold;
  33789. }
  33790. }
  33791. }
  33792. foreach ($collection as $item) {
  33793. $lev = levenshtein($name, $item);
  33794. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  33795. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  33796. }
  33797. }
  33798. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  33799. asort($alternatives);
  33800. return array_keys($alternatives);
  33801. }
  33802. public function setDefaultCommand($commandName)
  33803. {
  33804. $this->defaultCommand = $commandName;
  33805. }
  33806. private function splitStringByWidth($string, $width)
  33807. {
  33808. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  33809. return str_split($string, $width);
  33810. }
  33811. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  33812. $lines = array();
  33813. $line = '';
  33814. foreach (preg_split('//u', $utf8String) as $char) {
  33815. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  33816. $line .= $char;
  33817. continue;
  33818. }
  33819. $lines[] = str_pad($line, $width);
  33820. $line = $char;
  33821. }
  33822. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  33823. mb_convert_variables($encoding, 'utf8', $lines);
  33824. return $lines;
  33825. }
  33826. private function extractAllNamespaces($name)
  33827. {
  33828. $parts = explode(':', $name, -1);
  33829. $namespaces = array();
  33830. foreach ($parts as $part) {
  33831. if (\count($namespaces)) {
  33832. $namespaces[] = end($namespaces).':'.$part;
  33833. } else {
  33834. $namespaces[] = $part;
  33835. }
  33836. }
  33837. return $namespaces;
  33838. }
  33839. private function init()
  33840. {
  33841. if ($this->initialized) {
  33842. return;
  33843. }
  33844. $this->initialized = true;
  33845. foreach ($this->getDefaultCommands() as $command) {
  33846. $this->add($command);
  33847. }
  33848. }
  33849. private function getExitCodeForThrowable($throwable)
  33850. {
  33851. $exitCode = $throwable->getCode();
  33852. if (is_numeric($exitCode)) {
  33853. $exitCode = (int) $exitCode;
  33854. if (0 === $exitCode) {
  33855. $exitCode = 1;
  33856. }
  33857. } else {
  33858. $exitCode = 1;
  33859. }
  33860. return $exitCode;
  33861. }
  33862. }
  33863. <?php
  33864. namespace Symfony\Component\Console\Command;
  33865. use Symfony\Component\Console\Application;
  33866. use Symfony\Component\Console\Descriptor\TextDescriptor;
  33867. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  33868. use Symfony\Component\Console\Exception\ExceptionInterface;
  33869. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33870. use Symfony\Component\Console\Exception\LogicException;
  33871. use Symfony\Component\Console\Helper\HelperSet;
  33872. use Symfony\Component\Console\Input\InputArgument;
  33873. use Symfony\Component\Console\Input\InputDefinition;
  33874. use Symfony\Component\Console\Input\InputInterface;
  33875. use Symfony\Component\Console\Input\InputOption;
  33876. use Symfony\Component\Console\Output\BufferedOutput;
  33877. use Symfony\Component\Console\Output\OutputInterface;
  33878. class Command
  33879. {
  33880. private $application;
  33881. private $name;
  33882. private $processTitle;
  33883. private $aliases = array();
  33884. private $definition;
  33885. private $help;
  33886. private $description;
  33887. private $ignoreValidationErrors = false;
  33888. private $applicationDefinitionMerged = false;
  33889. private $applicationDefinitionMergedWithArgs = false;
  33890. private $code;
  33891. private $synopsis = array();
  33892. private $usages = array();
  33893. private $helperSet;
  33894. public function __construct($name = null)
  33895. {
  33896. $this->definition = new InputDefinition();
  33897. if (null !== $name) {
  33898. $this->setName($name);
  33899. }
  33900. $this->configure();
  33901. if (!$this->name) {
  33902. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  33903. }
  33904. }
  33905. public function ignoreValidationErrors()
  33906. {
  33907. $this->ignoreValidationErrors = true;
  33908. }
  33909. public function setApplication(Application $application = null)
  33910. {
  33911. $this->application = $application;
  33912. if ($application) {
  33913. $this->setHelperSet($application->getHelperSet());
  33914. } else {
  33915. $this->helperSet = null;
  33916. }
  33917. }
  33918. public function setHelperSet(HelperSet $helperSet)
  33919. {
  33920. $this->helperSet = $helperSet;
  33921. }
  33922. public function getHelperSet()
  33923. {
  33924. return $this->helperSet;
  33925. }
  33926. public function getApplication()
  33927. {
  33928. return $this->application;
  33929. }
  33930. public function isEnabled()
  33931. {
  33932. return true;
  33933. }
  33934. protected function configure()
  33935. {
  33936. }
  33937. protected function execute(InputInterface $input, OutputInterface $output)
  33938. {
  33939. throw new LogicException('You must override the execute() method in the concrete command class.');
  33940. }
  33941. protected function interact(InputInterface $input, OutputInterface $output)
  33942. {
  33943. }
  33944. protected function initialize(InputInterface $input, OutputInterface $output)
  33945. {
  33946. }
  33947. public function run(InputInterface $input, OutputInterface $output)
  33948. {
  33949. $this->getSynopsis(true);
  33950. $this->getSynopsis(false);
  33951. $this->mergeApplicationDefinition();
  33952. try {
  33953. $input->bind($this->definition);
  33954. } catch (ExceptionInterface $e) {
  33955. if (!$this->ignoreValidationErrors) {
  33956. throw $e;
  33957. }
  33958. }
  33959. $this->initialize($input, $output);
  33960. if (null !== $this->processTitle) {
  33961. if (\function_exists('cli_set_process_title')) {
  33962. if (!@cli_set_process_title($this->processTitle)) {
  33963. if ('Darwin' === PHP_OS) {
  33964. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  33965. } else {
  33966. cli_set_process_title($this->processTitle);
  33967. }
  33968. }
  33969. } elseif (\function_exists('setproctitle')) {
  33970. setproctitle($this->processTitle);
  33971. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  33972. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  33973. }
  33974. }
  33975. if ($input->isInteractive()) {
  33976. $this->interact($input, $output);
  33977. }
  33978. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  33979. $input->setArgument('command', $this->getName());
  33980. }
  33981. $input->validate();
  33982. if ($this->code) {
  33983. $statusCode = \call_user_func($this->code, $input, $output);
  33984. } else {
  33985. $statusCode = $this->execute($input, $output);
  33986. }
  33987. return is_numeric($statusCode) ? (int) $statusCode : 0;
  33988. }
  33989. public function setCode($code)
  33990. {
  33991. if (!\is_callable($code)) {
  33992. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  33993. }
  33994. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  33995. $r = new \ReflectionFunction($code);
  33996. if (null === $r->getClosureThis()) {
  33997. if (\PHP_VERSION_ID < 70000) {
  33998. $code = @\Closure::bind($code, $this);
  33999. } else {
  34000. $code = \Closure::bind($code, $this);
  34001. }
  34002. }
  34003. }
  34004. $this->code = $code;
  34005. return $this;
  34006. }
  34007. public function mergeApplicationDefinition($mergeArgs = true)
  34008. {
  34009. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  34010. return;
  34011. }
  34012. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  34013. $this->applicationDefinitionMerged = true;
  34014. if ($mergeArgs) {
  34015. $currentArguments = $this->definition->getArguments();
  34016. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  34017. $this->definition->addArguments($currentArguments);
  34018. $this->applicationDefinitionMergedWithArgs = true;
  34019. }
  34020. }
  34021. public function setDefinition($definition)
  34022. {
  34023. if ($definition instanceof InputDefinition) {
  34024. $this->definition = $definition;
  34025. } else {
  34026. $this->definition->setDefinition($definition);
  34027. }
  34028. $this->applicationDefinitionMerged = false;
  34029. return $this;
  34030. }
  34031. public function getDefinition()
  34032. {
  34033. return $this->definition;
  34034. }
  34035. public function getNativeDefinition()
  34036. {
  34037. return $this->getDefinition();
  34038. }
  34039. public function addArgument($name, $mode = null, $description = '', $default = null)
  34040. {
  34041. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  34042. return $this;
  34043. }
  34044. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  34045. {
  34046. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  34047. return $this;
  34048. }
  34049. public function setName($name)
  34050. {
  34051. $this->validateName($name);
  34052. $this->name = $name;
  34053. return $this;
  34054. }
  34055. public function setProcessTitle($title)
  34056. {
  34057. $this->processTitle = $title;
  34058. return $this;
  34059. }
  34060. public function getName()
  34061. {
  34062. return $this->name;
  34063. }
  34064. public function setDescription($description)
  34065. {
  34066. $this->description = $description;
  34067. return $this;
  34068. }
  34069. public function getDescription()
  34070. {
  34071. return $this->description;
  34072. }
  34073. public function setHelp($help)
  34074. {
  34075. $this->help = $help;
  34076. return $this;
  34077. }
  34078. public function getHelp()
  34079. {
  34080. return $this->help;
  34081. }
  34082. public function getProcessedHelp()
  34083. {
  34084. $name = $this->name;
  34085. $placeholders = array(
  34086. '%command.name%',
  34087. '%command.full_name%',
  34088. );
  34089. $replacements = array(
  34090. $name,
  34091. $_SERVER['PHP_SELF'].' '.$name,
  34092. );
  34093. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  34094. }
  34095. public function setAliases($aliases)
  34096. {
  34097. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  34098. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  34099. }
  34100. foreach ($aliases as $alias) {
  34101. $this->validateName($alias);
  34102. }
  34103. $this->aliases = $aliases;
  34104. return $this;
  34105. }
  34106. public function getAliases()
  34107. {
  34108. return $this->aliases;
  34109. }
  34110. public function getSynopsis($short = false)
  34111. {
  34112. $key = $short ? 'short' : 'long';
  34113. if (!isset($this->synopsis[$key])) {
  34114. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  34115. }
  34116. return $this->synopsis[$key];
  34117. }
  34118. public function addUsage($usage)
  34119. {
  34120. if (0 !== strpos($usage, $this->name)) {
  34121. $usage = sprintf('%s %s', $this->name, $usage);
  34122. }
  34123. $this->usages[] = $usage;
  34124. return $this;
  34125. }
  34126. public function getUsages()
  34127. {
  34128. return $this->usages;
  34129. }
  34130. public function getHelper($name)
  34131. {
  34132. if (null === $this->helperSet) {
  34133. throw new LogicException(sprintf('Cannot retrieve helper "%s" because there is no HelperSet defined. Did you forget to add your command to the application or to set the application on the command using the setApplication() method? You can also set the HelperSet directly using the setHelperSet() method.', $name));
  34134. }
  34135. return $this->helperSet->get($name);
  34136. }
  34137. public function asText()
  34138. {
  34139. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34140. $descriptor = new TextDescriptor();
  34141. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  34142. $descriptor->describe($output, $this, array('raw_output' => true));
  34143. return $output->fetch();
  34144. }
  34145. public function asXml($asDom = false)
  34146. {
  34147. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  34148. $descriptor = new XmlDescriptor();
  34149. if ($asDom) {
  34150. return $descriptor->getCommandDocument($this);
  34151. }
  34152. $output = new BufferedOutput();
  34153. $descriptor->describe($output, $this);
  34154. return $output->fetch();
  34155. }
  34156. private function validateName($name)
  34157. {
  34158. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  34159. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  34160. }
  34161. }
  34162. }
  34163. <?php
  34164. namespace Symfony\Component\Console\Command;
  34165. use Symfony\Component\Console\Helper\DescriptorHelper;
  34166. use Symfony\Component\Console\Input\InputArgument;
  34167. use Symfony\Component\Console\Input\InputInterface;
  34168. use Symfony\Component\Console\Input\InputOption;
  34169. use Symfony\Component\Console\Output\OutputInterface;
  34170. class HelpCommand extends Command
  34171. {
  34172. private $command;
  34173. protected function configure()
  34174. {
  34175. $this->ignoreValidationErrors();
  34176. $this
  34177. ->setName('help')
  34178. ->setDefinition(array(
  34179. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  34180. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  34181. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34182. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  34183. ))
  34184. ->setDescription('Displays help for a command')
  34185. ->setHelp(<<<'EOF'
  34186. The <info>%command.name%</info> command displays help for a given command:
  34187. <info>php %command.full_name% list</info>
  34188. You can also output the help in other formats by using the <comment>--format</comment> option:
  34189. <info>php %command.full_name% --format=xml list</info>
  34190. To display the list of available commands, please use the <info>list</info> command.
  34191. EOF
  34192. )
  34193. ;
  34194. }
  34195. public function setCommand(Command $command)
  34196. {
  34197. $this->command = $command;
  34198. }
  34199. protected function execute(InputInterface $input, OutputInterface $output)
  34200. {
  34201. if (null === $this->command) {
  34202. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  34203. }
  34204. if ($input->getOption('xml')) {
  34205. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34206. $input->setOption('format', 'xml');
  34207. }
  34208. $helper = new DescriptorHelper();
  34209. $helper->describe($output, $this->command, array(
  34210. 'format' => $input->getOption('format'),
  34211. 'raw_text' => $input->getOption('raw'),
  34212. ));
  34213. $this->command = null;
  34214. }
  34215. }
  34216. <?php
  34217. namespace Symfony\Component\Console\Command;
  34218. use Symfony\Component\Console\Helper\DescriptorHelper;
  34219. use Symfony\Component\Console\Input\InputArgument;
  34220. use Symfony\Component\Console\Input\InputDefinition;
  34221. use Symfony\Component\Console\Input\InputInterface;
  34222. use Symfony\Component\Console\Input\InputOption;
  34223. use Symfony\Component\Console\Output\OutputInterface;
  34224. class ListCommand extends Command
  34225. {
  34226. protected function configure()
  34227. {
  34228. $this
  34229. ->setName('list')
  34230. ->setDefinition($this->createDefinition())
  34231. ->setDescription('Lists commands')
  34232. ->setHelp(<<<'EOF'
  34233. The <info>%command.name%</info> command lists all commands:
  34234. <info>php %command.full_name%</info>
  34235. You can also display the commands for a specific namespace:
  34236. <info>php %command.full_name% test</info>
  34237. You can also output the information in other formats by using the <comment>--format</comment> option:
  34238. <info>php %command.full_name% --format=xml</info>
  34239. It's also possible to get raw list of commands (useful for embedding command runner):
  34240. <info>php %command.full_name% --raw</info>
  34241. EOF
  34242. )
  34243. ;
  34244. }
  34245. public function getNativeDefinition()
  34246. {
  34247. return $this->createDefinition();
  34248. }
  34249. protected function execute(InputInterface $input, OutputInterface $output)
  34250. {
  34251. if ($input->getOption('xml')) {
  34252. @trigger_error('The --xml option was deprecated in version 2.7 and will be removed in version 3.0. Use the --format option instead.', E_USER_DEPRECATED);
  34253. $input->setOption('format', 'xml');
  34254. }
  34255. $helper = new DescriptorHelper();
  34256. $helper->describe($output, $this->getApplication(), array(
  34257. 'format' => $input->getOption('format'),
  34258. 'raw_text' => $input->getOption('raw'),
  34259. 'namespace' => $input->getArgument('namespace'),
  34260. ));
  34261. }
  34262. private function createDefinition()
  34263. {
  34264. return new InputDefinition(array(
  34265. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  34266. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  34267. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  34268. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  34269. ));
  34270. }
  34271. }
  34272. <?php
  34273. namespace Symfony\Component\Console;
  34274. final class ConsoleEvents
  34275. {
  34276. const COMMAND = 'console.command';
  34277. const TERMINATE = 'console.terminate';
  34278. const EXCEPTION = 'console.exception';
  34279. }
  34280. <?php
  34281. namespace Symfony\Component\Console\Descriptor;
  34282. use Symfony\Component\Console\Application;
  34283. use Symfony\Component\Console\Command\Command;
  34284. use Symfony\Component\Console\Exception\CommandNotFoundException;
  34285. class ApplicationDescription
  34286. {
  34287. const GLOBAL_NAMESPACE = '_global';
  34288. private $application;
  34289. private $namespace;
  34290. private $namespaces;
  34291. private $commands;
  34292. private $aliases;
  34293. public function __construct(Application $application, $namespace = null)
  34294. {
  34295. $this->application = $application;
  34296. $this->namespace = $namespace;
  34297. }
  34298. public function getNamespaces()
  34299. {
  34300. if (null === $this->namespaces) {
  34301. $this->inspectApplication();
  34302. }
  34303. return $this->namespaces;
  34304. }
  34305. public function getCommands()
  34306. {
  34307. if (null === $this->commands) {
  34308. $this->inspectApplication();
  34309. }
  34310. return $this->commands;
  34311. }
  34312. public function getCommand($name)
  34313. {
  34314. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  34315. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  34316. }
  34317. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  34318. }
  34319. private function inspectApplication()
  34320. {
  34321. $this->commands = array();
  34322. $this->namespaces = array();
  34323. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  34324. foreach ($this->sortCommands($all) as $namespace => $commands) {
  34325. $names = array();
  34326. foreach ($commands as $name => $command) {
  34327. if (!$command->getName()) {
  34328. continue;
  34329. }
  34330. if ($command->getName() === $name) {
  34331. $this->commands[$name] = $command;
  34332. } else {
  34333. $this->aliases[$name] = $command;
  34334. }
  34335. $names[] = $name;
  34336. }
  34337. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  34338. }
  34339. }
  34340. private function sortCommands(array $commands)
  34341. {
  34342. $namespacedCommands = array();
  34343. $globalCommands = array();
  34344. foreach ($commands as $name => $command) {
  34345. $key = $this->application->extractNamespace($name, 1);
  34346. if (!$key) {
  34347. $globalCommands['_global'][$name] = $command;
  34348. } else {
  34349. $namespacedCommands[$key][$name] = $command;
  34350. }
  34351. }
  34352. ksort($namespacedCommands);
  34353. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  34354. foreach ($namespacedCommands as &$commandsSet) {
  34355. ksort($commandsSet);
  34356. }
  34357. unset($commandsSet);
  34358. return $namespacedCommands;
  34359. }
  34360. }
  34361. <?php
  34362. namespace Symfony\Component\Console\Descriptor;
  34363. use Symfony\Component\Console\Application;
  34364. use Symfony\Component\Console\Command\Command;
  34365. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34366. use Symfony\Component\Console\Input\InputArgument;
  34367. use Symfony\Component\Console\Input\InputDefinition;
  34368. use Symfony\Component\Console\Input\InputOption;
  34369. use Symfony\Component\Console\Output\OutputInterface;
  34370. abstract class Descriptor implements DescriptorInterface
  34371. {
  34372. private $output;
  34373. public function describe(OutputInterface $output, $object, array $options = array())
  34374. {
  34375. $this->output = $output;
  34376. switch (true) {
  34377. case $object instanceof InputArgument:
  34378. $this->describeInputArgument($object, $options);
  34379. break;
  34380. case $object instanceof InputOption:
  34381. $this->describeInputOption($object, $options);
  34382. break;
  34383. case $object instanceof InputDefinition:
  34384. $this->describeInputDefinition($object, $options);
  34385. break;
  34386. case $object instanceof Command:
  34387. $this->describeCommand($object, $options);
  34388. break;
  34389. case $object instanceof Application:
  34390. $this->describeApplication($object, $options);
  34391. break;
  34392. default:
  34393. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  34394. }
  34395. }
  34396. protected function write($content, $decorated = false)
  34397. {
  34398. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  34399. }
  34400. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  34401. abstract protected function describeInputOption(InputOption $option, array $options = array());
  34402. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  34403. abstract protected function describeCommand(Command $command, array $options = array());
  34404. abstract protected function describeApplication(Application $application, array $options = array());
  34405. }
  34406. <?php
  34407. namespace Symfony\Component\Console\Descriptor;
  34408. use Symfony\Component\Console\Output\OutputInterface;
  34409. interface DescriptorInterface
  34410. {
  34411. public function describe(OutputInterface $output, $object, array $options = array());
  34412. }
  34413. <?php
  34414. namespace Symfony\Component\Console\Descriptor;
  34415. use Symfony\Component\Console\Application;
  34416. use Symfony\Component\Console\Command\Command;
  34417. use Symfony\Component\Console\Input\InputArgument;
  34418. use Symfony\Component\Console\Input\InputDefinition;
  34419. use Symfony\Component\Console\Input\InputOption;
  34420. class JsonDescriptor extends Descriptor
  34421. {
  34422. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34423. {
  34424. $this->writeData($this->getInputArgumentData($argument), $options);
  34425. }
  34426. protected function describeInputOption(InputOption $option, array $options = array())
  34427. {
  34428. $this->writeData($this->getInputOptionData($option), $options);
  34429. }
  34430. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34431. {
  34432. $this->writeData($this->getInputDefinitionData($definition), $options);
  34433. }
  34434. protected function describeCommand(Command $command, array $options = array())
  34435. {
  34436. $this->writeData($this->getCommandData($command), $options);
  34437. }
  34438. protected function describeApplication(Application $application, array $options = array())
  34439. {
  34440. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34441. $description = new ApplicationDescription($application, $describedNamespace);
  34442. $commands = array();
  34443. foreach ($description->getCommands() as $command) {
  34444. $commands[] = $this->getCommandData($command);
  34445. }
  34446. $data = $describedNamespace
  34447. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  34448. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  34449. $this->writeData($data, $options);
  34450. }
  34451. private function writeData(array $data, array $options)
  34452. {
  34453. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  34454. }
  34455. private function getInputArgumentData(InputArgument $argument)
  34456. {
  34457. return array(
  34458. 'name' => $argument->getName(),
  34459. 'is_required' => $argument->isRequired(),
  34460. 'is_array' => $argument->isArray(),
  34461. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  34462. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  34463. );
  34464. }
  34465. private function getInputOptionData(InputOption $option)
  34466. {
  34467. return array(
  34468. 'name' => '--'.$option->getName(),
  34469. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  34470. 'accept_value' => $option->acceptValue(),
  34471. 'is_value_required' => $option->isValueRequired(),
  34472. 'is_multiple' => $option->isArray(),
  34473. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  34474. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  34475. );
  34476. }
  34477. private function getInputDefinitionData(InputDefinition $definition)
  34478. {
  34479. $inputArguments = array();
  34480. foreach ($definition->getArguments() as $name => $argument) {
  34481. $inputArguments[$name] = $this->getInputArgumentData($argument);
  34482. }
  34483. $inputOptions = array();
  34484. foreach ($definition->getOptions() as $name => $option) {
  34485. $inputOptions[$name] = $this->getInputOptionData($option);
  34486. }
  34487. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  34488. }
  34489. private function getCommandData(Command $command)
  34490. {
  34491. $command->getSynopsis();
  34492. $command->mergeApplicationDefinition(false);
  34493. return array(
  34494. 'name' => $command->getName(),
  34495. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  34496. 'description' => $command->getDescription(),
  34497. 'help' => $command->getProcessedHelp(),
  34498. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  34499. );
  34500. }
  34501. }
  34502. <?php
  34503. namespace Symfony\Component\Console\Descriptor;
  34504. use Symfony\Component\Console\Application;
  34505. use Symfony\Component\Console\Command\Command;
  34506. use Symfony\Component\Console\Helper\Helper;
  34507. use Symfony\Component\Console\Input\InputArgument;
  34508. use Symfony\Component\Console\Input\InputDefinition;
  34509. use Symfony\Component\Console\Input\InputOption;
  34510. class MarkdownDescriptor extends Descriptor
  34511. {
  34512. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34513. {
  34514. $this->write(
  34515. '**'.$argument->getName().':**'."\n\n"
  34516. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  34517. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  34518. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  34519. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  34520. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  34521. );
  34522. }
  34523. protected function describeInputOption(InputOption $option, array $options = array())
  34524. {
  34525. $this->write(
  34526. '**'.$option->getName().':**'."\n\n"
  34527. .'* Name: `--'.$option->getName().'`'."\n"
  34528. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  34529. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  34530. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  34531. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  34532. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  34533. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  34534. );
  34535. }
  34536. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34537. {
  34538. if ($showArguments = \count($definition->getArguments()) > 0) {
  34539. $this->write('### Arguments:');
  34540. foreach ($definition->getArguments() as $argument) {
  34541. $this->write("\n\n");
  34542. $this->write($this->describeInputArgument($argument));
  34543. }
  34544. }
  34545. if (\count($definition->getOptions()) > 0) {
  34546. if ($showArguments) {
  34547. $this->write("\n\n");
  34548. }
  34549. $this->write('### Options:');
  34550. foreach ($definition->getOptions() as $option) {
  34551. $this->write("\n\n");
  34552. $this->write($this->describeInputOption($option));
  34553. }
  34554. }
  34555. }
  34556. protected function describeCommand(Command $command, array $options = array())
  34557. {
  34558. $command->getSynopsis();
  34559. $command->mergeApplicationDefinition(false);
  34560. $this->write(
  34561. $command->getName()."\n"
  34562. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  34563. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  34564. .'* Usage:'."\n\n"
  34565. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  34566. return $carry.' * `'.$usage.'`'."\n";
  34567. })
  34568. );
  34569. if ($help = $command->getProcessedHelp()) {
  34570. $this->write("\n");
  34571. $this->write($help);
  34572. }
  34573. if ($command->getNativeDefinition()) {
  34574. $this->write("\n\n");
  34575. $this->describeInputDefinition($command->getNativeDefinition());
  34576. }
  34577. }
  34578. protected function describeApplication(Application $application, array $options = array())
  34579. {
  34580. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34581. $description = new ApplicationDescription($application, $describedNamespace);
  34582. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  34583. foreach ($description->getNamespaces() as $namespace) {
  34584. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34585. $this->write("\n\n");
  34586. $this->write('**'.$namespace['id'].':**');
  34587. }
  34588. $this->write("\n\n");
  34589. $this->write(implode("\n", array_map(function ($commandName) {
  34590. return '* '.$commandName;
  34591. }, $namespace['commands'])));
  34592. }
  34593. foreach ($description->getCommands() as $command) {
  34594. $this->write("\n\n");
  34595. $this->write($this->describeCommand($command));
  34596. }
  34597. }
  34598. }
  34599. <?php
  34600. namespace Symfony\Component\Console\Descriptor;
  34601. use Symfony\Component\Console\Application;
  34602. use Symfony\Component\Console\Command\Command;
  34603. use Symfony\Component\Console\Formatter\OutputFormatter;
  34604. use Symfony\Component\Console\Helper\Helper;
  34605. use Symfony\Component\Console\Input\InputArgument;
  34606. use Symfony\Component\Console\Input\InputDefinition;
  34607. use Symfony\Component\Console\Input\InputOption;
  34608. class TextDescriptor extends Descriptor
  34609. {
  34610. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34611. {
  34612. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  34613. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  34614. } else {
  34615. $default = '';
  34616. }
  34617. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  34618. $spacingWidth = $totalWidth - \strlen($argument->getName());
  34619. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  34620. $argument->getName(),
  34621. str_repeat(' ', $spacingWidth),
  34622. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  34623. $default
  34624. ), $options);
  34625. }
  34626. protected function describeInputOption(InputOption $option, array $options = array())
  34627. {
  34628. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  34629. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  34630. } else {
  34631. $default = '';
  34632. }
  34633. $value = '';
  34634. if ($option->acceptValue()) {
  34635. $value = '='.strtoupper($option->getName());
  34636. if ($option->isValueOptional()) {
  34637. $value = '['.$value.']';
  34638. }
  34639. }
  34640. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  34641. $synopsis = sprintf('%s%s',
  34642. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  34643. sprintf('--%s%s', $option->getName(), $value)
  34644. );
  34645. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  34646. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  34647. $synopsis,
  34648. str_repeat(' ', $spacingWidth),
  34649. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  34650. $default,
  34651. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  34652. ), $options);
  34653. }
  34654. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34655. {
  34656. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  34657. foreach ($definition->getArguments() as $argument) {
  34658. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  34659. }
  34660. if ($definition->getArguments()) {
  34661. $this->writeText('<comment>Arguments:</comment>', $options);
  34662. $this->writeText("\n");
  34663. foreach ($definition->getArguments() as $argument) {
  34664. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  34665. $this->writeText("\n");
  34666. }
  34667. }
  34668. if ($definition->getArguments() && $definition->getOptions()) {
  34669. $this->writeText("\n");
  34670. }
  34671. if ($definition->getOptions()) {
  34672. $laterOptions = array();
  34673. $this->writeText('<comment>Options:</comment>', $options);
  34674. foreach ($definition->getOptions() as $option) {
  34675. if (\strlen($option->getShortcut()) > 1) {
  34676. $laterOptions[] = $option;
  34677. continue;
  34678. }
  34679. $this->writeText("\n");
  34680. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34681. }
  34682. foreach ($laterOptions as $option) {
  34683. $this->writeText("\n");
  34684. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  34685. }
  34686. }
  34687. }
  34688. protected function describeCommand(Command $command, array $options = array())
  34689. {
  34690. $command->getSynopsis(true);
  34691. $command->getSynopsis(false);
  34692. $command->mergeApplicationDefinition(false);
  34693. $this->writeText('<comment>Usage:</comment>', $options);
  34694. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  34695. $this->writeText("\n");
  34696. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  34697. }
  34698. $this->writeText("\n");
  34699. $definition = $command->getNativeDefinition();
  34700. if ($definition->getOptions() || $definition->getArguments()) {
  34701. $this->writeText("\n");
  34702. $this->describeInputDefinition($definition, $options);
  34703. $this->writeText("\n");
  34704. }
  34705. if ($help = $command->getProcessedHelp()) {
  34706. $this->writeText("\n");
  34707. $this->writeText('<comment>Help:</comment>', $options);
  34708. $this->writeText("\n");
  34709. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  34710. $this->writeText("\n");
  34711. }
  34712. }
  34713. protected function describeApplication(Application $application, array $options = array())
  34714. {
  34715. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  34716. $description = new ApplicationDescription($application, $describedNamespace);
  34717. if (isset($options['raw_text']) && $options['raw_text']) {
  34718. $width = $this->getColumnWidth($description->getCommands());
  34719. foreach ($description->getCommands() as $command) {
  34720. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  34721. $this->writeText("\n");
  34722. }
  34723. } else {
  34724. if ('' != $help = $application->getHelp()) {
  34725. $this->writeText("$help\n\n", $options);
  34726. }
  34727. $this->writeText("<comment>Usage:</comment>\n", $options);
  34728. $this->writeText(" command [options] [arguments]\n\n", $options);
  34729. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  34730. $this->writeText("\n");
  34731. $this->writeText("\n");
  34732. $width = $this->getColumnWidth($description->getCommands());
  34733. if ($describedNamespace) {
  34734. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  34735. } else {
  34736. $this->writeText('<comment>Available commands:</comment>', $options);
  34737. }
  34738. foreach ($description->getNamespaces() as $namespace) {
  34739. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  34740. $this->writeText("\n");
  34741. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  34742. }
  34743. foreach ($namespace['commands'] as $name) {
  34744. $this->writeText("\n");
  34745. $spacingWidth = $width - Helper::strlen($name);
  34746. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  34747. }
  34748. }
  34749. $this->writeText("\n");
  34750. }
  34751. }
  34752. private function writeText($content, array $options = array())
  34753. {
  34754. $this->write(
  34755. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  34756. isset($options['raw_output']) ? !$options['raw_output'] : true
  34757. );
  34758. }
  34759. private function formatDefaultValue($default)
  34760. {
  34761. if (INF === $default) {
  34762. return 'INF';
  34763. }
  34764. if (\is_string($default)) {
  34765. $default = OutputFormatter::escape($default);
  34766. } elseif (\is_array($default)) {
  34767. foreach ($default as $key => $value) {
  34768. if (\is_string($value)) {
  34769. $default[$key] = OutputFormatter::escape($value);
  34770. }
  34771. }
  34772. }
  34773. if (\PHP_VERSION_ID < 50400) {
  34774. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  34775. }
  34776. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  34777. }
  34778. private function getColumnWidth(array $commands)
  34779. {
  34780. $widths = array();
  34781. foreach ($commands as $command) {
  34782. $widths[] = Helper::strlen($command->getName());
  34783. foreach ($command->getAliases() as $alias) {
  34784. $widths[] = Helper::strlen($alias);
  34785. }
  34786. }
  34787. return max($widths) + 2;
  34788. }
  34789. private function calculateTotalWidthForOptions(array $options)
  34790. {
  34791. $totalWidth = 0;
  34792. foreach ($options as $option) {
  34793. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  34794. if ($option->acceptValue()) {
  34795. $valueLength = 1 + Helper::strlen($option->getName());
  34796. $valueLength += $option->isValueOptional() ? 2 : 0;
  34797. $nameLength += $valueLength;
  34798. }
  34799. $totalWidth = max($totalWidth, $nameLength);
  34800. }
  34801. return $totalWidth;
  34802. }
  34803. }
  34804. <?php
  34805. namespace Symfony\Component\Console\Descriptor;
  34806. use Symfony\Component\Console\Application;
  34807. use Symfony\Component\Console\Command\Command;
  34808. use Symfony\Component\Console\Input\InputArgument;
  34809. use Symfony\Component\Console\Input\InputDefinition;
  34810. use Symfony\Component\Console\Input\InputOption;
  34811. class XmlDescriptor extends Descriptor
  34812. {
  34813. public function getInputDefinitionDocument(InputDefinition $definition)
  34814. {
  34815. $dom = new \DOMDocument('1.0', 'UTF-8');
  34816. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  34817. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  34818. foreach ($definition->getArguments() as $argument) {
  34819. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  34820. }
  34821. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  34822. foreach ($definition->getOptions() as $option) {
  34823. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  34824. }
  34825. return $dom;
  34826. }
  34827. public function getCommandDocument(Command $command)
  34828. {
  34829. $dom = new \DOMDocument('1.0', 'UTF-8');
  34830. $dom->appendChild($commandXML = $dom->createElement('command'));
  34831. $command->getSynopsis();
  34832. $command->mergeApplicationDefinition(false);
  34833. $commandXML->setAttribute('id', $command->getName());
  34834. $commandXML->setAttribute('name', $command->getName());
  34835. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  34836. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  34837. $usagesXML->appendChild($dom->createElement('usage', $usage));
  34838. }
  34839. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  34840. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  34841. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  34842. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  34843. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  34844. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  34845. return $dom;
  34846. }
  34847. public function getApplicationDocument(Application $application, $namespace = null)
  34848. {
  34849. $dom = new \DOMDocument('1.0', 'UTF-8');
  34850. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  34851. if ('UNKNOWN' !== $application->getName()) {
  34852. $rootXml->setAttribute('name', $application->getName());
  34853. if ('UNKNOWN' !== $application->getVersion()) {
  34854. $rootXml->setAttribute('version', $application->getVersion());
  34855. }
  34856. }
  34857. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  34858. $description = new ApplicationDescription($application, $namespace);
  34859. if ($namespace) {
  34860. $commandsXML->setAttribute('namespace', $namespace);
  34861. }
  34862. foreach ($description->getCommands() as $command) {
  34863. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  34864. }
  34865. if (!$namespace) {
  34866. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  34867. foreach ($description->getNamespaces() as $namespaceDescription) {
  34868. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  34869. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  34870. foreach ($namespaceDescription['commands'] as $name) {
  34871. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  34872. $commandXML->appendChild($dom->createTextNode($name));
  34873. }
  34874. }
  34875. }
  34876. return $dom;
  34877. }
  34878. protected function describeInputArgument(InputArgument $argument, array $options = array())
  34879. {
  34880. $this->writeDocument($this->getInputArgumentDocument($argument));
  34881. }
  34882. protected function describeInputOption(InputOption $option, array $options = array())
  34883. {
  34884. $this->writeDocument($this->getInputOptionDocument($option));
  34885. }
  34886. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  34887. {
  34888. $this->writeDocument($this->getInputDefinitionDocument($definition));
  34889. }
  34890. protected function describeCommand(Command $command, array $options = array())
  34891. {
  34892. $this->writeDocument($this->getCommandDocument($command));
  34893. }
  34894. protected function describeApplication(Application $application, array $options = array())
  34895. {
  34896. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  34897. }
  34898. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  34899. {
  34900. foreach ($importedParent->childNodes as $childNode) {
  34901. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  34902. }
  34903. }
  34904. private function writeDocument(\DOMDocument $dom)
  34905. {
  34906. $dom->formatOutput = true;
  34907. $this->write($dom->saveXML());
  34908. }
  34909. private function getInputArgumentDocument(InputArgument $argument)
  34910. {
  34911. $dom = new \DOMDocument('1.0', 'UTF-8');
  34912. $dom->appendChild($objectXML = $dom->createElement('argument'));
  34913. $objectXML->setAttribute('name', $argument->getName());
  34914. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  34915. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  34916. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34917. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  34918. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34919. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  34920. foreach ($defaults as $default) {
  34921. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34922. $defaultXML->appendChild($dom->createTextNode($default));
  34923. }
  34924. return $dom;
  34925. }
  34926. private function getInputOptionDocument(InputOption $option)
  34927. {
  34928. $dom = new \DOMDocument('1.0', 'UTF-8');
  34929. $dom->appendChild($objectXML = $dom->createElement('option'));
  34930. $objectXML->setAttribute('name', '--'.$option->getName());
  34931. $pos = strpos($option->getShortcut(), '|');
  34932. if (false !== $pos) {
  34933. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  34934. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  34935. } else {
  34936. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  34937. }
  34938. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  34939. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  34940. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  34941. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  34942. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  34943. if ($option->acceptValue()) {
  34944. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  34945. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  34946. if (!empty($defaults)) {
  34947. foreach ($defaults as $default) {
  34948. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  34949. $defaultXML->appendChild($dom->createTextNode($default));
  34950. }
  34951. }
  34952. }
  34953. return $dom;
  34954. }
  34955. }
  34956. <?php
  34957. namespace Symfony\Component\Console\Event;
  34958. class ConsoleCommandEvent extends ConsoleEvent
  34959. {
  34960. const RETURN_CODE_DISABLED = 113;
  34961. private $commandShouldRun = true;
  34962. public function disableCommand()
  34963. {
  34964. return $this->commandShouldRun = false;
  34965. }
  34966. public function enableCommand()
  34967. {
  34968. return $this->commandShouldRun = true;
  34969. }
  34970. public function commandShouldRun()
  34971. {
  34972. return $this->commandShouldRun;
  34973. }
  34974. }
  34975. <?php
  34976. namespace Symfony\Component\Console\Event;
  34977. use Symfony\Component\Console\Command\Command;
  34978. use Symfony\Component\Console\Input\InputInterface;
  34979. use Symfony\Component\Console\Output\OutputInterface;
  34980. use Symfony\Component\EventDispatcher\Event;
  34981. class ConsoleEvent extends Event
  34982. {
  34983. protected $command;
  34984. private $input;
  34985. private $output;
  34986. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  34987. {
  34988. $this->command = $command;
  34989. $this->input = $input;
  34990. $this->output = $output;
  34991. }
  34992. public function getCommand()
  34993. {
  34994. return $this->command;
  34995. }
  34996. public function getInput()
  34997. {
  34998. return $this->input;
  34999. }
  35000. public function getOutput()
  35001. {
  35002. return $this->output;
  35003. }
  35004. }
  35005. <?php
  35006. namespace Symfony\Component\Console\Event;
  35007. use Symfony\Component\Console\Command\Command;
  35008. use Symfony\Component\Console\Input\InputInterface;
  35009. use Symfony\Component\Console\Output\OutputInterface;
  35010. class ConsoleExceptionEvent extends ConsoleEvent
  35011. {
  35012. private $exception;
  35013. private $exitCode;
  35014. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  35015. {
  35016. parent::__construct($command, $input, $output);
  35017. $this->setException($exception);
  35018. $this->exitCode = (int) $exitCode;
  35019. }
  35020. public function getException()
  35021. {
  35022. return $this->exception;
  35023. }
  35024. public function setException(\Exception $exception)
  35025. {
  35026. $this->exception = $exception;
  35027. }
  35028. public function getExitCode()
  35029. {
  35030. return $this->exitCode;
  35031. }
  35032. }
  35033. <?php
  35034. namespace Symfony\Component\Console\Event;
  35035. use Symfony\Component\Console\Command\Command;
  35036. use Symfony\Component\Console\Input\InputInterface;
  35037. use Symfony\Component\Console\Output\OutputInterface;
  35038. class ConsoleTerminateEvent extends ConsoleEvent
  35039. {
  35040. private $exitCode;
  35041. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  35042. {
  35043. parent::__construct($command, $input, $output);
  35044. $this->setExitCode($exitCode);
  35045. }
  35046. public function setExitCode($exitCode)
  35047. {
  35048. $this->exitCode = (int) $exitCode;
  35049. }
  35050. public function getExitCode()
  35051. {
  35052. return $this->exitCode;
  35053. }
  35054. }
  35055. <?php
  35056. namespace Symfony\Component\Console\Exception;
  35057. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  35058. {
  35059. private $alternatives;
  35060. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  35061. {
  35062. parent::__construct($message, $code, $previous);
  35063. $this->alternatives = $alternatives;
  35064. }
  35065. public function getAlternatives()
  35066. {
  35067. return $this->alternatives;
  35068. }
  35069. }
  35070. <?php
  35071. namespace Symfony\Component\Console\Exception;
  35072. interface ExceptionInterface
  35073. {
  35074. }
  35075. <?php
  35076. namespace Symfony\Component\Console\Exception;
  35077. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  35078. {
  35079. }
  35080. <?php
  35081. namespace Symfony\Component\Console\Exception;
  35082. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  35083. {
  35084. }
  35085. <?php
  35086. namespace Symfony\Component\Console\Exception;
  35087. class LogicException extends \LogicException implements ExceptionInterface
  35088. {
  35089. }
  35090. <?php
  35091. namespace Symfony\Component\Console\Exception;
  35092. class RuntimeException extends \RuntimeException implements ExceptionInterface
  35093. {
  35094. }
  35095. <?php
  35096. namespace Symfony\Component\Console\Formatter;
  35097. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35098. class OutputFormatter implements OutputFormatterInterface
  35099. {
  35100. private $decorated;
  35101. private $styles = array();
  35102. private $styleStack;
  35103. public static function escape($text)
  35104. {
  35105. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  35106. return self::escapeTrailingBackslash($text);
  35107. }
  35108. public static function escapeTrailingBackslash($text)
  35109. {
  35110. if ('\\' === substr($text, -1)) {
  35111. $len = \strlen($text);
  35112. $text = rtrim($text, '\\');
  35113. $text = str_replace("\0", '', $text);
  35114. $text .= str_repeat("\0", $len - \strlen($text));
  35115. }
  35116. return $text;
  35117. }
  35118. public function __construct($decorated = false, array $styles = array())
  35119. {
  35120. $this->decorated = (bool) $decorated;
  35121. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  35122. $this->setStyle('info', new OutputFormatterStyle('green'));
  35123. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  35124. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  35125. foreach ($styles as $name => $style) {
  35126. $this->setStyle($name, $style);
  35127. }
  35128. $this->styleStack = new OutputFormatterStyleStack();
  35129. }
  35130. public function setDecorated($decorated)
  35131. {
  35132. $this->decorated = (bool) $decorated;
  35133. }
  35134. public function isDecorated()
  35135. {
  35136. return $this->decorated;
  35137. }
  35138. public function setStyle($name, OutputFormatterStyleInterface $style)
  35139. {
  35140. $this->styles[strtolower($name)] = $style;
  35141. }
  35142. public function hasStyle($name)
  35143. {
  35144. return isset($this->styles[strtolower($name)]);
  35145. }
  35146. public function getStyle($name)
  35147. {
  35148. if (!$this->hasStyle($name)) {
  35149. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  35150. }
  35151. return $this->styles[strtolower($name)];
  35152. }
  35153. public function format($message)
  35154. {
  35155. $message = (string) $message;
  35156. $offset = 0;
  35157. $output = '';
  35158. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  35159. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  35160. foreach ($matches[0] as $i => $match) {
  35161. $pos = $match[1];
  35162. $text = $match[0];
  35163. if (0 != $pos && '\\' == $message[$pos - 1]) {
  35164. continue;
  35165. }
  35166. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  35167. $offset = $pos + \strlen($text);
  35168. if ($open = '/' != $text[1]) {
  35169. $tag = $matches[1][$i][0];
  35170. } else {
  35171. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  35172. }
  35173. if (!$open && !$tag) {
  35174. $this->styleStack->pop();
  35175. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  35176. $output .= $this->applyCurrentStyle($text);
  35177. } elseif ($open) {
  35178. $this->styleStack->push($style);
  35179. } else {
  35180. $this->styleStack->pop($style);
  35181. }
  35182. }
  35183. $output .= $this->applyCurrentStyle(substr($message, $offset));
  35184. if (false !== strpos($output, "\0")) {
  35185. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  35186. }
  35187. return str_replace('\\<', '<', $output);
  35188. }
  35189. public function getStyleStack()
  35190. {
  35191. return $this->styleStack;
  35192. }
  35193. private function createStyleFromString($string)
  35194. {
  35195. if (isset($this->styles[$string])) {
  35196. return $this->styles[$string];
  35197. }
  35198. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  35199. return false;
  35200. }
  35201. $style = new OutputFormatterStyle();
  35202. foreach ($matches as $match) {
  35203. array_shift($match);
  35204. if ('fg' == $match[0]) {
  35205. $style->setForeground($match[1]);
  35206. } elseif ('bg' == $match[0]) {
  35207. $style->setBackground($match[1]);
  35208. } else {
  35209. try {
  35210. $style->setOption($match[1]);
  35211. } catch (\InvalidArgumentException $e) {
  35212. return false;
  35213. }
  35214. }
  35215. }
  35216. return $style;
  35217. }
  35218. private function applyCurrentStyle($text)
  35219. {
  35220. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  35221. }
  35222. }
  35223. <?php
  35224. namespace Symfony\Component\Console\Formatter;
  35225. interface OutputFormatterInterface
  35226. {
  35227. public function setDecorated($decorated);
  35228. public function isDecorated();
  35229. public function setStyle($name, OutputFormatterStyleInterface $style);
  35230. public function hasStyle($name);
  35231. public function getStyle($name);
  35232. public function format($message);
  35233. }
  35234. <?php
  35235. namespace Symfony\Component\Console\Formatter;
  35236. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35237. class OutputFormatterStyle implements OutputFormatterStyleInterface
  35238. {
  35239. private static $availableForegroundColors = array(
  35240. 'black' => array('set' => 30, 'unset' => 39),
  35241. 'red' => array('set' => 31, 'unset' => 39),
  35242. 'green' => array('set' => 32, 'unset' => 39),
  35243. 'yellow' => array('set' => 33, 'unset' => 39),
  35244. 'blue' => array('set' => 34, 'unset' => 39),
  35245. 'magenta' => array('set' => 35, 'unset' => 39),
  35246. 'cyan' => array('set' => 36, 'unset' => 39),
  35247. 'white' => array('set' => 37, 'unset' => 39),
  35248. 'default' => array('set' => 39, 'unset' => 39),
  35249. );
  35250. private static $availableBackgroundColors = array(
  35251. 'black' => array('set' => 40, 'unset' => 49),
  35252. 'red' => array('set' => 41, 'unset' => 49),
  35253. 'green' => array('set' => 42, 'unset' => 49),
  35254. 'yellow' => array('set' => 43, 'unset' => 49),
  35255. 'blue' => array('set' => 44, 'unset' => 49),
  35256. 'magenta' => array('set' => 45, 'unset' => 49),
  35257. 'cyan' => array('set' => 46, 'unset' => 49),
  35258. 'white' => array('set' => 47, 'unset' => 49),
  35259. 'default' => array('set' => 49, 'unset' => 49),
  35260. );
  35261. private static $availableOptions = array(
  35262. 'bold' => array('set' => 1, 'unset' => 22),
  35263. 'underscore' => array('set' => 4, 'unset' => 24),
  35264. 'blink' => array('set' => 5, 'unset' => 25),
  35265. 'reverse' => array('set' => 7, 'unset' => 27),
  35266. 'conceal' => array('set' => 8, 'unset' => 28),
  35267. );
  35268. private $foreground;
  35269. private $background;
  35270. private $options = array();
  35271. public function __construct($foreground = null, $background = null, array $options = array())
  35272. {
  35273. if (null !== $foreground) {
  35274. $this->setForeground($foreground);
  35275. }
  35276. if (null !== $background) {
  35277. $this->setBackground($background);
  35278. }
  35279. if (\count($options)) {
  35280. $this->setOptions($options);
  35281. }
  35282. }
  35283. public function setForeground($color = null)
  35284. {
  35285. if (null === $color) {
  35286. $this->foreground = null;
  35287. return;
  35288. }
  35289. if (!isset(static::$availableForegroundColors[$color])) {
  35290. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  35291. }
  35292. $this->foreground = static::$availableForegroundColors[$color];
  35293. }
  35294. public function setBackground($color = null)
  35295. {
  35296. if (null === $color) {
  35297. $this->background = null;
  35298. return;
  35299. }
  35300. if (!isset(static::$availableBackgroundColors[$color])) {
  35301. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  35302. }
  35303. $this->background = static::$availableBackgroundColors[$color];
  35304. }
  35305. public function setOption($option)
  35306. {
  35307. if (!isset(static::$availableOptions[$option])) {
  35308. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35309. }
  35310. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  35311. $this->options[] = static::$availableOptions[$option];
  35312. }
  35313. }
  35314. public function unsetOption($option)
  35315. {
  35316. if (!isset(static::$availableOptions[$option])) {
  35317. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  35318. }
  35319. $pos = array_search(static::$availableOptions[$option], $this->options);
  35320. if (false !== $pos) {
  35321. unset($this->options[$pos]);
  35322. }
  35323. }
  35324. public function setOptions(array $options)
  35325. {
  35326. $this->options = array();
  35327. foreach ($options as $option) {
  35328. $this->setOption($option);
  35329. }
  35330. }
  35331. public function apply($text)
  35332. {
  35333. $setCodes = array();
  35334. $unsetCodes = array();
  35335. if (null !== $this->foreground) {
  35336. $setCodes[] = $this->foreground['set'];
  35337. $unsetCodes[] = $this->foreground['unset'];
  35338. }
  35339. if (null !== $this->background) {
  35340. $setCodes[] = $this->background['set'];
  35341. $unsetCodes[] = $this->background['unset'];
  35342. }
  35343. if (\count($this->options)) {
  35344. foreach ($this->options as $option) {
  35345. $setCodes[] = $option['set'];
  35346. $unsetCodes[] = $option['unset'];
  35347. }
  35348. }
  35349. if (0 === \count($setCodes)) {
  35350. return $text;
  35351. }
  35352. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  35353. }
  35354. }
  35355. <?php
  35356. namespace Symfony\Component\Console\Formatter;
  35357. interface OutputFormatterStyleInterface
  35358. {
  35359. public function setForeground($color = null);
  35360. public function setBackground($color = null);
  35361. public function setOption($option);
  35362. public function unsetOption($option);
  35363. public function setOptions(array $options);
  35364. public function apply($text);
  35365. }
  35366. <?php
  35367. namespace Symfony\Component\Console\Formatter;
  35368. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35369. class OutputFormatterStyleStack
  35370. {
  35371. private $styles;
  35372. private $emptyStyle;
  35373. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  35374. {
  35375. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  35376. $this->reset();
  35377. }
  35378. public function reset()
  35379. {
  35380. $this->styles = array();
  35381. }
  35382. public function push(OutputFormatterStyleInterface $style)
  35383. {
  35384. $this->styles[] = $style;
  35385. }
  35386. public function pop(OutputFormatterStyleInterface $style = null)
  35387. {
  35388. if (empty($this->styles)) {
  35389. return $this->emptyStyle;
  35390. }
  35391. if (null === $style) {
  35392. return array_pop($this->styles);
  35393. }
  35394. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  35395. if ($style->apply('') === $stackedStyle->apply('')) {
  35396. $this->styles = \array_slice($this->styles, 0, $index);
  35397. return $stackedStyle;
  35398. }
  35399. }
  35400. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  35401. }
  35402. public function getCurrent()
  35403. {
  35404. if (empty($this->styles)) {
  35405. return $this->emptyStyle;
  35406. }
  35407. return $this->styles[\count($this->styles) - 1];
  35408. }
  35409. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  35410. {
  35411. $this->emptyStyle = $emptyStyle;
  35412. return $this;
  35413. }
  35414. public function getEmptyStyle()
  35415. {
  35416. return $this->emptyStyle;
  35417. }
  35418. }
  35419. <?php
  35420. namespace Symfony\Component\Console\Helper;
  35421. class DebugFormatterHelper extends Helper
  35422. {
  35423. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  35424. private $started = array();
  35425. private $count = -1;
  35426. public function start($id, $message, $prefix = 'RUN')
  35427. {
  35428. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  35429. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  35430. }
  35431. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  35432. {
  35433. $message = '';
  35434. if ($error) {
  35435. if (isset($this->started[$id]['out'])) {
  35436. $message .= "\n";
  35437. unset($this->started[$id]['out']);
  35438. }
  35439. if (!isset($this->started[$id]['err'])) {
  35440. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  35441. $this->started[$id]['err'] = true;
  35442. }
  35443. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  35444. } else {
  35445. if (isset($this->started[$id]['err'])) {
  35446. $message .= "\n";
  35447. unset($this->started[$id]['err']);
  35448. }
  35449. if (!isset($this->started[$id]['out'])) {
  35450. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  35451. $this->started[$id]['out'] = true;
  35452. }
  35453. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  35454. }
  35455. return $message;
  35456. }
  35457. public function stop($id, $message, $successful, $prefix = 'RES')
  35458. {
  35459. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  35460. if ($successful) {
  35461. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35462. }
  35463. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  35464. unset($this->started[$id]['out'], $this->started[$id]['err']);
  35465. return $message;
  35466. }
  35467. private function getBorder($id)
  35468. {
  35469. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  35470. }
  35471. public function getName()
  35472. {
  35473. return 'debug_formatter';
  35474. }
  35475. }
  35476. <?php
  35477. namespace Symfony\Component\Console\Helper;
  35478. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  35479. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  35480. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  35481. use Symfony\Component\Console\Descriptor\TextDescriptor;
  35482. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  35483. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35484. use Symfony\Component\Console\Output\OutputInterface;
  35485. class DescriptorHelper extends Helper
  35486. {
  35487. private $descriptors = array();
  35488. public function __construct()
  35489. {
  35490. $this
  35491. ->register('txt', new TextDescriptor())
  35492. ->register('xml', new XmlDescriptor())
  35493. ->register('json', new JsonDescriptor())
  35494. ->register('md', new MarkdownDescriptor())
  35495. ;
  35496. }
  35497. public function describe(OutputInterface $output, $object, array $options = array())
  35498. {
  35499. $options = array_merge(array(
  35500. 'raw_text' => false,
  35501. 'format' => 'txt',
  35502. ), $options);
  35503. if (!isset($this->descriptors[$options['format']])) {
  35504. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  35505. }
  35506. $descriptor = $this->descriptors[$options['format']];
  35507. $descriptor->describe($output, $object, $options);
  35508. }
  35509. public function register($format, DescriptorInterface $descriptor)
  35510. {
  35511. $this->descriptors[$format] = $descriptor;
  35512. return $this;
  35513. }
  35514. public function getName()
  35515. {
  35516. return 'descriptor';
  35517. }
  35518. }
  35519. <?php
  35520. namespace Symfony\Component\Console\Helper;
  35521. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35522. use Symfony\Component\Console\Exception\RuntimeException;
  35523. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35524. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35525. use Symfony\Component\Console\Output\OutputInterface;
  35526. class DialogHelper extends InputAwareHelper
  35527. {
  35528. private $inputStream;
  35529. private static $shell;
  35530. private static $stty;
  35531. public function __construct($triggerDeprecationError = true)
  35532. {
  35533. if ($triggerDeprecationError) {
  35534. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35535. }
  35536. }
  35537. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  35538. {
  35539. if ($output instanceof ConsoleOutputInterface) {
  35540. $output = $output->getErrorOutput();
  35541. }
  35542. $width = max(array_map('strlen', array_keys($choices)));
  35543. $messages = (array) $question;
  35544. foreach ($choices as $key => $value) {
  35545. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  35546. }
  35547. $output->writeln($messages);
  35548. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  35549. $selectedChoices = str_replace(' ', '', $picked);
  35550. if ($multiselect) {
  35551. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  35552. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  35553. }
  35554. $selectedChoices = explode(',', $selectedChoices);
  35555. } else {
  35556. $selectedChoices = array($picked);
  35557. }
  35558. $multiselectChoices = array();
  35559. foreach ($selectedChoices as $value) {
  35560. if (empty($choices[$value])) {
  35561. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  35562. }
  35563. $multiselectChoices[] = $value;
  35564. }
  35565. if ($multiselect) {
  35566. return $multiselectChoices;
  35567. }
  35568. return $picked;
  35569. }, $attempts, $default);
  35570. return $result;
  35571. }
  35572. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  35573. {
  35574. if ($this->input && !$this->input->isInteractive()) {
  35575. return $default;
  35576. }
  35577. if ($output instanceof ConsoleOutputInterface) {
  35578. $output = $output->getErrorOutput();
  35579. }
  35580. $output->write($question);
  35581. $inputStream = $this->inputStream ?: STDIN;
  35582. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35583. $ret = fgets($inputStream, 4096);
  35584. if (false === $ret) {
  35585. throw new RuntimeException('Aborted');
  35586. }
  35587. $ret = trim($ret);
  35588. } else {
  35589. $ret = '';
  35590. $i = 0;
  35591. $ofs = -1;
  35592. $matches = $autocomplete;
  35593. $numMatches = \count($matches);
  35594. $sttyMode = shell_exec('stty -g');
  35595. shell_exec('stty -icanon -echo');
  35596. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35597. while (!feof($inputStream)) {
  35598. $c = fread($inputStream, 1);
  35599. if ("\177" === $c) {
  35600. if (0 === $numMatches && 0 !== $i) {
  35601. --$i;
  35602. $output->write("\033[1D");
  35603. }
  35604. if (0 === $i) {
  35605. $ofs = -1;
  35606. $matches = $autocomplete;
  35607. $numMatches = \count($matches);
  35608. } else {
  35609. $numMatches = 0;
  35610. }
  35611. $ret = substr($ret, 0, $i);
  35612. } elseif ("\033" === $c) {
  35613. $c .= fread($inputStream, 2);
  35614. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35615. if ('A' === $c[2] && -1 === $ofs) {
  35616. $ofs = 0;
  35617. }
  35618. if (0 === $numMatches) {
  35619. continue;
  35620. }
  35621. $ofs += ('A' === $c[2]) ? -1 : 1;
  35622. $ofs = ($numMatches + $ofs) % $numMatches;
  35623. }
  35624. } elseif (\ord($c) < 32) {
  35625. if ("\t" === $c || "\n" === $c) {
  35626. if ($numMatches > 0 && -1 !== $ofs) {
  35627. $ret = $matches[$ofs];
  35628. $output->write(substr($ret, $i));
  35629. $i = \strlen($ret);
  35630. }
  35631. if ("\n" === $c) {
  35632. $output->write($c);
  35633. break;
  35634. }
  35635. $numMatches = 0;
  35636. }
  35637. continue;
  35638. } else {
  35639. $output->write($c);
  35640. $ret .= $c;
  35641. ++$i;
  35642. $numMatches = 0;
  35643. $ofs = 0;
  35644. foreach ($autocomplete as $value) {
  35645. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  35646. $matches[$numMatches++] = $value;
  35647. }
  35648. }
  35649. }
  35650. $output->write("\033[K");
  35651. if ($numMatches > 0 && -1 !== $ofs) {
  35652. $output->write("\0337");
  35653. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  35654. $output->write("\0338");
  35655. }
  35656. }
  35657. shell_exec(sprintf('stty %s', $sttyMode));
  35658. }
  35659. return \strlen($ret) > 0 ? $ret : $default;
  35660. }
  35661. public function askConfirmation(OutputInterface $output, $question, $default = true)
  35662. {
  35663. $answer = 'z';
  35664. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  35665. $answer = $this->ask($output, $question);
  35666. }
  35667. if (false === $default) {
  35668. return $answer && 'y' == strtolower($answer[0]);
  35669. }
  35670. return !$answer || 'y' == strtolower($answer[0]);
  35671. }
  35672. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  35673. {
  35674. if ($output instanceof ConsoleOutputInterface) {
  35675. $output = $output->getErrorOutput();
  35676. }
  35677. if ('\\' === \DIRECTORY_SEPARATOR) {
  35678. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35679. if ('phar:' === substr(__FILE__, 0, 5)) {
  35680. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35681. copy($exe, $tmpExe);
  35682. $exe = $tmpExe;
  35683. }
  35684. $output->write($question);
  35685. $value = rtrim(shell_exec($exe));
  35686. $output->writeln('');
  35687. if (isset($tmpExe)) {
  35688. unlink($tmpExe);
  35689. }
  35690. return $value;
  35691. }
  35692. if ($this->hasSttyAvailable()) {
  35693. $output->write($question);
  35694. $sttyMode = shell_exec('stty -g');
  35695. shell_exec('stty -echo');
  35696. $value = fgets($this->inputStream ?: STDIN, 4096);
  35697. shell_exec(sprintf('stty %s', $sttyMode));
  35698. if (false === $value) {
  35699. throw new RuntimeException('Aborted');
  35700. }
  35701. $value = trim($value);
  35702. $output->writeln('');
  35703. return $value;
  35704. }
  35705. if (false !== $shell = $this->getShell()) {
  35706. $output->write($question);
  35707. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35708. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35709. $value = rtrim(shell_exec($command));
  35710. $output->writeln('');
  35711. return $value;
  35712. }
  35713. if ($fallback) {
  35714. return $this->ask($output, $question);
  35715. }
  35716. throw new RuntimeException('Unable to hide the response');
  35717. }
  35718. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  35719. {
  35720. $that = $this;
  35721. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  35722. return $that->ask($output, $question, $default, $autocomplete);
  35723. };
  35724. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35725. }
  35726. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  35727. {
  35728. $that = $this;
  35729. $interviewer = function () use ($output, $question, $fallback, $that) {
  35730. return $that->askHiddenResponse($output, $question, $fallback);
  35731. };
  35732. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  35733. }
  35734. public function setInputStream($stream)
  35735. {
  35736. $this->inputStream = $stream;
  35737. }
  35738. public function getInputStream()
  35739. {
  35740. return $this->inputStream;
  35741. }
  35742. public function getName()
  35743. {
  35744. return 'dialog';
  35745. }
  35746. private function getShell()
  35747. {
  35748. if (null !== self::$shell) {
  35749. return self::$shell;
  35750. }
  35751. self::$shell = false;
  35752. if (file_exists('/usr/bin/env')) {
  35753. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35754. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35755. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35756. self::$shell = $sh;
  35757. break;
  35758. }
  35759. }
  35760. }
  35761. return self::$shell;
  35762. }
  35763. private function hasSttyAvailable()
  35764. {
  35765. if (null !== self::$stty) {
  35766. return self::$stty;
  35767. }
  35768. exec('stty 2>&1', $output, $exitcode);
  35769. return self::$stty = 0 === $exitcode;
  35770. }
  35771. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  35772. {
  35773. if ($output instanceof ConsoleOutputInterface) {
  35774. $output = $output->getErrorOutput();
  35775. }
  35776. $e = null;
  35777. while (false === $attempts || $attempts--) {
  35778. if (null !== $e) {
  35779. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  35780. }
  35781. try {
  35782. return \call_user_func($validator, $interviewer());
  35783. } catch (\Exception $e) {
  35784. }
  35785. }
  35786. throw $e;
  35787. }
  35788. }
  35789. <?php
  35790. namespace Symfony\Component\Console\Helper;
  35791. use Symfony\Component\Console\Formatter\OutputFormatter;
  35792. class FormatterHelper extends Helper
  35793. {
  35794. public function formatSection($section, $message, $style = 'info')
  35795. {
  35796. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  35797. }
  35798. public function formatBlock($messages, $style, $large = false)
  35799. {
  35800. if (!\is_array($messages)) {
  35801. $messages = array($messages);
  35802. }
  35803. $len = 0;
  35804. $lines = array();
  35805. foreach ($messages as $message) {
  35806. $message = OutputFormatter::escape($message);
  35807. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  35808. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  35809. }
  35810. $messages = $large ? array(str_repeat(' ', $len)) : array();
  35811. for ($i = 0; isset($lines[$i]); ++$i) {
  35812. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  35813. }
  35814. if ($large) {
  35815. $messages[] = str_repeat(' ', $len);
  35816. }
  35817. for ($i = 0; isset($messages[$i]); ++$i) {
  35818. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  35819. }
  35820. return implode("\n", $messages);
  35821. }
  35822. public function getName()
  35823. {
  35824. return 'formatter';
  35825. }
  35826. }
  35827. <?php
  35828. namespace Symfony\Component\Console\Helper;
  35829. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  35830. abstract class Helper implements HelperInterface
  35831. {
  35832. protected $helperSet = null;
  35833. public function setHelperSet(HelperSet $helperSet = null)
  35834. {
  35835. $this->helperSet = $helperSet;
  35836. }
  35837. public function getHelperSet()
  35838. {
  35839. return $this->helperSet;
  35840. }
  35841. public static function strlen($string)
  35842. {
  35843. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  35844. return \strlen($string);
  35845. }
  35846. return mb_strwidth($string, $encoding);
  35847. }
  35848. public static function formatTime($secs)
  35849. {
  35850. static $timeFormats = array(
  35851. array(0, '< 1 sec'),
  35852. array(1, '1 sec'),
  35853. array(2, 'secs', 1),
  35854. array(60, '1 min'),
  35855. array(120, 'mins', 60),
  35856. array(3600, '1 hr'),
  35857. array(7200, 'hrs', 3600),
  35858. array(86400, '1 day'),
  35859. array(172800, 'days', 86400),
  35860. );
  35861. foreach ($timeFormats as $index => $format) {
  35862. if ($secs >= $format[0]) {
  35863. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  35864. || $index == \count($timeFormats) - 1
  35865. ) {
  35866. if (2 == \count($format)) {
  35867. return $format[1];
  35868. }
  35869. return floor($secs / $format[2]).' '.$format[1];
  35870. }
  35871. }
  35872. }
  35873. }
  35874. public static function formatMemory($memory)
  35875. {
  35876. if ($memory >= 1024 * 1024 * 1024) {
  35877. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  35878. }
  35879. if ($memory >= 1024 * 1024) {
  35880. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  35881. }
  35882. if ($memory >= 1024) {
  35883. return sprintf('%d KiB', $memory / 1024);
  35884. }
  35885. return sprintf('%d B', $memory);
  35886. }
  35887. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  35888. {
  35889. return self::strlen(self::removeDecoration($formatter, $string));
  35890. }
  35891. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  35892. {
  35893. $isDecorated = $formatter->isDecorated();
  35894. $formatter->setDecorated(false);
  35895. $string = $formatter->format($string);
  35896. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  35897. $formatter->setDecorated($isDecorated);
  35898. return $string;
  35899. }
  35900. }
  35901. <?php
  35902. namespace Symfony\Component\Console\Helper;
  35903. interface HelperInterface
  35904. {
  35905. public function setHelperSet(HelperSet $helperSet = null);
  35906. public function getHelperSet();
  35907. public function getName();
  35908. }
  35909. <?php
  35910. namespace Symfony\Component\Console\Helper;
  35911. use Symfony\Component\Console\Command\Command;
  35912. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35913. class HelperSet implements \IteratorAggregate
  35914. {
  35915. private $helpers = array();
  35916. private $command;
  35917. public function __construct(array $helpers = array())
  35918. {
  35919. foreach ($helpers as $alias => $helper) {
  35920. $this->set($helper, \is_int($alias) ? null : $alias);
  35921. }
  35922. }
  35923. public function set(HelperInterface $helper, $alias = null)
  35924. {
  35925. $this->helpers[$helper->getName()] = $helper;
  35926. if (null !== $alias) {
  35927. $this->helpers[$alias] = $helper;
  35928. }
  35929. $helper->setHelperSet($this);
  35930. }
  35931. public function has($name)
  35932. {
  35933. return isset($this->helpers[$name]);
  35934. }
  35935. public function get($name)
  35936. {
  35937. if (!$this->has($name)) {
  35938. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  35939. }
  35940. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  35941. @trigger_error('"Symfony\Component\Console\Helper\DialogHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\QuestionHelper" instead.', E_USER_DEPRECATED);
  35942. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  35943. @trigger_error('"Symfony\Component\Console\Helper\ProgressHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\ProgressBar" instead.', E_USER_DEPRECATED);
  35944. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  35945. @trigger_error('"Symfony\Component\Console\Helper\TableHelper" is deprecated since Symfony 2.5 and will be removed in 3.0. Use "Symfony\Component\Console\Helper\Table" instead.', E_USER_DEPRECATED);
  35946. }
  35947. return $this->helpers[$name];
  35948. }
  35949. public function setCommand(Command $command = null)
  35950. {
  35951. $this->command = $command;
  35952. }
  35953. public function getCommand()
  35954. {
  35955. return $this->command;
  35956. }
  35957. public function getIterator()
  35958. {
  35959. return new \ArrayIterator($this->helpers);
  35960. }
  35961. }
  35962. <?php
  35963. namespace Symfony\Component\Console\Helper;
  35964. use Symfony\Component\Console\Input\InputAwareInterface;
  35965. use Symfony\Component\Console\Input\InputInterface;
  35966. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  35967. {
  35968. protected $input;
  35969. public function setInput(InputInterface $input)
  35970. {
  35971. $this->input = $input;
  35972. }
  35973. }
  35974. <?php
  35975. namespace Symfony\Component\Console\Helper;
  35976. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35977. use Symfony\Component\Console\Output\OutputInterface;
  35978. use Symfony\Component\Process\Exception\ProcessFailedException;
  35979. use Symfony\Component\Process\Process;
  35980. use Symfony\Component\Process\ProcessBuilder;
  35981. class ProcessHelper extends Helper
  35982. {
  35983. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  35984. {
  35985. if ($output instanceof ConsoleOutputInterface) {
  35986. $output = $output->getErrorOutput();
  35987. }
  35988. $formatter = $this->getHelperSet()->get('debug_formatter');
  35989. if (\is_array($cmd)) {
  35990. $process = ProcessBuilder::create($cmd)->getProcess();
  35991. } elseif ($cmd instanceof Process) {
  35992. $process = $cmd;
  35993. } else {
  35994. $process = new Process($cmd);
  35995. }
  35996. if ($verbosity <= $output->getVerbosity()) {
  35997. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  35998. }
  35999. if ($output->isDebug()) {
  36000. $callback = $this->wrapCallback($output, $process, $callback);
  36001. }
  36002. $process->run($callback);
  36003. if ($verbosity <= $output->getVerbosity()) {
  36004. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  36005. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  36006. }
  36007. if (!$process->isSuccessful() && null !== $error) {
  36008. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  36009. }
  36010. return $process;
  36011. }
  36012. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  36013. {
  36014. $process = $this->run($output, $cmd, $error, $callback);
  36015. if (!$process->isSuccessful()) {
  36016. throw new ProcessFailedException($process);
  36017. }
  36018. return $process;
  36019. }
  36020. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  36021. {
  36022. if ($output instanceof ConsoleOutputInterface) {
  36023. $output = $output->getErrorOutput();
  36024. }
  36025. $formatter = $this->getHelperSet()->get('debug_formatter');
  36026. $that = $this;
  36027. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  36028. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  36029. if (null !== $callback) {
  36030. \call_user_func($callback, $type, $buffer);
  36031. }
  36032. };
  36033. }
  36034. public function escapeString($str)
  36035. {
  36036. return str_replace('<', '\\<', $str);
  36037. }
  36038. public function getName()
  36039. {
  36040. return 'process';
  36041. }
  36042. }
  36043. <?php
  36044. namespace Symfony\Component\Console\Helper;
  36045. use Symfony\Component\Console\Exception\LogicException;
  36046. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36047. use Symfony\Component\Console\Output\OutputInterface;
  36048. class ProgressBar
  36049. {
  36050. private $barWidth = 28;
  36051. private $barChar;
  36052. private $emptyBarChar = '-';
  36053. private $progressChar = '>';
  36054. private $format;
  36055. private $internalFormat;
  36056. private $redrawFreq = 1;
  36057. private $output;
  36058. private $step = 0;
  36059. private $max;
  36060. private $startTime;
  36061. private $stepWidth;
  36062. private $percent = 0.0;
  36063. private $formatLineCount;
  36064. private $messages = array();
  36065. private $overwrite = true;
  36066. private $firstRun = true;
  36067. private static $formatters;
  36068. private static $formats;
  36069. public function __construct(OutputInterface $output, $max = 0)
  36070. {
  36071. if ($output instanceof ConsoleOutputInterface) {
  36072. $output = $output->getErrorOutput();
  36073. }
  36074. $this->output = $output;
  36075. $this->setMaxSteps($max);
  36076. if (!$this->output->isDecorated()) {
  36077. $this->overwrite = false;
  36078. $this->setRedrawFrequency($max / 10);
  36079. }
  36080. $this->startTime = time();
  36081. }
  36082. public static function setPlaceholderFormatterDefinition($name, $callable)
  36083. {
  36084. if (!self::$formatters) {
  36085. self::$formatters = self::initPlaceholderFormatters();
  36086. }
  36087. self::$formatters[$name] = $callable;
  36088. }
  36089. public static function getPlaceholderFormatterDefinition($name)
  36090. {
  36091. if (!self::$formatters) {
  36092. self::$formatters = self::initPlaceholderFormatters();
  36093. }
  36094. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36095. }
  36096. public static function setFormatDefinition($name, $format)
  36097. {
  36098. if (!self::$formats) {
  36099. self::$formats = self::initFormats();
  36100. }
  36101. self::$formats[$name] = $format;
  36102. }
  36103. public static function getFormatDefinition($name)
  36104. {
  36105. if (!self::$formats) {
  36106. self::$formats = self::initFormats();
  36107. }
  36108. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36109. }
  36110. public function setMessage($message, $name = 'message')
  36111. {
  36112. $this->messages[$name] = $message;
  36113. }
  36114. public function getMessage($name = 'message')
  36115. {
  36116. return $this->messages[$name];
  36117. }
  36118. public function getStartTime()
  36119. {
  36120. return $this->startTime;
  36121. }
  36122. public function getMaxSteps()
  36123. {
  36124. return $this->max;
  36125. }
  36126. public function getStep()
  36127. {
  36128. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the getProgress() method instead.', E_USER_DEPRECATED);
  36129. return $this->getProgress();
  36130. }
  36131. public function getProgress()
  36132. {
  36133. return $this->step;
  36134. }
  36135. public function getStepWidth()
  36136. {
  36137. return $this->stepWidth;
  36138. }
  36139. public function getProgressPercent()
  36140. {
  36141. return $this->percent;
  36142. }
  36143. public function setBarWidth($size)
  36144. {
  36145. $this->barWidth = (int) $size;
  36146. }
  36147. public function getBarWidth()
  36148. {
  36149. return $this->barWidth;
  36150. }
  36151. public function setBarCharacter($char)
  36152. {
  36153. $this->barChar = $char;
  36154. }
  36155. public function getBarCharacter()
  36156. {
  36157. if (null === $this->barChar) {
  36158. return $this->max ? '=' : $this->emptyBarChar;
  36159. }
  36160. return $this->barChar;
  36161. }
  36162. public function setEmptyBarCharacter($char)
  36163. {
  36164. $this->emptyBarChar = $char;
  36165. }
  36166. public function getEmptyBarCharacter()
  36167. {
  36168. return $this->emptyBarChar;
  36169. }
  36170. public function setProgressCharacter($char)
  36171. {
  36172. $this->progressChar = $char;
  36173. }
  36174. public function getProgressCharacter()
  36175. {
  36176. return $this->progressChar;
  36177. }
  36178. public function setFormat($format)
  36179. {
  36180. $this->format = null;
  36181. $this->internalFormat = $format;
  36182. }
  36183. public function setRedrawFrequency($freq)
  36184. {
  36185. $this->redrawFreq = max((int) $freq, 1);
  36186. }
  36187. public function start($max = null)
  36188. {
  36189. $this->startTime = time();
  36190. $this->step = 0;
  36191. $this->percent = 0.0;
  36192. if (null !== $max) {
  36193. $this->setMaxSteps($max);
  36194. }
  36195. $this->display();
  36196. }
  36197. public function advance($step = 1)
  36198. {
  36199. $this->setProgress($this->step + $step);
  36200. }
  36201. public function setCurrent($step)
  36202. {
  36203. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setProgress() method instead.', E_USER_DEPRECATED);
  36204. $this->setProgress($step);
  36205. }
  36206. public function setOverwrite($overwrite)
  36207. {
  36208. $this->overwrite = (bool) $overwrite;
  36209. }
  36210. public function setProgress($step)
  36211. {
  36212. $step = (int) $step;
  36213. if ($step < $this->step) {
  36214. throw new LogicException('You can\'t regress the progress bar.');
  36215. }
  36216. if ($this->max && $step > $this->max) {
  36217. $this->max = $step;
  36218. }
  36219. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  36220. $currPeriod = (int) ($step / $this->redrawFreq);
  36221. $this->step = $step;
  36222. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  36223. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  36224. $this->display();
  36225. }
  36226. }
  36227. public function finish()
  36228. {
  36229. if (!$this->max) {
  36230. $this->max = $this->step;
  36231. }
  36232. if ($this->step === $this->max && !$this->overwrite) {
  36233. return;
  36234. }
  36235. $this->setProgress($this->max);
  36236. }
  36237. public function display()
  36238. {
  36239. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36240. return;
  36241. }
  36242. if (null === $this->format) {
  36243. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36244. }
  36245. $self = $this;
  36246. $output = $this->output;
  36247. $messages = $this->messages;
  36248. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  36249. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36250. $text = \call_user_func($formatter, $self, $output);
  36251. } elseif (isset($messages[$matches[1]])) {
  36252. $text = $messages[$matches[1]];
  36253. } else {
  36254. return $matches[0];
  36255. }
  36256. if (isset($matches[2])) {
  36257. $text = sprintf('%'.$matches[2], $text);
  36258. }
  36259. return $text;
  36260. }, $this->format));
  36261. }
  36262. public function clear()
  36263. {
  36264. if (!$this->overwrite) {
  36265. return;
  36266. }
  36267. if (null === $this->format) {
  36268. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  36269. }
  36270. $this->overwrite('');
  36271. }
  36272. private function setRealFormat($format)
  36273. {
  36274. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  36275. $this->format = self::getFormatDefinition($format.'_nomax');
  36276. } elseif (null !== self::getFormatDefinition($format)) {
  36277. $this->format = self::getFormatDefinition($format);
  36278. } else {
  36279. $this->format = $format;
  36280. }
  36281. $this->formatLineCount = substr_count($this->format, "\n");
  36282. }
  36283. private function setMaxSteps($max)
  36284. {
  36285. $this->max = max(0, (int) $max);
  36286. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  36287. }
  36288. private function overwrite($message)
  36289. {
  36290. if ($this->overwrite) {
  36291. if (!$this->firstRun) {
  36292. $this->output->write("\x0D");
  36293. $this->output->write("\x1B[2K");
  36294. if ($this->formatLineCount > 0) {
  36295. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  36296. }
  36297. }
  36298. } elseif ($this->step > 0) {
  36299. $this->output->writeln('');
  36300. }
  36301. $this->firstRun = false;
  36302. $this->output->write($message);
  36303. }
  36304. private function determineBestFormat()
  36305. {
  36306. switch ($this->output->getVerbosity()) {
  36307. case OutputInterface::VERBOSITY_VERBOSE:
  36308. return $this->max ? 'verbose' : 'verbose_nomax';
  36309. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36310. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  36311. case OutputInterface::VERBOSITY_DEBUG:
  36312. return $this->max ? 'debug' : 'debug_nomax';
  36313. default:
  36314. return $this->max ? 'normal' : 'normal_nomax';
  36315. }
  36316. }
  36317. private static function initPlaceholderFormatters()
  36318. {
  36319. return array(
  36320. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  36321. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  36322. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  36323. if ($completeBars < $bar->getBarWidth()) {
  36324. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  36325. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  36326. }
  36327. return $display;
  36328. },
  36329. 'elapsed' => function (ProgressBar $bar) {
  36330. return Helper::formatTime(time() - $bar->getStartTime());
  36331. },
  36332. 'remaining' => function (ProgressBar $bar) {
  36333. if (!$bar->getMaxSteps()) {
  36334. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  36335. }
  36336. if (!$bar->getProgress()) {
  36337. $remaining = 0;
  36338. } else {
  36339. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  36340. }
  36341. return Helper::formatTime($remaining);
  36342. },
  36343. 'estimated' => function (ProgressBar $bar) {
  36344. if (!$bar->getMaxSteps()) {
  36345. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  36346. }
  36347. if (!$bar->getProgress()) {
  36348. $estimated = 0;
  36349. } else {
  36350. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  36351. }
  36352. return Helper::formatTime($estimated);
  36353. },
  36354. 'memory' => function (ProgressBar $bar) {
  36355. return Helper::formatMemory(memory_get_usage(true));
  36356. },
  36357. 'current' => function (ProgressBar $bar) {
  36358. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  36359. },
  36360. 'max' => function (ProgressBar $bar) {
  36361. return $bar->getMaxSteps();
  36362. },
  36363. 'percent' => function (ProgressBar $bar) {
  36364. return floor($bar->getProgressPercent() * 100);
  36365. },
  36366. );
  36367. }
  36368. private static function initFormats()
  36369. {
  36370. return array(
  36371. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  36372. 'normal_nomax' => ' %current% [%bar%]',
  36373. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  36374. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36375. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  36376. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  36377. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  36378. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  36379. );
  36380. }
  36381. }
  36382. <?php
  36383. namespace Symfony\Component\Console\Helper;
  36384. use Symfony\Component\Console\Exception\LogicException;
  36385. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36386. use Symfony\Component\Console\Output\NullOutput;
  36387. use Symfony\Component\Console\Output\OutputInterface;
  36388. class ProgressHelper extends Helper
  36389. {
  36390. const FORMAT_QUIET = ' %percent%%';
  36391. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  36392. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  36393. const FORMAT_QUIET_NOMAX = ' %current%';
  36394. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  36395. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  36396. private $barWidth = 28;
  36397. private $barChar = '=';
  36398. private $emptyBarChar = '-';
  36399. private $progressChar = '>';
  36400. private $format = null;
  36401. private $redrawFreq = 1;
  36402. private $lastMessagesLength;
  36403. private $barCharOriginal;
  36404. private $output;
  36405. private $current;
  36406. private $max;
  36407. private $startTime;
  36408. private $defaultFormatVars = array(
  36409. 'current',
  36410. 'max',
  36411. 'bar',
  36412. 'percent',
  36413. 'elapsed',
  36414. );
  36415. private $formatVars;
  36416. private $widths = array(
  36417. 'current' => 4,
  36418. 'max' => 4,
  36419. 'percent' => 3,
  36420. 'elapsed' => 6,
  36421. );
  36422. private $timeFormats = array(
  36423. array(0, '???'),
  36424. array(2, '1 sec'),
  36425. array(59, 'secs', 1),
  36426. array(60, '1 min'),
  36427. array(3600, 'mins', 60),
  36428. array(5400, '1 hr'),
  36429. array(86400, 'hrs', 3600),
  36430. array(129600, '1 day'),
  36431. array(604800, 'days', 86400),
  36432. );
  36433. public function __construct($triggerDeprecationError = true)
  36434. {
  36435. if ($triggerDeprecationError) {
  36436. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\ProgressBar class instead.', E_USER_DEPRECATED);
  36437. }
  36438. }
  36439. public function setBarWidth($size)
  36440. {
  36441. $this->barWidth = (int) $size;
  36442. }
  36443. public function setBarCharacter($char)
  36444. {
  36445. $this->barChar = $char;
  36446. }
  36447. public function setEmptyBarCharacter($char)
  36448. {
  36449. $this->emptyBarChar = $char;
  36450. }
  36451. public function setProgressCharacter($char)
  36452. {
  36453. $this->progressChar = $char;
  36454. }
  36455. public function setFormat($format)
  36456. {
  36457. $this->format = $format;
  36458. }
  36459. public function setRedrawFrequency($freq)
  36460. {
  36461. $this->redrawFreq = (int) $freq;
  36462. }
  36463. public function start(OutputInterface $output, $max = null)
  36464. {
  36465. if ($output instanceof ConsoleOutputInterface) {
  36466. $output = $output->getErrorOutput();
  36467. }
  36468. $this->startTime = time();
  36469. $this->current = 0;
  36470. $this->max = (int) $max;
  36471. $this->output = $output->isDecorated() ? $output : new NullOutput();
  36472. $this->lastMessagesLength = 0;
  36473. $this->barCharOriginal = '';
  36474. if (null === $this->format) {
  36475. switch ($output->getVerbosity()) {
  36476. case OutputInterface::VERBOSITY_QUIET:
  36477. $this->format = self::FORMAT_QUIET_NOMAX;
  36478. if ($this->max > 0) {
  36479. $this->format = self::FORMAT_QUIET;
  36480. }
  36481. break;
  36482. case OutputInterface::VERBOSITY_VERBOSE:
  36483. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36484. case OutputInterface::VERBOSITY_DEBUG:
  36485. $this->format = self::FORMAT_VERBOSE_NOMAX;
  36486. if ($this->max > 0) {
  36487. $this->format = self::FORMAT_VERBOSE;
  36488. }
  36489. break;
  36490. default:
  36491. $this->format = self::FORMAT_NORMAL_NOMAX;
  36492. if ($this->max > 0) {
  36493. $this->format = self::FORMAT_NORMAL;
  36494. }
  36495. break;
  36496. }
  36497. }
  36498. $this->initialize();
  36499. }
  36500. public function advance($step = 1, $redraw = false)
  36501. {
  36502. $this->setCurrent($this->current + $step, $redraw);
  36503. }
  36504. public function setCurrent($current, $redraw = false)
  36505. {
  36506. if (null === $this->startTime) {
  36507. throw new LogicException('You must start the progress bar before calling setCurrent().');
  36508. }
  36509. $current = (int) $current;
  36510. if ($current < $this->current) {
  36511. throw new LogicException('You can\'t regress the progress bar');
  36512. }
  36513. if (0 === $this->current) {
  36514. $redraw = true;
  36515. }
  36516. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  36517. $this->current = $current;
  36518. $currPeriod = (int) ($this->current / $this->redrawFreq);
  36519. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  36520. $this->display();
  36521. }
  36522. }
  36523. public function display($finish = false)
  36524. {
  36525. if (null === $this->startTime) {
  36526. throw new LogicException('You must start the progress bar before calling display().');
  36527. }
  36528. $message = $this->format;
  36529. foreach ($this->generate($finish) as $name => $value) {
  36530. $message = str_replace("%{$name}%", $value, $message);
  36531. }
  36532. $this->overwrite($this->output, $message);
  36533. }
  36534. public function clear()
  36535. {
  36536. $this->overwrite($this->output, '');
  36537. }
  36538. public function finish()
  36539. {
  36540. if (null === $this->startTime) {
  36541. throw new LogicException('You must start the progress bar before calling finish().');
  36542. }
  36543. if (null !== $this->startTime) {
  36544. if (!$this->max) {
  36545. $this->barChar = $this->barCharOriginal;
  36546. $this->display(true);
  36547. }
  36548. $this->startTime = null;
  36549. $this->output->writeln('');
  36550. $this->output = null;
  36551. }
  36552. }
  36553. private function initialize()
  36554. {
  36555. $this->formatVars = array();
  36556. foreach ($this->defaultFormatVars as $var) {
  36557. if (false !== strpos($this->format, "%{$var}%")) {
  36558. $this->formatVars[$var] = true;
  36559. }
  36560. }
  36561. if ($this->max > 0) {
  36562. $this->widths['max'] = $this->strlen($this->max);
  36563. $this->widths['current'] = $this->widths['max'];
  36564. } else {
  36565. $this->barCharOriginal = $this->barChar;
  36566. $this->barChar = $this->emptyBarChar;
  36567. }
  36568. }
  36569. private function generate($finish = false)
  36570. {
  36571. $vars = array();
  36572. $percent = 0;
  36573. if ($this->max > 0) {
  36574. $percent = (float) $this->current / $this->max;
  36575. }
  36576. if (isset($this->formatVars['bar'])) {
  36577. if ($this->max > 0) {
  36578. $completeBars = floor($percent * $this->barWidth);
  36579. } else {
  36580. if (!$finish) {
  36581. $completeBars = floor($this->current % $this->barWidth);
  36582. } else {
  36583. $completeBars = $this->barWidth;
  36584. }
  36585. }
  36586. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  36587. $bar = str_repeat($this->barChar, $completeBars);
  36588. if ($completeBars < $this->barWidth) {
  36589. $bar .= $this->progressChar;
  36590. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  36591. }
  36592. $vars['bar'] = $bar;
  36593. }
  36594. if (isset($this->formatVars['elapsed'])) {
  36595. $elapsed = time() - $this->startTime;
  36596. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  36597. }
  36598. if (isset($this->formatVars['current'])) {
  36599. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  36600. }
  36601. if (isset($this->formatVars['max'])) {
  36602. $vars['max'] = $this->max;
  36603. }
  36604. if (isset($this->formatVars['percent'])) {
  36605. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  36606. }
  36607. return $vars;
  36608. }
  36609. private function humaneTime($secs)
  36610. {
  36611. $text = '';
  36612. foreach ($this->timeFormats as $format) {
  36613. if ($secs < $format[0]) {
  36614. if (2 == \count($format)) {
  36615. $text = $format[1];
  36616. break;
  36617. } else {
  36618. $text = ceil($secs / $format[2]).' '.$format[1];
  36619. break;
  36620. }
  36621. }
  36622. }
  36623. return $text;
  36624. }
  36625. private function overwrite(OutputInterface $output, $message)
  36626. {
  36627. $length = $this->strlen($message);
  36628. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  36629. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  36630. }
  36631. $output->write("\x0D");
  36632. $output->write($message);
  36633. $this->lastMessagesLength = $this->strlen($message);
  36634. }
  36635. public function getName()
  36636. {
  36637. return 'progress';
  36638. }
  36639. }
  36640. <?php
  36641. namespace Symfony\Component\Console\Helper;
  36642. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36643. use Symfony\Component\Console\Exception\LogicException;
  36644. use Symfony\Component\Console\Output\OutputInterface;
  36645. class ProgressIndicator
  36646. {
  36647. private $output;
  36648. private $startTime;
  36649. private $format;
  36650. private $message;
  36651. private $indicatorValues;
  36652. private $indicatorCurrent;
  36653. private $indicatorChangeInterval;
  36654. private $indicatorUpdateTime;
  36655. private $started = false;
  36656. private static $formatters;
  36657. private static $formats;
  36658. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  36659. {
  36660. $this->output = $output;
  36661. if (null === $format) {
  36662. $format = $this->determineBestFormat();
  36663. }
  36664. if (null === $indicatorValues) {
  36665. $indicatorValues = array('-', '\\', '|', '/');
  36666. }
  36667. $indicatorValues = array_values($indicatorValues);
  36668. if (2 > \count($indicatorValues)) {
  36669. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  36670. }
  36671. $this->format = self::getFormatDefinition($format);
  36672. $this->indicatorChangeInterval = $indicatorChangeInterval;
  36673. $this->indicatorValues = $indicatorValues;
  36674. $this->startTime = time();
  36675. }
  36676. public function setMessage($message)
  36677. {
  36678. $this->message = $message;
  36679. $this->display();
  36680. }
  36681. public function getMessage()
  36682. {
  36683. return $this->message;
  36684. }
  36685. public function getStartTime()
  36686. {
  36687. return $this->startTime;
  36688. }
  36689. public function getCurrentValue()
  36690. {
  36691. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  36692. }
  36693. public function start($message)
  36694. {
  36695. if ($this->started) {
  36696. throw new LogicException('Progress indicator already started.');
  36697. }
  36698. $this->message = $message;
  36699. $this->started = true;
  36700. $this->startTime = time();
  36701. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  36702. $this->indicatorCurrent = 0;
  36703. $this->display();
  36704. }
  36705. public function advance()
  36706. {
  36707. if (!$this->started) {
  36708. throw new LogicException('Progress indicator has not yet been started.');
  36709. }
  36710. if (!$this->output->isDecorated()) {
  36711. return;
  36712. }
  36713. $currentTime = $this->getCurrentTimeInMilliseconds();
  36714. if ($currentTime < $this->indicatorUpdateTime) {
  36715. return;
  36716. }
  36717. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  36718. ++$this->indicatorCurrent;
  36719. $this->display();
  36720. }
  36721. public function finish($message)
  36722. {
  36723. if (!$this->started) {
  36724. throw new LogicException('Progress indicator has not yet been started.');
  36725. }
  36726. $this->message = $message;
  36727. $this->display();
  36728. $this->output->writeln('');
  36729. $this->started = false;
  36730. }
  36731. public static function getFormatDefinition($name)
  36732. {
  36733. if (!self::$formats) {
  36734. self::$formats = self::initFormats();
  36735. }
  36736. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  36737. }
  36738. public static function setPlaceholderFormatterDefinition($name, $callable)
  36739. {
  36740. if (!self::$formatters) {
  36741. self::$formatters = self::initPlaceholderFormatters();
  36742. }
  36743. self::$formatters[$name] = $callable;
  36744. }
  36745. public static function getPlaceholderFormatterDefinition($name)
  36746. {
  36747. if (!self::$formatters) {
  36748. self::$formatters = self::initPlaceholderFormatters();
  36749. }
  36750. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  36751. }
  36752. private function display()
  36753. {
  36754. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  36755. return;
  36756. }
  36757. $self = $this;
  36758. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  36759. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  36760. return \call_user_func($formatter, $self);
  36761. }
  36762. return $matches[0];
  36763. }, $this->format));
  36764. }
  36765. private function determineBestFormat()
  36766. {
  36767. switch ($this->output->getVerbosity()) {
  36768. case OutputInterface::VERBOSITY_VERBOSE:
  36769. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  36770. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  36771. case OutputInterface::VERBOSITY_DEBUG:
  36772. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  36773. default:
  36774. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  36775. }
  36776. }
  36777. private function overwrite($message)
  36778. {
  36779. if ($this->output->isDecorated()) {
  36780. $this->output->write("\x0D\x1B[2K");
  36781. $this->output->write($message);
  36782. } else {
  36783. $this->output->writeln($message);
  36784. }
  36785. }
  36786. private function getCurrentTimeInMilliseconds()
  36787. {
  36788. return round(microtime(true) * 1000);
  36789. }
  36790. private static function initPlaceholderFormatters()
  36791. {
  36792. return array(
  36793. 'indicator' => function (ProgressIndicator $indicator) {
  36794. return $indicator->getCurrentValue();
  36795. },
  36796. 'message' => function (ProgressIndicator $indicator) {
  36797. return $indicator->getMessage();
  36798. },
  36799. 'elapsed' => function (ProgressIndicator $indicator) {
  36800. return Helper::formatTime(time() - $indicator->getStartTime());
  36801. },
  36802. 'memory' => function () {
  36803. return Helper::formatMemory(memory_get_usage(true));
  36804. },
  36805. );
  36806. }
  36807. private static function initFormats()
  36808. {
  36809. return array(
  36810. 'normal' => ' %indicator% %message%',
  36811. 'normal_no_ansi' => ' %message%',
  36812. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  36813. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  36814. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  36815. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  36816. );
  36817. }
  36818. }
  36819. <?php
  36820. namespace Symfony\Component\Console\Helper;
  36821. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36822. use Symfony\Component\Console\Exception\RuntimeException;
  36823. use Symfony\Component\Console\Formatter\OutputFormatter;
  36824. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  36825. use Symfony\Component\Console\Input\InputInterface;
  36826. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  36827. use Symfony\Component\Console\Output\OutputInterface;
  36828. use Symfony\Component\Console\Question\ChoiceQuestion;
  36829. use Symfony\Component\Console\Question\Question;
  36830. class QuestionHelper extends Helper
  36831. {
  36832. private $inputStream;
  36833. private static $shell;
  36834. private static $stty;
  36835. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  36836. {
  36837. if ($output instanceof ConsoleOutputInterface) {
  36838. $output = $output->getErrorOutput();
  36839. }
  36840. if (!$input->isInteractive()) {
  36841. $default = $question->getDefault();
  36842. if (null !== $default && $question instanceof ChoiceQuestion) {
  36843. $choices = $question->getChoices();
  36844. if (!$question->isMultiselect()) {
  36845. return isset($choices[$default]) ? $choices[$default] : $default;
  36846. }
  36847. $default = explode(',', $default);
  36848. foreach ($default as $k => $v) {
  36849. $v = trim($v);
  36850. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  36851. }
  36852. }
  36853. return $default;
  36854. }
  36855. if (!$question->getValidator()) {
  36856. return $this->doAsk($output, $question);
  36857. }
  36858. $that = $this;
  36859. $interviewer = function () use ($output, $question, $that) {
  36860. return $that->doAsk($output, $question);
  36861. };
  36862. return $this->validateAttempts($interviewer, $output, $question);
  36863. }
  36864. public function setInputStream($stream)
  36865. {
  36866. if (!\is_resource($stream)) {
  36867. throw new InvalidArgumentException('Input stream must be a valid resource.');
  36868. }
  36869. $this->inputStream = $stream;
  36870. }
  36871. public function getInputStream()
  36872. {
  36873. return $this->inputStream;
  36874. }
  36875. public function getName()
  36876. {
  36877. return 'question';
  36878. }
  36879. public function doAsk(OutputInterface $output, Question $question)
  36880. {
  36881. $this->writePrompt($output, $question);
  36882. $inputStream = $this->inputStream ?: STDIN;
  36883. $autocomplete = $question->getAutocompleterValues();
  36884. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  36885. $ret = false;
  36886. if ($question->isHidden()) {
  36887. try {
  36888. $ret = trim($this->getHiddenResponse($output, $inputStream));
  36889. } catch (RuntimeException $e) {
  36890. if (!$question->isHiddenFallback()) {
  36891. throw $e;
  36892. }
  36893. }
  36894. }
  36895. if (false === $ret) {
  36896. $ret = fgets($inputStream, 4096);
  36897. if (false === $ret) {
  36898. throw new RuntimeException('Aborted');
  36899. }
  36900. $ret = trim($ret);
  36901. }
  36902. } else {
  36903. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  36904. }
  36905. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  36906. if ($normalizer = $question->getNormalizer()) {
  36907. return $normalizer($ret);
  36908. }
  36909. return $ret;
  36910. }
  36911. protected function writePrompt(OutputInterface $output, Question $question)
  36912. {
  36913. $message = $question->getQuestion();
  36914. if ($question instanceof ChoiceQuestion) {
  36915. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  36916. $messages = (array) $question->getQuestion();
  36917. foreach ($question->getChoices() as $key => $value) {
  36918. $width = $maxWidth - $this->strlen($key);
  36919. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  36920. }
  36921. $output->writeln($messages);
  36922. $message = $question->getPrompt();
  36923. }
  36924. $output->write($message);
  36925. }
  36926. protected function writeError(OutputInterface $output, \Exception $error)
  36927. {
  36928. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  36929. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  36930. } else {
  36931. $message = '<error>'.$error->getMessage().'</error>';
  36932. }
  36933. $output->writeln($message);
  36934. }
  36935. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  36936. {
  36937. $ret = '';
  36938. $i = 0;
  36939. $ofs = -1;
  36940. $matches = $autocomplete;
  36941. $numMatches = \count($matches);
  36942. $sttyMode = shell_exec('stty -g');
  36943. shell_exec('stty -icanon -echo');
  36944. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  36945. while (!feof($inputStream)) {
  36946. $c = fread($inputStream, 1);
  36947. if ("\177" === $c) {
  36948. if (0 === $numMatches && 0 !== $i) {
  36949. --$i;
  36950. $output->write("\033[1D");
  36951. }
  36952. if (0 === $i) {
  36953. $ofs = -1;
  36954. $matches = $autocomplete;
  36955. $numMatches = \count($matches);
  36956. } else {
  36957. $numMatches = 0;
  36958. }
  36959. $ret = substr($ret, 0, $i);
  36960. } elseif ("\033" === $c) {
  36961. $c .= fread($inputStream, 2);
  36962. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  36963. if ('A' === $c[2] && -1 === $ofs) {
  36964. $ofs = 0;
  36965. }
  36966. if (0 === $numMatches) {
  36967. continue;
  36968. }
  36969. $ofs += ('A' === $c[2]) ? -1 : 1;
  36970. $ofs = ($numMatches + $ofs) % $numMatches;
  36971. }
  36972. } elseif (\ord($c) < 32) {
  36973. if ("\t" === $c || "\n" === $c) {
  36974. if ($numMatches > 0 && -1 !== $ofs) {
  36975. $ret = $matches[$ofs];
  36976. $output->write(substr($ret, $i));
  36977. $i = \strlen($ret);
  36978. }
  36979. if ("\n" === $c) {
  36980. $output->write($c);
  36981. break;
  36982. }
  36983. $numMatches = 0;
  36984. }
  36985. continue;
  36986. } else {
  36987. $output->write($c);
  36988. $ret .= $c;
  36989. ++$i;
  36990. $numMatches = 0;
  36991. $ofs = 0;
  36992. foreach ($autocomplete as $value) {
  36993. if (0 === strpos($value, $ret)) {
  36994. $matches[$numMatches++] = $value;
  36995. }
  36996. }
  36997. }
  36998. $output->write("\033[K");
  36999. if ($numMatches > 0 && -1 !== $ofs) {
  37000. $output->write("\0337");
  37001. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  37002. $output->write("\0338");
  37003. }
  37004. }
  37005. shell_exec(sprintf('stty %s', $sttyMode));
  37006. return $ret;
  37007. }
  37008. private function getHiddenResponse(OutputInterface $output, $inputStream)
  37009. {
  37010. if ('\\' === \DIRECTORY_SEPARATOR) {
  37011. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  37012. if ('phar:' === substr(__FILE__, 0, 5)) {
  37013. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  37014. copy($exe, $tmpExe);
  37015. $exe = $tmpExe;
  37016. }
  37017. $value = rtrim(shell_exec($exe));
  37018. $output->writeln('');
  37019. if (isset($tmpExe)) {
  37020. unlink($tmpExe);
  37021. }
  37022. return $value;
  37023. }
  37024. if ($this->hasSttyAvailable()) {
  37025. $sttyMode = shell_exec('stty -g');
  37026. shell_exec('stty -echo');
  37027. $value = fgets($inputStream, 4096);
  37028. shell_exec(sprintf('stty %s', $sttyMode));
  37029. if (false === $value) {
  37030. throw new RuntimeException('Aborted');
  37031. }
  37032. $value = trim($value);
  37033. $output->writeln('');
  37034. return $value;
  37035. }
  37036. if (false !== $shell = $this->getShell()) {
  37037. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  37038. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  37039. $value = rtrim(shell_exec($command));
  37040. $output->writeln('');
  37041. return $value;
  37042. }
  37043. throw new RuntimeException('Unable to hide the response.');
  37044. }
  37045. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  37046. {
  37047. $error = null;
  37048. $attempts = $question->getMaxAttempts();
  37049. while (null === $attempts || $attempts--) {
  37050. if (null !== $error) {
  37051. $this->writeError($output, $error);
  37052. }
  37053. try {
  37054. return \call_user_func($question->getValidator(), $interviewer());
  37055. } catch (RuntimeException $e) {
  37056. throw $e;
  37057. } catch (\Exception $error) {
  37058. }
  37059. }
  37060. throw $error;
  37061. }
  37062. private function getShell()
  37063. {
  37064. if (null !== self::$shell) {
  37065. return self::$shell;
  37066. }
  37067. self::$shell = false;
  37068. if (file_exists('/usr/bin/env')) {
  37069. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  37070. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  37071. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  37072. self::$shell = $sh;
  37073. break;
  37074. }
  37075. }
  37076. }
  37077. return self::$shell;
  37078. }
  37079. private function hasSttyAvailable()
  37080. {
  37081. if (null !== self::$stty) {
  37082. return self::$stty;
  37083. }
  37084. exec('stty 2>&1', $output, $exitcode);
  37085. return self::$stty = 0 === $exitcode;
  37086. }
  37087. }
  37088. <?php
  37089. namespace Symfony\Component\Console\Helper;
  37090. use Symfony\Component\Console\Exception\LogicException;
  37091. use Symfony\Component\Console\Formatter\OutputFormatter;
  37092. use Symfony\Component\Console\Input\InputInterface;
  37093. use Symfony\Component\Console\Output\OutputInterface;
  37094. use Symfony\Component\Console\Question\ChoiceQuestion;
  37095. use Symfony\Component\Console\Question\ConfirmationQuestion;
  37096. use Symfony\Component\Console\Question\Question;
  37097. use Symfony\Component\Console\Style\SymfonyStyle;
  37098. class SymfonyQuestionHelper extends QuestionHelper
  37099. {
  37100. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  37101. {
  37102. $validator = $question->getValidator();
  37103. $question->setValidator(function ($value) use ($validator) {
  37104. if (null !== $validator) {
  37105. $value = $validator($value);
  37106. } else {
  37107. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  37108. throw new LogicException('A value is required.');
  37109. }
  37110. }
  37111. return $value;
  37112. });
  37113. return parent::ask($input, $output, $question);
  37114. }
  37115. protected function writePrompt(OutputInterface $output, Question $question)
  37116. {
  37117. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  37118. $default = $question->getDefault();
  37119. switch (true) {
  37120. case null === $default:
  37121. $text = sprintf(' <info>%s</info>:', $text);
  37122. break;
  37123. case $question instanceof ConfirmationQuestion:
  37124. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  37125. break;
  37126. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  37127. $choices = $question->getChoices();
  37128. $default = explode(',', $default);
  37129. foreach ($default as $key => $value) {
  37130. $default[$key] = $choices[trim($value)];
  37131. }
  37132. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  37133. break;
  37134. case $question instanceof ChoiceQuestion:
  37135. $choices = $question->getChoices();
  37136. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  37137. break;
  37138. default:
  37139. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  37140. }
  37141. $output->writeln($text);
  37142. if ($question instanceof ChoiceQuestion) {
  37143. $width = max(array_map('strlen', array_keys($question->getChoices())));
  37144. foreach ($question->getChoices() as $key => $value) {
  37145. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  37146. }
  37147. }
  37148. $output->write(' > ');
  37149. }
  37150. protected function writeError(OutputInterface $output, \Exception $error)
  37151. {
  37152. if ($output instanceof SymfonyStyle) {
  37153. $output->newLine();
  37154. $output->error($error->getMessage());
  37155. return;
  37156. }
  37157. parent::writeError($output, $error);
  37158. }
  37159. }
  37160. <?php
  37161. namespace Symfony\Component\Console\Helper;
  37162. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37163. use Symfony\Component\Console\Output\OutputInterface;
  37164. class Table
  37165. {
  37166. private $headers = array();
  37167. private $rows = array();
  37168. private $columnWidths = array();
  37169. private $numberOfColumns;
  37170. private $output;
  37171. private $style;
  37172. private $columnStyles = array();
  37173. private static $styles;
  37174. public function __construct(OutputInterface $output)
  37175. {
  37176. $this->output = $output;
  37177. if (!self::$styles) {
  37178. self::$styles = self::initStyles();
  37179. }
  37180. $this->setStyle('default');
  37181. }
  37182. public static function setStyleDefinition($name, TableStyle $style)
  37183. {
  37184. if (!self::$styles) {
  37185. self::$styles = self::initStyles();
  37186. }
  37187. self::$styles[$name] = $style;
  37188. }
  37189. public static function getStyleDefinition($name)
  37190. {
  37191. if (!self::$styles) {
  37192. self::$styles = self::initStyles();
  37193. }
  37194. if (isset(self::$styles[$name])) {
  37195. return self::$styles[$name];
  37196. }
  37197. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37198. }
  37199. public function setStyle($name)
  37200. {
  37201. $this->style = $this->resolveStyle($name);
  37202. return $this;
  37203. }
  37204. public function getStyle()
  37205. {
  37206. return $this->style;
  37207. }
  37208. public function setColumnStyle($columnIndex, $name)
  37209. {
  37210. $columnIndex = (int) $columnIndex;
  37211. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  37212. return $this;
  37213. }
  37214. public function getColumnStyle($columnIndex)
  37215. {
  37216. if (isset($this->columnStyles[$columnIndex])) {
  37217. return $this->columnStyles[$columnIndex];
  37218. }
  37219. return $this->getStyle();
  37220. }
  37221. public function setHeaders(array $headers)
  37222. {
  37223. $headers = array_values($headers);
  37224. if (!empty($headers) && !\is_array($headers[0])) {
  37225. $headers = array($headers);
  37226. }
  37227. $this->headers = $headers;
  37228. return $this;
  37229. }
  37230. public function setRows(array $rows)
  37231. {
  37232. $this->rows = array();
  37233. return $this->addRows($rows);
  37234. }
  37235. public function addRows(array $rows)
  37236. {
  37237. foreach ($rows as $row) {
  37238. $this->addRow($row);
  37239. }
  37240. return $this;
  37241. }
  37242. public function addRow($row)
  37243. {
  37244. if ($row instanceof TableSeparator) {
  37245. $this->rows[] = $row;
  37246. return $this;
  37247. }
  37248. if (!\is_array($row)) {
  37249. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  37250. }
  37251. $this->rows[] = array_values($row);
  37252. return $this;
  37253. }
  37254. public function setRow($column, array $row)
  37255. {
  37256. $this->rows[$column] = $row;
  37257. return $this;
  37258. }
  37259. public function render()
  37260. {
  37261. $this->calculateNumberOfColumns();
  37262. $rows = $this->buildTableRows($this->rows);
  37263. $headers = $this->buildTableRows($this->headers);
  37264. $this->calculateColumnsWidth(array_merge($headers, $rows));
  37265. $this->renderRowSeparator();
  37266. if (!empty($headers)) {
  37267. foreach ($headers as $header) {
  37268. $this->renderRow($header, $this->style->getCellHeaderFormat());
  37269. $this->renderRowSeparator();
  37270. }
  37271. }
  37272. foreach ($rows as $row) {
  37273. if ($row instanceof TableSeparator) {
  37274. $this->renderRowSeparator();
  37275. } else {
  37276. $this->renderRow($row, $this->style->getCellRowFormat());
  37277. }
  37278. }
  37279. if (!empty($rows)) {
  37280. $this->renderRowSeparator();
  37281. }
  37282. $this->cleanup();
  37283. }
  37284. private function renderRowSeparator()
  37285. {
  37286. if (0 === $count = $this->numberOfColumns) {
  37287. return;
  37288. }
  37289. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  37290. return;
  37291. }
  37292. $markup = $this->style->getCrossingChar();
  37293. for ($column = 0; $column < $count; ++$column) {
  37294. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  37295. }
  37296. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  37297. }
  37298. private function renderColumnSeparator()
  37299. {
  37300. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  37301. }
  37302. private function renderRow(array $row, $cellFormat)
  37303. {
  37304. if (empty($row)) {
  37305. return;
  37306. }
  37307. $rowContent = $this->renderColumnSeparator();
  37308. foreach ($this->getRowColumns($row) as $column) {
  37309. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  37310. $rowContent .= $this->renderColumnSeparator();
  37311. }
  37312. $this->output->writeln($rowContent);
  37313. }
  37314. private function renderCell(array $row, $column, $cellFormat)
  37315. {
  37316. $cell = isset($row[$column]) ? $row[$column] : '';
  37317. $width = $this->columnWidths[$column];
  37318. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37319. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  37320. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  37321. }
  37322. }
  37323. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  37324. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  37325. }
  37326. $style = $this->getColumnStyle($column);
  37327. if ($cell instanceof TableSeparator) {
  37328. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  37329. }
  37330. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37331. $content = sprintf($style->getCellRowContentFormat(), $cell);
  37332. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  37333. }
  37334. private function calculateNumberOfColumns()
  37335. {
  37336. if (null !== $this->numberOfColumns) {
  37337. return;
  37338. }
  37339. $columns = array(0);
  37340. foreach (array_merge($this->headers, $this->rows) as $row) {
  37341. if ($row instanceof TableSeparator) {
  37342. continue;
  37343. }
  37344. $columns[] = $this->getNumberOfColumns($row);
  37345. }
  37346. $this->numberOfColumns = max($columns);
  37347. }
  37348. private function buildTableRows($rows)
  37349. {
  37350. $unmergedRows = array();
  37351. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  37352. $rows = $this->fillNextRows($rows, $rowKey);
  37353. foreach ($rows[$rowKey] as $column => $cell) {
  37354. if (!strstr($cell, "\n")) {
  37355. continue;
  37356. }
  37357. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37358. foreach ($lines as $lineKey => $line) {
  37359. if ($cell instanceof TableCell) {
  37360. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  37361. }
  37362. if (0 === $lineKey) {
  37363. $rows[$rowKey][$column] = $line;
  37364. } else {
  37365. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  37366. }
  37367. }
  37368. }
  37369. }
  37370. $tableRows = array();
  37371. foreach ($rows as $rowKey => $row) {
  37372. $tableRows[] = $this->fillCells($row);
  37373. if (isset($unmergedRows[$rowKey])) {
  37374. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  37375. }
  37376. }
  37377. return $tableRows;
  37378. }
  37379. private function fillNextRows(array $rows, $line)
  37380. {
  37381. $unmergedRows = array();
  37382. foreach ($rows[$line] as $column => $cell) {
  37383. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  37384. $nbLines = $cell->getRowspan() - 1;
  37385. $lines = array($cell);
  37386. if (strstr($cell, "\n")) {
  37387. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  37388. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  37389. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  37390. unset($lines[0]);
  37391. }
  37392. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  37393. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37394. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  37395. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  37396. if ($nbLines === $unmergedRowKey - $line) {
  37397. break;
  37398. }
  37399. }
  37400. }
  37401. }
  37402. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  37403. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  37404. foreach ($unmergedRow as $cellKey => $cell) {
  37405. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  37406. }
  37407. } else {
  37408. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  37409. foreach ($unmergedRow as $column => $cell) {
  37410. if (!empty($cell)) {
  37411. $row[$column] = $unmergedRow[$column];
  37412. }
  37413. }
  37414. array_splice($rows, $unmergedRowKey, 0, array($row));
  37415. }
  37416. }
  37417. return $rows;
  37418. }
  37419. private function fillCells($row)
  37420. {
  37421. $newRow = array();
  37422. foreach ($row as $column => $cell) {
  37423. $newRow[] = $cell;
  37424. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37425. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  37426. $newRow[] = '';
  37427. }
  37428. }
  37429. }
  37430. return $newRow ?: $row;
  37431. }
  37432. private function copyRow(array $rows, $line)
  37433. {
  37434. $row = $rows[$line];
  37435. foreach ($row as $cellKey => $cellValue) {
  37436. $row[$cellKey] = '';
  37437. if ($cellValue instanceof TableCell) {
  37438. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  37439. }
  37440. }
  37441. return $row;
  37442. }
  37443. private function getNumberOfColumns(array $row)
  37444. {
  37445. $columns = \count($row);
  37446. foreach ($row as $column) {
  37447. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  37448. }
  37449. return $columns;
  37450. }
  37451. private function getRowColumns(array $row)
  37452. {
  37453. $columns = range(0, $this->numberOfColumns - 1);
  37454. foreach ($row as $cellKey => $cell) {
  37455. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  37456. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  37457. }
  37458. }
  37459. return $columns;
  37460. }
  37461. private function calculateColumnsWidth($rows)
  37462. {
  37463. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  37464. $lengths = array();
  37465. foreach ($rows as $row) {
  37466. if ($row instanceof TableSeparator) {
  37467. continue;
  37468. }
  37469. foreach ($row as $i => $cell) {
  37470. if ($cell instanceof TableCell) {
  37471. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  37472. $textLength = Helper::strlen($textContent);
  37473. if ($textLength > 0) {
  37474. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  37475. foreach ($contentColumns as $position => $content) {
  37476. $row[$i + $position] = $content;
  37477. }
  37478. }
  37479. }
  37480. }
  37481. $lengths[] = $this->getCellWidth($row, $column);
  37482. }
  37483. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  37484. }
  37485. }
  37486. private function getColumnSeparatorWidth()
  37487. {
  37488. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  37489. }
  37490. private function getCellWidth(array $row, $column)
  37491. {
  37492. if (isset($row[$column])) {
  37493. $cell = $row[$column];
  37494. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  37495. return $cellWidth;
  37496. }
  37497. return 0;
  37498. }
  37499. private function cleanup()
  37500. {
  37501. $this->columnWidths = array();
  37502. $this->numberOfColumns = null;
  37503. }
  37504. private static function initStyles()
  37505. {
  37506. $borderless = new TableStyle();
  37507. $borderless
  37508. ->setHorizontalBorderChar('=')
  37509. ->setVerticalBorderChar(' ')
  37510. ->setCrossingChar(' ')
  37511. ;
  37512. $compact = new TableStyle();
  37513. $compact
  37514. ->setHorizontalBorderChar('')
  37515. ->setVerticalBorderChar(' ')
  37516. ->setCrossingChar('')
  37517. ->setCellRowContentFormat('%s')
  37518. ;
  37519. $styleGuide = new TableStyle();
  37520. $styleGuide
  37521. ->setHorizontalBorderChar('-')
  37522. ->setVerticalBorderChar(' ')
  37523. ->setCrossingChar(' ')
  37524. ->setCellHeaderFormat('%s')
  37525. ;
  37526. return array(
  37527. 'default' => new TableStyle(),
  37528. 'borderless' => $borderless,
  37529. 'compact' => $compact,
  37530. 'symfony-style-guide' => $styleGuide,
  37531. );
  37532. }
  37533. private function resolveStyle($name)
  37534. {
  37535. if ($name instanceof TableStyle) {
  37536. return $name;
  37537. }
  37538. if (isset(self::$styles[$name])) {
  37539. return self::$styles[$name];
  37540. }
  37541. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  37542. }
  37543. }
  37544. <?php
  37545. namespace Symfony\Component\Console\Helper;
  37546. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37547. class TableCell
  37548. {
  37549. private $value;
  37550. private $options = array(
  37551. 'rowspan' => 1,
  37552. 'colspan' => 1,
  37553. );
  37554. public function __construct($value = '', array $options = array())
  37555. {
  37556. if (is_numeric($value) && !\is_string($value)) {
  37557. $value = (string) $value;
  37558. }
  37559. $this->value = $value;
  37560. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  37561. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  37562. }
  37563. $this->options = array_merge($this->options, $options);
  37564. }
  37565. public function __toString()
  37566. {
  37567. return $this->value;
  37568. }
  37569. public function getColspan()
  37570. {
  37571. return (int) $this->options['colspan'];
  37572. }
  37573. public function getRowspan()
  37574. {
  37575. return (int) $this->options['rowspan'];
  37576. }
  37577. }
  37578. <?php
  37579. namespace Symfony\Component\Console\Helper;
  37580. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37581. use Symfony\Component\Console\Output\NullOutput;
  37582. use Symfony\Component\Console\Output\OutputInterface;
  37583. class TableHelper extends Helper
  37584. {
  37585. const LAYOUT_DEFAULT = 0;
  37586. const LAYOUT_BORDERLESS = 1;
  37587. const LAYOUT_COMPACT = 2;
  37588. private $table;
  37589. public function __construct($triggerDeprecationError = true)
  37590. {
  37591. if ($triggerDeprecationError) {
  37592. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.5 and will be removed in 3.0. Use the Symfony\Component\Console\Helper\Table class instead.', E_USER_DEPRECATED);
  37593. }
  37594. $this->table = new Table(new NullOutput());
  37595. }
  37596. public function setLayout($layout)
  37597. {
  37598. switch ($layout) {
  37599. case self::LAYOUT_BORDERLESS:
  37600. $this->table->setStyle('borderless');
  37601. break;
  37602. case self::LAYOUT_COMPACT:
  37603. $this->table->setStyle('compact');
  37604. break;
  37605. case self::LAYOUT_DEFAULT:
  37606. $this->table->setStyle('default');
  37607. break;
  37608. default:
  37609. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  37610. }
  37611. return $this;
  37612. }
  37613. public function setHeaders(array $headers)
  37614. {
  37615. $this->table->setHeaders($headers);
  37616. return $this;
  37617. }
  37618. public function setRows(array $rows)
  37619. {
  37620. $this->table->setRows($rows);
  37621. return $this;
  37622. }
  37623. public function addRows(array $rows)
  37624. {
  37625. $this->table->addRows($rows);
  37626. return $this;
  37627. }
  37628. public function addRow(array $row)
  37629. {
  37630. $this->table->addRow($row);
  37631. return $this;
  37632. }
  37633. public function setRow($column, array $row)
  37634. {
  37635. $this->table->setRow($column, $row);
  37636. return $this;
  37637. }
  37638. public function setPaddingChar($paddingChar)
  37639. {
  37640. $this->table->getStyle()->setPaddingChar($paddingChar);
  37641. return $this;
  37642. }
  37643. public function setHorizontalBorderChar($horizontalBorderChar)
  37644. {
  37645. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  37646. return $this;
  37647. }
  37648. public function setVerticalBorderChar($verticalBorderChar)
  37649. {
  37650. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  37651. return $this;
  37652. }
  37653. public function setCrossingChar($crossingChar)
  37654. {
  37655. $this->table->getStyle()->setCrossingChar($crossingChar);
  37656. return $this;
  37657. }
  37658. public function setCellHeaderFormat($cellHeaderFormat)
  37659. {
  37660. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  37661. return $this;
  37662. }
  37663. public function setCellRowFormat($cellRowFormat)
  37664. {
  37665. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  37666. return $this;
  37667. }
  37668. public function setCellRowContentFormat($cellRowContentFormat)
  37669. {
  37670. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  37671. return $this;
  37672. }
  37673. public function setBorderFormat($borderFormat)
  37674. {
  37675. $this->table->getStyle()->setBorderFormat($borderFormat);
  37676. return $this;
  37677. }
  37678. public function setPadType($padType)
  37679. {
  37680. $this->table->getStyle()->setPadType($padType);
  37681. return $this;
  37682. }
  37683. public function render(OutputInterface $output)
  37684. {
  37685. $p = new \ReflectionProperty($this->table, 'output');
  37686. $p->setAccessible(true);
  37687. $p->setValue($this->table, $output);
  37688. $this->table->render();
  37689. }
  37690. public function getName()
  37691. {
  37692. return 'table';
  37693. }
  37694. }
  37695. <?php
  37696. namespace Symfony\Component\Console\Helper;
  37697. class TableSeparator extends TableCell
  37698. {
  37699. public function __construct(array $options = array())
  37700. {
  37701. parent::__construct('', $options);
  37702. }
  37703. }
  37704. <?php
  37705. namespace Symfony\Component\Console\Helper;
  37706. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37707. use Symfony\Component\Console\Exception\LogicException;
  37708. class TableStyle
  37709. {
  37710. private $paddingChar = ' ';
  37711. private $horizontalBorderChar = '-';
  37712. private $verticalBorderChar = '|';
  37713. private $crossingChar = '+';
  37714. private $cellHeaderFormat = '<info>%s</info>';
  37715. private $cellRowFormat = '%s';
  37716. private $cellRowContentFormat = ' %s ';
  37717. private $borderFormat = '%s';
  37718. private $padType = STR_PAD_RIGHT;
  37719. public function setPaddingChar($paddingChar)
  37720. {
  37721. if (!$paddingChar) {
  37722. throw new LogicException('The padding char must not be empty');
  37723. }
  37724. $this->paddingChar = $paddingChar;
  37725. return $this;
  37726. }
  37727. public function getPaddingChar()
  37728. {
  37729. return $this->paddingChar;
  37730. }
  37731. public function setHorizontalBorderChar($horizontalBorderChar)
  37732. {
  37733. $this->horizontalBorderChar = $horizontalBorderChar;
  37734. return $this;
  37735. }
  37736. public function getHorizontalBorderChar()
  37737. {
  37738. return $this->horizontalBorderChar;
  37739. }
  37740. public function setVerticalBorderChar($verticalBorderChar)
  37741. {
  37742. $this->verticalBorderChar = $verticalBorderChar;
  37743. return $this;
  37744. }
  37745. public function getVerticalBorderChar()
  37746. {
  37747. return $this->verticalBorderChar;
  37748. }
  37749. public function setCrossingChar($crossingChar)
  37750. {
  37751. $this->crossingChar = $crossingChar;
  37752. return $this;
  37753. }
  37754. public function getCrossingChar()
  37755. {
  37756. return $this->crossingChar;
  37757. }
  37758. public function setCellHeaderFormat($cellHeaderFormat)
  37759. {
  37760. $this->cellHeaderFormat = $cellHeaderFormat;
  37761. return $this;
  37762. }
  37763. public function getCellHeaderFormat()
  37764. {
  37765. return $this->cellHeaderFormat;
  37766. }
  37767. public function setCellRowFormat($cellRowFormat)
  37768. {
  37769. $this->cellRowFormat = $cellRowFormat;
  37770. return $this;
  37771. }
  37772. public function getCellRowFormat()
  37773. {
  37774. return $this->cellRowFormat;
  37775. }
  37776. public function setCellRowContentFormat($cellRowContentFormat)
  37777. {
  37778. $this->cellRowContentFormat = $cellRowContentFormat;
  37779. return $this;
  37780. }
  37781. public function getCellRowContentFormat()
  37782. {
  37783. return $this->cellRowContentFormat;
  37784. }
  37785. public function setBorderFormat($borderFormat)
  37786. {
  37787. $this->borderFormat = $borderFormat;
  37788. return $this;
  37789. }
  37790. public function getBorderFormat()
  37791. {
  37792. return $this->borderFormat;
  37793. }
  37794. public function setPadType($padType)
  37795. {
  37796. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  37797. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  37798. }
  37799. $this->padType = $padType;
  37800. return $this;
  37801. }
  37802. public function getPadType()
  37803. {
  37804. return $this->padType;
  37805. }
  37806. }
  37807. <?php
  37808. namespace Symfony\Component\Console\Input;
  37809. use Symfony\Component\Console\Exception\RuntimeException;
  37810. class ArgvInput extends Input
  37811. {
  37812. private $tokens;
  37813. private $parsed;
  37814. public function __construct(array $argv = null, InputDefinition $definition = null)
  37815. {
  37816. if (null === $argv) {
  37817. $argv = $_SERVER['argv'];
  37818. }
  37819. array_shift($argv);
  37820. $this->tokens = $argv;
  37821. parent::__construct($definition);
  37822. }
  37823. protected function setTokens(array $tokens)
  37824. {
  37825. $this->tokens = $tokens;
  37826. }
  37827. protected function parse()
  37828. {
  37829. $parseOptions = true;
  37830. $this->parsed = $this->tokens;
  37831. while (null !== $token = array_shift($this->parsed)) {
  37832. if ($parseOptions && '' == $token) {
  37833. $this->parseArgument($token);
  37834. } elseif ($parseOptions && '--' == $token) {
  37835. $parseOptions = false;
  37836. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  37837. $this->parseLongOption($token);
  37838. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  37839. $this->parseShortOption($token);
  37840. } else {
  37841. $this->parseArgument($token);
  37842. }
  37843. }
  37844. }
  37845. private function parseShortOption($token)
  37846. {
  37847. $name = substr($token, 1);
  37848. if (\strlen($name) > 1) {
  37849. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  37850. $this->addShortOption($name[0], substr($name, 1));
  37851. } else {
  37852. $this->parseShortOptionSet($name);
  37853. }
  37854. } else {
  37855. $this->addShortOption($name, null);
  37856. }
  37857. }
  37858. private function parseShortOptionSet($name)
  37859. {
  37860. $len = \strlen($name);
  37861. for ($i = 0; $i < $len; ++$i) {
  37862. if (!$this->definition->hasShortcut($name[$i])) {
  37863. $encoding = mb_detect_encoding($name, null, true);
  37864. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  37865. }
  37866. $option = $this->definition->getOptionForShortcut($name[$i]);
  37867. if ($option->acceptValue()) {
  37868. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  37869. break;
  37870. } else {
  37871. $this->addLongOption($option->getName(), null);
  37872. }
  37873. }
  37874. }
  37875. private function parseLongOption($token)
  37876. {
  37877. $name = substr($token, 2);
  37878. if (false !== $pos = strpos($name, '=')) {
  37879. if (0 === \strlen($value = substr($name, $pos + 1))) {
  37880. array_unshift($this->parsed, null);
  37881. }
  37882. $this->addLongOption(substr($name, 0, $pos), $value);
  37883. } else {
  37884. $this->addLongOption($name, null);
  37885. }
  37886. }
  37887. private function parseArgument($token)
  37888. {
  37889. $c = \count($this->arguments);
  37890. if ($this->definition->hasArgument($c)) {
  37891. $arg = $this->definition->getArgument($c);
  37892. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  37893. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  37894. $arg = $this->definition->getArgument($c - 1);
  37895. $this->arguments[$arg->getName()][] = $token;
  37896. } else {
  37897. $all = $this->definition->getArguments();
  37898. if (\count($all)) {
  37899. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  37900. }
  37901. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  37902. }
  37903. }
  37904. private function addShortOption($shortcut, $value)
  37905. {
  37906. if (!$this->definition->hasShortcut($shortcut)) {
  37907. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  37908. }
  37909. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  37910. }
  37911. private function addLongOption($name, $value)
  37912. {
  37913. if (!$this->definition->hasOption($name)) {
  37914. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  37915. }
  37916. $option = $this->definition->getOption($name);
  37917. if (!isset($value[0])) {
  37918. $value = null;
  37919. }
  37920. if (null !== $value && !$option->acceptValue()) {
  37921. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  37922. }
  37923. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  37924. $next = array_shift($this->parsed);
  37925. if (isset($next[0]) && '-' !== $next[0]) {
  37926. $value = $next;
  37927. } elseif (empty($next)) {
  37928. $value = null;
  37929. } else {
  37930. array_unshift($this->parsed, $next);
  37931. }
  37932. }
  37933. if (null === $value) {
  37934. if ($option->isValueRequired()) {
  37935. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  37936. }
  37937. if (!$option->isArray()) {
  37938. $value = $option->isValueOptional() ? $option->getDefault() : true;
  37939. }
  37940. }
  37941. if ($option->isArray()) {
  37942. $this->options[$name][] = $value;
  37943. } else {
  37944. $this->options[$name] = $value;
  37945. }
  37946. }
  37947. public function getFirstArgument()
  37948. {
  37949. foreach ($this->tokens as $token) {
  37950. if ($token && '-' === $token[0]) {
  37951. continue;
  37952. }
  37953. return $token;
  37954. }
  37955. }
  37956. public function hasParameterOption($values)
  37957. {
  37958. $values = (array) $values;
  37959. foreach ($this->tokens as $token) {
  37960. foreach ($values as $value) {
  37961. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37962. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  37963. return true;
  37964. }
  37965. }
  37966. }
  37967. return false;
  37968. }
  37969. public function getParameterOption($values, $default = false)
  37970. {
  37971. $values = (array) $values;
  37972. $tokens = $this->tokens;
  37973. while (0 < \count($tokens)) {
  37974. $token = array_shift($tokens);
  37975. foreach ($values as $value) {
  37976. if ($token === $value) {
  37977. return array_shift($tokens);
  37978. }
  37979. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  37980. if ('' !== $leading && 0 === strpos($token, $leading)) {
  37981. return substr($token, \strlen($leading));
  37982. }
  37983. }
  37984. }
  37985. return $default;
  37986. }
  37987. public function __toString()
  37988. {
  37989. $self = $this;
  37990. $tokens = array_map(function ($token) use ($self) {
  37991. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  37992. return $match[1].$self->escapeToken($match[2]);
  37993. }
  37994. if ($token && '-' !== $token[0]) {
  37995. return $self->escapeToken($token);
  37996. }
  37997. return $token;
  37998. }, $this->tokens);
  37999. return implode(' ', $tokens);
  38000. }
  38001. }
  38002. <?php
  38003. namespace Symfony\Component\Console\Input;
  38004. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38005. use Symfony\Component\Console\Exception\InvalidOptionException;
  38006. class ArrayInput extends Input
  38007. {
  38008. private $parameters;
  38009. public function __construct(array $parameters, InputDefinition $definition = null)
  38010. {
  38011. $this->parameters = $parameters;
  38012. parent::__construct($definition);
  38013. }
  38014. public function getFirstArgument()
  38015. {
  38016. foreach ($this->parameters as $key => $value) {
  38017. if ($key && '-' === $key[0]) {
  38018. continue;
  38019. }
  38020. return $value;
  38021. }
  38022. }
  38023. public function hasParameterOption($values)
  38024. {
  38025. $values = (array) $values;
  38026. foreach ($this->parameters as $k => $v) {
  38027. if (!\is_int($k)) {
  38028. $v = $k;
  38029. }
  38030. if (\in_array($v, $values)) {
  38031. return true;
  38032. }
  38033. }
  38034. return false;
  38035. }
  38036. public function getParameterOption($values, $default = false)
  38037. {
  38038. $values = (array) $values;
  38039. foreach ($this->parameters as $k => $v) {
  38040. if (\is_int($k)) {
  38041. if (\in_array($v, $values)) {
  38042. return true;
  38043. }
  38044. } elseif (\in_array($k, $values)) {
  38045. return $v;
  38046. }
  38047. }
  38048. return $default;
  38049. }
  38050. public function __toString()
  38051. {
  38052. $params = array();
  38053. foreach ($this->parameters as $param => $val) {
  38054. if ($param && '-' === $param[0]) {
  38055. if (\is_array($val)) {
  38056. foreach ($val as $v) {
  38057. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  38058. }
  38059. } else {
  38060. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  38061. }
  38062. } else {
  38063. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  38064. }
  38065. }
  38066. return implode(' ', $params);
  38067. }
  38068. protected function parse()
  38069. {
  38070. foreach ($this->parameters as $key => $value) {
  38071. if (0 === strpos($key, '--')) {
  38072. $this->addLongOption(substr($key, 2), $value);
  38073. } elseif ('-' === $key[0]) {
  38074. $this->addShortOption(substr($key, 1), $value);
  38075. } else {
  38076. $this->addArgument($key, $value);
  38077. }
  38078. }
  38079. }
  38080. private function addShortOption($shortcut, $value)
  38081. {
  38082. if (!$this->definition->hasShortcut($shortcut)) {
  38083. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  38084. }
  38085. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  38086. }
  38087. private function addLongOption($name, $value)
  38088. {
  38089. if (!$this->definition->hasOption($name)) {
  38090. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  38091. }
  38092. $option = $this->definition->getOption($name);
  38093. if (null === $value) {
  38094. if ($option->isValueRequired()) {
  38095. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  38096. }
  38097. $value = $option->isValueOptional() ? $option->getDefault() : true;
  38098. }
  38099. $this->options[$name] = $value;
  38100. }
  38101. private function addArgument($name, $value)
  38102. {
  38103. if (!$this->definition->hasArgument($name)) {
  38104. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38105. }
  38106. $this->arguments[$name] = $value;
  38107. }
  38108. }
  38109. <?php
  38110. namespace Symfony\Component\Console\Input;
  38111. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38112. use Symfony\Component\Console\Exception\RuntimeException;
  38113. abstract class Input implements InputInterface
  38114. {
  38115. protected $definition;
  38116. protected $options = array();
  38117. protected $arguments = array();
  38118. protected $interactive = true;
  38119. public function __construct(InputDefinition $definition = null)
  38120. {
  38121. if (null === $definition) {
  38122. $this->definition = new InputDefinition();
  38123. } else {
  38124. $this->bind($definition);
  38125. $this->validate();
  38126. }
  38127. }
  38128. public function bind(InputDefinition $definition)
  38129. {
  38130. $this->arguments = array();
  38131. $this->options = array();
  38132. $this->definition = $definition;
  38133. $this->parse();
  38134. }
  38135. abstract protected function parse();
  38136. public function validate()
  38137. {
  38138. $definition = $this->definition;
  38139. $givenArguments = $this->arguments;
  38140. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  38141. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  38142. });
  38143. if (\count($missingArguments) > 0) {
  38144. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  38145. }
  38146. }
  38147. public function isInteractive()
  38148. {
  38149. return $this->interactive;
  38150. }
  38151. public function setInteractive($interactive)
  38152. {
  38153. $this->interactive = (bool) $interactive;
  38154. }
  38155. public function getArguments()
  38156. {
  38157. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  38158. }
  38159. public function getArgument($name)
  38160. {
  38161. if (!$this->definition->hasArgument($name)) {
  38162. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38163. }
  38164. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  38165. }
  38166. public function setArgument($name, $value)
  38167. {
  38168. if (!$this->definition->hasArgument($name)) {
  38169. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38170. }
  38171. $this->arguments[$name] = $value;
  38172. }
  38173. public function hasArgument($name)
  38174. {
  38175. return $this->definition->hasArgument($name);
  38176. }
  38177. public function getOptions()
  38178. {
  38179. return array_merge($this->definition->getOptionDefaults(), $this->options);
  38180. }
  38181. public function getOption($name)
  38182. {
  38183. if (!$this->definition->hasOption($name)) {
  38184. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38185. }
  38186. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  38187. }
  38188. public function setOption($name, $value)
  38189. {
  38190. if (!$this->definition->hasOption($name)) {
  38191. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  38192. }
  38193. $this->options[$name] = $value;
  38194. }
  38195. public function hasOption($name)
  38196. {
  38197. return $this->definition->hasOption($name);
  38198. }
  38199. public function escapeToken($token)
  38200. {
  38201. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  38202. }
  38203. }
  38204. <?php
  38205. namespace Symfony\Component\Console\Input;
  38206. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38207. use Symfony\Component\Console\Exception\LogicException;
  38208. class InputArgument
  38209. {
  38210. const REQUIRED = 1;
  38211. const OPTIONAL = 2;
  38212. const IS_ARRAY = 4;
  38213. private $name;
  38214. private $mode;
  38215. private $default;
  38216. private $description;
  38217. public function __construct($name, $mode = null, $description = '', $default = null)
  38218. {
  38219. if (null === $mode) {
  38220. $mode = self::OPTIONAL;
  38221. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  38222. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  38223. }
  38224. $this->name = $name;
  38225. $this->mode = $mode;
  38226. $this->description = $description;
  38227. $this->setDefault($default);
  38228. }
  38229. public function getName()
  38230. {
  38231. return $this->name;
  38232. }
  38233. public function isRequired()
  38234. {
  38235. return self::REQUIRED === (self::REQUIRED & $this->mode);
  38236. }
  38237. public function isArray()
  38238. {
  38239. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  38240. }
  38241. public function setDefault($default = null)
  38242. {
  38243. if (self::REQUIRED === $this->mode && null !== $default) {
  38244. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  38245. }
  38246. if ($this->isArray()) {
  38247. if (null === $default) {
  38248. $default = array();
  38249. } elseif (!\is_array($default)) {
  38250. throw new LogicException('A default value for an array argument must be an array.');
  38251. }
  38252. }
  38253. $this->default = $default;
  38254. }
  38255. public function getDefault()
  38256. {
  38257. return $this->default;
  38258. }
  38259. public function getDescription()
  38260. {
  38261. return $this->description;
  38262. }
  38263. }
  38264. <?php
  38265. namespace Symfony\Component\Console\Input;
  38266. interface InputAwareInterface
  38267. {
  38268. public function setInput(InputInterface $input);
  38269. }
  38270. <?php
  38271. namespace Symfony\Component\Console\Input;
  38272. use Symfony\Component\Console\Descriptor\TextDescriptor;
  38273. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  38274. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38275. use Symfony\Component\Console\Exception\LogicException;
  38276. use Symfony\Component\Console\Output\BufferedOutput;
  38277. class InputDefinition
  38278. {
  38279. private $arguments;
  38280. private $requiredCount;
  38281. private $hasAnArrayArgument = false;
  38282. private $hasOptional;
  38283. private $options;
  38284. private $shortcuts;
  38285. public function __construct(array $definition = array())
  38286. {
  38287. $this->setDefinition($definition);
  38288. }
  38289. public function setDefinition(array $definition)
  38290. {
  38291. $arguments = array();
  38292. $options = array();
  38293. foreach ($definition as $item) {
  38294. if ($item instanceof InputOption) {
  38295. $options[] = $item;
  38296. } else {
  38297. $arguments[] = $item;
  38298. }
  38299. }
  38300. $this->setArguments($arguments);
  38301. $this->setOptions($options);
  38302. }
  38303. public function setArguments($arguments = array())
  38304. {
  38305. $this->arguments = array();
  38306. $this->requiredCount = 0;
  38307. $this->hasOptional = false;
  38308. $this->hasAnArrayArgument = false;
  38309. $this->addArguments($arguments);
  38310. }
  38311. public function addArguments($arguments = array())
  38312. {
  38313. if (null !== $arguments) {
  38314. foreach ($arguments as $argument) {
  38315. $this->addArgument($argument);
  38316. }
  38317. }
  38318. }
  38319. public function addArgument(InputArgument $argument)
  38320. {
  38321. if (isset($this->arguments[$argument->getName()])) {
  38322. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  38323. }
  38324. if ($this->hasAnArrayArgument) {
  38325. throw new LogicException('Cannot add an argument after an array argument.');
  38326. }
  38327. if ($argument->isRequired() && $this->hasOptional) {
  38328. throw new LogicException('Cannot add a required argument after an optional one.');
  38329. }
  38330. if ($argument->isArray()) {
  38331. $this->hasAnArrayArgument = true;
  38332. }
  38333. if ($argument->isRequired()) {
  38334. ++$this->requiredCount;
  38335. } else {
  38336. $this->hasOptional = true;
  38337. }
  38338. $this->arguments[$argument->getName()] = $argument;
  38339. }
  38340. public function getArgument($name)
  38341. {
  38342. if (!$this->hasArgument($name)) {
  38343. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  38344. }
  38345. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38346. return $arguments[$name];
  38347. }
  38348. public function hasArgument($name)
  38349. {
  38350. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  38351. return isset($arguments[$name]);
  38352. }
  38353. public function getArguments()
  38354. {
  38355. return $this->arguments;
  38356. }
  38357. public function getArgumentCount()
  38358. {
  38359. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  38360. }
  38361. public function getArgumentRequiredCount()
  38362. {
  38363. return $this->requiredCount;
  38364. }
  38365. public function getArgumentDefaults()
  38366. {
  38367. $values = array();
  38368. foreach ($this->arguments as $argument) {
  38369. $values[$argument->getName()] = $argument->getDefault();
  38370. }
  38371. return $values;
  38372. }
  38373. public function setOptions($options = array())
  38374. {
  38375. $this->options = array();
  38376. $this->shortcuts = array();
  38377. $this->addOptions($options);
  38378. }
  38379. public function addOptions($options = array())
  38380. {
  38381. foreach ($options as $option) {
  38382. $this->addOption($option);
  38383. }
  38384. }
  38385. public function addOption(InputOption $option)
  38386. {
  38387. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  38388. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  38389. }
  38390. if ($option->getShortcut()) {
  38391. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38392. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  38393. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  38394. }
  38395. }
  38396. }
  38397. $this->options[$option->getName()] = $option;
  38398. if ($option->getShortcut()) {
  38399. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  38400. $this->shortcuts[$shortcut] = $option->getName();
  38401. }
  38402. }
  38403. }
  38404. public function getOption($name)
  38405. {
  38406. if (!$this->hasOption($name)) {
  38407. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  38408. }
  38409. return $this->options[$name];
  38410. }
  38411. public function hasOption($name)
  38412. {
  38413. return isset($this->options[$name]);
  38414. }
  38415. public function getOptions()
  38416. {
  38417. return $this->options;
  38418. }
  38419. public function hasShortcut($name)
  38420. {
  38421. return isset($this->shortcuts[$name]);
  38422. }
  38423. public function getOptionForShortcut($shortcut)
  38424. {
  38425. return $this->getOption($this->shortcutToName($shortcut));
  38426. }
  38427. public function getOptionDefaults()
  38428. {
  38429. $values = array();
  38430. foreach ($this->options as $option) {
  38431. $values[$option->getName()] = $option->getDefault();
  38432. }
  38433. return $values;
  38434. }
  38435. private function shortcutToName($shortcut)
  38436. {
  38437. if (!isset($this->shortcuts[$shortcut])) {
  38438. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  38439. }
  38440. return $this->shortcuts[$shortcut];
  38441. }
  38442. public function getSynopsis($short = false)
  38443. {
  38444. $elements = array();
  38445. if ($short && $this->getOptions()) {
  38446. $elements[] = '[options]';
  38447. } elseif (!$short) {
  38448. foreach ($this->getOptions() as $option) {
  38449. $value = '';
  38450. if ($option->acceptValue()) {
  38451. $value = sprintf(
  38452. ' %s%s%s',
  38453. $option->isValueOptional() ? '[' : '',
  38454. strtoupper($option->getName()),
  38455. $option->isValueOptional() ? ']' : ''
  38456. );
  38457. }
  38458. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  38459. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  38460. }
  38461. }
  38462. if (\count($elements) && $this->getArguments()) {
  38463. $elements[] = '[--]';
  38464. }
  38465. foreach ($this->getArguments() as $argument) {
  38466. $element = '<'.$argument->getName().'>';
  38467. if (!$argument->isRequired()) {
  38468. $element = '['.$element.']';
  38469. } elseif ($argument->isArray()) {
  38470. $element .= ' ('.$element.')';
  38471. }
  38472. if ($argument->isArray()) {
  38473. $element .= '...';
  38474. }
  38475. $elements[] = $element;
  38476. }
  38477. return implode(' ', $elements);
  38478. }
  38479. public function asText()
  38480. {
  38481. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38482. $descriptor = new TextDescriptor();
  38483. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  38484. $descriptor->describe($output, $this, array('raw_output' => true));
  38485. return $output->fetch();
  38486. }
  38487. public function asXml($asDom = false)
  38488. {
  38489. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  38490. $descriptor = new XmlDescriptor();
  38491. if ($asDom) {
  38492. return $descriptor->getInputDefinitionDocument($this);
  38493. }
  38494. $output = new BufferedOutput();
  38495. $descriptor->describe($output, $this);
  38496. return $output->fetch();
  38497. }
  38498. }
  38499. <?php
  38500. namespace Symfony\Component\Console\Input;
  38501. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38502. use Symfony\Component\Console\Exception\RuntimeException;
  38503. interface InputInterface
  38504. {
  38505. public function getFirstArgument();
  38506. public function hasParameterOption($values);
  38507. public function getParameterOption($values, $default = false);
  38508. public function bind(InputDefinition $definition);
  38509. public function validate();
  38510. public function getArguments();
  38511. public function getArgument($name);
  38512. public function setArgument($name, $value);
  38513. public function hasArgument($name);
  38514. public function getOptions();
  38515. public function getOption($name);
  38516. public function setOption($name, $value);
  38517. public function hasOption($name);
  38518. public function isInteractive();
  38519. public function setInteractive($interactive);
  38520. }
  38521. <?php
  38522. namespace Symfony\Component\Console\Input;
  38523. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38524. use Symfony\Component\Console\Exception\LogicException;
  38525. class InputOption
  38526. {
  38527. const VALUE_NONE = 1;
  38528. const VALUE_REQUIRED = 2;
  38529. const VALUE_OPTIONAL = 4;
  38530. const VALUE_IS_ARRAY = 8;
  38531. private $name;
  38532. private $shortcut;
  38533. private $mode;
  38534. private $default;
  38535. private $description;
  38536. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  38537. {
  38538. if (0 === strpos($name, '--')) {
  38539. $name = substr($name, 2);
  38540. }
  38541. if (empty($name)) {
  38542. throw new InvalidArgumentException('An option name cannot be empty.');
  38543. }
  38544. if (empty($shortcut)) {
  38545. $shortcut = null;
  38546. }
  38547. if (null !== $shortcut) {
  38548. if (\is_array($shortcut)) {
  38549. $shortcut = implode('|', $shortcut);
  38550. }
  38551. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  38552. $shortcuts = array_filter($shortcuts);
  38553. $shortcut = implode('|', $shortcuts);
  38554. if (empty($shortcut)) {
  38555. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  38556. }
  38557. }
  38558. if (null === $mode) {
  38559. $mode = self::VALUE_NONE;
  38560. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  38561. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  38562. }
  38563. $this->name = $name;
  38564. $this->shortcut = $shortcut;
  38565. $this->mode = $mode;
  38566. $this->description = $description;
  38567. if ($this->isArray() && !$this->acceptValue()) {
  38568. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  38569. }
  38570. $this->setDefault($default);
  38571. }
  38572. public function getShortcut()
  38573. {
  38574. return $this->shortcut;
  38575. }
  38576. public function getName()
  38577. {
  38578. return $this->name;
  38579. }
  38580. public function acceptValue()
  38581. {
  38582. return $this->isValueRequired() || $this->isValueOptional();
  38583. }
  38584. public function isValueRequired()
  38585. {
  38586. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  38587. }
  38588. public function isValueOptional()
  38589. {
  38590. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  38591. }
  38592. public function isArray()
  38593. {
  38594. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  38595. }
  38596. public function setDefault($default = null)
  38597. {
  38598. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  38599. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  38600. }
  38601. if ($this->isArray()) {
  38602. if (null === $default) {
  38603. $default = array();
  38604. } elseif (!\is_array($default)) {
  38605. throw new LogicException('A default value for an array option must be an array.');
  38606. }
  38607. }
  38608. $this->default = $this->acceptValue() ? $default : false;
  38609. }
  38610. public function getDefault()
  38611. {
  38612. return $this->default;
  38613. }
  38614. public function getDescription()
  38615. {
  38616. return $this->description;
  38617. }
  38618. public function equals(self $option)
  38619. {
  38620. return $option->getName() === $this->getName()
  38621. && $option->getShortcut() === $this->getShortcut()
  38622. && $option->getDefault() === $this->getDefault()
  38623. && $option->isArray() === $this->isArray()
  38624. && $option->isValueRequired() === $this->isValueRequired()
  38625. && $option->isValueOptional() === $this->isValueOptional()
  38626. ;
  38627. }
  38628. }
  38629. <?php
  38630. namespace Symfony\Component\Console\Input;
  38631. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38632. class StringInput extends ArgvInput
  38633. {
  38634. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  38635. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  38636. public function __construct($input, InputDefinition $definition = null)
  38637. {
  38638. if ($definition) {
  38639. @trigger_error('The $definition argument of the '.__METHOD__.' method is deprecated and will be removed in 3.0. Set this parameter with the bind() method instead.', E_USER_DEPRECATED);
  38640. }
  38641. parent::__construct(array(), null);
  38642. $this->setTokens($this->tokenize($input));
  38643. if (null !== $definition) {
  38644. $this->bind($definition);
  38645. }
  38646. }
  38647. private function tokenize($input)
  38648. {
  38649. $tokens = array();
  38650. $length = \strlen($input);
  38651. $cursor = 0;
  38652. while ($cursor < $length) {
  38653. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  38654. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  38655. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  38656. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  38657. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  38658. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  38659. $tokens[] = stripcslashes($match[1]);
  38660. } else {
  38661. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  38662. }
  38663. $cursor += \strlen($match[0]);
  38664. }
  38665. return $tokens;
  38666. }
  38667. }
  38668. Copyright (c) 2004-2018 Fabien Potencier
  38669. Permission is hereby granted, free of charge, to any person obtaining a copy
  38670. of this software and associated documentation files (the "Software"), to deal
  38671. in the Software without restriction, including without limitation the rights
  38672. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  38673. copies of the Software, and to permit persons to whom the Software is furnished
  38674. to do so, subject to the following conditions:
  38675. The above copyright notice and this permission notice shall be included in all
  38676. copies or substantial portions of the Software.
  38677. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  38678. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  38679. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  38680. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  38681. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  38682. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  38683. THE SOFTWARE.
  38684. <?php
  38685. namespace Symfony\Component\Console\Logger;
  38686. use Psr\Log\AbstractLogger;
  38687. use Psr\Log\InvalidArgumentException;
  38688. use Psr\Log\LogLevel;
  38689. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  38690. use Symfony\Component\Console\Output\OutputInterface;
  38691. class ConsoleLogger extends AbstractLogger
  38692. {
  38693. const INFO = 'info';
  38694. const ERROR = 'error';
  38695. private $output;
  38696. private $verbosityLevelMap = array(
  38697. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  38698. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  38699. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  38700. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  38701. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  38702. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  38703. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  38704. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  38705. );
  38706. private $formatLevelMap = array(
  38707. LogLevel::EMERGENCY => self::ERROR,
  38708. LogLevel::ALERT => self::ERROR,
  38709. LogLevel::CRITICAL => self::ERROR,
  38710. LogLevel::ERROR => self::ERROR,
  38711. LogLevel::WARNING => self::INFO,
  38712. LogLevel::NOTICE => self::INFO,
  38713. LogLevel::INFO => self::INFO,
  38714. LogLevel::DEBUG => self::INFO,
  38715. );
  38716. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  38717. {
  38718. $this->output = $output;
  38719. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  38720. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  38721. }
  38722. public function log($level, $message, array $context = array())
  38723. {
  38724. if (!isset($this->verbosityLevelMap[$level])) {
  38725. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  38726. }
  38727. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  38728. $output = $this->output->getErrorOutput();
  38729. } else {
  38730. $output = $this->output;
  38731. }
  38732. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  38733. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  38734. }
  38735. }
  38736. private function interpolate($message, array $context)
  38737. {
  38738. $replace = array();
  38739. foreach ($context as $key => $val) {
  38740. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  38741. $replace[sprintf('{%s}', $key)] = $val;
  38742. }
  38743. }
  38744. return strtr($message, $replace);
  38745. }
  38746. }
  38747. <?php
  38748. namespace Symfony\Component\Console\Output;
  38749. class BufferedOutput extends Output
  38750. {
  38751. private $buffer = '';
  38752. public function fetch()
  38753. {
  38754. $content = $this->buffer;
  38755. $this->buffer = '';
  38756. return $content;
  38757. }
  38758. protected function doWrite($message, $newline)
  38759. {
  38760. $this->buffer .= $message;
  38761. if ($newline) {
  38762. $this->buffer .= PHP_EOL;
  38763. }
  38764. }
  38765. }
  38766. <?php
  38767. namespace Symfony\Component\Console\Output;
  38768. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38769. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  38770. {
  38771. private $stderr;
  38772. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  38773. {
  38774. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  38775. $actualDecorated = $this->isDecorated();
  38776. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  38777. if (null === $decorated) {
  38778. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  38779. }
  38780. }
  38781. public function setDecorated($decorated)
  38782. {
  38783. parent::setDecorated($decorated);
  38784. $this->stderr->setDecorated($decorated);
  38785. }
  38786. public function setFormatter(OutputFormatterInterface $formatter)
  38787. {
  38788. parent::setFormatter($formatter);
  38789. $this->stderr->setFormatter($formatter);
  38790. }
  38791. public function setVerbosity($level)
  38792. {
  38793. parent::setVerbosity($level);
  38794. $this->stderr->setVerbosity($level);
  38795. }
  38796. public function getErrorOutput()
  38797. {
  38798. return $this->stderr;
  38799. }
  38800. public function setErrorOutput(OutputInterface $error)
  38801. {
  38802. $this->stderr = $error;
  38803. }
  38804. protected function hasStdoutSupport()
  38805. {
  38806. return false === $this->isRunningOS400();
  38807. }
  38808. protected function hasStderrSupport()
  38809. {
  38810. return false === $this->isRunningOS400();
  38811. }
  38812. private function isRunningOS400()
  38813. {
  38814. $checks = array(
  38815. \function_exists('php_uname') ? php_uname('s') : '',
  38816. getenv('OSTYPE'),
  38817. PHP_OS,
  38818. );
  38819. return false !== stripos(implode(';', $checks), 'OS400');
  38820. }
  38821. private function openOutputStream()
  38822. {
  38823. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  38824. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  38825. }
  38826. private function openErrorStream()
  38827. {
  38828. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  38829. return fopen($errorStream, 'w');
  38830. }
  38831. }
  38832. <?php
  38833. namespace Symfony\Component\Console\Output;
  38834. interface ConsoleOutputInterface extends OutputInterface
  38835. {
  38836. public function getErrorOutput();
  38837. public function setErrorOutput(OutputInterface $error);
  38838. }
  38839. <?php
  38840. namespace Symfony\Component\Console\Output;
  38841. use Symfony\Component\Console\Formatter\OutputFormatter;
  38842. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38843. class NullOutput implements OutputInterface
  38844. {
  38845. public function setFormatter(OutputFormatterInterface $formatter)
  38846. {
  38847. }
  38848. public function getFormatter()
  38849. {
  38850. return new OutputFormatter();
  38851. }
  38852. public function setDecorated($decorated)
  38853. {
  38854. }
  38855. public function isDecorated()
  38856. {
  38857. return false;
  38858. }
  38859. public function setVerbosity($level)
  38860. {
  38861. }
  38862. public function getVerbosity()
  38863. {
  38864. return self::VERBOSITY_QUIET;
  38865. }
  38866. public function isQuiet()
  38867. {
  38868. return true;
  38869. }
  38870. public function isVerbose()
  38871. {
  38872. return false;
  38873. }
  38874. public function isVeryVerbose()
  38875. {
  38876. return false;
  38877. }
  38878. public function isDebug()
  38879. {
  38880. return false;
  38881. }
  38882. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38883. {
  38884. }
  38885. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38886. {
  38887. }
  38888. }
  38889. <?php
  38890. namespace Symfony\Component\Console\Output;
  38891. use Symfony\Component\Console\Formatter\OutputFormatter;
  38892. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38893. abstract class Output implements OutputInterface
  38894. {
  38895. private $verbosity;
  38896. private $formatter;
  38897. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  38898. {
  38899. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  38900. $this->formatter = $formatter ?: new OutputFormatter();
  38901. $this->formatter->setDecorated($decorated);
  38902. }
  38903. public function setFormatter(OutputFormatterInterface $formatter)
  38904. {
  38905. $this->formatter = $formatter;
  38906. }
  38907. public function getFormatter()
  38908. {
  38909. return $this->formatter;
  38910. }
  38911. public function setDecorated($decorated)
  38912. {
  38913. $this->formatter->setDecorated($decorated);
  38914. }
  38915. public function isDecorated()
  38916. {
  38917. return $this->formatter->isDecorated();
  38918. }
  38919. public function setVerbosity($level)
  38920. {
  38921. $this->verbosity = (int) $level;
  38922. }
  38923. public function getVerbosity()
  38924. {
  38925. return $this->verbosity;
  38926. }
  38927. public function isQuiet()
  38928. {
  38929. return self::VERBOSITY_QUIET === $this->verbosity;
  38930. }
  38931. public function isVerbose()
  38932. {
  38933. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  38934. }
  38935. public function isVeryVerbose()
  38936. {
  38937. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  38938. }
  38939. public function isDebug()
  38940. {
  38941. return self::VERBOSITY_DEBUG <= $this->verbosity;
  38942. }
  38943. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  38944. {
  38945. $this->write($messages, true, $options);
  38946. }
  38947. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  38948. {
  38949. $messages = (array) $messages;
  38950. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  38951. $type = $types & $options ?: self::OUTPUT_NORMAL;
  38952. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  38953. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  38954. if ($verbosity > $this->getVerbosity()) {
  38955. return;
  38956. }
  38957. foreach ($messages as $message) {
  38958. switch ($type) {
  38959. case OutputInterface::OUTPUT_NORMAL:
  38960. $message = $this->formatter->format($message);
  38961. break;
  38962. case OutputInterface::OUTPUT_RAW:
  38963. break;
  38964. case OutputInterface::OUTPUT_PLAIN:
  38965. $message = strip_tags($this->formatter->format($message));
  38966. break;
  38967. }
  38968. $this->doWrite($message, $newline);
  38969. }
  38970. }
  38971. abstract protected function doWrite($message, $newline);
  38972. }
  38973. <?php
  38974. namespace Symfony\Component\Console\Output;
  38975. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38976. interface OutputInterface
  38977. {
  38978. const VERBOSITY_QUIET = 16;
  38979. const VERBOSITY_NORMAL = 32;
  38980. const VERBOSITY_VERBOSE = 64;
  38981. const VERBOSITY_VERY_VERBOSE = 128;
  38982. const VERBOSITY_DEBUG = 256;
  38983. const OUTPUT_NORMAL = 1;
  38984. const OUTPUT_RAW = 2;
  38985. const OUTPUT_PLAIN = 4;
  38986. public function write($messages, $newline = false, $options = 0);
  38987. public function writeln($messages, $options = 0);
  38988. public function setVerbosity($level);
  38989. public function getVerbosity();
  38990. public function setDecorated($decorated);
  38991. public function isDecorated();
  38992. public function setFormatter(OutputFormatterInterface $formatter);
  38993. public function getFormatter();
  38994. }
  38995. <?php
  38996. namespace Symfony\Component\Console\Output;
  38997. use Symfony\Component\Console\Exception\InvalidArgumentException;
  38998. use Symfony\Component\Console\Exception\RuntimeException;
  38999. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  39000. class StreamOutput extends Output
  39001. {
  39002. private $stream;
  39003. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  39004. {
  39005. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  39006. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  39007. }
  39008. $this->stream = $stream;
  39009. if (null === $decorated) {
  39010. $decorated = $this->hasColorSupport();
  39011. }
  39012. parent::__construct($verbosity, $decorated, $formatter);
  39013. }
  39014. public function getStream()
  39015. {
  39016. return $this->stream;
  39017. }
  39018. protected function doWrite($message, $newline)
  39019. {
  39020. if ($newline) {
  39021. $message .= PHP_EOL;
  39022. }
  39023. if (false === @fwrite($this->stream, $message)) {
  39024. throw new RuntimeException('Unable to write output.');
  39025. }
  39026. fflush($this->stream);
  39027. }
  39028. protected function hasColorSupport()
  39029. {
  39030. if ('Hyper' === getenv('TERM_PROGRAM')) {
  39031. return true;
  39032. }
  39033. if (\DIRECTORY_SEPARATOR === '\\') {
  39034. return (\function_exists('sapi_windows_vt100_support')
  39035. && @sapi_windows_vt100_support($this->stream))
  39036. || false !== getenv('ANSICON')
  39037. || 'ON' === getenv('ConEmuANSI')
  39038. || 'xterm' === getenv('TERM');
  39039. }
  39040. if (\function_exists('stream_isatty')) {
  39041. return @stream_isatty($this->stream);
  39042. }
  39043. if (\function_exists('posix_isatty')) {
  39044. return @posix_isatty($this->stream);
  39045. }
  39046. $stat = @fstat($this->stream);
  39047. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  39048. }
  39049. }
  39050. <?php
  39051. namespace Symfony\Component\Console\Question;
  39052. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39053. class ChoiceQuestion extends Question
  39054. {
  39055. private $choices;
  39056. private $multiselect = false;
  39057. private $prompt = ' > ';
  39058. private $errorMessage = 'Value "%s" is invalid';
  39059. public function __construct($question, array $choices, $default = null)
  39060. {
  39061. if (!$choices) {
  39062. throw new \LogicException('Choice question must have at least 1 choice available.');
  39063. }
  39064. parent::__construct($question, $default);
  39065. $this->choices = $choices;
  39066. $this->setValidator($this->getDefaultValidator());
  39067. $this->setAutocompleterValues($choices);
  39068. }
  39069. public function getChoices()
  39070. {
  39071. return $this->choices;
  39072. }
  39073. public function setMultiselect($multiselect)
  39074. {
  39075. $this->multiselect = $multiselect;
  39076. $this->setValidator($this->getDefaultValidator());
  39077. return $this;
  39078. }
  39079. public function isMultiselect()
  39080. {
  39081. return $this->multiselect;
  39082. }
  39083. public function getPrompt()
  39084. {
  39085. return $this->prompt;
  39086. }
  39087. public function setPrompt($prompt)
  39088. {
  39089. $this->prompt = $prompt;
  39090. return $this;
  39091. }
  39092. public function setErrorMessage($errorMessage)
  39093. {
  39094. $this->errorMessage = $errorMessage;
  39095. $this->setValidator($this->getDefaultValidator());
  39096. return $this;
  39097. }
  39098. private function getDefaultValidator()
  39099. {
  39100. $choices = $this->choices;
  39101. $errorMessage = $this->errorMessage;
  39102. $multiselect = $this->multiselect;
  39103. $isAssoc = $this->isAssoc($choices);
  39104. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  39105. $selectedChoices = str_replace(' ', '', $selected);
  39106. if ($multiselect) {
  39107. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  39108. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  39109. }
  39110. $selectedChoices = explode(',', $selectedChoices);
  39111. } else {
  39112. $selectedChoices = array($selected);
  39113. }
  39114. $multiselectChoices = array();
  39115. foreach ($selectedChoices as $value) {
  39116. $results = array();
  39117. foreach ($choices as $key => $choice) {
  39118. if ($choice === $value) {
  39119. $results[] = $key;
  39120. }
  39121. }
  39122. if (\count($results) > 1) {
  39123. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  39124. }
  39125. $result = array_search($value, $choices);
  39126. if (!$isAssoc) {
  39127. if (false !== $result) {
  39128. $result = $choices[$result];
  39129. } elseif (isset($choices[$value])) {
  39130. $result = $choices[$value];
  39131. }
  39132. } elseif (false === $result && isset($choices[$value])) {
  39133. $result = $value;
  39134. }
  39135. if (false === $result) {
  39136. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  39137. }
  39138. $multiselectChoices[] = (string) $result;
  39139. }
  39140. if ($multiselect) {
  39141. return $multiselectChoices;
  39142. }
  39143. return current($multiselectChoices);
  39144. };
  39145. }
  39146. }
  39147. <?php
  39148. namespace Symfony\Component\Console\Question;
  39149. class ConfirmationQuestion extends Question
  39150. {
  39151. private $trueAnswerRegex;
  39152. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  39153. {
  39154. parent::__construct($question, (bool) $default);
  39155. $this->trueAnswerRegex = $trueAnswerRegex;
  39156. $this->setNormalizer($this->getDefaultNormalizer());
  39157. }
  39158. private function getDefaultNormalizer()
  39159. {
  39160. $default = $this->getDefault();
  39161. $regex = $this->trueAnswerRegex;
  39162. return function ($answer) use ($default, $regex) {
  39163. if (\is_bool($answer)) {
  39164. return $answer;
  39165. }
  39166. $answerIsTrue = (bool) preg_match($regex, $answer);
  39167. if (false === $default) {
  39168. return $answer && $answerIsTrue;
  39169. }
  39170. return !$answer || $answerIsTrue;
  39171. };
  39172. }
  39173. }
  39174. <?php
  39175. namespace Symfony\Component\Console\Question;
  39176. use Symfony\Component\Console\Exception\InvalidArgumentException;
  39177. use Symfony\Component\Console\Exception\LogicException;
  39178. class Question
  39179. {
  39180. private $question;
  39181. private $attempts;
  39182. private $hidden = false;
  39183. private $hiddenFallback = true;
  39184. private $autocompleterValues;
  39185. private $validator;
  39186. private $default;
  39187. private $normalizer;
  39188. public function __construct($question, $default = null)
  39189. {
  39190. $this->question = $question;
  39191. $this->default = $default;
  39192. }
  39193. public function getQuestion()
  39194. {
  39195. return $this->question;
  39196. }
  39197. public function getDefault()
  39198. {
  39199. return $this->default;
  39200. }
  39201. public function isHidden()
  39202. {
  39203. return $this->hidden;
  39204. }
  39205. public function setHidden($hidden)
  39206. {
  39207. if ($this->autocompleterValues) {
  39208. throw new LogicException('A hidden question cannot use the autocompleter.');
  39209. }
  39210. $this->hidden = (bool) $hidden;
  39211. return $this;
  39212. }
  39213. public function isHiddenFallback()
  39214. {
  39215. return $this->hiddenFallback;
  39216. }
  39217. public function setHiddenFallback($fallback)
  39218. {
  39219. $this->hiddenFallback = (bool) $fallback;
  39220. return $this;
  39221. }
  39222. public function getAutocompleterValues()
  39223. {
  39224. return $this->autocompleterValues;
  39225. }
  39226. public function setAutocompleterValues($values)
  39227. {
  39228. if (\is_array($values)) {
  39229. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  39230. }
  39231. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  39232. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  39233. }
  39234. if ($this->hidden) {
  39235. throw new LogicException('A hidden question cannot use the autocompleter.');
  39236. }
  39237. $this->autocompleterValues = $values;
  39238. return $this;
  39239. }
  39240. public function setValidator($validator)
  39241. {
  39242. $this->validator = $validator;
  39243. return $this;
  39244. }
  39245. public function getValidator()
  39246. {
  39247. return $this->validator;
  39248. }
  39249. public function setMaxAttempts($attempts)
  39250. {
  39251. if (null !== $attempts && $attempts < 1) {
  39252. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  39253. }
  39254. $this->attempts = $attempts;
  39255. return $this;
  39256. }
  39257. public function getMaxAttempts()
  39258. {
  39259. return $this->attempts;
  39260. }
  39261. public function setNormalizer($normalizer)
  39262. {
  39263. $this->normalizer = $normalizer;
  39264. return $this;
  39265. }
  39266. public function getNormalizer()
  39267. {
  39268. return $this->normalizer;
  39269. }
  39270. protected function isAssoc($array)
  39271. {
  39272. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  39273. }
  39274. }
  39275. <?php
  39276. namespace Symfony\Component\Console;
  39277. use Symfony\Component\Console\Exception\RuntimeException;
  39278. use Symfony\Component\Console\Input\StringInput;
  39279. use Symfony\Component\Console\Output\ConsoleOutput;
  39280. use Symfony\Component\Process\PhpExecutableFinder;
  39281. use Symfony\Component\Process\ProcessBuilder;
  39282. class Shell
  39283. {
  39284. private $application;
  39285. private $history;
  39286. private $output;
  39287. private $hasReadline;
  39288. private $processIsolation = false;
  39289. public function __construct(Application $application)
  39290. {
  39291. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39292. $this->hasReadline = \function_exists('readline');
  39293. $this->application = $application;
  39294. $this->history = getenv('HOME').'/.history_'.$application->getName();
  39295. $this->output = new ConsoleOutput();
  39296. }
  39297. public function run()
  39298. {
  39299. $this->application->setAutoExit(false);
  39300. $this->application->setCatchExceptions(true);
  39301. if ($this->hasReadline) {
  39302. readline_read_history($this->history);
  39303. readline_completion_function(array($this, 'autocompleter'));
  39304. }
  39305. $this->output->writeln($this->getHeader());
  39306. $php = null;
  39307. if ($this->processIsolation) {
  39308. $finder = new PhpExecutableFinder();
  39309. $php = $finder->find();
  39310. $this->output->writeln(<<<'EOF'
  39311. <info>Running with process isolation, you should consider this:</info>
  39312. * each command is executed as separate process,
  39313. * commands don't support interactivity, all params must be passed explicitly,
  39314. * commands output is not colorized.
  39315. EOF
  39316. );
  39317. }
  39318. while (true) {
  39319. $command = $this->readline();
  39320. if (false === $command) {
  39321. $this->output->writeln("\n");
  39322. break;
  39323. }
  39324. if ($this->hasReadline) {
  39325. readline_add_history($command);
  39326. readline_write_history($this->history);
  39327. }
  39328. if ($this->processIsolation) {
  39329. $pb = new ProcessBuilder();
  39330. $process = $pb
  39331. ->add($php)
  39332. ->add($_SERVER['argv'][0])
  39333. ->add($command)
  39334. ->inheritEnvironmentVariables(true)
  39335. ->getProcess()
  39336. ;
  39337. $output = $this->output;
  39338. $process->run(function ($type, $data) use ($output) {
  39339. $output->writeln($data);
  39340. });
  39341. $ret = $process->getExitCode();
  39342. } else {
  39343. $ret = $this->application->run(new StringInput($command), $this->output);
  39344. }
  39345. if (0 !== $ret) {
  39346. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  39347. }
  39348. }
  39349. }
  39350. protected function getHeader()
  39351. {
  39352. return <<<EOF
  39353. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  39354. At the prompt, type <comment>help</comment> for some help,
  39355. or <comment>list</comment> to get a list of available commands.
  39356. To exit the shell, type <comment>^D</comment>.
  39357. EOF;
  39358. }
  39359. protected function getPrompt()
  39360. {
  39361. return $this->output->getFormatter()->format($this->application->getName().' > ');
  39362. }
  39363. protected function getOutput()
  39364. {
  39365. return $this->output;
  39366. }
  39367. protected function getApplication()
  39368. {
  39369. return $this->application;
  39370. }
  39371. private function autocompleter($text)
  39372. {
  39373. $info = readline_info();
  39374. $text = substr($info['line_buffer'], 0, $info['end']);
  39375. if ($info['point'] !== $info['end']) {
  39376. return true;
  39377. }
  39378. if (false === strpos($text, ' ') || !$text) {
  39379. return array_keys($this->application->all());
  39380. }
  39381. try {
  39382. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  39383. } catch (\Exception $e) {
  39384. return true;
  39385. }
  39386. $list = array('--help');
  39387. foreach ($command->getDefinition()->getOptions() as $option) {
  39388. $list[] = '--'.$option->getName();
  39389. }
  39390. return $list;
  39391. }
  39392. private function readline()
  39393. {
  39394. if ($this->hasReadline) {
  39395. $line = readline($this->getPrompt());
  39396. } else {
  39397. $this->output->write($this->getPrompt());
  39398. $line = fgets(STDIN, 1024);
  39399. $line = (false === $line || '' === $line) ? false : rtrim($line);
  39400. }
  39401. return $line;
  39402. }
  39403. public function getProcessIsolation()
  39404. {
  39405. return $this->processIsolation;
  39406. }
  39407. public function setProcessIsolation($processIsolation)
  39408. {
  39409. $this->processIsolation = (bool) $processIsolation;
  39410. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  39411. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  39412. }
  39413. }
  39414. }
  39415. <?php
  39416. namespace Symfony\Component\Console\Style;
  39417. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  39418. use Symfony\Component\Console\Helper\ProgressBar;
  39419. use Symfony\Component\Console\Output\OutputInterface;
  39420. abstract class OutputStyle implements OutputInterface, StyleInterface
  39421. {
  39422. private $output;
  39423. public function __construct(OutputInterface $output)
  39424. {
  39425. $this->output = $output;
  39426. }
  39427. public function newLine($count = 1)
  39428. {
  39429. $this->output->write(str_repeat(PHP_EOL, $count));
  39430. }
  39431. public function createProgressBar($max = 0)
  39432. {
  39433. return new ProgressBar($this->output, $max);
  39434. }
  39435. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39436. {
  39437. $this->output->write($messages, $newline, $type);
  39438. }
  39439. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39440. {
  39441. $this->output->writeln($messages, $type);
  39442. }
  39443. public function setVerbosity($level)
  39444. {
  39445. $this->output->setVerbosity($level);
  39446. }
  39447. public function getVerbosity()
  39448. {
  39449. return $this->output->getVerbosity();
  39450. }
  39451. public function setDecorated($decorated)
  39452. {
  39453. $this->output->setDecorated($decorated);
  39454. }
  39455. public function isDecorated()
  39456. {
  39457. return $this->output->isDecorated();
  39458. }
  39459. public function setFormatter(OutputFormatterInterface $formatter)
  39460. {
  39461. $this->output->setFormatter($formatter);
  39462. }
  39463. public function getFormatter()
  39464. {
  39465. return $this->output->getFormatter();
  39466. }
  39467. }
  39468. <?php
  39469. namespace Symfony\Component\Console\Style;
  39470. interface StyleInterface
  39471. {
  39472. public function title($message);
  39473. public function section($message);
  39474. public function listing(array $elements);
  39475. public function text($message);
  39476. public function success($message);
  39477. public function error($message);
  39478. public function warning($message);
  39479. public function note($message);
  39480. public function caution($message);
  39481. public function table(array $headers, array $rows);
  39482. public function ask($question, $default = null, $validator = null);
  39483. public function askHidden($question, $validator = null);
  39484. public function confirm($question, $default = true);
  39485. public function choice($question, array $choices, $default = null);
  39486. public function newLine($count = 1);
  39487. public function progressStart($max = 0);
  39488. public function progressAdvance($step = 1);
  39489. public function progressFinish();
  39490. }
  39491. <?php
  39492. namespace Symfony\Component\Console\Style;
  39493. use Symfony\Component\Console\Application;
  39494. use Symfony\Component\Console\Exception\RuntimeException;
  39495. use Symfony\Component\Console\Formatter\OutputFormatter;
  39496. use Symfony\Component\Console\Helper\Helper;
  39497. use Symfony\Component\Console\Helper\ProgressBar;
  39498. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  39499. use Symfony\Component\Console\Helper\Table;
  39500. use Symfony\Component\Console\Input\InputInterface;
  39501. use Symfony\Component\Console\Output\BufferedOutput;
  39502. use Symfony\Component\Console\Output\OutputInterface;
  39503. use Symfony\Component\Console\Question\ChoiceQuestion;
  39504. use Symfony\Component\Console\Question\ConfirmationQuestion;
  39505. use Symfony\Component\Console\Question\Question;
  39506. class SymfonyStyle extends OutputStyle
  39507. {
  39508. const MAX_LINE_LENGTH = 120;
  39509. private $input;
  39510. private $questionHelper;
  39511. private $progressBar;
  39512. private $lineLength;
  39513. private $bufferedOutput;
  39514. public function __construct(InputInterface $input, OutputInterface $output)
  39515. {
  39516. $this->input = $input;
  39517. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  39518. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  39519. parent::__construct($output);
  39520. }
  39521. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  39522. {
  39523. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  39524. $this->autoPrependBlock();
  39525. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  39526. $this->newLine();
  39527. }
  39528. public function title($message)
  39529. {
  39530. $this->autoPrependBlock();
  39531. $this->writeln(array(
  39532. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39533. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39534. ));
  39535. $this->newLine();
  39536. }
  39537. public function section($message)
  39538. {
  39539. $this->autoPrependBlock();
  39540. $this->writeln(array(
  39541. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  39542. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  39543. ));
  39544. $this->newLine();
  39545. }
  39546. public function listing(array $elements)
  39547. {
  39548. $this->autoPrependText();
  39549. $elements = array_map(function ($element) {
  39550. return sprintf(' * %s', $element);
  39551. }, $elements);
  39552. $this->writeln($elements);
  39553. $this->newLine();
  39554. }
  39555. public function text($message)
  39556. {
  39557. $this->autoPrependText();
  39558. $messages = \is_array($message) ? array_values($message) : array($message);
  39559. foreach ($messages as $message) {
  39560. $this->writeln(sprintf(' %s', $message));
  39561. }
  39562. }
  39563. public function comment($message)
  39564. {
  39565. $messages = \is_array($message) ? array_values($message) : array($message);
  39566. $this->autoPrependBlock();
  39567. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  39568. $this->newLine();
  39569. }
  39570. public function success($message)
  39571. {
  39572. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  39573. }
  39574. public function error($message)
  39575. {
  39576. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  39577. }
  39578. public function warning($message)
  39579. {
  39580. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  39581. }
  39582. public function note($message)
  39583. {
  39584. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  39585. }
  39586. public function caution($message)
  39587. {
  39588. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  39589. }
  39590. public function table(array $headers, array $rows)
  39591. {
  39592. $style = clone Table::getStyleDefinition('symfony-style-guide');
  39593. $style->setCellHeaderFormat('<info>%s</info>');
  39594. $table = new Table($this);
  39595. $table->setHeaders($headers);
  39596. $table->setRows($rows);
  39597. $table->setStyle($style);
  39598. $table->render();
  39599. $this->newLine();
  39600. }
  39601. public function ask($question, $default = null, $validator = null)
  39602. {
  39603. $question = new Question($question, $default);
  39604. $question->setValidator($validator);
  39605. return $this->askQuestion($question);
  39606. }
  39607. public function askHidden($question, $validator = null)
  39608. {
  39609. $question = new Question($question);
  39610. $question->setHidden(true);
  39611. $question->setValidator($validator);
  39612. return $this->askQuestion($question);
  39613. }
  39614. public function confirm($question, $default = true)
  39615. {
  39616. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  39617. }
  39618. public function choice($question, array $choices, $default = null)
  39619. {
  39620. if (null !== $default) {
  39621. $values = array_flip($choices);
  39622. $default = $values[$default];
  39623. }
  39624. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  39625. }
  39626. public function progressStart($max = 0)
  39627. {
  39628. $this->progressBar = $this->createProgressBar($max);
  39629. $this->progressBar->start();
  39630. }
  39631. public function progressAdvance($step = 1)
  39632. {
  39633. $this->getProgressBar()->advance($step);
  39634. }
  39635. public function progressFinish()
  39636. {
  39637. $this->getProgressBar()->finish();
  39638. $this->newLine(2);
  39639. $this->progressBar = null;
  39640. }
  39641. public function createProgressBar($max = 0)
  39642. {
  39643. $progressBar = parent::createProgressBar($max);
  39644. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  39645. $progressBar->setEmptyBarCharacter('â–‘');
  39646. $progressBar->setProgressCharacter('');
  39647. $progressBar->setBarCharacter('â–“');
  39648. }
  39649. return $progressBar;
  39650. }
  39651. public function askQuestion(Question $question)
  39652. {
  39653. if ($this->input->isInteractive()) {
  39654. $this->autoPrependBlock();
  39655. }
  39656. if (!$this->questionHelper) {
  39657. $this->questionHelper = new SymfonyQuestionHelper();
  39658. }
  39659. $answer = $this->questionHelper->ask($this->input, $this, $question);
  39660. if ($this->input->isInteractive()) {
  39661. $this->newLine();
  39662. $this->bufferedOutput->write("\n");
  39663. }
  39664. return $answer;
  39665. }
  39666. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  39667. {
  39668. parent::writeln($messages, $type);
  39669. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  39670. }
  39671. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  39672. {
  39673. parent::write($messages, $newline, $type);
  39674. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  39675. }
  39676. public function newLine($count = 1)
  39677. {
  39678. parent::newLine($count);
  39679. $this->bufferedOutput->write(str_repeat("\n", $count));
  39680. }
  39681. private function getProgressBar()
  39682. {
  39683. if (!$this->progressBar) {
  39684. throw new RuntimeException('The ProgressBar is not started.');
  39685. }
  39686. return $this->progressBar;
  39687. }
  39688. private function getTerminalWidth()
  39689. {
  39690. $application = new Application();
  39691. $dimensions = $application->getTerminalDimensions();
  39692. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  39693. }
  39694. private function autoPrependBlock()
  39695. {
  39696. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  39697. if (!isset($chars[0])) {
  39698. return $this->newLine();
  39699. }
  39700. $this->newLine(2 - substr_count($chars, "\n"));
  39701. }
  39702. private function autoPrependText()
  39703. {
  39704. $fetched = $this->bufferedOutput->fetch();
  39705. if ("\n" !== substr($fetched, -1)) {
  39706. $this->newLine();
  39707. }
  39708. }
  39709. private function reduceBuffer($messages)
  39710. {
  39711. return array_map(function ($value) {
  39712. return substr($value, -4);
  39713. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  39714. }
  39715. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  39716. {
  39717. $indentLength = 0;
  39718. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  39719. $lines = array();
  39720. if (null !== $type) {
  39721. $type = sprintf('[%s] ', $type);
  39722. $indentLength = \strlen($type);
  39723. $lineIndentation = str_repeat(' ', $indentLength);
  39724. }
  39725. foreach ($messages as $key => $message) {
  39726. if ($escape) {
  39727. $message = OutputFormatter::escape($message);
  39728. }
  39729. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  39730. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  39731. $lines[] = '';
  39732. }
  39733. }
  39734. $firstLineIndex = 0;
  39735. if ($padding && $this->isDecorated()) {
  39736. $firstLineIndex = 1;
  39737. array_unshift($lines, '');
  39738. $lines[] = '';
  39739. }
  39740. foreach ($lines as $i => &$line) {
  39741. if (null !== $type) {
  39742. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  39743. }
  39744. $line = $prefix.$line;
  39745. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  39746. if ($style) {
  39747. $line = sprintf('<%s>%s</>', $style, $line);
  39748. }
  39749. }
  39750. return $lines;
  39751. }
  39752. }
  39753. <?php
  39754. namespace Symfony\Component\Console\Tester;
  39755. use Symfony\Component\Console\Application;
  39756. use Symfony\Component\Console\Input\ArrayInput;
  39757. use Symfony\Component\Console\Input\InputInterface;
  39758. use Symfony\Component\Console\Output\OutputInterface;
  39759. use Symfony\Component\Console\Output\StreamOutput;
  39760. class ApplicationTester
  39761. {
  39762. private $application;
  39763. private $input;
  39764. private $output;
  39765. private $statusCode;
  39766. public function __construct(Application $application)
  39767. {
  39768. $this->application = $application;
  39769. }
  39770. public function run(array $input, $options = array())
  39771. {
  39772. $this->input = new ArrayInput($input);
  39773. if (isset($options['interactive'])) {
  39774. $this->input->setInteractive($options['interactive']);
  39775. }
  39776. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39777. if (isset($options['decorated'])) {
  39778. $this->output->setDecorated($options['decorated']);
  39779. }
  39780. if (isset($options['verbosity'])) {
  39781. $this->output->setVerbosity($options['verbosity']);
  39782. }
  39783. return $this->statusCode = $this->application->run($this->input, $this->output);
  39784. }
  39785. public function getDisplay($normalize = false)
  39786. {
  39787. rewind($this->output->getStream());
  39788. $display = stream_get_contents($this->output->getStream());
  39789. if ($normalize) {
  39790. $display = str_replace(PHP_EOL, "\n", $display);
  39791. }
  39792. return $display;
  39793. }
  39794. public function getInput()
  39795. {
  39796. return $this->input;
  39797. }
  39798. public function getOutput()
  39799. {
  39800. return $this->output;
  39801. }
  39802. public function getStatusCode()
  39803. {
  39804. return $this->statusCode;
  39805. }
  39806. }
  39807. <?php
  39808. namespace Symfony\Component\Console\Tester;
  39809. use Symfony\Component\Console\Command\Command;
  39810. use Symfony\Component\Console\Input\ArrayInput;
  39811. use Symfony\Component\Console\Input\InputInterface;
  39812. use Symfony\Component\Console\Output\OutputInterface;
  39813. use Symfony\Component\Console\Output\StreamOutput;
  39814. class CommandTester
  39815. {
  39816. private $command;
  39817. private $input;
  39818. private $output;
  39819. private $statusCode;
  39820. public function __construct(Command $command)
  39821. {
  39822. $this->command = $command;
  39823. }
  39824. public function execute(array $input, array $options = array())
  39825. {
  39826. if (!isset($input['command'])
  39827. && (null !== $application = $this->command->getApplication())
  39828. && $application->getDefinition()->hasArgument('command')
  39829. ) {
  39830. $input = array_merge(array('command' => $this->command->getName()), $input);
  39831. }
  39832. $this->input = new ArrayInput($input);
  39833. if (isset($options['interactive'])) {
  39834. $this->input->setInteractive($options['interactive']);
  39835. }
  39836. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  39837. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  39838. if (isset($options['verbosity'])) {
  39839. $this->output->setVerbosity($options['verbosity']);
  39840. }
  39841. return $this->statusCode = $this->command->run($this->input, $this->output);
  39842. }
  39843. public function getDisplay($normalize = false)
  39844. {
  39845. rewind($this->output->getStream());
  39846. $display = stream_get_contents($this->output->getStream());
  39847. if ($normalize) {
  39848. $display = str_replace(PHP_EOL, "\n", $display);
  39849. }
  39850. return $display;
  39851. }
  39852. public function getInput()
  39853. {
  39854. return $this->input;
  39855. }
  39856. public function getOutput()
  39857. {
  39858. return $this->output;
  39859. }
  39860. public function getStatusCode()
  39861. {
  39862. return $this->statusCode;
  39863. }
  39864. }
  39865. <?php
  39866. namespace Symfony\Component\Debug;
  39867. use Psr\Log\AbstractLogger;
  39868. class BufferingLogger extends AbstractLogger
  39869. {
  39870. private $logs = array();
  39871. public function log($level, $message, array $context = array())
  39872. {
  39873. $this->logs[] = array($level, $message, $context);
  39874. }
  39875. public function cleanLogs()
  39876. {
  39877. $logs = $this->logs;
  39878. $this->logs = array();
  39879. return $logs;
  39880. }
  39881. }
  39882. <?php
  39883. namespace Symfony\Component\Debug;
  39884. class Debug
  39885. {
  39886. private static $enabled = false;
  39887. public static function enable($errorReportingLevel = null, $displayErrors = true)
  39888. {
  39889. if (static::$enabled) {
  39890. return;
  39891. }
  39892. static::$enabled = true;
  39893. if (null !== $errorReportingLevel) {
  39894. error_reporting($errorReportingLevel);
  39895. } else {
  39896. error_reporting(-1);
  39897. }
  39898. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  39899. ini_set('display_errors', 0);
  39900. ExceptionHandler::register();
  39901. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  39902. ini_set('display_errors', 1);
  39903. }
  39904. if ($displayErrors) {
  39905. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  39906. } else {
  39907. ErrorHandler::register()->throwAt(0, true);
  39908. }
  39909. DebugClassLoader::enable();
  39910. }
  39911. }
  39912. <?php
  39913. namespace Symfony\Component\Debug;
  39914. class DebugClassLoader
  39915. {
  39916. private $classLoader;
  39917. private $isFinder;
  39918. private $loaded = array();
  39919. private $wasFinder;
  39920. private static $caseCheck;
  39921. private static $deprecated = array();
  39922. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  39923. private static $darwinCache = array('/' => array('/', array()));
  39924. public function __construct($classLoader)
  39925. {
  39926. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  39927. if ($this->wasFinder) {
  39928. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  39929. $this->classLoader = array($classLoader, 'loadClass');
  39930. $this->isFinder = true;
  39931. } else {
  39932. $this->classLoader = $classLoader;
  39933. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  39934. }
  39935. if (!isset(self::$caseCheck)) {
  39936. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  39937. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  39938. $dir = substr($file, 0, 1 + $i);
  39939. $file = substr($file, 1 + $i);
  39940. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  39941. $test = realpath($dir.$test);
  39942. if (false === $test || false === $i) {
  39943. self::$caseCheck = 0;
  39944. } elseif (substr($test, -\strlen($file)) === $file) {
  39945. self::$caseCheck = 1;
  39946. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  39947. self::$caseCheck = 2;
  39948. } else {
  39949. self::$caseCheck = 0;
  39950. }
  39951. }
  39952. }
  39953. public function getClassLoader()
  39954. {
  39955. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  39956. }
  39957. public static function enable()
  39958. {
  39959. class_exists('Symfony\Component\Debug\ErrorHandler');
  39960. class_exists('Psr\Log\LogLevel');
  39961. if (!\is_array($functions = spl_autoload_functions())) {
  39962. return;
  39963. }
  39964. foreach ($functions as $function) {
  39965. spl_autoload_unregister($function);
  39966. }
  39967. foreach ($functions as $function) {
  39968. if (!\is_array($function) || !$function[0] instanceof self) {
  39969. $function = array(new static($function), 'loadClass');
  39970. }
  39971. spl_autoload_register($function);
  39972. }
  39973. }
  39974. public static function disable()
  39975. {
  39976. if (!\is_array($functions = spl_autoload_functions())) {
  39977. return;
  39978. }
  39979. foreach ($functions as $function) {
  39980. spl_autoload_unregister($function);
  39981. }
  39982. foreach ($functions as $function) {
  39983. if (\is_array($function) && $function[0] instanceof self) {
  39984. $function = $function[0]->getClassLoader();
  39985. }
  39986. spl_autoload_register($function);
  39987. }
  39988. }
  39989. public function findFile($class)
  39990. {
  39991. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39992. if ($this->wasFinder) {
  39993. return $this->classLoader[0]->findFile($class);
  39994. }
  39995. }
  39996. public function loadClass($class)
  39997. {
  39998. ErrorHandler::stackErrors();
  39999. try {
  40000. if ($this->isFinder && !isset($this->loaded[$class])) {
  40001. $this->loaded[$class] = true;
  40002. if ($file = $this->classLoader[0]->findFile($class)) {
  40003. require $file;
  40004. }
  40005. } else {
  40006. \call_user_func($this->classLoader, $class);
  40007. $file = false;
  40008. }
  40009. } catch (\Exception $e) {
  40010. ErrorHandler::unstackErrors();
  40011. throw $e;
  40012. } catch (\Throwable $e) {
  40013. ErrorHandler::unstackErrors();
  40014. throw $e;
  40015. }
  40016. ErrorHandler::unstackErrors();
  40017. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  40018. if ($class && '\\' === $class[0]) {
  40019. $class = substr($class, 1);
  40020. }
  40021. if ($exists) {
  40022. $refl = new \ReflectionClass($class);
  40023. $name = $refl->getName();
  40024. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  40025. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  40026. }
  40027. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  40028. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  40029. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  40030. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  40031. } else {
  40032. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  40033. $len = 0;
  40034. $ns = '';
  40035. } else {
  40036. $ns = substr($name, 0, $len);
  40037. }
  40038. $parent = get_parent_class($class);
  40039. if (!$parent || strncmp($ns, $parent, $len)) {
  40040. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  40041. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  40042. }
  40043. $parentInterfaces = array();
  40044. $deprecatedInterfaces = array();
  40045. if ($parent) {
  40046. foreach (class_implements($parent) as $interface) {
  40047. $parentInterfaces[$interface] = 1;
  40048. }
  40049. }
  40050. foreach ($refl->getInterfaceNames() as $interface) {
  40051. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  40052. $deprecatedInterfaces[] = $interface;
  40053. }
  40054. foreach (class_implements($interface) as $interface) {
  40055. $parentInterfaces[$interface] = 1;
  40056. }
  40057. }
  40058. foreach ($deprecatedInterfaces as $interface) {
  40059. if (!isset($parentInterfaces[$interface])) {
  40060. @trigger_error(sprintf('The %s %s %s that is deprecated %s', $name, $refl->isInterface() ? 'interface extends' : 'class implements', $interface, self::$deprecated[$interface]), E_USER_DEPRECATED);
  40061. }
  40062. }
  40063. }
  40064. }
  40065. }
  40066. if ($file) {
  40067. if (!$exists) {
  40068. if (false !== strpos($class, '/')) {
  40069. throw new \RuntimeException(sprintf('Trying to autoload a class with an invalid name "%s". Be careful that the namespace separator is "\" in PHP, not "/".', $class));
  40070. }
  40071. throw new \RuntimeException(sprintf('The autoloader expected class "%s" to be defined in file "%s". The file was found but the class was not in it, the class name or namespace probably has a typo.', $class, $file));
  40072. }
  40073. if (self::$caseCheck) {
  40074. $real = explode('\\', $class.strrchr($file, '.'));
  40075. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  40076. $i = \count($tail) - 1;
  40077. $j = \count($real) - 1;
  40078. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  40079. --$i;
  40080. --$j;
  40081. }
  40082. array_splice($tail, 0, $i + 1);
  40083. }
  40084. if (self::$caseCheck && $tail) {
  40085. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  40086. $tailLen = \strlen($tail);
  40087. $real = $refl->getFileName();
  40088. if (2 === self::$caseCheck) {
  40089. $i = 1 + strrpos($real, '/');
  40090. $file = substr($real, $i);
  40091. $real = substr($real, 0, $i);
  40092. if (isset(self::$darwinCache[$real])) {
  40093. $kDir = $real;
  40094. } else {
  40095. $kDir = strtolower($real);
  40096. if (isset(self::$darwinCache[$kDir])) {
  40097. $real = self::$darwinCache[$kDir][0];
  40098. } else {
  40099. $dir = getcwd();
  40100. chdir($real);
  40101. $real = getcwd().'/';
  40102. chdir($dir);
  40103. $dir = $real;
  40104. $k = $kDir;
  40105. $i = \strlen($dir) - 1;
  40106. while (!isset(self::$darwinCache[$k])) {
  40107. self::$darwinCache[$k] = array($dir, array());
  40108. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  40109. while ('/' !== $dir[--$i]) {
  40110. }
  40111. $k = substr($k, 0, ++$i);
  40112. $dir = substr($dir, 0, $i--);
  40113. }
  40114. }
  40115. }
  40116. $dirFiles = self::$darwinCache[$kDir][1];
  40117. if (isset($dirFiles[$file])) {
  40118. $kFile = $file;
  40119. } else {
  40120. $kFile = strtolower($file);
  40121. if (!isset($dirFiles[$kFile])) {
  40122. foreach (scandir($real, 2) as $f) {
  40123. if ('.' !== $f[0]) {
  40124. $dirFiles[$f] = $f;
  40125. if ($f === $file) {
  40126. $kFile = $k = $file;
  40127. } elseif ($f !== $k = strtolower($f)) {
  40128. $dirFiles[$k] = $f;
  40129. }
  40130. }
  40131. }
  40132. self::$darwinCache[$kDir][1] = $dirFiles;
  40133. }
  40134. }
  40135. $real .= $dirFiles[$kFile];
  40136. }
  40137. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  40138. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  40139. ) {
  40140. throw new \RuntimeException(sprintf('Case mismatch between class and real file names: %s vs %s in %s', substr($tail, -$tailLen + 1), substr($real, -$tailLen + 1), substr($real, 0, -$tailLen + 1)));
  40141. }
  40142. }
  40143. return true;
  40144. }
  40145. }
  40146. }
  40147. <?php
  40148. namespace Symfony\Component\Debug;
  40149. use Psr\Log\LoggerInterface;
  40150. use Psr\Log\LogLevel;
  40151. use Symfony\Component\Debug\Exception\ContextErrorException;
  40152. use Symfony\Component\Debug\Exception\FatalErrorException;
  40153. use Symfony\Component\Debug\Exception\FatalThrowableError;
  40154. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  40155. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  40156. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  40157. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  40158. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  40159. class ErrorHandler
  40160. {
  40161. const TYPE_DEPRECATION = -100;
  40162. private $levels = array(
  40163. E_DEPRECATED => 'Deprecated',
  40164. E_USER_DEPRECATED => 'User Deprecated',
  40165. E_NOTICE => 'Notice',
  40166. E_USER_NOTICE => 'User Notice',
  40167. E_STRICT => 'Runtime Notice',
  40168. E_WARNING => 'Warning',
  40169. E_USER_WARNING => 'User Warning',
  40170. E_COMPILE_WARNING => 'Compile Warning',
  40171. E_CORE_WARNING => 'Core Warning',
  40172. E_USER_ERROR => 'User Error',
  40173. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  40174. E_COMPILE_ERROR => 'Compile Error',
  40175. E_PARSE => 'Parse Error',
  40176. E_ERROR => 'Error',
  40177. E_CORE_ERROR => 'Core Error',
  40178. );
  40179. private $loggers = array(
  40180. E_DEPRECATED => array(null, LogLevel::INFO),
  40181. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  40182. E_NOTICE => array(null, LogLevel::WARNING),
  40183. E_USER_NOTICE => array(null, LogLevel::WARNING),
  40184. E_STRICT => array(null, LogLevel::WARNING),
  40185. E_WARNING => array(null, LogLevel::WARNING),
  40186. E_USER_WARNING => array(null, LogLevel::WARNING),
  40187. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  40188. E_CORE_WARNING => array(null, LogLevel::WARNING),
  40189. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  40190. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  40191. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  40192. E_PARSE => array(null, LogLevel::CRITICAL),
  40193. E_ERROR => array(null, LogLevel::CRITICAL),
  40194. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  40195. );
  40196. private $thrownErrors = 0x1FFF;
  40197. private $scopedErrors = 0x1FFF;
  40198. private $tracedErrors = 0x77FB;
  40199. private $screamedErrors = 0x55;
  40200. private $loggedErrors = 0;
  40201. private $loggedTraces = array();
  40202. private $isRecursive = 0;
  40203. private $isRoot = false;
  40204. private $exceptionHandler;
  40205. private $bootstrappingLogger;
  40206. private static $reservedMemory;
  40207. private static $stackedErrors = array();
  40208. private static $stackedErrorLevels = array();
  40209. private static $toStringException = null;
  40210. private static $exitCode = 0;
  40211. private $displayErrors = 0x1FFF;
  40212. public static function register($handler = null, $replace = true)
  40213. {
  40214. if (null === self::$reservedMemory) {
  40215. self::$reservedMemory = str_repeat('x', 10240);
  40216. register_shutdown_function(__CLASS__.'::handleFatalError');
  40217. }
  40218. $levels = -1;
  40219. if ($handlerIsNew = !$handler instanceof self) {
  40220. if (null !== $handler) {
  40221. $levels = $replace ? $handler : 0;
  40222. $replace = true;
  40223. }
  40224. $handler = new static();
  40225. }
  40226. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  40227. restore_error_handler();
  40228. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  40229. $handler->isRoot = true;
  40230. }
  40231. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  40232. $handler = $prev[0];
  40233. $replace = false;
  40234. }
  40235. if (!$replace && $prev) {
  40236. restore_error_handler();
  40237. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  40238. } else {
  40239. $handlerIsRegistered = true;
  40240. }
  40241. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  40242. restore_exception_handler();
  40243. if (!$handlerIsRegistered) {
  40244. $handler = $prev[0];
  40245. } elseif ($handler !== $prev[0] && $replace) {
  40246. set_exception_handler(array($handler, 'handleException'));
  40247. $p = $prev[0]->setExceptionHandler(null);
  40248. $handler->setExceptionHandler($p);
  40249. $prev[0]->setExceptionHandler($p);
  40250. }
  40251. } else {
  40252. $handler->setExceptionHandler($prev);
  40253. }
  40254. $handler->throwAt($levels & $handler->thrownErrors, true);
  40255. return $handler;
  40256. }
  40257. public function __construct(BufferingLogger $bootstrappingLogger = null)
  40258. {
  40259. if ($bootstrappingLogger) {
  40260. $this->bootstrappingLogger = $bootstrappingLogger;
  40261. $this->setDefaultLogger($bootstrappingLogger);
  40262. }
  40263. }
  40264. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  40265. {
  40266. $loggers = array();
  40267. if (\is_array($levels)) {
  40268. foreach ($levels as $type => $logLevel) {
  40269. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  40270. $loggers[$type] = array($logger, $logLevel);
  40271. }
  40272. }
  40273. } else {
  40274. if (null === $levels) {
  40275. $levels = E_ALL | E_STRICT;
  40276. }
  40277. foreach ($this->loggers as $type => $log) {
  40278. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  40279. $log[0] = $logger;
  40280. $loggers[$type] = $log;
  40281. }
  40282. }
  40283. }
  40284. $this->setLoggers($loggers);
  40285. }
  40286. public function setLoggers(array $loggers)
  40287. {
  40288. $prevLogged = $this->loggedErrors;
  40289. $prev = $this->loggers;
  40290. $flush = array();
  40291. foreach ($loggers as $type => $log) {
  40292. if (!isset($prev[$type])) {
  40293. throw new \InvalidArgumentException('Unknown error type: '.$type);
  40294. }
  40295. if (!\is_array($log)) {
  40296. $log = array($log);
  40297. } elseif (!array_key_exists(0, $log)) {
  40298. throw new \InvalidArgumentException('No logger provided');
  40299. }
  40300. if (null === $log[0]) {
  40301. $this->loggedErrors &= ~$type;
  40302. } elseif ($log[0] instanceof LoggerInterface) {
  40303. $this->loggedErrors |= $type;
  40304. } else {
  40305. throw new \InvalidArgumentException('Invalid logger provided');
  40306. }
  40307. $this->loggers[$type] = $log + $prev[$type];
  40308. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  40309. $flush[$type] = $type;
  40310. }
  40311. }
  40312. $this->reRegister($prevLogged | $this->thrownErrors);
  40313. if ($flush) {
  40314. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  40315. $type = $log[2]['type'];
  40316. if (!isset($flush[$type])) {
  40317. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  40318. } elseif ($this->loggers[$type][0]) {
  40319. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  40320. }
  40321. }
  40322. }
  40323. return $prev;
  40324. }
  40325. public function setExceptionHandler($handler)
  40326. {
  40327. if (null !== $handler && !\is_callable($handler)) {
  40328. throw new \LogicException('The exception handler must be a valid PHP callable.');
  40329. }
  40330. $prev = $this->exceptionHandler;
  40331. $this->exceptionHandler = $handler;
  40332. return $prev;
  40333. }
  40334. public function throwAt($levels, $replace = false)
  40335. {
  40336. $prev = $this->thrownErrors;
  40337. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  40338. if (!$replace) {
  40339. $this->thrownErrors |= $prev;
  40340. }
  40341. $this->reRegister($prev | $this->loggedErrors);
  40342. $this->displayErrors = $this->thrownErrors;
  40343. return $prev;
  40344. }
  40345. public function scopeAt($levels, $replace = false)
  40346. {
  40347. $prev = $this->scopedErrors;
  40348. $this->scopedErrors = (int) $levels;
  40349. if (!$replace) {
  40350. $this->scopedErrors |= $prev;
  40351. }
  40352. return $prev;
  40353. }
  40354. public function traceAt($levels, $replace = false)
  40355. {
  40356. $prev = $this->tracedErrors;
  40357. $this->tracedErrors = (int) $levels;
  40358. if (!$replace) {
  40359. $this->tracedErrors |= $prev;
  40360. }
  40361. return $prev;
  40362. }
  40363. public function screamAt($levels, $replace = false)
  40364. {
  40365. $prev = $this->screamedErrors;
  40366. $this->screamedErrors = (int) $levels;
  40367. if (!$replace) {
  40368. $this->screamedErrors |= $prev;
  40369. }
  40370. return $prev;
  40371. }
  40372. private function reRegister($prev)
  40373. {
  40374. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  40375. $handler = set_error_handler('var_dump');
  40376. $handler = \is_array($handler) ? $handler[0] : null;
  40377. restore_error_handler();
  40378. if ($handler === $this) {
  40379. restore_error_handler();
  40380. if ($this->isRoot) {
  40381. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  40382. } else {
  40383. set_error_handler(array($this, 'handleError'));
  40384. }
  40385. }
  40386. }
  40387. }
  40388. public function handleError($type, $message, $file, $line)
  40389. {
  40390. $level = error_reporting();
  40391. $silenced = 0 === ($level & $type);
  40392. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  40393. $log = $this->loggedErrors & $type;
  40394. $throw = $this->thrownErrors & $type & $level;
  40395. $type &= $level | $this->screamedErrors;
  40396. if (!$type || (!$log && !$throw)) {
  40397. return !$silenced && $type && $log;
  40398. }
  40399. $scope = $this->scopedErrors & $type;
  40400. if (4 < $numArgs = \func_num_args()) {
  40401. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  40402. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  40403. } else {
  40404. $context = array();
  40405. $backtrace = null;
  40406. }
  40407. if (isset($context['GLOBALS']) && $scope) {
  40408. $e = $context;
  40409. unset($e['GLOBALS'], $context);
  40410. $context = $e;
  40411. }
  40412. if (null !== $backtrace && $type & E_ERROR) {
  40413. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  40414. return true;
  40415. }
  40416. if ($throw) {
  40417. if (null !== self::$toStringException) {
  40418. $throw = self::$toStringException;
  40419. self::$toStringException = null;
  40420. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  40421. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  40422. } else {
  40423. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  40424. }
  40425. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  40426. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  40427. }
  40428. if (E_USER_ERROR & $type) {
  40429. $backtrace = $backtrace ?: $throw->getTrace();
  40430. for ($i = 1; isset($backtrace[$i]); ++$i) {
  40431. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  40432. && '__toString' === $backtrace[$i]['function']
  40433. && '->' === $backtrace[$i]['type']
  40434. && !isset($backtrace[$i - 1]['class'])
  40435. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  40436. ) {
  40437. foreach ($context as $e) {
  40438. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  40439. if (1 === $i) {
  40440. $throw = $e;
  40441. break;
  40442. }
  40443. self::$toStringException = $e;
  40444. return true;
  40445. }
  40446. }
  40447. if (1 < $i) {
  40448. $this->handleException($throw);
  40449. return false;
  40450. }
  40451. }
  40452. }
  40453. }
  40454. throw $throw;
  40455. }
  40456. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  40457. $trace = true;
  40458. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  40459. $trace = false;
  40460. } else {
  40461. $this->loggedTraces[$e] = 1;
  40462. }
  40463. $e = compact('type', 'file', 'line', 'level');
  40464. if ($type & $level) {
  40465. if ($scope) {
  40466. $e['scope_vars'] = $context;
  40467. if ($trace) {
  40468. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  40469. }
  40470. } elseif ($trace) {
  40471. if (null === $backtrace) {
  40472. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  40473. } else {
  40474. foreach ($backtrace as &$frame) {
  40475. unset($frame['args'], $frame);
  40476. }
  40477. $e['stack'] = $backtrace;
  40478. }
  40479. }
  40480. }
  40481. if ($this->isRecursive) {
  40482. $log = 0;
  40483. } elseif (self::$stackedErrorLevels) {
  40484. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40485. } else {
  40486. try {
  40487. $this->isRecursive = true;
  40488. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  40489. $this->isRecursive = false;
  40490. } catch (\Exception $e) {
  40491. $this->isRecursive = false;
  40492. throw $e;
  40493. } catch (\Throwable $e) {
  40494. $this->isRecursive = false;
  40495. throw $e;
  40496. }
  40497. }
  40498. return !$silenced && $type && $log;
  40499. }
  40500. public function handleException($exception, array $error = null)
  40501. {
  40502. if (null === $error) {
  40503. self::$exitCode = 255;
  40504. }
  40505. if (!$exception instanceof \Exception) {
  40506. $exception = new FatalThrowableError($exception);
  40507. }
  40508. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  40509. $handlerException = null;
  40510. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  40511. $e = array(
  40512. 'type' => $type,
  40513. 'file' => $exception->getFile(),
  40514. 'line' => $exception->getLine(),
  40515. 'level' => error_reporting(),
  40516. 'stack' => $exception->getTrace(),
  40517. );
  40518. if ($exception instanceof FatalErrorException) {
  40519. if ($exception instanceof FatalThrowableError) {
  40520. $error = array(
  40521. 'type' => $type,
  40522. 'message' => $message = $exception->getMessage(),
  40523. 'file' => $e['file'],
  40524. 'line' => $e['line'],
  40525. );
  40526. } else {
  40527. $message = 'Fatal '.$exception->getMessage();
  40528. }
  40529. } elseif ($exception instanceof \ErrorException) {
  40530. $message = 'Uncaught '.$exception->getMessage();
  40531. if ($exception instanceof ContextErrorException) {
  40532. $e['context'] = $exception->getContext();
  40533. }
  40534. } else {
  40535. $message = 'Uncaught Exception: '.$exception->getMessage();
  40536. }
  40537. }
  40538. if ($this->loggedErrors & $type) {
  40539. try {
  40540. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  40541. } catch (\Exception $handlerException) {
  40542. } catch (\Throwable $handlerException) {
  40543. }
  40544. }
  40545. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  40546. foreach ($this->getFatalErrorHandlers() as $handler) {
  40547. if ($e = $handler->handleError($error, $exception)) {
  40548. $exception = $e;
  40549. break;
  40550. }
  40551. }
  40552. }
  40553. $exceptionHandler = $this->exceptionHandler;
  40554. $this->exceptionHandler = null;
  40555. try {
  40556. if (null !== $exceptionHandler) {
  40557. return \call_user_func($exceptionHandler, $exception);
  40558. }
  40559. $handlerException = $handlerException ?: $exception;
  40560. } catch (\Exception $handlerException) {
  40561. } catch (\Throwable $handlerException) {
  40562. }
  40563. if ($exception === $handlerException) {
  40564. self::$reservedMemory = null;
  40565. throw $exception;
  40566. }
  40567. $this->handleException($handlerException);
  40568. }
  40569. public static function handleFatalError(array $error = null)
  40570. {
  40571. if (null === self::$reservedMemory) {
  40572. return;
  40573. }
  40574. $handler = self::$reservedMemory = null;
  40575. $handlers = array();
  40576. $previousHandler = null;
  40577. $sameHandlerLimit = 10;
  40578. while (!\is_array($handler) || !$handler[0] instanceof self) {
  40579. $handler = set_exception_handler('var_dump');
  40580. restore_exception_handler();
  40581. if (!$handler) {
  40582. break;
  40583. }
  40584. restore_exception_handler();
  40585. if ($handler !== $previousHandler) {
  40586. array_unshift($handlers, $handler);
  40587. $previousHandler = $handler;
  40588. } elseif (0 === --$sameHandlerLimit) {
  40589. $handler = null;
  40590. break;
  40591. }
  40592. }
  40593. foreach ($handlers as $h) {
  40594. set_exception_handler($h);
  40595. }
  40596. if (!$handler) {
  40597. return;
  40598. }
  40599. if ($handler !== $h) {
  40600. $handler[0]->setExceptionHandler($h);
  40601. }
  40602. $handler = $handler[0];
  40603. $handlers = array();
  40604. if ($exit = null === $error) {
  40605. $error = error_get_last();
  40606. }
  40607. try {
  40608. while (self::$stackedErrorLevels) {
  40609. static::unstackErrors();
  40610. }
  40611. } catch (\Exception $exception) {
  40612. } catch (\Throwable $exception) {
  40613. }
  40614. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  40615. $handler->throwAt(0, true);
  40616. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  40617. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  40618. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  40619. } else {
  40620. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  40621. }
  40622. }
  40623. try {
  40624. if (isset($exception)) {
  40625. self::$exitCode = 255;
  40626. $handler->handleException($exception, $error);
  40627. }
  40628. } catch (FatalErrorException $e) {
  40629. }
  40630. if ($exit && self::$exitCode) {
  40631. $exitCode = self::$exitCode;
  40632. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  40633. }
  40634. }
  40635. public static function stackErrors()
  40636. {
  40637. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40638. }
  40639. public static function unstackErrors()
  40640. {
  40641. $level = array_pop(self::$stackedErrorLevels);
  40642. if (null !== $level) {
  40643. $e = error_reporting($level);
  40644. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  40645. error_reporting($e);
  40646. }
  40647. }
  40648. if (empty(self::$stackedErrorLevels)) {
  40649. $errors = self::$stackedErrors;
  40650. self::$stackedErrors = array();
  40651. foreach ($errors as $e) {
  40652. $e[0]->log($e[1], $e[2], $e[3]);
  40653. }
  40654. }
  40655. }
  40656. protected function getFatalErrorHandlers()
  40657. {
  40658. return array(
  40659. new UndefinedFunctionFatalErrorHandler(),
  40660. new UndefinedMethodFatalErrorHandler(),
  40661. new ClassNotFoundFatalErrorHandler(),
  40662. );
  40663. }
  40664. public function setLevel($level)
  40665. {
  40666. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40667. $level = null === $level ? error_reporting() : $level;
  40668. $this->throwAt($level, true);
  40669. }
  40670. public function setDisplayErrors($displayErrors)
  40671. {
  40672. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the throwAt() method instead.', E_USER_DEPRECATED);
  40673. if ($displayErrors) {
  40674. $this->throwAt($this->displayErrors, true);
  40675. } else {
  40676. $displayErrors = $this->displayErrors;
  40677. $this->throwAt(0, true);
  40678. $this->displayErrors = $displayErrors;
  40679. }
  40680. }
  40681. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  40682. {
  40683. @trigger_error('The '.__METHOD__.' static method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the setLoggers() or setDefaultLogger() methods instead.', E_USER_DEPRECATED);
  40684. $handler = set_error_handler('var_dump');
  40685. $handler = \is_array($handler) ? $handler[0] : null;
  40686. restore_error_handler();
  40687. if (!$handler instanceof self) {
  40688. return;
  40689. }
  40690. if ('deprecation' === $channel) {
  40691. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  40692. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  40693. } elseif ('scream' === $channel) {
  40694. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  40695. $handler->screamAt(E_ALL | E_STRICT);
  40696. } elseif ('emergency' === $channel) {
  40697. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  40698. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  40699. }
  40700. }
  40701. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  40702. {
  40703. $this->handleError(E_USER_DEPRECATED, 'The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleError() method instead.', __FILE__, __LINE__, array());
  40704. return $this->handleError($level, $message, $file, $line, (array) $context);
  40705. }
  40706. public function handleFatal()
  40707. {
  40708. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.6 and will be removed in 3.0. Use the handleFatalError() method instead.', E_USER_DEPRECATED);
  40709. static::handleFatalError();
  40710. }
  40711. }
  40712. class ErrorHandlerCanary
  40713. {
  40714. private static $displayErrors = null;
  40715. public function __construct()
  40716. {
  40717. if (null === self::$displayErrors) {
  40718. self::$displayErrors = ini_set('display_errors', 1);
  40719. }
  40720. }
  40721. public function __destruct()
  40722. {
  40723. if (null !== self::$displayErrors) {
  40724. ini_set('display_errors', self::$displayErrors);
  40725. self::$displayErrors = null;
  40726. }
  40727. }
  40728. }
  40729. <?php
  40730. namespace Symfony\Component\Debug\Exception;
  40731. class ClassNotFoundException extends FatalErrorException
  40732. {
  40733. public function __construct($message, \ErrorException $previous)
  40734. {
  40735. parent::__construct(
  40736. $message,
  40737. $previous->getCode(),
  40738. $previous->getSeverity(),
  40739. $previous->getFile(),
  40740. $previous->getLine(),
  40741. null,
  40742. true,
  40743. null,
  40744. $previous->getPrevious()
  40745. );
  40746. $this->setTrace($previous->getTrace());
  40747. }
  40748. }
  40749. <?php
  40750. namespace Symfony\Component\Debug\Exception;
  40751. class ContextErrorException extends \ErrorException
  40752. {
  40753. private $context = array();
  40754. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  40755. {
  40756. parent::__construct($message, $code, $severity, $filename, $lineno);
  40757. $this->context = $context;
  40758. }
  40759. public function getContext()
  40760. {
  40761. return $this->context;
  40762. }
  40763. }
  40764. <?php
  40765. namespace Symfony\Component\Debug\Exception;
  40766. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  40767. class DummyException extends \ErrorException
  40768. {
  40769. }
  40770. <?php
  40771. namespace Symfony\Component\HttpKernel\Exception;
  40772. class FatalErrorException extends \ErrorException
  40773. {
  40774. }
  40775. namespace Symfony\Component\Debug\Exception;
  40776. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  40777. class FatalErrorException extends LegacyFatalErrorException
  40778. {
  40779. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  40780. {
  40781. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  40782. if (null !== $trace) {
  40783. if (!$traceArgs) {
  40784. foreach ($trace as &$frame) {
  40785. unset($frame['args'], $frame['this'], $frame);
  40786. }
  40787. }
  40788. $this->setTrace($trace);
  40789. } elseif (null !== $traceOffset) {
  40790. if (\function_exists('xdebug_get_function_stack')) {
  40791. $trace = xdebug_get_function_stack();
  40792. if (0 < $traceOffset) {
  40793. array_splice($trace, -$traceOffset);
  40794. }
  40795. foreach ($trace as &$frame) {
  40796. if (!isset($frame['type'])) {
  40797. if (isset($frame['class'])) {
  40798. $frame['type'] = '::';
  40799. }
  40800. } elseif ('dynamic' === $frame['type']) {
  40801. $frame['type'] = '->';
  40802. } elseif ('static' === $frame['type']) {
  40803. $frame['type'] = '::';
  40804. }
  40805. if (!$traceArgs) {
  40806. unset($frame['params'], $frame['args']);
  40807. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  40808. $frame['args'] = $frame['params'];
  40809. unset($frame['params']);
  40810. }
  40811. }
  40812. unset($frame);
  40813. $trace = array_reverse($trace);
  40814. } elseif (\function_exists('symfony_debug_backtrace')) {
  40815. $trace = symfony_debug_backtrace();
  40816. if (0 < $traceOffset) {
  40817. array_splice($trace, 0, $traceOffset);
  40818. }
  40819. } else {
  40820. $trace = array();
  40821. }
  40822. $this->setTrace($trace);
  40823. }
  40824. }
  40825. protected function setTrace($trace)
  40826. {
  40827. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  40828. $traceReflector->setAccessible(true);
  40829. $traceReflector->setValue($this, $trace);
  40830. }
  40831. }
  40832. <?php
  40833. namespace Symfony\Component\Debug\Exception;
  40834. class FatalThrowableError extends FatalErrorException
  40835. {
  40836. public function __construct(\Throwable $e)
  40837. {
  40838. if ($e instanceof \ParseError) {
  40839. $message = 'Parse error: '.$e->getMessage();
  40840. $severity = E_PARSE;
  40841. } elseif ($e instanceof \TypeError) {
  40842. $message = 'Type error: '.$e->getMessage();
  40843. $severity = E_RECOVERABLE_ERROR;
  40844. } else {
  40845. $message = $e->getMessage();
  40846. $severity = E_ERROR;
  40847. }
  40848. \ErrorException::__construct(
  40849. $message,
  40850. $e->getCode(),
  40851. $severity,
  40852. $e->getFile(),
  40853. $e->getLine(),
  40854. $e->getPrevious()
  40855. );
  40856. $this->setTrace($e->getTrace());
  40857. }
  40858. }
  40859. <?php
  40860. namespace Symfony\Component\HttpKernel\Exception;
  40861. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  40862. class FlattenException
  40863. {
  40864. private $handler;
  40865. public static function __callStatic($method, $args)
  40866. {
  40867. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  40868. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  40869. }
  40870. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  40871. }
  40872. public function __call($method, $args)
  40873. {
  40874. if (!isset($this->handler)) {
  40875. $this->handler = new DebugFlattenException();
  40876. }
  40877. if (!method_exists($this->handler, $method)) {
  40878. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  40879. }
  40880. return \call_user_func_array(array($this->handler, $method), $args);
  40881. }
  40882. }
  40883. namespace Symfony\Component\Debug\Exception;
  40884. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  40885. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  40886. class FlattenException extends LegacyFlattenException
  40887. {
  40888. private $message;
  40889. private $code;
  40890. private $previous;
  40891. private $trace;
  40892. private $class;
  40893. private $statusCode;
  40894. private $headers;
  40895. private $file;
  40896. private $line;
  40897. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  40898. {
  40899. $e = new static();
  40900. $e->setMessage($exception->getMessage());
  40901. $e->setCode($exception->getCode());
  40902. if ($exception instanceof HttpExceptionInterface) {
  40903. $statusCode = $exception->getStatusCode();
  40904. $headers = array_merge($headers, $exception->getHeaders());
  40905. }
  40906. if (null === $statusCode) {
  40907. $statusCode = 500;
  40908. }
  40909. $e->setStatusCode($statusCode);
  40910. $e->setHeaders($headers);
  40911. $e->setTraceFromException($exception);
  40912. $e->setClass(\get_class($exception));
  40913. $e->setFile($exception->getFile());
  40914. $e->setLine($exception->getLine());
  40915. $previous = $exception->getPrevious();
  40916. if ($previous instanceof \Exception) {
  40917. $e->setPrevious(static::create($previous));
  40918. } elseif ($previous instanceof \Throwable) {
  40919. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  40920. }
  40921. return $e;
  40922. }
  40923. public function toArray()
  40924. {
  40925. $exceptions = array();
  40926. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  40927. $exceptions[] = array(
  40928. 'message' => $exception->getMessage(),
  40929. 'class' => $exception->getClass(),
  40930. 'trace' => $exception->getTrace(),
  40931. );
  40932. }
  40933. return $exceptions;
  40934. }
  40935. public function getStatusCode()
  40936. {
  40937. return $this->statusCode;
  40938. }
  40939. public function setStatusCode($code)
  40940. {
  40941. $this->statusCode = $code;
  40942. }
  40943. public function getHeaders()
  40944. {
  40945. return $this->headers;
  40946. }
  40947. public function setHeaders(array $headers)
  40948. {
  40949. $this->headers = $headers;
  40950. }
  40951. public function getClass()
  40952. {
  40953. return $this->class;
  40954. }
  40955. public function setClass($class)
  40956. {
  40957. $this->class = $class;
  40958. }
  40959. public function getFile()
  40960. {
  40961. return $this->file;
  40962. }
  40963. public function setFile($file)
  40964. {
  40965. $this->file = $file;
  40966. }
  40967. public function getLine()
  40968. {
  40969. return $this->line;
  40970. }
  40971. public function setLine($line)
  40972. {
  40973. $this->line = $line;
  40974. }
  40975. public function getMessage()
  40976. {
  40977. return $this->message;
  40978. }
  40979. public function setMessage($message)
  40980. {
  40981. $this->message = $message;
  40982. }
  40983. public function getCode()
  40984. {
  40985. return $this->code;
  40986. }
  40987. public function setCode($code)
  40988. {
  40989. $this->code = $code;
  40990. }
  40991. public function getPrevious()
  40992. {
  40993. return $this->previous;
  40994. }
  40995. public function setPrevious(FlattenException $previous)
  40996. {
  40997. $this->previous = $previous;
  40998. }
  40999. public function getAllPrevious()
  41000. {
  41001. $exceptions = array();
  41002. $e = $this;
  41003. while ($e = $e->getPrevious()) {
  41004. $exceptions[] = $e;
  41005. }
  41006. return $exceptions;
  41007. }
  41008. public function getTrace()
  41009. {
  41010. return $this->trace;
  41011. }
  41012. public function setTraceFromException(\Exception $exception)
  41013. {
  41014. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  41015. }
  41016. public function setTrace($trace, $file, $line)
  41017. {
  41018. $this->trace = array();
  41019. $this->trace[] = array(
  41020. 'namespace' => '',
  41021. 'short_class' => '',
  41022. 'class' => '',
  41023. 'type' => '',
  41024. 'function' => '',
  41025. 'file' => $file,
  41026. 'line' => $line,
  41027. 'args' => array(),
  41028. );
  41029. foreach ($trace as $entry) {
  41030. $class = '';
  41031. $namespace = '';
  41032. if (isset($entry['class'])) {
  41033. $parts = explode('\\', $entry['class']);
  41034. $class = array_pop($parts);
  41035. $namespace = implode('\\', $parts);
  41036. }
  41037. $this->trace[] = array(
  41038. 'namespace' => $namespace,
  41039. 'short_class' => $class,
  41040. 'class' => isset($entry['class']) ? $entry['class'] : '',
  41041. 'type' => isset($entry['type']) ? $entry['type'] : '',
  41042. 'function' => isset($entry['function']) ? $entry['function'] : null,
  41043. 'file' => isset($entry['file']) ? $entry['file'] : null,
  41044. 'line' => isset($entry['line']) ? $entry['line'] : null,
  41045. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  41046. );
  41047. }
  41048. }
  41049. private function flattenArgs($args, $level = 0, &$count = 0)
  41050. {
  41051. $result = array();
  41052. foreach ($args as $key => $value) {
  41053. if (++$count > 1e4) {
  41054. return array('array', '*SKIPPED over 10000 entries*');
  41055. }
  41056. if ($value instanceof \__PHP_Incomplete_Class) {
  41057. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  41058. } elseif (\is_object($value)) {
  41059. $result[$key] = array('object', \get_class($value));
  41060. } elseif (\is_array($value)) {
  41061. if ($level > 10) {
  41062. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  41063. } else {
  41064. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  41065. }
  41066. } elseif (null === $value) {
  41067. $result[$key] = array('null', null);
  41068. } elseif (\is_bool($value)) {
  41069. $result[$key] = array('boolean', $value);
  41070. } elseif (\is_resource($value)) {
  41071. $result[$key] = array('resource', get_resource_type($value));
  41072. } else {
  41073. $result[$key] = array('string', (string) $value);
  41074. }
  41075. }
  41076. return $result;
  41077. }
  41078. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  41079. {
  41080. $array = new \ArrayObject($value);
  41081. return $array['__PHP_Incomplete_Class_Name'];
  41082. }
  41083. }
  41084. <?php
  41085. namespace Symfony\Component\Debug\Exception;
  41086. class OutOfMemoryException extends FatalErrorException
  41087. {
  41088. }
  41089. <?php
  41090. namespace Symfony\Component\Debug\Exception;
  41091. class UndefinedFunctionException extends FatalErrorException
  41092. {
  41093. public function __construct($message, \ErrorException $previous)
  41094. {
  41095. parent::__construct(
  41096. $message,
  41097. $previous->getCode(),
  41098. $previous->getSeverity(),
  41099. $previous->getFile(),
  41100. $previous->getLine(),
  41101. null,
  41102. true,
  41103. null,
  41104. $previous->getPrevious()
  41105. );
  41106. $this->setTrace($previous->getTrace());
  41107. }
  41108. }
  41109. <?php
  41110. namespace Symfony\Component\Debug\Exception;
  41111. class UndefinedMethodException extends FatalErrorException
  41112. {
  41113. public function __construct($message, \ErrorException $previous)
  41114. {
  41115. parent::__construct(
  41116. $message,
  41117. $previous->getCode(),
  41118. $previous->getSeverity(),
  41119. $previous->getFile(),
  41120. $previous->getLine(),
  41121. null,
  41122. true,
  41123. null,
  41124. $previous->getPrevious()
  41125. );
  41126. $this->setTrace($previous->getTrace());
  41127. }
  41128. }
  41129. <?php
  41130. namespace Symfony\Component\Debug;
  41131. use Symfony\Component\Debug\Exception\FlattenException;
  41132. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  41133. use Symfony\Component\HttpFoundation\Response;
  41134. class ExceptionHandler
  41135. {
  41136. private $debug;
  41137. private $charset;
  41138. private $handler;
  41139. private $caughtBuffer;
  41140. private $caughtLength;
  41141. private $fileLinkFormat;
  41142. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  41143. {
  41144. if (false !== strpos($charset, '%')) {
  41145. @trigger_error('Providing $fileLinkFormat as second argument to '.__METHOD__.' is deprecated since Symfony 2.8 and will be unsupported in 3.0. Please provide it as third argument, after $charset.', E_USER_DEPRECATED);
  41146. $pivot = $fileLinkFormat;
  41147. $fileLinkFormat = $charset;
  41148. $charset = $pivot;
  41149. }
  41150. $this->debug = $debug;
  41151. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  41152. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  41153. }
  41154. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  41155. {
  41156. $handler = new static($debug, $charset, $fileLinkFormat);
  41157. $prev = set_exception_handler(array($handler, 'handle'));
  41158. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  41159. restore_exception_handler();
  41160. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  41161. }
  41162. return $handler;
  41163. }
  41164. public function setHandler($handler)
  41165. {
  41166. if (null !== $handler && !\is_callable($handler)) {
  41167. throw new \LogicException('The exception handler must be a valid PHP callable.');
  41168. }
  41169. $old = $this->handler;
  41170. $this->handler = $handler;
  41171. return $old;
  41172. }
  41173. public function setFileLinkFormat($format)
  41174. {
  41175. $old = $this->fileLinkFormat;
  41176. $this->fileLinkFormat = $format;
  41177. return $old;
  41178. }
  41179. public function handle(\Exception $exception)
  41180. {
  41181. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  41182. $this->failSafeHandle($exception);
  41183. return;
  41184. }
  41185. $caughtLength = $this->caughtLength = 0;
  41186. ob_start(array($this, 'catchOutput'));
  41187. $this->failSafeHandle($exception);
  41188. while (null === $this->caughtBuffer && ob_end_flush()) {
  41189. }
  41190. if (isset($this->caughtBuffer[0])) {
  41191. ob_start(array($this, 'cleanOutput'));
  41192. echo $this->caughtBuffer;
  41193. $caughtLength = ob_get_length();
  41194. }
  41195. $this->caughtBuffer = null;
  41196. try {
  41197. \call_user_func($this->handler, $exception);
  41198. $this->caughtLength = $caughtLength;
  41199. } catch (\Exception $e) {
  41200. if (!$caughtLength) {
  41201. throw $exception;
  41202. }
  41203. }
  41204. }
  41205. private function failSafeHandle(\Exception $exception)
  41206. {
  41207. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  41208. && __CLASS__ !== \get_class($this)
  41209. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  41210. && __CLASS__ !== $reflector->class
  41211. ) {
  41212. $response = $this->createResponse($exception);
  41213. $response->sendHeaders();
  41214. $response->sendContent();
  41215. @trigger_error(sprintf("The %s::createResponse method is deprecated since Symfony 2.8 and won't be called anymore when handling an exception in 3.0.", $reflector->class), E_USER_DEPRECATED);
  41216. return;
  41217. }
  41218. $this->sendPhpResponse($exception);
  41219. }
  41220. public function sendPhpResponse($exception)
  41221. {
  41222. if (!$exception instanceof FlattenException) {
  41223. $exception = FlattenException::create($exception);
  41224. }
  41225. if (!headers_sent()) {
  41226. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  41227. foreach ($exception->getHeaders() as $name => $value) {
  41228. header($name.': '.$value, false);
  41229. }
  41230. header('Content-Type: text/html; charset='.$this->charset);
  41231. }
  41232. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41233. }
  41234. public function createResponse($exception)
  41235. {
  41236. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41237. if (!$exception instanceof FlattenException) {
  41238. $exception = FlattenException::create($exception);
  41239. }
  41240. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  41241. }
  41242. public function getHtml($exception)
  41243. {
  41244. if (!$exception instanceof FlattenException) {
  41245. $exception = FlattenException::create($exception);
  41246. }
  41247. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  41248. }
  41249. public function getContent(FlattenException $exception)
  41250. {
  41251. switch ($exception->getStatusCode()) {
  41252. case 404:
  41253. $title = 'Sorry, the page you are looking for could not be found.';
  41254. break;
  41255. default:
  41256. $title = 'Whoops, looks like something went wrong.';
  41257. }
  41258. $content = '';
  41259. if ($this->debug) {
  41260. try {
  41261. $count = \count($exception->getAllPrevious());
  41262. $total = $count + 1;
  41263. foreach ($exception->toArray() as $position => $e) {
  41264. $ind = $count - $position + 1;
  41265. $class = $this->formatClass($e['class']);
  41266. $message = nl2br($this->escapeHtml($e['message']));
  41267. $content .= sprintf(<<<'EOF'
  41268. <h2 class="block_exception clear_fix">
  41269. <span class="exception_counter">%d/%d</span>
  41270. <span class="exception_title">%s%s:</span>
  41271. <span class="exception_message">%s</span>
  41272. </h2>
  41273. <div class="block">
  41274. <ol class="traces list_exception">
  41275. EOF
  41276. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  41277. foreach ($e['trace'] as $trace) {
  41278. $content .= ' <li>';
  41279. if ($trace['function']) {
  41280. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  41281. }
  41282. if (isset($trace['file']) && isset($trace['line'])) {
  41283. $content .= $this->formatPath($trace['file'], $trace['line']);
  41284. }
  41285. $content .= "</li>\n";
  41286. }
  41287. $content .= " </ol>\n</div>\n";
  41288. }
  41289. } catch (\Exception $e) {
  41290. if ($this->debug) {
  41291. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  41292. } else {
  41293. $title = 'Whoops, looks like something went wrong.';
  41294. }
  41295. }
  41296. }
  41297. return <<<EOF
  41298. <div id="sf-resetcontent" class="sf-reset">
  41299. <h1>$title</h1>
  41300. $content
  41301. </div>
  41302. EOF;
  41303. }
  41304. public function getStylesheet(FlattenException $exception)
  41305. {
  41306. return <<<'EOF'
  41307. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  41308. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  41309. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  41310. .sf-reset .clear_fix { display:inline-block; }
  41311. .sf-reset * html .clear_fix { height:1%; }
  41312. .sf-reset .clear_fix { display:block; }
  41313. .sf-reset, .sf-reset .block { margin: auto }
  41314. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  41315. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  41316. .sf-reset strong { font-weight:bold; }
  41317. .sf-reset a { color:#6c6159; cursor: default; }
  41318. .sf-reset a img { border:none; }
  41319. .sf-reset a:hover { text-decoration:underline; }
  41320. .sf-reset em { font-style:italic; }
  41321. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  41322. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  41323. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  41324. .sf-reset .exception_message { margin-left: 3em; display: block; }
  41325. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  41326. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  41327. -webkit-border-bottom-right-radius: 16px;
  41328. -webkit-border-bottom-left-radius: 16px;
  41329. -moz-border-radius-bottomright: 16px;
  41330. -moz-border-radius-bottomleft: 16px;
  41331. border-bottom-right-radius: 16px;
  41332. border-bottom-left-radius: 16px;
  41333. border-bottom:1px solid #ccc;
  41334. border-right:1px solid #ccc;
  41335. border-left:1px solid #ccc;
  41336. word-wrap: break-word;
  41337. }
  41338. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  41339. -webkit-border-top-left-radius: 16px;
  41340. -webkit-border-top-right-radius: 16px;
  41341. -moz-border-radius-topleft: 16px;
  41342. -moz-border-radius-topright: 16px;
  41343. border-top-left-radius: 16px;
  41344. border-top-right-radius: 16px;
  41345. border-top:1px solid #ccc;
  41346. border-right:1px solid #ccc;
  41347. border-left:1px solid #ccc;
  41348. overflow: hidden;
  41349. word-wrap: break-word;
  41350. }
  41351. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  41352. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  41353. .sf-reset ol { padding: 10px 0; }
  41354. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  41355. -webkit-border-radius: 10px;
  41356. -moz-border-radius: 10px;
  41357. border-radius: 10px;
  41358. border: 1px solid #ccc;
  41359. }
  41360. EOF;
  41361. }
  41362. private function decorate($content, $css)
  41363. {
  41364. return <<<EOF
  41365. <!DOCTYPE html>
  41366. <html>
  41367. <head>
  41368. <meta charset="{$this->charset}" />
  41369. <meta name="robots" content="noindex,nofollow" />
  41370. <style>
  41371. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  41372. html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var{font-style:normal;font-weight:normal;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:text-top;}sub{vertical-align:text-bottom;}input,textarea,select{font-family:inherit;font-size:inherit;font-weight:inherit;}input,textarea,select{*font-size:100%;}legend{color:#000;}
  41373. html { background: #eee; padding: 10px }
  41374. img { border: 0; }
  41375. #sf-resetcontent { width:970px; margin:0 auto; }
  41376. $css
  41377. </style>
  41378. </head>
  41379. <body>
  41380. $content
  41381. </body>
  41382. </html>
  41383. EOF;
  41384. }
  41385. private function formatClass($class)
  41386. {
  41387. $parts = explode('\\', $class);
  41388. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  41389. }
  41390. private function formatPath($path, $line)
  41391. {
  41392. $path = $this->escapeHtml($path);
  41393. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  41394. if ($linkFormat = $this->fileLinkFormat) {
  41395. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  41396. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  41397. }
  41398. return sprintf(' in <a title="%s line %3$d" ondblclick="var f=this.innerHTML;this.innerHTML=this.title;this.title=f;">%s line %d</a>', $path, $file, $line);
  41399. }
  41400. private function formatArgs(array $args)
  41401. {
  41402. $result = array();
  41403. foreach ($args as $key => $item) {
  41404. if ('object' === $item[0]) {
  41405. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  41406. } elseif ('array' === $item[0]) {
  41407. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  41408. } elseif ('string' === $item[0]) {
  41409. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  41410. } elseif ('null' === $item[0]) {
  41411. $formattedValue = '<em>null</em>';
  41412. } elseif ('boolean' === $item[0]) {
  41413. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  41414. } elseif ('resource' === $item[0]) {
  41415. $formattedValue = '<em>resource</em>';
  41416. } else {
  41417. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  41418. }
  41419. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  41420. }
  41421. return implode(', ', $result);
  41422. }
  41423. protected static function utf8Htmlize($str)
  41424. {
  41425. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  41426. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  41427. }
  41428. private function escapeHtml($str)
  41429. {
  41430. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  41431. }
  41432. public function catchOutput($buffer)
  41433. {
  41434. $this->caughtBuffer = $buffer;
  41435. return '';
  41436. }
  41437. public function cleanOutput($buffer)
  41438. {
  41439. if ($this->caughtLength) {
  41440. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  41441. if (isset($cleanBuffer[0])) {
  41442. $buffer = $cleanBuffer;
  41443. }
  41444. }
  41445. return $buffer;
  41446. }
  41447. }
  41448. <?php
  41449. namespace Symfony\Component\Debug\FatalErrorHandler;
  41450. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  41451. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  41452. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  41453. use Symfony\Component\Debug\DebugClassLoader;
  41454. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  41455. use Symfony\Component\Debug\Exception\FatalErrorException;
  41456. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  41457. {
  41458. public function handleError(array $error, FatalErrorException $exception)
  41459. {
  41460. $messageLen = \strlen($error['message']);
  41461. $notFoundSuffix = '\' not found';
  41462. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41463. if ($notFoundSuffixLen > $messageLen) {
  41464. return;
  41465. }
  41466. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41467. return;
  41468. }
  41469. foreach (array('class', 'interface', 'trait') as $typeName) {
  41470. $prefix = ucfirst($typeName).' \'';
  41471. $prefixLen = \strlen($prefix);
  41472. if (0 !== strpos($error['message'], $prefix)) {
  41473. continue;
  41474. }
  41475. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41476. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  41477. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  41478. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  41479. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  41480. $tail = ' for another namespace?';
  41481. } else {
  41482. $className = $fullyQualifiedClassName;
  41483. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  41484. $tail = '?';
  41485. }
  41486. if ($candidates = $this->getClassCandidates($className)) {
  41487. $tail = array_pop($candidates).'"?';
  41488. if ($candidates) {
  41489. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  41490. } else {
  41491. $tail = ' for "'.$tail;
  41492. }
  41493. }
  41494. $message .= "\nDid you forget a \"use\" statement".$tail;
  41495. return new ClassNotFoundException($message, $exception);
  41496. }
  41497. }
  41498. private function getClassCandidates($class)
  41499. {
  41500. if (!\is_array($functions = spl_autoload_functions())) {
  41501. return array();
  41502. }
  41503. $classes = array();
  41504. foreach ($functions as $function) {
  41505. if (!\is_array($function)) {
  41506. continue;
  41507. }
  41508. if ($function[0] instanceof DebugClassLoader) {
  41509. $function = $function[0]->getClassLoader();
  41510. if (\is_object($function)) {
  41511. $function = array($function);
  41512. }
  41513. if (!\is_array($function)) {
  41514. continue;
  41515. }
  41516. }
  41517. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  41518. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  41519. foreach ($paths as $path) {
  41520. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41521. }
  41522. }
  41523. }
  41524. if ($function[0] instanceof ComposerClassLoader) {
  41525. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  41526. foreach ($paths as $path) {
  41527. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  41528. }
  41529. }
  41530. }
  41531. }
  41532. return array_unique($classes);
  41533. }
  41534. private function findClassInPath($path, $class, $prefix)
  41535. {
  41536. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  41537. return array();
  41538. }
  41539. $classes = array();
  41540. $filename = $class.'.php';
  41541. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  41542. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  41543. $classes[] = $class;
  41544. }
  41545. }
  41546. return $classes;
  41547. }
  41548. private function convertFileToClass($path, $file, $prefix)
  41549. {
  41550. $candidates = array(
  41551. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  41552. $prefix.$namespacedClass,
  41553. $prefix.'\\'.$namespacedClass,
  41554. str_replace('\\', '_', $namespacedClass),
  41555. str_replace('\\', '_', $prefix.$namespacedClass),
  41556. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  41557. );
  41558. if ($prefix) {
  41559. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  41560. }
  41561. foreach ($candidates as $candidate) {
  41562. if ($this->classExists($candidate)) {
  41563. return $candidate;
  41564. }
  41565. }
  41566. require_once $file;
  41567. foreach ($candidates as $candidate) {
  41568. if ($this->classExists($candidate)) {
  41569. return $candidate;
  41570. }
  41571. }
  41572. }
  41573. private function classExists($class)
  41574. {
  41575. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  41576. }
  41577. }
  41578. <?php
  41579. namespace Symfony\Component\Debug\FatalErrorHandler;
  41580. use Symfony\Component\Debug\Exception\FatalErrorException;
  41581. interface FatalErrorHandlerInterface
  41582. {
  41583. public function handleError(array $error, FatalErrorException $exception);
  41584. }
  41585. <?php
  41586. namespace Symfony\Component\Debug\FatalErrorHandler;
  41587. use Symfony\Component\Debug\Exception\FatalErrorException;
  41588. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  41589. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  41590. {
  41591. public function handleError(array $error, FatalErrorException $exception)
  41592. {
  41593. $messageLen = \strlen($error['message']);
  41594. $notFoundSuffix = '()';
  41595. $notFoundSuffixLen = \strlen($notFoundSuffix);
  41596. if ($notFoundSuffixLen > $messageLen) {
  41597. return;
  41598. }
  41599. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  41600. return;
  41601. }
  41602. $prefix = 'Call to undefined function ';
  41603. $prefixLen = \strlen($prefix);
  41604. if (0 !== strpos($error['message'], $prefix)) {
  41605. return;
  41606. }
  41607. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  41608. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  41609. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  41610. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  41611. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  41612. } else {
  41613. $functionName = $fullyQualifiedFunctionName;
  41614. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  41615. }
  41616. $candidates = array();
  41617. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  41618. foreach ($definedFunctionNames as $definedFunctionName) {
  41619. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  41620. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  41621. } else {
  41622. $definedFunctionNameBasename = $definedFunctionName;
  41623. }
  41624. if ($definedFunctionNameBasename === $functionName) {
  41625. $candidates[] = '\\'.$definedFunctionName;
  41626. }
  41627. }
  41628. }
  41629. if ($candidates) {
  41630. sort($candidates);
  41631. $last = array_pop($candidates).'"?';
  41632. if ($candidates) {
  41633. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41634. } else {
  41635. $candidates = '"'.$last;
  41636. }
  41637. $message .= "\nDid you mean to call ".$candidates;
  41638. }
  41639. return new UndefinedFunctionException($message, $exception);
  41640. }
  41641. }
  41642. <?php
  41643. namespace Symfony\Component\Debug\FatalErrorHandler;
  41644. use Symfony\Component\Debug\Exception\FatalErrorException;
  41645. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  41646. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  41647. {
  41648. public function handleError(array $error, FatalErrorException $exception)
  41649. {
  41650. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  41651. if (!$matches) {
  41652. return;
  41653. }
  41654. $className = $matches[1];
  41655. $methodName = $matches[2];
  41656. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  41657. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  41658. return new UndefinedMethodException($message, $exception);
  41659. }
  41660. $candidates = array();
  41661. foreach ($methods as $definedMethodName) {
  41662. $lev = levenshtein($methodName, $definedMethodName);
  41663. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  41664. $candidates[] = $definedMethodName;
  41665. }
  41666. }
  41667. if ($candidates) {
  41668. sort($candidates);
  41669. $last = array_pop($candidates).'"?';
  41670. if ($candidates) {
  41671. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  41672. } else {
  41673. $candidates = '"'.$last;
  41674. }
  41675. $message .= "\nDid you mean to call ".$candidates;
  41676. }
  41677. return new UndefinedMethodException($message, $exception);
  41678. }
  41679. }
  41680. Copyright (c) 2004-2018 Fabien Potencier
  41681. Permission is hereby granted, free of charge, to any person obtaining a copy
  41682. of this software and associated documentation files (the "Software"), to deal
  41683. in the Software without restriction, including without limitation the rights
  41684. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  41685. copies of the Software, and to permit persons to whom the Software is furnished
  41686. to do so, subject to the following conditions:
  41687. The above copyright notice and this permission notice shall be included in all
  41688. copies or substantial portions of the Software.
  41689. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  41690. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  41691. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  41692. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  41693. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  41694. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  41695. THE SOFTWARE.
  41696. <?php
  41697. namespace Symfony\Component\Filesystem\Exception;
  41698. interface ExceptionInterface
  41699. {
  41700. }
  41701. <?php
  41702. namespace Symfony\Component\Filesystem\Exception;
  41703. class FileNotFoundException extends IOException
  41704. {
  41705. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  41706. {
  41707. if (null === $message) {
  41708. if (null === $path) {
  41709. $message = 'File could not be found.';
  41710. } else {
  41711. $message = sprintf('File "%s" could not be found.', $path);
  41712. }
  41713. }
  41714. parent::__construct($message, $code, $previous, $path);
  41715. }
  41716. }
  41717. <?php
  41718. namespace Symfony\Component\Filesystem\Exception;
  41719. class IOException extends \RuntimeException implements IOExceptionInterface
  41720. {
  41721. private $path;
  41722. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  41723. {
  41724. $this->path = $path;
  41725. parent::__construct($message, $code, $previous);
  41726. }
  41727. public function getPath()
  41728. {
  41729. return $this->path;
  41730. }
  41731. }
  41732. <?php
  41733. namespace Symfony\Component\Filesystem\Exception;
  41734. interface IOExceptionInterface extends ExceptionInterface
  41735. {
  41736. public function getPath();
  41737. }
  41738. <?php
  41739. namespace Symfony\Component\Filesystem;
  41740. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  41741. use Symfony\Component\Filesystem\Exception\IOException;
  41742. class Filesystem
  41743. {
  41744. private static $lastError;
  41745. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  41746. {
  41747. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  41748. if ($originIsLocal && !is_file($originFile)) {
  41749. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  41750. }
  41751. $this->mkdir(\dirname($targetFile));
  41752. $doCopy = true;
  41753. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  41754. $doCopy = filemtime($originFile) > filemtime($targetFile);
  41755. }
  41756. if ($doCopy) {
  41757. if (false === $source = @fopen($originFile, 'r')) {
  41758. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  41759. }
  41760. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  41761. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  41762. }
  41763. $bytesCopied = stream_copy_to_stream($source, $target);
  41764. fclose($source);
  41765. fclose($target);
  41766. unset($source, $target);
  41767. if (!is_file($targetFile)) {
  41768. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  41769. }
  41770. if ($originIsLocal) {
  41771. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  41772. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  41773. throw new IOException(sprintf('Failed to copy the whole content of "%s" to "%s" (%g of %g bytes copied).', $originFile, $targetFile, $bytesCopied, $bytesOrigin), 0, null, $originFile);
  41774. }
  41775. }
  41776. }
  41777. }
  41778. public function mkdir($dirs, $mode = 0777)
  41779. {
  41780. foreach ($this->toIterator($dirs) as $dir) {
  41781. if (is_dir($dir)) {
  41782. continue;
  41783. }
  41784. if (!self::box('mkdir', $dir, $mode, true)) {
  41785. if (!is_dir($dir)) {
  41786. if (self::$lastError) {
  41787. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  41788. }
  41789. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  41790. }
  41791. }
  41792. }
  41793. }
  41794. public function exists($files)
  41795. {
  41796. $maxPathLength = PHP_MAXPATHLEN - 2;
  41797. foreach ($this->toIterator($files) as $file) {
  41798. if (\strlen($file) > $maxPathLength) {
  41799. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  41800. }
  41801. if (!file_exists($file)) {
  41802. return false;
  41803. }
  41804. }
  41805. return true;
  41806. }
  41807. public function touch($files, $time = null, $atime = null)
  41808. {
  41809. foreach ($this->toIterator($files) as $file) {
  41810. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  41811. if (true !== $touch) {
  41812. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  41813. }
  41814. }
  41815. }
  41816. public function remove($files)
  41817. {
  41818. if ($files instanceof \Traversable) {
  41819. $files = iterator_to_array($files, false);
  41820. } elseif (!\is_array($files)) {
  41821. $files = array($files);
  41822. }
  41823. $files = array_reverse($files);
  41824. foreach ($files as $file) {
  41825. if (is_link($file)) {
  41826. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  41827. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  41828. }
  41829. } elseif (is_dir($file)) {
  41830. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  41831. if (!self::box('rmdir', $file) && file_exists($file)) {
  41832. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  41833. }
  41834. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  41835. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  41836. }
  41837. }
  41838. }
  41839. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  41840. {
  41841. foreach ($this->toIterator($files) as $file) {
  41842. if (true !== @chmod($file, $mode & ~$umask)) {
  41843. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  41844. }
  41845. if ($recursive && is_dir($file) && !is_link($file)) {
  41846. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  41847. }
  41848. }
  41849. }
  41850. public function chown($files, $user, $recursive = false)
  41851. {
  41852. foreach ($this->toIterator($files) as $file) {
  41853. if ($recursive && is_dir($file) && !is_link($file)) {
  41854. $this->chown(new \FilesystemIterator($file), $user, true);
  41855. }
  41856. if (is_link($file) && \function_exists('lchown')) {
  41857. if (true !== @lchown($file, $user)) {
  41858. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41859. }
  41860. } else {
  41861. if (true !== @chown($file, $user)) {
  41862. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  41863. }
  41864. }
  41865. }
  41866. }
  41867. public function chgrp($files, $group, $recursive = false)
  41868. {
  41869. foreach ($this->toIterator($files) as $file) {
  41870. if ($recursive && is_dir($file) && !is_link($file)) {
  41871. $this->chgrp(new \FilesystemIterator($file), $group, true);
  41872. }
  41873. if (is_link($file) && \function_exists('lchgrp')) {
  41874. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  41875. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41876. }
  41877. } else {
  41878. if (true !== @chgrp($file, $group)) {
  41879. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  41880. }
  41881. }
  41882. }
  41883. }
  41884. public function rename($origin, $target, $overwrite = false)
  41885. {
  41886. if (!$overwrite && $this->isReadable($target)) {
  41887. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  41888. }
  41889. if (true !== @rename($origin, $target)) {
  41890. if (is_dir($origin)) {
  41891. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  41892. $this->remove($origin);
  41893. return;
  41894. }
  41895. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  41896. }
  41897. }
  41898. private function isReadable($filename)
  41899. {
  41900. $maxPathLength = PHP_MAXPATHLEN - 2;
  41901. if (\strlen($filename) > $maxPathLength) {
  41902. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  41903. }
  41904. return is_readable($filename);
  41905. }
  41906. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  41907. {
  41908. if ('\\' === \DIRECTORY_SEPARATOR) {
  41909. $originDir = strtr($originDir, '/', '\\');
  41910. $targetDir = strtr($targetDir, '/', '\\');
  41911. if ($copyOnWindows) {
  41912. $this->mirror($originDir, $targetDir);
  41913. return;
  41914. }
  41915. }
  41916. $this->mkdir(\dirname($targetDir));
  41917. if (is_link($targetDir)) {
  41918. if (readlink($targetDir) === $originDir) {
  41919. return;
  41920. }
  41921. $this->remove($targetDir);
  41922. }
  41923. if (!self::box('symlink', $originDir, $targetDir)) {
  41924. if (null !== self::$lastError) {
  41925. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  41926. throw new IOException('Unable to create symlink due to error code 1314: \'A required privilege is not held by the client\'. Do you have the required Administrator-rights?', 0, null, $targetDir);
  41927. }
  41928. }
  41929. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  41930. }
  41931. }
  41932. public function makePathRelative($endPath, $startPath)
  41933. {
  41934. if ('\\' === \DIRECTORY_SEPARATOR) {
  41935. $endPath = str_replace('\\', '/', $endPath);
  41936. $startPath = str_replace('\\', '/', $startPath);
  41937. }
  41938. $stripDriveLetter = function ($path) {
  41939. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  41940. return substr($path, 2);
  41941. }
  41942. return $path;
  41943. };
  41944. $endPath = $stripDriveLetter($endPath);
  41945. $startPath = $stripDriveLetter($startPath);
  41946. $startPathArr = explode('/', trim($startPath, '/'));
  41947. $endPathArr = explode('/', trim($endPath, '/'));
  41948. $normalizePathArray = function ($pathSegments, $absolute) {
  41949. $result = array();
  41950. foreach ($pathSegments as $segment) {
  41951. if ('..' === $segment && ($absolute || \count($result))) {
  41952. array_pop($result);
  41953. } elseif ('.' !== $segment) {
  41954. $result[] = $segment;
  41955. }
  41956. }
  41957. return $result;
  41958. };
  41959. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  41960. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  41961. $index = 0;
  41962. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  41963. ++$index;
  41964. }
  41965. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  41966. $depth = 0;
  41967. } else {
  41968. $depth = \count($startPathArr) - $index;
  41969. }
  41970. $traverser = str_repeat('../', $depth);
  41971. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  41972. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  41973. return '' === $relativePath ? './' : $relativePath;
  41974. }
  41975. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  41976. {
  41977. $targetDir = rtrim($targetDir, '/\\');
  41978. $originDir = rtrim($originDir, '/\\');
  41979. $originDirLen = \strlen($originDir);
  41980. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  41981. $deleteIterator = $iterator;
  41982. if (null === $deleteIterator) {
  41983. $flags = \FilesystemIterator::SKIP_DOTS;
  41984. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  41985. }
  41986. $targetDirLen = \strlen($targetDir);
  41987. foreach ($deleteIterator as $file) {
  41988. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  41989. if (!$this->exists($origin)) {
  41990. $this->remove($file);
  41991. }
  41992. }
  41993. }
  41994. $copyOnWindows = false;
  41995. if (isset($options['copy_on_windows'])) {
  41996. $copyOnWindows = $options['copy_on_windows'];
  41997. }
  41998. if (null === $iterator) {
  41999. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  42000. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  42001. }
  42002. if ($this->exists($originDir)) {
  42003. $this->mkdir($targetDir);
  42004. }
  42005. foreach ($iterator as $file) {
  42006. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  42007. if ($copyOnWindows) {
  42008. if (is_file($file)) {
  42009. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  42010. } elseif (is_dir($file)) {
  42011. $this->mkdir($target);
  42012. } else {
  42013. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  42014. }
  42015. } else {
  42016. if (is_link($file)) {
  42017. $this->symlink($file->getLinkTarget(), $target);
  42018. } elseif (is_dir($file)) {
  42019. $this->mkdir($target);
  42020. } elseif (is_file($file)) {
  42021. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  42022. } else {
  42023. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  42024. }
  42025. }
  42026. }
  42027. }
  42028. public function isAbsolutePath($file)
  42029. {
  42030. return strspn($file, '/\\', 0, 1)
  42031. || (\strlen($file) > 3 && ctype_alpha($file[0])
  42032. && ':' === substr($file, 1, 1)
  42033. && strspn($file, '/\\', 2, 1)
  42034. )
  42035. || null !== parse_url($file, PHP_URL_SCHEME)
  42036. ;
  42037. }
  42038. public function tempnam($dir, $prefix)
  42039. {
  42040. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  42041. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  42042. $tmpFile = @tempnam($hierarchy, $prefix);
  42043. if (false !== $tmpFile) {
  42044. if (null !== $scheme && 'gs' !== $scheme) {
  42045. return $scheme.'://'.$tmpFile;
  42046. }
  42047. return $tmpFile;
  42048. }
  42049. throw new IOException('A temporary file could not be created.');
  42050. }
  42051. for ($i = 0; $i < 10; ++$i) {
  42052. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  42053. $handle = @fopen($tmpFile, 'x+');
  42054. if (false === $handle) {
  42055. continue;
  42056. }
  42057. @fclose($handle);
  42058. return $tmpFile;
  42059. }
  42060. throw new IOException('A temporary file could not be created.');
  42061. }
  42062. public function dumpFile($filename, $content, $mode = 0666)
  42063. {
  42064. $dir = \dirname($filename);
  42065. if (!is_dir($dir)) {
  42066. $this->mkdir($dir);
  42067. }
  42068. if (!is_writable($dir)) {
  42069. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  42070. }
  42071. $tmpFile = $this->tempnam($dir, basename($filename));
  42072. if (false === @file_put_contents($tmpFile, $content)) {
  42073. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  42074. }
  42075. if (null !== $mode) {
  42076. if (\func_num_args() > 2) {
  42077. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  42078. }
  42079. $this->chmod($tmpFile, $mode);
  42080. } elseif (file_exists($filename)) {
  42081. @chmod($tmpFile, fileperms($filename));
  42082. }
  42083. $this->rename($tmpFile, $filename, true);
  42084. }
  42085. private function toIterator($files)
  42086. {
  42087. if (!$files instanceof \Traversable) {
  42088. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  42089. }
  42090. return $files;
  42091. }
  42092. private function getSchemeAndHierarchy($filename)
  42093. {
  42094. $components = explode('://', $filename, 2);
  42095. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  42096. }
  42097. private static function box($func)
  42098. {
  42099. self::$lastError = null;
  42100. \set_error_handler(__CLASS__.'::handleError');
  42101. try {
  42102. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  42103. \restore_error_handler();
  42104. return $result;
  42105. } catch (\Throwable $e) {
  42106. } catch (\Exception $e) {
  42107. }
  42108. \restore_error_handler();
  42109. throw $e;
  42110. }
  42111. public static function handleError($type, $msg)
  42112. {
  42113. self::$lastError = $msg;
  42114. }
  42115. }
  42116. Copyright (c) 2004-2018 Fabien Potencier
  42117. Permission is hereby granted, free of charge, to any person obtaining a copy
  42118. of this software and associated documentation files (the "Software"), to deal
  42119. in the Software without restriction, including without limitation the rights
  42120. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42121. copies of the Software, and to permit persons to whom the Software is furnished
  42122. to do so, subject to the following conditions:
  42123. The above copyright notice and this permission notice shall be included in all
  42124. copies or substantial portions of the Software.
  42125. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42126. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42127. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42128. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42129. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42130. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42131. THE SOFTWARE.
  42132. <?php
  42133. namespace Symfony\Component\Filesystem;
  42134. use Symfony\Component\Filesystem\Exception\IOException;
  42135. class LockHandler
  42136. {
  42137. private $file;
  42138. private $handle;
  42139. public function __construct($name, $lockPath = null)
  42140. {
  42141. $lockPath = $lockPath ?: sys_get_temp_dir();
  42142. if (!is_dir($lockPath)) {
  42143. $fs = new Filesystem();
  42144. $fs->mkdir($lockPath);
  42145. }
  42146. if (!is_writable($lockPath)) {
  42147. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  42148. }
  42149. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  42150. }
  42151. public function lock($blocking = false)
  42152. {
  42153. if ($this->handle) {
  42154. return true;
  42155. }
  42156. $error = null;
  42157. set_error_handler(function ($errno, $msg) use (&$error) {
  42158. $error = $msg;
  42159. });
  42160. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42161. if ($this->handle = fopen($this->file, 'x')) {
  42162. chmod($this->file, 0666);
  42163. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  42164. usleep(100);
  42165. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  42166. }
  42167. }
  42168. restore_error_handler();
  42169. if (!$this->handle) {
  42170. throw new IOException($error, 0, null, $this->file);
  42171. }
  42172. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  42173. fclose($this->handle);
  42174. $this->handle = null;
  42175. return false;
  42176. }
  42177. return true;
  42178. }
  42179. public function release()
  42180. {
  42181. if ($this->handle) {
  42182. flock($this->handle, LOCK_UN | LOCK_NB);
  42183. fclose($this->handle);
  42184. $this->handle = null;
  42185. }
  42186. }
  42187. }
  42188. <?php
  42189. namespace Symfony\Component\Finder\Adapter;
  42190. @trigger_error('The '.__NAMESPACE__.'\AbstractAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42191. abstract class AbstractAdapter implements AdapterInterface
  42192. {
  42193. protected $followLinks = false;
  42194. protected $mode = 0;
  42195. protected $minDepth = 0;
  42196. protected $maxDepth = PHP_INT_MAX;
  42197. protected $exclude = array();
  42198. protected $names = array();
  42199. protected $notNames = array();
  42200. protected $contains = array();
  42201. protected $notContains = array();
  42202. protected $sizes = array();
  42203. protected $dates = array();
  42204. protected $filters = array();
  42205. protected $sort = false;
  42206. protected $paths = array();
  42207. protected $notPaths = array();
  42208. protected $ignoreUnreadableDirs = false;
  42209. private static $areSupported = array();
  42210. public function isSupported()
  42211. {
  42212. $name = $this->getName();
  42213. if (!array_key_exists($name, self::$areSupported)) {
  42214. self::$areSupported[$name] = $this->canBeUsed();
  42215. }
  42216. return self::$areSupported[$name];
  42217. }
  42218. public function setFollowLinks($followLinks)
  42219. {
  42220. $this->followLinks = $followLinks;
  42221. return $this;
  42222. }
  42223. public function setMode($mode)
  42224. {
  42225. $this->mode = $mode;
  42226. return $this;
  42227. }
  42228. public function setDepths(array $depths)
  42229. {
  42230. $this->minDepth = 0;
  42231. $this->maxDepth = PHP_INT_MAX;
  42232. foreach ($depths as $comparator) {
  42233. switch ($comparator->getOperator()) {
  42234. case '>':
  42235. $this->minDepth = $comparator->getTarget() + 1;
  42236. break;
  42237. case '>=':
  42238. $this->minDepth = $comparator->getTarget();
  42239. break;
  42240. case '<':
  42241. $this->maxDepth = $comparator->getTarget() - 1;
  42242. break;
  42243. case '<=':
  42244. $this->maxDepth = $comparator->getTarget();
  42245. break;
  42246. default:
  42247. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  42248. }
  42249. }
  42250. return $this;
  42251. }
  42252. public function setExclude(array $exclude)
  42253. {
  42254. $this->exclude = $exclude;
  42255. return $this;
  42256. }
  42257. public function setNames(array $names)
  42258. {
  42259. $this->names = $names;
  42260. return $this;
  42261. }
  42262. public function setNotNames(array $notNames)
  42263. {
  42264. $this->notNames = $notNames;
  42265. return $this;
  42266. }
  42267. public function setContains(array $contains)
  42268. {
  42269. $this->contains = $contains;
  42270. return $this;
  42271. }
  42272. public function setNotContains(array $notContains)
  42273. {
  42274. $this->notContains = $notContains;
  42275. return $this;
  42276. }
  42277. public function setSizes(array $sizes)
  42278. {
  42279. $this->sizes = $sizes;
  42280. return $this;
  42281. }
  42282. public function setDates(array $dates)
  42283. {
  42284. $this->dates = $dates;
  42285. return $this;
  42286. }
  42287. public function setFilters(array $filters)
  42288. {
  42289. $this->filters = $filters;
  42290. return $this;
  42291. }
  42292. public function setSort($sort)
  42293. {
  42294. $this->sort = $sort;
  42295. return $this;
  42296. }
  42297. public function setPath(array $paths)
  42298. {
  42299. $this->paths = $paths;
  42300. return $this;
  42301. }
  42302. public function setNotPath(array $notPaths)
  42303. {
  42304. $this->notPaths = $notPaths;
  42305. return $this;
  42306. }
  42307. public function ignoreUnreadableDirs($ignore = true)
  42308. {
  42309. $this->ignoreUnreadableDirs = (bool) $ignore;
  42310. return $this;
  42311. }
  42312. abstract protected function canBeUsed();
  42313. }
  42314. <?php
  42315. namespace Symfony\Component\Finder\Adapter;
  42316. @trigger_error('The '.__NAMESPACE__.'\AbstractFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42317. use Symfony\Component\Finder\Comparator\DateComparator;
  42318. use Symfony\Component\Finder\Comparator\NumberComparator;
  42319. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42320. use Symfony\Component\Finder\Expression\Expression;
  42321. use Symfony\Component\Finder\Iterator;
  42322. use Symfony\Component\Finder\Shell\Command;
  42323. use Symfony\Component\Finder\Shell\Shell;
  42324. abstract class AbstractFindAdapter extends AbstractAdapter
  42325. {
  42326. protected $shell;
  42327. public function __construct()
  42328. {
  42329. $this->shell = new Shell();
  42330. }
  42331. public function searchInDirectory($dir)
  42332. {
  42333. $dir = realpath($dir);
  42334. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  42335. return new Iterator\FilePathsIterator(array(), $dir);
  42336. }
  42337. $command = Command::create();
  42338. $find = $this->buildFindCommand($command, $dir);
  42339. if ($this->followLinks) {
  42340. $find->add('-follow');
  42341. }
  42342. $find->add('-mindepth')->add($this->minDepth + 1);
  42343. if (PHP_INT_MAX !== $this->maxDepth) {
  42344. $find->add('-maxdepth')->add($this->maxDepth + 1);
  42345. }
  42346. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  42347. $find->add('-type d');
  42348. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  42349. $find->add('-type f');
  42350. }
  42351. $this->buildNamesFiltering($find, $this->names);
  42352. $this->buildNamesFiltering($find, $this->notNames, true);
  42353. $this->buildPathsFiltering($find, $dir, $this->paths);
  42354. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  42355. $this->buildSizesFiltering($find, $this->sizes);
  42356. $this->buildDatesFiltering($find, $this->dates);
  42357. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  42358. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  42359. if ($useGrep && ($this->contains || $this->notContains)) {
  42360. $grep = $command->ins('grep');
  42361. $this->buildContentFiltering($grep, $this->contains);
  42362. $this->buildContentFiltering($grep, $this->notContains, true);
  42363. }
  42364. if ($useSort) {
  42365. $this->buildSorting($command, $this->sort);
  42366. }
  42367. $command->setErrorHandler(
  42368. $this->ignoreUnreadableDirs
  42369. ? function ($stderr) { }
  42370. : function ($stderr) { throw new AccessDeniedException($stderr); }
  42371. );
  42372. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  42373. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  42374. if ($this->exclude) {
  42375. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42376. }
  42377. if (!$useGrep && ($this->contains || $this->notContains)) {
  42378. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42379. }
  42380. if ($this->filters) {
  42381. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42382. }
  42383. if (!$useSort && $this->sort) {
  42384. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42385. $iterator = $iteratorAggregate->getIterator();
  42386. }
  42387. return $iterator;
  42388. }
  42389. protected function canBeUsed()
  42390. {
  42391. return $this->shell->testCommand('find');
  42392. }
  42393. protected function buildFindCommand(Command $command, $dir)
  42394. {
  42395. return $command
  42396. ->ins('find')
  42397. ->add('find ')
  42398. ->arg($dir)
  42399. ->add('-noleaf');
  42400. }
  42401. private function buildNamesFiltering(Command $command, array $names, $not = false)
  42402. {
  42403. if (0 === \count($names)) {
  42404. return;
  42405. }
  42406. $command->add($not ? '-not' : null)->cmd('(');
  42407. foreach ($names as $i => $name) {
  42408. $expr = Expression::create($name);
  42409. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42410. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42411. }
  42412. if ($expr->isRegex()) {
  42413. $regex = $expr->getRegex();
  42414. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  42415. ->setStartFlag(false)
  42416. ->setStartJoker(true)
  42417. ->replaceJokers('[^/]');
  42418. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  42419. $regex->setEndJoker(false)->append('[^/]*');
  42420. }
  42421. }
  42422. $command
  42423. ->add($i > 0 ? '-or' : null)
  42424. ->add($expr->isRegex()
  42425. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42426. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  42427. )
  42428. ->arg($expr->renderPattern());
  42429. }
  42430. $command->cmd(')');
  42431. }
  42432. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  42433. {
  42434. if (0 === \count($paths)) {
  42435. return;
  42436. }
  42437. $command->add($not ? '-not' : null)->cmd('(');
  42438. foreach ($paths as $i => $path) {
  42439. $expr = Expression::create($path);
  42440. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  42441. $expr = Expression::create($expr->getGlob()->toRegex(false));
  42442. }
  42443. if ($expr->isRegex()) {
  42444. $regex = $expr->getRegex();
  42445. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  42446. } else {
  42447. $expr->prepend('*')->append('*');
  42448. }
  42449. $command
  42450. ->add($i > 0 ? '-or' : null)
  42451. ->add($expr->isRegex()
  42452. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  42453. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  42454. )
  42455. ->arg($expr->renderPattern());
  42456. }
  42457. $command->cmd(')');
  42458. }
  42459. private function buildSizesFiltering(Command $command, array $sizes)
  42460. {
  42461. foreach ($sizes as $i => $size) {
  42462. $command->add($i > 0 ? '-and' : null);
  42463. switch ($size->getOperator()) {
  42464. case '<=':
  42465. $command->add('-size -'.($size->getTarget() + 1).'c');
  42466. break;
  42467. case '>=':
  42468. $command->add('-size +'.($size->getTarget() - 1).'c');
  42469. break;
  42470. case '>':
  42471. $command->add('-size +'.$size->getTarget().'c');
  42472. break;
  42473. case '!=':
  42474. $command->add('-size -'.$size->getTarget().'c');
  42475. $command->add('-size +'.$size->getTarget().'c');
  42476. break;
  42477. case '<':
  42478. default:
  42479. $command->add('-size -'.$size->getTarget().'c');
  42480. }
  42481. }
  42482. }
  42483. private function buildDatesFiltering(Command $command, array $dates)
  42484. {
  42485. foreach ($dates as $i => $date) {
  42486. $command->add($i > 0 ? '-and' : null);
  42487. $mins = (int) round((time() - $date->getTarget()) / 60);
  42488. if (0 > $mins) {
  42489. $command->add(' -mmin -0');
  42490. return;
  42491. }
  42492. switch ($date->getOperator()) {
  42493. case '<=':
  42494. $command->add('-mmin +'.($mins - 1));
  42495. break;
  42496. case '>=':
  42497. $command->add('-mmin -'.($mins + 1));
  42498. break;
  42499. case '>':
  42500. $command->add('-mmin -'.$mins);
  42501. break;
  42502. case '!=':
  42503. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  42504. break;
  42505. case '<':
  42506. default:
  42507. $command->add('-mmin +'.$mins);
  42508. }
  42509. }
  42510. }
  42511. private function buildSorting(Command $command, $sort)
  42512. {
  42513. $this->buildFormatSorting($command, $sort);
  42514. }
  42515. abstract protected function buildFormatSorting(Command $command, $sort);
  42516. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  42517. }
  42518. <?php
  42519. namespace Symfony\Component\Finder\Adapter;
  42520. interface AdapterInterface
  42521. {
  42522. public function setFollowLinks($followLinks);
  42523. public function setMode($mode);
  42524. public function setExclude(array $exclude);
  42525. public function setDepths(array $depths);
  42526. public function setNames(array $names);
  42527. public function setNotNames(array $notNames);
  42528. public function setContains(array $contains);
  42529. public function setNotContains(array $notContains);
  42530. public function setSizes(array $sizes);
  42531. public function setDates(array $dates);
  42532. public function setFilters(array $filters);
  42533. public function setSort($sort);
  42534. public function setPath(array $paths);
  42535. public function setNotPath(array $notPaths);
  42536. public function ignoreUnreadableDirs($ignore = true);
  42537. public function searchInDirectory($dir);
  42538. public function isSupported();
  42539. public function getName();
  42540. }
  42541. <?php
  42542. namespace Symfony\Component\Finder\Adapter;
  42543. @trigger_error('The '.__NAMESPACE__.'\BsdFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42544. use Symfony\Component\Finder\Expression\Expression;
  42545. use Symfony\Component\Finder\Iterator\SortableIterator;
  42546. use Symfony\Component\Finder\Shell\Command;
  42547. use Symfony\Component\Finder\Shell\Shell;
  42548. class BsdFindAdapter extends AbstractFindAdapter
  42549. {
  42550. public function getName()
  42551. {
  42552. return 'bsd_find';
  42553. }
  42554. protected function canBeUsed()
  42555. {
  42556. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  42557. }
  42558. protected function buildFormatSorting(Command $command, $sort)
  42559. {
  42560. switch ($sort) {
  42561. case SortableIterator::SORT_BY_NAME:
  42562. $command->ins('sort')->add('| sort');
  42563. return;
  42564. case SortableIterator::SORT_BY_TYPE:
  42565. $format = '%HT';
  42566. break;
  42567. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42568. $format = '%a';
  42569. break;
  42570. case SortableIterator::SORT_BY_CHANGED_TIME:
  42571. $format = '%c';
  42572. break;
  42573. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42574. $format = '%m';
  42575. break;
  42576. default:
  42577. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42578. }
  42579. $command
  42580. ->add('-print0 | xargs -0 stat -f')
  42581. ->arg($format.'%t%N')
  42582. ->add('| sort | cut -f 2');
  42583. }
  42584. protected function buildFindCommand(Command $command, $dir)
  42585. {
  42586. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  42587. return $command;
  42588. }
  42589. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42590. {
  42591. foreach ($contains as $contain) {
  42592. $expr = Expression::create($contain);
  42593. $command
  42594. ->add('| grep -v \'^$\'')
  42595. ->add('| xargs -I{} grep -I')
  42596. ->add($expr->isCaseSensitive() ? null : '-i')
  42597. ->add($not ? '-L' : '-l')
  42598. ->add('-Ee')->arg($expr->renderPattern())
  42599. ->add('{}')
  42600. ;
  42601. }
  42602. }
  42603. }
  42604. <?php
  42605. namespace Symfony\Component\Finder\Adapter;
  42606. @trigger_error('The '.__NAMESPACE__.'\GnuFindAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42607. use Symfony\Component\Finder\Expression\Expression;
  42608. use Symfony\Component\Finder\Iterator\SortableIterator;
  42609. use Symfony\Component\Finder\Shell\Command;
  42610. use Symfony\Component\Finder\Shell\Shell;
  42611. class GnuFindAdapter extends AbstractFindAdapter
  42612. {
  42613. public function getName()
  42614. {
  42615. return 'gnu_find';
  42616. }
  42617. protected function buildFormatSorting(Command $command, $sort)
  42618. {
  42619. switch ($sort) {
  42620. case SortableIterator::SORT_BY_NAME:
  42621. $command->ins('sort')->add('| sort');
  42622. return;
  42623. case SortableIterator::SORT_BY_TYPE:
  42624. $format = '%y';
  42625. break;
  42626. case SortableIterator::SORT_BY_ACCESSED_TIME:
  42627. $format = '%A@';
  42628. break;
  42629. case SortableIterator::SORT_BY_CHANGED_TIME:
  42630. $format = '%C@';
  42631. break;
  42632. case SortableIterator::SORT_BY_MODIFIED_TIME:
  42633. $format = '%T@';
  42634. break;
  42635. default:
  42636. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  42637. }
  42638. $command
  42639. ->get('find')
  42640. ->add('-printf')
  42641. ->arg($format.' %h/%f\\n')
  42642. ->add('| sort | cut')
  42643. ->arg('-d ')
  42644. ->arg('-f2-')
  42645. ;
  42646. }
  42647. protected function canBeUsed()
  42648. {
  42649. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  42650. }
  42651. protected function buildFindCommand(Command $command, $dir)
  42652. {
  42653. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  42654. }
  42655. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  42656. {
  42657. foreach ($contains as $contain) {
  42658. $expr = Expression::create($contain);
  42659. $command
  42660. ->add('| xargs -I{} -r grep -I')
  42661. ->add($expr->isCaseSensitive() ? null : '-i')
  42662. ->add($not ? '-L' : '-l')
  42663. ->add('-Ee')->arg($expr->renderPattern())
  42664. ->add('{}')
  42665. ;
  42666. }
  42667. }
  42668. }
  42669. <?php
  42670. namespace Symfony\Component\Finder\Adapter;
  42671. @trigger_error('The '.__NAMESPACE__.'\PhpAdapter class is deprecated since Symfony 2.8 and will be removed in 3.0. Use directly the Finder class instead.', E_USER_DEPRECATED);
  42672. use Symfony\Component\Finder\Iterator;
  42673. class PhpAdapter extends AbstractAdapter
  42674. {
  42675. public function searchInDirectory($dir)
  42676. {
  42677. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42678. if ($this->followLinks) {
  42679. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42680. }
  42681. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42682. if ($this->exclude) {
  42683. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42684. }
  42685. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42686. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  42687. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  42688. }
  42689. if ($this->mode) {
  42690. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42691. }
  42692. if ($this->names || $this->notNames) {
  42693. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42694. }
  42695. if ($this->contains || $this->notContains) {
  42696. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42697. }
  42698. if ($this->sizes) {
  42699. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42700. }
  42701. if ($this->dates) {
  42702. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42703. }
  42704. if ($this->filters) {
  42705. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42706. }
  42707. if ($this->paths || $this->notPaths) {
  42708. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42709. }
  42710. if ($this->sort) {
  42711. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42712. $iterator = $iteratorAggregate->getIterator();
  42713. }
  42714. return $iterator;
  42715. }
  42716. public function getName()
  42717. {
  42718. return 'php';
  42719. }
  42720. protected function canBeUsed()
  42721. {
  42722. return true;
  42723. }
  42724. }
  42725. <?php
  42726. namespace Symfony\Component\Finder\Comparator;
  42727. class Comparator
  42728. {
  42729. private $target;
  42730. private $operator = '==';
  42731. public function getTarget()
  42732. {
  42733. return $this->target;
  42734. }
  42735. public function setTarget($target)
  42736. {
  42737. $this->target = $target;
  42738. }
  42739. public function getOperator()
  42740. {
  42741. return $this->operator;
  42742. }
  42743. public function setOperator($operator)
  42744. {
  42745. if (!$operator) {
  42746. $operator = '==';
  42747. }
  42748. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  42749. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  42750. }
  42751. $this->operator = $operator;
  42752. }
  42753. public function test($test)
  42754. {
  42755. switch ($this->operator) {
  42756. case '>':
  42757. return $test > $this->target;
  42758. case '>=':
  42759. return $test >= $this->target;
  42760. case '<':
  42761. return $test < $this->target;
  42762. case '<=':
  42763. return $test <= $this->target;
  42764. case '!=':
  42765. return $test != $this->target;
  42766. }
  42767. return $test == $this->target;
  42768. }
  42769. }
  42770. <?php
  42771. namespace Symfony\Component\Finder\Comparator;
  42772. class DateComparator extends Comparator
  42773. {
  42774. public function __construct($test)
  42775. {
  42776. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  42777. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  42778. }
  42779. try {
  42780. $date = new \DateTime($matches[2]);
  42781. $target = $date->format('U');
  42782. } catch (\Exception $e) {
  42783. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  42784. }
  42785. $operator = isset($matches[1]) ? $matches[1] : '==';
  42786. if ('since' === $operator || 'after' === $operator) {
  42787. $operator = '>';
  42788. }
  42789. if ('until' === $operator || 'before' === $operator) {
  42790. $operator = '<';
  42791. }
  42792. $this->setOperator($operator);
  42793. $this->setTarget($target);
  42794. }
  42795. }
  42796. <?php
  42797. namespace Symfony\Component\Finder\Comparator;
  42798. class NumberComparator extends Comparator
  42799. {
  42800. public function __construct($test)
  42801. {
  42802. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  42803. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  42804. }
  42805. $target = $matches[2];
  42806. if (!is_numeric($target)) {
  42807. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  42808. }
  42809. if (isset($matches[3])) {
  42810. switch (strtolower($matches[3])) {
  42811. case 'k':
  42812. $target *= 1000;
  42813. break;
  42814. case 'ki':
  42815. $target *= 1024;
  42816. break;
  42817. case 'm':
  42818. $target *= 1000000;
  42819. break;
  42820. case 'mi':
  42821. $target *= 1024 * 1024;
  42822. break;
  42823. case 'g':
  42824. $target *= 1000000000;
  42825. break;
  42826. case 'gi':
  42827. $target *= 1024 * 1024 * 1024;
  42828. break;
  42829. }
  42830. }
  42831. $this->setTarget($target);
  42832. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  42833. }
  42834. }
  42835. <?php
  42836. namespace Symfony\Component\Finder\Exception;
  42837. class AccessDeniedException extends \UnexpectedValueException
  42838. {
  42839. }
  42840. <?php
  42841. namespace Symfony\Component\Finder\Exception;
  42842. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42843. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42844. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  42845. {
  42846. private $adapter;
  42847. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  42848. {
  42849. $this->adapter = $adapter;
  42850. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  42851. }
  42852. public function getAdapter()
  42853. {
  42854. return $this->adapter;
  42855. }
  42856. }
  42857. <?php
  42858. namespace Symfony\Component\Finder\Exception;
  42859. interface ExceptionInterface
  42860. {
  42861. public function getAdapter();
  42862. }
  42863. <?php
  42864. namespace Symfony\Component\Finder\Exception;
  42865. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42866. class OperationNotPermitedException extends AdapterFailureException
  42867. {
  42868. }
  42869. <?php
  42870. namespace Symfony\Component\Finder\Exception;
  42871. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42872. use Symfony\Component\Finder\Adapter\AdapterInterface;
  42873. use Symfony\Component\Finder\Shell\Command;
  42874. class ShellCommandFailureException extends AdapterFailureException
  42875. {
  42876. private $command;
  42877. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  42878. {
  42879. $this->command = $command;
  42880. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  42881. }
  42882. public function getCommand()
  42883. {
  42884. return $this->command;
  42885. }
  42886. }
  42887. <?php
  42888. namespace Symfony\Component\Finder\Expression;
  42889. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42890. class Expression implements ValueInterface
  42891. {
  42892. const TYPE_REGEX = 1;
  42893. const TYPE_GLOB = 2;
  42894. private $value;
  42895. public static function create($expr)
  42896. {
  42897. return new self($expr);
  42898. }
  42899. public function __construct($expr)
  42900. {
  42901. try {
  42902. $this->value = Regex::create($expr);
  42903. } catch (\InvalidArgumentException $e) {
  42904. $this->value = new Glob($expr);
  42905. }
  42906. }
  42907. public function __toString()
  42908. {
  42909. return $this->render();
  42910. }
  42911. public function render()
  42912. {
  42913. return $this->value->render();
  42914. }
  42915. public function renderPattern()
  42916. {
  42917. return $this->value->renderPattern();
  42918. }
  42919. public function isCaseSensitive()
  42920. {
  42921. return $this->value->isCaseSensitive();
  42922. }
  42923. public function getType()
  42924. {
  42925. return $this->value->getType();
  42926. }
  42927. public function prepend($expr)
  42928. {
  42929. $this->value->prepend($expr);
  42930. return $this;
  42931. }
  42932. public function append($expr)
  42933. {
  42934. $this->value->append($expr);
  42935. return $this;
  42936. }
  42937. public function isRegex()
  42938. {
  42939. return self::TYPE_REGEX === $this->value->getType();
  42940. }
  42941. public function isGlob()
  42942. {
  42943. return self::TYPE_GLOB === $this->value->getType();
  42944. }
  42945. public function getGlob()
  42946. {
  42947. if (self::TYPE_GLOB !== $this->value->getType()) {
  42948. throw new \LogicException('Regex can\'t be transformed to glob.');
  42949. }
  42950. return $this->value;
  42951. }
  42952. public function getRegex()
  42953. {
  42954. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  42955. }
  42956. }
  42957. <?php
  42958. namespace Symfony\Component\Finder\Expression;
  42959. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42960. use Symfony\Component\Finder\Glob as FinderGlob;
  42961. class Glob implements ValueInterface
  42962. {
  42963. private $pattern;
  42964. public function __construct($pattern)
  42965. {
  42966. $this->pattern = $pattern;
  42967. }
  42968. public function render()
  42969. {
  42970. return $this->pattern;
  42971. }
  42972. public function renderPattern()
  42973. {
  42974. return $this->pattern;
  42975. }
  42976. public function getType()
  42977. {
  42978. return Expression::TYPE_GLOB;
  42979. }
  42980. public function isCaseSensitive()
  42981. {
  42982. return true;
  42983. }
  42984. public function prepend($expr)
  42985. {
  42986. $this->pattern = $expr.$this->pattern;
  42987. return $this;
  42988. }
  42989. public function append($expr)
  42990. {
  42991. $this->pattern .= $expr;
  42992. return $this;
  42993. }
  42994. public function isExpandable()
  42995. {
  42996. return false !== strpos($this->pattern, '{')
  42997. && false !== strpos($this->pattern, '}');
  42998. }
  42999. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  43000. {
  43001. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  43002. return new Regex($regex);
  43003. }
  43004. }
  43005. <?php
  43006. namespace Symfony\Component\Finder\Expression;
  43007. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43008. class Regex implements ValueInterface
  43009. {
  43010. const START_FLAG = '^';
  43011. const END_FLAG = '$';
  43012. const BOUNDARY = '~';
  43013. const JOKER = '.*';
  43014. const ESCAPING = '\\';
  43015. private $pattern;
  43016. private $options;
  43017. private $startFlag;
  43018. private $endFlag;
  43019. private $startJoker;
  43020. private $endJoker;
  43021. public static function create($expr)
  43022. {
  43023. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  43024. $start = substr($m[1], 0, 1);
  43025. $end = substr($m[1], -1);
  43026. if (
  43027. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  43028. || ('{' === $start && '}' === $end)
  43029. || ('(' === $start && ')' === $end)
  43030. ) {
  43031. return new self(substr($m[1], 1, -1), $m[2], $end);
  43032. }
  43033. }
  43034. throw new \InvalidArgumentException('Given expression is not a regex.');
  43035. }
  43036. public function __construct($pattern, $options = '', $delimiter = null)
  43037. {
  43038. if (null !== $delimiter) {
  43039. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  43040. }
  43041. $this->parsePattern($pattern);
  43042. $this->options = $options;
  43043. }
  43044. public function __toString()
  43045. {
  43046. return $this->render();
  43047. }
  43048. public function render()
  43049. {
  43050. return self::BOUNDARY
  43051. .$this->renderPattern()
  43052. .self::BOUNDARY
  43053. .$this->options;
  43054. }
  43055. public function renderPattern()
  43056. {
  43057. return ($this->startFlag ? self::START_FLAG : '')
  43058. .($this->startJoker ? self::JOKER : '')
  43059. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  43060. .($this->endJoker ? self::JOKER : '')
  43061. .($this->endFlag ? self::END_FLAG : '');
  43062. }
  43063. public function isCaseSensitive()
  43064. {
  43065. return !$this->hasOption('i');
  43066. }
  43067. public function getType()
  43068. {
  43069. return Expression::TYPE_REGEX;
  43070. }
  43071. public function prepend($expr)
  43072. {
  43073. $this->pattern = $expr.$this->pattern;
  43074. return $this;
  43075. }
  43076. public function append($expr)
  43077. {
  43078. $this->pattern .= $expr;
  43079. return $this;
  43080. }
  43081. public function hasOption($option)
  43082. {
  43083. return false !== strpos($this->options, $option);
  43084. }
  43085. public function addOption($option)
  43086. {
  43087. if (!$this->hasOption($option)) {
  43088. $this->options .= $option;
  43089. }
  43090. return $this;
  43091. }
  43092. public function removeOption($option)
  43093. {
  43094. $this->options = str_replace($option, '', $this->options);
  43095. return $this;
  43096. }
  43097. public function setStartFlag($startFlag)
  43098. {
  43099. $this->startFlag = $startFlag;
  43100. return $this;
  43101. }
  43102. public function hasStartFlag()
  43103. {
  43104. return $this->startFlag;
  43105. }
  43106. public function setEndFlag($endFlag)
  43107. {
  43108. $this->endFlag = (bool) $endFlag;
  43109. return $this;
  43110. }
  43111. public function hasEndFlag()
  43112. {
  43113. return $this->endFlag;
  43114. }
  43115. public function setStartJoker($startJoker)
  43116. {
  43117. $this->startJoker = $startJoker;
  43118. return $this;
  43119. }
  43120. public function hasStartJoker()
  43121. {
  43122. return $this->startJoker;
  43123. }
  43124. public function setEndJoker($endJoker)
  43125. {
  43126. $this->endJoker = (bool) $endJoker;
  43127. return $this;
  43128. }
  43129. public function hasEndJoker()
  43130. {
  43131. return $this->endJoker;
  43132. }
  43133. public function replaceJokers($replacement)
  43134. {
  43135. $replace = function ($subject) use ($replacement) {
  43136. $subject = $subject[0];
  43137. $replace = 0 === substr_count($subject, '\\') % 2;
  43138. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  43139. };
  43140. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  43141. return $this;
  43142. }
  43143. private function parsePattern($pattern)
  43144. {
  43145. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  43146. $pattern = substr($pattern, 1);
  43147. }
  43148. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  43149. $pattern = substr($pattern, 2);
  43150. }
  43151. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  43152. $pattern = substr($pattern, 0, -1);
  43153. }
  43154. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  43155. $pattern = substr($pattern, 0, -2);
  43156. }
  43157. $this->pattern = $pattern;
  43158. }
  43159. }
  43160. <?php
  43161. namespace Symfony\Component\Finder\Expression;
  43162. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43163. interface ValueInterface
  43164. {
  43165. public function render();
  43166. public function renderPattern();
  43167. public function isCaseSensitive();
  43168. public function getType();
  43169. public function prepend($expr);
  43170. public function append($expr);
  43171. }
  43172. <?php
  43173. namespace Symfony\Component\Finder;
  43174. use Symfony\Component\Finder\Adapter\AdapterInterface;
  43175. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  43176. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  43177. use Symfony\Component\Finder\Adapter\PhpAdapter;
  43178. use Symfony\Component\Finder\Comparator\DateComparator;
  43179. use Symfony\Component\Finder\Comparator\NumberComparator;
  43180. use Symfony\Component\Finder\Exception\ExceptionInterface;
  43181. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  43182. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  43183. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  43184. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  43185. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  43186. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  43187. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  43188. use Symfony\Component\Finder\Iterator\SortableIterator;
  43189. class Finder implements \IteratorAggregate, \Countable
  43190. {
  43191. const IGNORE_VCS_FILES = 1;
  43192. const IGNORE_DOT_FILES = 2;
  43193. private $mode = 0;
  43194. private $names = array();
  43195. private $notNames = array();
  43196. private $exclude = array();
  43197. private $filters = array();
  43198. private $depths = array();
  43199. private $sizes = array();
  43200. private $followLinks = false;
  43201. private $sort = false;
  43202. private $ignore = 0;
  43203. private $dirs = array();
  43204. private $dates = array();
  43205. private $iterators = array();
  43206. private $contains = array();
  43207. private $notContains = array();
  43208. private $adapters = null;
  43209. private $paths = array();
  43210. private $notPaths = array();
  43211. private $ignoreUnreadableDirs = false;
  43212. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  43213. public function __construct()
  43214. {
  43215. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  43216. }
  43217. public static function create()
  43218. {
  43219. return new static();
  43220. }
  43221. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  43222. {
  43223. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43224. $this->initDefaultAdapters();
  43225. $this->adapters[$adapter->getName()] = array(
  43226. 'adapter' => $adapter,
  43227. 'priority' => $priority,
  43228. 'selected' => false,
  43229. );
  43230. return $this->sortAdapters();
  43231. }
  43232. public function useBestAdapter()
  43233. {
  43234. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43235. $this->initDefaultAdapters();
  43236. $this->resetAdapterSelection();
  43237. return $this->sortAdapters();
  43238. }
  43239. public function setAdapter($name)
  43240. {
  43241. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43242. $this->initDefaultAdapters();
  43243. if (!isset($this->adapters[$name])) {
  43244. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  43245. }
  43246. $this->resetAdapterSelection();
  43247. $this->adapters[$name]['selected'] = true;
  43248. return $this->sortAdapters();
  43249. }
  43250. public function removeAdapters()
  43251. {
  43252. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43253. $this->adapters = array();
  43254. return $this;
  43255. }
  43256. public function getAdapters()
  43257. {
  43258. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43259. $this->initDefaultAdapters();
  43260. return array_values(array_map(function (array $adapter) {
  43261. return $adapter['adapter'];
  43262. }, $this->adapters));
  43263. }
  43264. public function directories()
  43265. {
  43266. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  43267. return $this;
  43268. }
  43269. public function files()
  43270. {
  43271. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  43272. return $this;
  43273. }
  43274. public function depth($level)
  43275. {
  43276. $this->depths[] = new Comparator\NumberComparator($level);
  43277. return $this;
  43278. }
  43279. public function date($date)
  43280. {
  43281. $this->dates[] = new Comparator\DateComparator($date);
  43282. return $this;
  43283. }
  43284. public function name($pattern)
  43285. {
  43286. $this->names[] = $pattern;
  43287. return $this;
  43288. }
  43289. public function notName($pattern)
  43290. {
  43291. $this->notNames[] = $pattern;
  43292. return $this;
  43293. }
  43294. public function contains($pattern)
  43295. {
  43296. $this->contains[] = $pattern;
  43297. return $this;
  43298. }
  43299. public function notContains($pattern)
  43300. {
  43301. $this->notContains[] = $pattern;
  43302. return $this;
  43303. }
  43304. public function path($pattern)
  43305. {
  43306. $this->paths[] = $pattern;
  43307. return $this;
  43308. }
  43309. public function notPath($pattern)
  43310. {
  43311. $this->notPaths[] = $pattern;
  43312. return $this;
  43313. }
  43314. public function size($size)
  43315. {
  43316. $this->sizes[] = new Comparator\NumberComparator($size);
  43317. return $this;
  43318. }
  43319. public function exclude($dirs)
  43320. {
  43321. $this->exclude = array_merge($this->exclude, (array) $dirs);
  43322. return $this;
  43323. }
  43324. public function ignoreDotFiles($ignoreDotFiles)
  43325. {
  43326. if ($ignoreDotFiles) {
  43327. $this->ignore |= static::IGNORE_DOT_FILES;
  43328. } else {
  43329. $this->ignore &= ~static::IGNORE_DOT_FILES;
  43330. }
  43331. return $this;
  43332. }
  43333. public function ignoreVCS($ignoreVCS)
  43334. {
  43335. if ($ignoreVCS) {
  43336. $this->ignore |= static::IGNORE_VCS_FILES;
  43337. } else {
  43338. $this->ignore &= ~static::IGNORE_VCS_FILES;
  43339. }
  43340. return $this;
  43341. }
  43342. public static function addVCSPattern($pattern)
  43343. {
  43344. foreach ((array) $pattern as $p) {
  43345. self::$vcsPatterns[] = $p;
  43346. }
  43347. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  43348. }
  43349. public function sort(\Closure $closure)
  43350. {
  43351. $this->sort = $closure;
  43352. return $this;
  43353. }
  43354. public function sortByName()
  43355. {
  43356. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  43357. return $this;
  43358. }
  43359. public function sortByType()
  43360. {
  43361. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  43362. return $this;
  43363. }
  43364. public function sortByAccessedTime()
  43365. {
  43366. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  43367. return $this;
  43368. }
  43369. public function sortByChangedTime()
  43370. {
  43371. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  43372. return $this;
  43373. }
  43374. public function sortByModifiedTime()
  43375. {
  43376. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  43377. return $this;
  43378. }
  43379. public function filter(\Closure $closure)
  43380. {
  43381. $this->filters[] = $closure;
  43382. return $this;
  43383. }
  43384. public function followLinks()
  43385. {
  43386. $this->followLinks = true;
  43387. return $this;
  43388. }
  43389. public function ignoreUnreadableDirs($ignore = true)
  43390. {
  43391. $this->ignoreUnreadableDirs = (bool) $ignore;
  43392. return $this;
  43393. }
  43394. public function in($dirs)
  43395. {
  43396. $resolvedDirs = array();
  43397. foreach ((array) $dirs as $dir) {
  43398. if (is_dir($dir)) {
  43399. $resolvedDirs[] = $this->normalizeDir($dir);
  43400. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  43401. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  43402. } else {
  43403. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  43404. }
  43405. }
  43406. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  43407. return $this;
  43408. }
  43409. public function getIterator()
  43410. {
  43411. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43412. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  43413. }
  43414. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  43415. return $this->searchInDirectory($this->dirs[0]);
  43416. }
  43417. $iterator = new \AppendIterator();
  43418. foreach ($this->dirs as $dir) {
  43419. $iterator->append($this->searchInDirectory($dir));
  43420. }
  43421. foreach ($this->iterators as $it) {
  43422. $iterator->append($it);
  43423. }
  43424. return $iterator;
  43425. }
  43426. public function append($iterator)
  43427. {
  43428. if ($iterator instanceof \IteratorAggregate) {
  43429. $this->iterators[] = $iterator->getIterator();
  43430. } elseif ($iterator instanceof \Iterator) {
  43431. $this->iterators[] = $iterator;
  43432. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  43433. $it = new \ArrayIterator();
  43434. foreach ($iterator as $file) {
  43435. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  43436. }
  43437. $this->iterators[] = $it;
  43438. } else {
  43439. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  43440. }
  43441. return $this;
  43442. }
  43443. public function count()
  43444. {
  43445. return iterator_count($this->getIterator());
  43446. }
  43447. private function sortAdapters()
  43448. {
  43449. uasort($this->adapters, function (array $a, array $b) {
  43450. if ($a['selected'] || $b['selected']) {
  43451. return $a['selected'] ? -1 : 1;
  43452. }
  43453. return $a['priority'] > $b['priority'] ? -1 : 1;
  43454. });
  43455. return $this;
  43456. }
  43457. private function searchInDirectory($dir)
  43458. {
  43459. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  43460. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  43461. }
  43462. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  43463. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  43464. }
  43465. if ($this->adapters) {
  43466. foreach ($this->adapters as $adapter) {
  43467. if ($adapter['adapter']->isSupported()) {
  43468. try {
  43469. return $this
  43470. ->buildAdapter($adapter['adapter'])
  43471. ->searchInDirectory($dir);
  43472. } catch (ExceptionInterface $e) {
  43473. }
  43474. }
  43475. }
  43476. }
  43477. $minDepth = 0;
  43478. $maxDepth = PHP_INT_MAX;
  43479. foreach ($this->depths as $comparator) {
  43480. switch ($comparator->getOperator()) {
  43481. case '>':
  43482. $minDepth = $comparator->getTarget() + 1;
  43483. break;
  43484. case '>=':
  43485. $minDepth = $comparator->getTarget();
  43486. break;
  43487. case '<':
  43488. $maxDepth = $comparator->getTarget() - 1;
  43489. break;
  43490. case '<=':
  43491. $maxDepth = $comparator->getTarget();
  43492. break;
  43493. default:
  43494. $minDepth = $maxDepth = $comparator->getTarget();
  43495. }
  43496. }
  43497. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  43498. if ($this->followLinks) {
  43499. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  43500. }
  43501. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  43502. if ($this->exclude) {
  43503. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  43504. }
  43505. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  43506. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  43507. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  43508. }
  43509. if ($this->mode) {
  43510. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  43511. }
  43512. if ($this->names || $this->notNames) {
  43513. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  43514. }
  43515. if ($this->contains || $this->notContains) {
  43516. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  43517. }
  43518. if ($this->sizes) {
  43519. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  43520. }
  43521. if ($this->dates) {
  43522. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  43523. }
  43524. if ($this->filters) {
  43525. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  43526. }
  43527. if ($this->paths || $this->notPaths) {
  43528. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  43529. }
  43530. if ($this->sort) {
  43531. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  43532. $iterator = $iteratorAggregate->getIterator();
  43533. }
  43534. return $iterator;
  43535. }
  43536. private function buildAdapter(AdapterInterface $adapter)
  43537. {
  43538. return $adapter
  43539. ->setFollowLinks($this->followLinks)
  43540. ->setDepths($this->depths)
  43541. ->setMode($this->mode)
  43542. ->setExclude($this->exclude)
  43543. ->setNames($this->names)
  43544. ->setNotNames($this->notNames)
  43545. ->setContains($this->contains)
  43546. ->setNotContains($this->notContains)
  43547. ->setSizes($this->sizes)
  43548. ->setDates($this->dates)
  43549. ->setFilters($this->filters)
  43550. ->setSort($this->sort)
  43551. ->setPath($this->paths)
  43552. ->setNotPath($this->notPaths)
  43553. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  43554. }
  43555. private function resetAdapterSelection()
  43556. {
  43557. $this->adapters = array_map(function (array $properties) {
  43558. $properties['selected'] = false;
  43559. return $properties;
  43560. }, $this->adapters);
  43561. }
  43562. private function initDefaultAdapters()
  43563. {
  43564. if (null === $this->adapters) {
  43565. $this->adapters = array();
  43566. $this
  43567. ->addAdapter(new GnuFindAdapter())
  43568. ->addAdapter(new BsdFindAdapter())
  43569. ->addAdapter(new PhpAdapter(), -50)
  43570. ->setAdapter('php')
  43571. ;
  43572. }
  43573. }
  43574. private function normalizeDir($dir)
  43575. {
  43576. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  43577. }
  43578. }
  43579. <?php
  43580. namespace Symfony\Component\Finder;
  43581. class Glob
  43582. {
  43583. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  43584. {
  43585. $firstByte = true;
  43586. $escaping = false;
  43587. $inCurlies = 0;
  43588. $regex = '';
  43589. $sizeGlob = \strlen($glob);
  43590. for ($i = 0; $i < $sizeGlob; ++$i) {
  43591. $car = $glob[$i];
  43592. if ($firstByte) {
  43593. if ($strictLeadingDot && '.' !== $car) {
  43594. $regex .= '(?=[^\.])';
  43595. }
  43596. $firstByte = false;
  43597. }
  43598. if ('/' === $car) {
  43599. $firstByte = true;
  43600. }
  43601. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  43602. $regex .= "\\$car";
  43603. } elseif ('*' === $car) {
  43604. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  43605. } elseif ('?' === $car) {
  43606. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  43607. } elseif ('{' === $car) {
  43608. $regex .= $escaping ? '\\{' : '(';
  43609. if (!$escaping) {
  43610. ++$inCurlies;
  43611. }
  43612. } elseif ('}' === $car && $inCurlies) {
  43613. $regex .= $escaping ? '}' : ')';
  43614. if (!$escaping) {
  43615. --$inCurlies;
  43616. }
  43617. } elseif (',' === $car && $inCurlies) {
  43618. $regex .= $escaping ? ',' : '|';
  43619. } elseif ('\\' === $car) {
  43620. if ($escaping) {
  43621. $regex .= '\\\\';
  43622. $escaping = false;
  43623. } else {
  43624. $escaping = true;
  43625. }
  43626. continue;
  43627. } else {
  43628. $regex .= $car;
  43629. }
  43630. $escaping = false;
  43631. }
  43632. return $delimiter.'^'.$regex.'$'.$delimiter;
  43633. }
  43634. }
  43635. <?php
  43636. namespace Symfony\Component\Finder\Iterator;
  43637. class CustomFilterIterator extends FilterIterator
  43638. {
  43639. private $filters = array();
  43640. public function __construct(\Iterator $iterator, array $filters)
  43641. {
  43642. foreach ($filters as $filter) {
  43643. if (!\is_callable($filter)) {
  43644. throw new \InvalidArgumentException('Invalid PHP callback.');
  43645. }
  43646. }
  43647. $this->filters = $filters;
  43648. parent::__construct($iterator);
  43649. }
  43650. public function accept()
  43651. {
  43652. $fileinfo = $this->current();
  43653. foreach ($this->filters as $filter) {
  43654. if (false === \call_user_func($filter, $fileinfo)) {
  43655. return false;
  43656. }
  43657. }
  43658. return true;
  43659. }
  43660. }
  43661. <?php
  43662. namespace Symfony\Component\Finder\Iterator;
  43663. use Symfony\Component\Finder\Comparator\DateComparator;
  43664. class DateRangeFilterIterator extends FilterIterator
  43665. {
  43666. private $comparators = array();
  43667. public function __construct(\Iterator $iterator, array $comparators)
  43668. {
  43669. $this->comparators = $comparators;
  43670. parent::__construct($iterator);
  43671. }
  43672. public function accept()
  43673. {
  43674. $fileinfo = $this->current();
  43675. if (!file_exists($fileinfo->getPathname())) {
  43676. return false;
  43677. }
  43678. $filedate = $fileinfo->getMTime();
  43679. foreach ($this->comparators as $compare) {
  43680. if (!$compare->test($filedate)) {
  43681. return false;
  43682. }
  43683. }
  43684. return true;
  43685. }
  43686. }
  43687. <?php
  43688. namespace Symfony\Component\Finder\Iterator;
  43689. class DepthRangeFilterIterator extends FilterIterator
  43690. {
  43691. private $minDepth = 0;
  43692. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  43693. {
  43694. $this->minDepth = $minDepth;
  43695. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  43696. parent::__construct($iterator);
  43697. }
  43698. public function accept()
  43699. {
  43700. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  43701. }
  43702. }
  43703. <?php
  43704. namespace Symfony\Component\Finder\Iterator;
  43705. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  43706. {
  43707. private $iterator;
  43708. private $isRecursive;
  43709. private $excludedDirs = array();
  43710. private $excludedPattern;
  43711. public function __construct(\Iterator $iterator, array $directories)
  43712. {
  43713. $this->iterator = $iterator;
  43714. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  43715. $patterns = array();
  43716. foreach ($directories as $directory) {
  43717. $directory = rtrim($directory, '/');
  43718. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  43719. $patterns[] = preg_quote($directory, '#');
  43720. } else {
  43721. $this->excludedDirs[$directory] = true;
  43722. }
  43723. }
  43724. if ($patterns) {
  43725. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  43726. }
  43727. parent::__construct($iterator);
  43728. }
  43729. public function accept()
  43730. {
  43731. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  43732. return false;
  43733. }
  43734. if ($this->excludedPattern) {
  43735. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  43736. $path = str_replace('\\', '/', $path);
  43737. return !preg_match($this->excludedPattern, $path);
  43738. }
  43739. return true;
  43740. }
  43741. public function hasChildren()
  43742. {
  43743. return $this->isRecursive && $this->iterator->hasChildren();
  43744. }
  43745. public function getChildren()
  43746. {
  43747. $children = new self($this->iterator->getChildren(), array());
  43748. $children->excludedDirs = $this->excludedDirs;
  43749. $children->excludedPattern = $this->excludedPattern;
  43750. return $children;
  43751. }
  43752. }
  43753. <?php
  43754. namespace Symfony\Component\Finder\Iterator;
  43755. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  43756. use Symfony\Component\Finder\SplFileInfo;
  43757. class FilePathsIterator extends \ArrayIterator
  43758. {
  43759. private $baseDir;
  43760. private $baseDirLength;
  43761. private $subPath;
  43762. private $subPathname;
  43763. private $current;
  43764. public function __construct(array $paths, $baseDir)
  43765. {
  43766. $this->baseDir = $baseDir;
  43767. $this->baseDirLength = \strlen($baseDir);
  43768. parent::__construct($paths);
  43769. }
  43770. public function __call($name, array $arguments)
  43771. {
  43772. return \call_user_func_array(array($this->current(), $name), $arguments);
  43773. }
  43774. public function current()
  43775. {
  43776. return $this->current;
  43777. }
  43778. public function key()
  43779. {
  43780. return $this->current->getPathname();
  43781. }
  43782. public function next()
  43783. {
  43784. parent::next();
  43785. $this->buildProperties();
  43786. }
  43787. public function rewind()
  43788. {
  43789. parent::rewind();
  43790. $this->buildProperties();
  43791. }
  43792. public function getSubPath()
  43793. {
  43794. return $this->subPath;
  43795. }
  43796. public function getSubPathname()
  43797. {
  43798. return $this->subPathname;
  43799. }
  43800. private function buildProperties()
  43801. {
  43802. $absolutePath = parent::current();
  43803. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  43804. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  43805. $dir = \dirname($this->subPathname);
  43806. $this->subPath = '.' === $dir ? '' : $dir;
  43807. } else {
  43808. $this->subPath = $this->subPathname = '';
  43809. }
  43810. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  43811. }
  43812. }
  43813. <?php
  43814. namespace Symfony\Component\Finder\Iterator;
  43815. class FileTypeFilterIterator extends FilterIterator
  43816. {
  43817. const ONLY_FILES = 1;
  43818. const ONLY_DIRECTORIES = 2;
  43819. private $mode;
  43820. public function __construct(\Iterator $iterator, $mode)
  43821. {
  43822. $this->mode = $mode;
  43823. parent::__construct($iterator);
  43824. }
  43825. public function accept()
  43826. {
  43827. $fileinfo = $this->current();
  43828. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  43829. return false;
  43830. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  43831. return false;
  43832. }
  43833. return true;
  43834. }
  43835. }
  43836. <?php
  43837. namespace Symfony\Component\Finder\Iterator;
  43838. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  43839. {
  43840. public function accept()
  43841. {
  43842. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  43843. return true;
  43844. }
  43845. $fileinfo = $this->current();
  43846. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  43847. return false;
  43848. }
  43849. $content = $fileinfo->getContents();
  43850. if (!$content) {
  43851. return false;
  43852. }
  43853. return $this->isAccepted($content);
  43854. }
  43855. protected function toRegex($str)
  43856. {
  43857. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43858. }
  43859. }
  43860. <?php
  43861. namespace Symfony\Component\Finder\Iterator;
  43862. use Symfony\Component\Finder\Glob;
  43863. class FilenameFilterIterator extends MultiplePcreFilterIterator
  43864. {
  43865. public function accept()
  43866. {
  43867. return $this->isAccepted($this->current()->getFilename());
  43868. }
  43869. protected function toRegex($str)
  43870. {
  43871. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  43872. }
  43873. }
  43874. <?php
  43875. namespace Symfony\Component\Finder\Iterator;
  43876. abstract class FilterIterator extends \FilterIterator
  43877. {
  43878. public function rewind()
  43879. {
  43880. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  43881. parent::rewind();
  43882. return;
  43883. }
  43884. $iterator = $this;
  43885. while ($iterator instanceof \OuterIterator) {
  43886. $innerIterator = $iterator->getInnerIterator();
  43887. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  43888. if ($innerIterator->isRewindable()) {
  43889. $innerIterator->next();
  43890. $innerIterator->rewind();
  43891. }
  43892. } elseif ($innerIterator instanceof \FilesystemIterator) {
  43893. $innerIterator->next();
  43894. $innerIterator->rewind();
  43895. }
  43896. $iterator = $innerIterator;
  43897. }
  43898. parent::rewind();
  43899. }
  43900. }
  43901. <?php
  43902. namespace Symfony\Component\Finder\Iterator;
  43903. abstract class MultiplePcreFilterIterator extends FilterIterator
  43904. {
  43905. protected $matchRegexps = array();
  43906. protected $noMatchRegexps = array();
  43907. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  43908. {
  43909. foreach ($matchPatterns as $pattern) {
  43910. $this->matchRegexps[] = $this->toRegex($pattern);
  43911. }
  43912. foreach ($noMatchPatterns as $pattern) {
  43913. $this->noMatchRegexps[] = $this->toRegex($pattern);
  43914. }
  43915. parent::__construct($iterator);
  43916. }
  43917. protected function isAccepted($string)
  43918. {
  43919. foreach ($this->noMatchRegexps as $regex) {
  43920. if (preg_match($regex, $string)) {
  43921. return false;
  43922. }
  43923. }
  43924. if ($this->matchRegexps) {
  43925. foreach ($this->matchRegexps as $regex) {
  43926. if (preg_match($regex, $string)) {
  43927. return true;
  43928. }
  43929. }
  43930. return false;
  43931. }
  43932. return true;
  43933. }
  43934. protected function isRegex($str)
  43935. {
  43936. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  43937. $start = substr($m[1], 0, 1);
  43938. $end = substr($m[1], -1);
  43939. if ($start === $end) {
  43940. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  43941. }
  43942. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  43943. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  43944. return true;
  43945. }
  43946. }
  43947. }
  43948. return false;
  43949. }
  43950. abstract protected function toRegex($str);
  43951. }
  43952. <?php
  43953. namespace Symfony\Component\Finder\Iterator;
  43954. class PathFilterIterator extends MultiplePcreFilterIterator
  43955. {
  43956. public function accept()
  43957. {
  43958. $filename = $this->current()->getRelativePathname();
  43959. if ('\\' === \DIRECTORY_SEPARATOR) {
  43960. $filename = str_replace('\\', '/', $filename);
  43961. }
  43962. return $this->isAccepted($filename);
  43963. }
  43964. protected function toRegex($str)
  43965. {
  43966. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  43967. }
  43968. }
  43969. <?php
  43970. namespace Symfony\Component\Finder\Iterator;
  43971. use Symfony\Component\Finder\Exception\AccessDeniedException;
  43972. use Symfony\Component\Finder\SplFileInfo;
  43973. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  43974. {
  43975. private $ignoreUnreadableDirs;
  43976. private $rewindable;
  43977. private $rootPath;
  43978. private $subPath;
  43979. private $directorySeparator = '/';
  43980. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  43981. {
  43982. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  43983. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  43984. }
  43985. parent::__construct($path, $flags);
  43986. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  43987. $this->rootPath = (string) $path;
  43988. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  43989. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  43990. }
  43991. }
  43992. public function current()
  43993. {
  43994. if (null === $subPathname = $this->subPath) {
  43995. $subPathname = $this->subPath = (string) $this->getSubPath();
  43996. }
  43997. if ('' !== $subPathname) {
  43998. $subPathname .= $this->directorySeparator;
  43999. }
  44000. $subPathname .= $this->getFilename();
  44001. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  44002. }
  44003. public function getChildren()
  44004. {
  44005. try {
  44006. $children = parent::getChildren();
  44007. if ($children instanceof self) {
  44008. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  44009. $children->rewindable = &$this->rewindable;
  44010. $children->rootPath = $this->rootPath;
  44011. }
  44012. return $children;
  44013. } catch (\UnexpectedValueException $e) {
  44014. if ($this->ignoreUnreadableDirs) {
  44015. return new \RecursiveArrayIterator(array());
  44016. } else {
  44017. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  44018. }
  44019. }
  44020. }
  44021. public function rewind()
  44022. {
  44023. if (false === $this->isRewindable()) {
  44024. return;
  44025. }
  44026. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  44027. parent::next();
  44028. }
  44029. parent::rewind();
  44030. }
  44031. public function isRewindable()
  44032. {
  44033. if (null !== $this->rewindable) {
  44034. return $this->rewindable;
  44035. }
  44036. if ('' === $this->getPath()) {
  44037. return $this->rewindable = false;
  44038. }
  44039. if (false !== $stream = @opendir($this->getPath())) {
  44040. $infos = stream_get_meta_data($stream);
  44041. closedir($stream);
  44042. if ($infos['seekable']) {
  44043. return $this->rewindable = true;
  44044. }
  44045. }
  44046. return $this->rewindable = false;
  44047. }
  44048. }
  44049. <?php
  44050. namespace Symfony\Component\Finder\Iterator;
  44051. use Symfony\Component\Finder\Comparator\NumberComparator;
  44052. class SizeRangeFilterIterator extends FilterIterator
  44053. {
  44054. private $comparators = array();
  44055. public function __construct(\Iterator $iterator, array $comparators)
  44056. {
  44057. $this->comparators = $comparators;
  44058. parent::__construct($iterator);
  44059. }
  44060. public function accept()
  44061. {
  44062. $fileinfo = $this->current();
  44063. if (!$fileinfo->isFile()) {
  44064. return true;
  44065. }
  44066. $filesize = $fileinfo->getSize();
  44067. foreach ($this->comparators as $compare) {
  44068. if (!$compare->test($filesize)) {
  44069. return false;
  44070. }
  44071. }
  44072. return true;
  44073. }
  44074. }
  44075. <?php
  44076. namespace Symfony\Component\Finder\Iterator;
  44077. class SortableIterator implements \IteratorAggregate
  44078. {
  44079. const SORT_BY_NAME = 1;
  44080. const SORT_BY_TYPE = 2;
  44081. const SORT_BY_ACCESSED_TIME = 3;
  44082. const SORT_BY_CHANGED_TIME = 4;
  44083. const SORT_BY_MODIFIED_TIME = 5;
  44084. private $iterator;
  44085. private $sort;
  44086. public function __construct(\Traversable $iterator, $sort)
  44087. {
  44088. $this->iterator = $iterator;
  44089. if (self::SORT_BY_NAME === $sort) {
  44090. $this->sort = function ($a, $b) {
  44091. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44092. };
  44093. } elseif (self::SORT_BY_TYPE === $sort) {
  44094. $this->sort = function ($a, $b) {
  44095. if ($a->isDir() && $b->isFile()) {
  44096. return -1;
  44097. } elseif ($a->isFile() && $b->isDir()) {
  44098. return 1;
  44099. }
  44100. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  44101. };
  44102. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  44103. $this->sort = function ($a, $b) {
  44104. return $a->getATime() - $b->getATime();
  44105. };
  44106. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  44107. $this->sort = function ($a, $b) {
  44108. return $a->getCTime() - $b->getCTime();
  44109. };
  44110. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  44111. $this->sort = function ($a, $b) {
  44112. return $a->getMTime() - $b->getMTime();
  44113. };
  44114. } elseif (\is_callable($sort)) {
  44115. $this->sort = $sort;
  44116. } else {
  44117. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  44118. }
  44119. }
  44120. public function getIterator()
  44121. {
  44122. $array = iterator_to_array($this->iterator, true);
  44123. uasort($array, $this->sort);
  44124. return new \ArrayIterator($array);
  44125. }
  44126. }
  44127. Copyright (c) 2004-2018 Fabien Potencier
  44128. Permission is hereby granted, free of charge, to any person obtaining a copy
  44129. of this software and associated documentation files (the "Software"), to deal
  44130. in the Software without restriction, including without limitation the rights
  44131. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44132. copies of the Software, and to permit persons to whom the Software is furnished
  44133. to do so, subject to the following conditions:
  44134. The above copyright notice and this permission notice shall be included in all
  44135. copies or substantial portions of the Software.
  44136. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44137. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44138. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44139. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44140. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44141. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44142. THE SOFTWARE.
  44143. <?php
  44144. namespace Symfony\Component\Finder\Shell;
  44145. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44146. class Command
  44147. {
  44148. private $parent;
  44149. private $bits = array();
  44150. private $labels = array();
  44151. private $errorHandler;
  44152. public function __construct(Command $parent = null)
  44153. {
  44154. $this->parent = $parent;
  44155. }
  44156. public function __toString()
  44157. {
  44158. return $this->join();
  44159. }
  44160. public static function create(Command $parent = null)
  44161. {
  44162. return new self($parent);
  44163. }
  44164. public static function escape($input)
  44165. {
  44166. return escapeshellcmd($input);
  44167. }
  44168. public static function quote($input)
  44169. {
  44170. return escapeshellarg($input);
  44171. }
  44172. public function add($bit)
  44173. {
  44174. $this->bits[] = $bit;
  44175. return $this;
  44176. }
  44177. public function top($bit)
  44178. {
  44179. array_unshift($this->bits, $bit);
  44180. foreach ($this->labels as $label => $index) {
  44181. ++$this->labels[$label];
  44182. }
  44183. return $this;
  44184. }
  44185. public function arg($arg)
  44186. {
  44187. $this->bits[] = self::quote($arg);
  44188. return $this;
  44189. }
  44190. public function cmd($esc)
  44191. {
  44192. $this->bits[] = self::escape($esc);
  44193. return $this;
  44194. }
  44195. public function ins($label)
  44196. {
  44197. if (isset($this->labels[$label])) {
  44198. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  44199. }
  44200. $this->bits[] = self::create($this);
  44201. $this->labels[$label] = \count($this->bits) - 1;
  44202. return $this->bits[$this->labels[$label]];
  44203. }
  44204. public function get($label)
  44205. {
  44206. if (!isset($this->labels[$label])) {
  44207. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  44208. }
  44209. return $this->bits[$this->labels[$label]];
  44210. }
  44211. public function end()
  44212. {
  44213. if (null === $this->parent) {
  44214. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  44215. }
  44216. return $this->parent;
  44217. }
  44218. public function length()
  44219. {
  44220. return \count($this->bits);
  44221. }
  44222. public function setErrorHandler(\Closure $errorHandler)
  44223. {
  44224. $this->errorHandler = $errorHandler;
  44225. return $this;
  44226. }
  44227. public function getErrorHandler()
  44228. {
  44229. return $this->errorHandler;
  44230. }
  44231. public function execute()
  44232. {
  44233. if (null === $errorHandler = $this->errorHandler) {
  44234. exec($this->join(), $output);
  44235. } else {
  44236. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  44237. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  44238. if ($error = stream_get_contents($pipes[2])) {
  44239. $errorHandler($error);
  44240. }
  44241. proc_close($process);
  44242. }
  44243. return $output ?: array();
  44244. }
  44245. public function join()
  44246. {
  44247. return implode(' ', array_filter(
  44248. array_map(function ($bit) {
  44249. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  44250. }, $this->bits),
  44251. function ($bit) { return null !== $bit; }
  44252. ));
  44253. }
  44254. public function addAtIndex($bit, $index)
  44255. {
  44256. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  44257. return $this;
  44258. }
  44259. }
  44260. <?php
  44261. namespace Symfony\Component\Finder\Shell;
  44262. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  44263. class Shell
  44264. {
  44265. const TYPE_UNIX = 1;
  44266. const TYPE_DARWIN = 2;
  44267. const TYPE_CYGWIN = 3;
  44268. const TYPE_WINDOWS = 4;
  44269. const TYPE_BSD = 5;
  44270. private $type;
  44271. public function getType()
  44272. {
  44273. if (null === $this->type) {
  44274. $this->type = $this->guessType();
  44275. }
  44276. return $this->type;
  44277. }
  44278. public function testCommand($command)
  44279. {
  44280. if (!\function_exists('exec')) {
  44281. return false;
  44282. }
  44283. $testCommand = 'which ';
  44284. if (self::TYPE_WINDOWS === $this->type) {
  44285. $testCommand = 'where ';
  44286. }
  44287. $command = escapeshellcmd($command);
  44288. exec($testCommand.$command, $output, $code);
  44289. return 0 === $code && \count($output) > 0;
  44290. }
  44291. private function guessType()
  44292. {
  44293. $os = strtolower(PHP_OS);
  44294. if (false !== strpos($os, 'cygwin')) {
  44295. return self::TYPE_CYGWIN;
  44296. }
  44297. if (false !== strpos($os, 'darwin')) {
  44298. return self::TYPE_DARWIN;
  44299. }
  44300. if (false !== strpos($os, 'bsd')) {
  44301. return self::TYPE_BSD;
  44302. }
  44303. if (0 === strpos($os, 'win')) {
  44304. return self::TYPE_WINDOWS;
  44305. }
  44306. return self::TYPE_UNIX;
  44307. }
  44308. }
  44309. <?php
  44310. namespace Symfony\Component\Finder;
  44311. class SplFileInfo extends \SplFileInfo
  44312. {
  44313. private $relativePath;
  44314. private $relativePathname;
  44315. public function __construct($file, $relativePath, $relativePathname)
  44316. {
  44317. parent::__construct($file);
  44318. $this->relativePath = $relativePath;
  44319. $this->relativePathname = $relativePathname;
  44320. }
  44321. public function getRelativePath()
  44322. {
  44323. return $this->relativePath;
  44324. }
  44325. public function getRelativePathname()
  44326. {
  44327. return $this->relativePathname;
  44328. }
  44329. public function getContents()
  44330. {
  44331. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  44332. $content = file_get_contents($this->getPathname());
  44333. restore_error_handler();
  44334. if (false === $content) {
  44335. throw new \RuntimeException($error);
  44336. }
  44337. return $content;
  44338. }
  44339. }
  44340. <?php
  44341. namespace Symfony\Polyfill\Ctype;
  44342. final class Ctype
  44343. {
  44344. public static function ctype_alnum($text)
  44345. {
  44346. $text = self::convert_int_to_char_for_ctype($text);
  44347. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  44348. }
  44349. public static function ctype_alpha($text)
  44350. {
  44351. $text = self::convert_int_to_char_for_ctype($text);
  44352. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  44353. }
  44354. public static function ctype_cntrl($text)
  44355. {
  44356. $text = self::convert_int_to_char_for_ctype($text);
  44357. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  44358. }
  44359. public static function ctype_digit($text)
  44360. {
  44361. $text = self::convert_int_to_char_for_ctype($text);
  44362. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  44363. }
  44364. public static function ctype_graph($text)
  44365. {
  44366. $text = self::convert_int_to_char_for_ctype($text);
  44367. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  44368. }
  44369. public static function ctype_lower($text)
  44370. {
  44371. $text = self::convert_int_to_char_for_ctype($text);
  44372. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  44373. }
  44374. public static function ctype_print($text)
  44375. {
  44376. $text = self::convert_int_to_char_for_ctype($text);
  44377. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  44378. }
  44379. public static function ctype_punct($text)
  44380. {
  44381. $text = self::convert_int_to_char_for_ctype($text);
  44382. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  44383. }
  44384. public static function ctype_space($text)
  44385. {
  44386. $text = self::convert_int_to_char_for_ctype($text);
  44387. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  44388. }
  44389. public static function ctype_upper($text)
  44390. {
  44391. $text = self::convert_int_to_char_for_ctype($text);
  44392. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  44393. }
  44394. public static function ctype_xdigit($text)
  44395. {
  44396. $text = self::convert_int_to_char_for_ctype($text);
  44397. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  44398. }
  44399. private static function convert_int_to_char_for_ctype($int)
  44400. {
  44401. if (!\is_int($int)) {
  44402. return $int;
  44403. }
  44404. if ($int < -128 || $int > 255) {
  44405. return (string) $int;
  44406. }
  44407. if ($int < 0) {
  44408. $int += 256;
  44409. }
  44410. return \chr($int);
  44411. }
  44412. }
  44413. Copyright (c) 2018-2019 Fabien Potencier
  44414. Permission is hereby granted, free of charge, to any person obtaining a copy
  44415. of this software and associated documentation files (the "Software"), to deal
  44416. in the Software without restriction, including without limitation the rights
  44417. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44418. copies of the Software, and to permit persons to whom the Software is furnished
  44419. to do so, subject to the following conditions:
  44420. The above copyright notice and this permission notice shall be included in all
  44421. copies or substantial portions of the Software.
  44422. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44423. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44424. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44425. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44426. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44427. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44428. THE SOFTWARE.
  44429. <?php
  44430. use Symfony\Polyfill\Ctype as p;
  44431. if (!function_exists('ctype_alnum')) {
  44432. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  44433. }
  44434. if (!function_exists('ctype_alpha')) {
  44435. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  44436. }
  44437. if (!function_exists('ctype_cntrl')) {
  44438. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  44439. }
  44440. if (!function_exists('ctype_digit')) {
  44441. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  44442. }
  44443. if (!function_exists('ctype_graph')) {
  44444. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  44445. }
  44446. if (!function_exists('ctype_lower')) {
  44447. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  44448. }
  44449. if (!function_exists('ctype_print')) {
  44450. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  44451. }
  44452. if (!function_exists('ctype_punct')) {
  44453. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  44454. }
  44455. if (!function_exists('ctype_space')) {
  44456. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  44457. }
  44458. if (!function_exists('ctype_upper')) {
  44459. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  44460. }
  44461. if (!function_exists('ctype_xdigit')) {
  44462. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  44463. }
  44464. Copyright (c) 2015-2019 Fabien Potencier
  44465. Permission is hereby granted, free of charge, to any person obtaining a copy
  44466. of this software and associated documentation files (the "Software"), to deal
  44467. in the Software without restriction, including without limitation the rights
  44468. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  44469. copies of the Software, and to permit persons to whom the Software is furnished
  44470. to do so, subject to the following conditions:
  44471. The above copyright notice and this permission notice shall be included in all
  44472. copies or substantial portions of the Software.
  44473. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  44474. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  44475. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  44476. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  44477. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  44478. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  44479. THE SOFTWARE.
  44480. <?php
  44481. namespace Symfony\Polyfill\Mbstring;
  44482. final class Mbstring
  44483. {
  44484. const MB_CASE_FOLD = PHP_INT_MAX;
  44485. private static $encodingList = array('ASCII', 'UTF-8');
  44486. private static $language = 'neutral';
  44487. private static $internalEncoding = 'UTF-8';
  44488. private static $caseFold = array(
  44489. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  44490. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  44491. );
  44492. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  44493. {
  44494. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  44495. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  44496. } else {
  44497. $fromEncoding = self::getEncoding($fromEncoding);
  44498. }
  44499. $toEncoding = self::getEncoding($toEncoding);
  44500. if ('BASE64' === $fromEncoding) {
  44501. $s = base64_decode($s);
  44502. $fromEncoding = $toEncoding;
  44503. }
  44504. if ('BASE64' === $toEncoding) {
  44505. return base64_encode($s);
  44506. }
  44507. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  44508. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  44509. $fromEncoding = 'Windows-1252';
  44510. }
  44511. if ('UTF-8' !== $fromEncoding) {
  44512. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  44513. }
  44514. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  44515. }
  44516. if ('HTML-ENTITIES' === $fromEncoding) {
  44517. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  44518. $fromEncoding = 'UTF-8';
  44519. }
  44520. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  44521. }
  44522. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  44523. {
  44524. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  44525. $ok = true;
  44526. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  44527. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  44528. $ok = false;
  44529. }
  44530. });
  44531. return $ok ? $fromEncoding : false;
  44532. }
  44533. public static function mb_decode_mimeheader($s)
  44534. {
  44535. return iconv_mime_decode($s, 2, self::$internalEncoding);
  44536. }
  44537. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  44538. {
  44539. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  44540. }
  44541. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  44542. {
  44543. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44544. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44545. return null;
  44546. }
  44547. if (!\is_array($convmap) || !$convmap) {
  44548. return false;
  44549. }
  44550. if (null !== $encoding && !\is_scalar($encoding)) {
  44551. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44552. return '';
  44553. }
  44554. $s = (string) $s;
  44555. if ('' === $s) {
  44556. return '';
  44557. }
  44558. $encoding = self::getEncoding($encoding);
  44559. if ('UTF-8' === $encoding) {
  44560. $encoding = null;
  44561. if (!preg_match('//u', $s)) {
  44562. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44563. }
  44564. } else {
  44565. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44566. }
  44567. $cnt = floor(\count($convmap) / 4) * 4;
  44568. for ($i = 0; $i < $cnt; $i += 4) {
  44569. $convmap[$i] += $convmap[$i + 2];
  44570. $convmap[$i + 1] += $convmap[$i + 2];
  44571. }
  44572. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  44573. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  44574. for ($i = 0; $i < $cnt; $i += 4) {
  44575. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  44576. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  44577. }
  44578. }
  44579. return $m[0];
  44580. }, $s);
  44581. if (null === $encoding) {
  44582. return $s;
  44583. }
  44584. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44585. }
  44586. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  44587. {
  44588. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  44589. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44590. return null;
  44591. }
  44592. if (!\is_array($convmap) || !$convmap) {
  44593. return false;
  44594. }
  44595. if (null !== $encoding && !\is_scalar($encoding)) {
  44596. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  44597. return null;
  44598. }
  44599. if (null !== $is_hex && !\is_scalar($is_hex)) {
  44600. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  44601. return null;
  44602. }
  44603. $s = (string) $s;
  44604. if ('' === $s) {
  44605. return '';
  44606. }
  44607. $encoding = self::getEncoding($encoding);
  44608. if ('UTF-8' === $encoding) {
  44609. $encoding = null;
  44610. if (!preg_match('//u', $s)) {
  44611. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44612. }
  44613. } else {
  44614. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44615. }
  44616. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44617. $cnt = floor(\count($convmap) / 4) * 4;
  44618. $i = 0;
  44619. $len = \strlen($s);
  44620. $result = '';
  44621. while ($i < $len) {
  44622. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44623. $uchr = substr($s, $i, $ulen);
  44624. $i += $ulen;
  44625. $c = self::mb_ord($uchr);
  44626. for ($j = 0; $j < $cnt; $j += 4) {
  44627. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  44628. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  44629. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  44630. continue 2;
  44631. }
  44632. }
  44633. $result .= $uchr;
  44634. }
  44635. if (null === $encoding) {
  44636. return $result;
  44637. }
  44638. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  44639. }
  44640. public static function mb_convert_case($s, $mode, $encoding = null)
  44641. {
  44642. $s = (string) $s;
  44643. if ('' === $s) {
  44644. return '';
  44645. }
  44646. $encoding = self::getEncoding($encoding);
  44647. if ('UTF-8' === $encoding) {
  44648. $encoding = null;
  44649. if (!preg_match('//u', $s)) {
  44650. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  44651. }
  44652. } else {
  44653. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44654. }
  44655. if (MB_CASE_TITLE == $mode) {
  44656. static $titleRegexp = null;
  44657. if (null === $titleRegexp) {
  44658. $titleRegexp = self::getData('titleCaseRegexp');
  44659. }
  44660. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  44661. } else {
  44662. if (MB_CASE_UPPER == $mode) {
  44663. static $upper = null;
  44664. if (null === $upper) {
  44665. $upper = self::getData('upperCase');
  44666. }
  44667. $map = $upper;
  44668. } else {
  44669. if (self::MB_CASE_FOLD === $mode) {
  44670. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  44671. }
  44672. static $lower = null;
  44673. if (null === $lower) {
  44674. $lower = self::getData('lowerCase');
  44675. }
  44676. $map = $lower;
  44677. }
  44678. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  44679. $i = 0;
  44680. $len = \strlen($s);
  44681. while ($i < $len) {
  44682. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  44683. $uchr = substr($s, $i, $ulen);
  44684. $i += $ulen;
  44685. if (isset($map[$uchr])) {
  44686. $uchr = $map[$uchr];
  44687. $nlen = \strlen($uchr);
  44688. if ($nlen == $ulen) {
  44689. $nlen = $i;
  44690. do {
  44691. $s[--$nlen] = $uchr[--$ulen];
  44692. } while ($ulen);
  44693. } else {
  44694. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  44695. $len += $nlen - $ulen;
  44696. $i += $nlen - $ulen;
  44697. }
  44698. }
  44699. }
  44700. }
  44701. if (null === $encoding) {
  44702. return $s;
  44703. }
  44704. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  44705. }
  44706. public static function mb_internal_encoding($encoding = null)
  44707. {
  44708. if (null === $encoding) {
  44709. return self::$internalEncoding;
  44710. }
  44711. $encoding = self::getEncoding($encoding);
  44712. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  44713. self::$internalEncoding = $encoding;
  44714. return true;
  44715. }
  44716. return false;
  44717. }
  44718. public static function mb_language($lang = null)
  44719. {
  44720. if (null === $lang) {
  44721. return self::$language;
  44722. }
  44723. switch ($lang = strtolower($lang)) {
  44724. case 'uni':
  44725. case 'neutral':
  44726. self::$language = $lang;
  44727. return true;
  44728. }
  44729. return false;
  44730. }
  44731. public static function mb_list_encodings()
  44732. {
  44733. return array('UTF-8');
  44734. }
  44735. public static function mb_encoding_aliases($encoding)
  44736. {
  44737. switch (strtoupper($encoding)) {
  44738. case 'UTF8':
  44739. case 'UTF-8':
  44740. return array('utf8');
  44741. }
  44742. return false;
  44743. }
  44744. public static function mb_check_encoding($var = null, $encoding = null)
  44745. {
  44746. if (null === $encoding) {
  44747. if (null === $var) {
  44748. return false;
  44749. }
  44750. $encoding = self::$internalEncoding;
  44751. }
  44752. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  44753. }
  44754. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  44755. {
  44756. if (null === $encodingList) {
  44757. $encodingList = self::$encodingList;
  44758. } else {
  44759. if (!\is_array($encodingList)) {
  44760. $encodingList = array_map('trim', explode(',', $encodingList));
  44761. }
  44762. $encodingList = array_map('strtoupper', $encodingList);
  44763. }
  44764. foreach ($encodingList as $enc) {
  44765. switch ($enc) {
  44766. case 'ASCII':
  44767. if (!preg_match('/[\x80-\xFF]/', $str)) {
  44768. return $enc;
  44769. }
  44770. break;
  44771. case 'UTF8':
  44772. case 'UTF-8':
  44773. if (preg_match('//u', $str)) {
  44774. return 'UTF-8';
  44775. }
  44776. break;
  44777. default:
  44778. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  44779. return $enc;
  44780. }
  44781. }
  44782. }
  44783. return false;
  44784. }
  44785. public static function mb_detect_order($encodingList = null)
  44786. {
  44787. if (null === $encodingList) {
  44788. return self::$encodingList;
  44789. }
  44790. if (!\is_array($encodingList)) {
  44791. $encodingList = array_map('trim', explode(',', $encodingList));
  44792. }
  44793. $encodingList = array_map('strtoupper', $encodingList);
  44794. foreach ($encodingList as $enc) {
  44795. switch ($enc) {
  44796. default:
  44797. if (strncmp($enc, 'ISO-8859-', 9)) {
  44798. return false;
  44799. }
  44800. case 'ASCII':
  44801. case 'UTF8':
  44802. case 'UTF-8':
  44803. }
  44804. }
  44805. self::$encodingList = $encodingList;
  44806. return true;
  44807. }
  44808. public static function mb_strlen($s, $encoding = null)
  44809. {
  44810. $encoding = self::getEncoding($encoding);
  44811. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44812. return \strlen($s);
  44813. }
  44814. return @iconv_strlen($s, $encoding);
  44815. }
  44816. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  44817. {
  44818. $encoding = self::getEncoding($encoding);
  44819. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44820. return strpos($haystack, $needle, $offset);
  44821. }
  44822. $needle = (string) $needle;
  44823. if ('' === $needle) {
  44824. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  44825. return false;
  44826. }
  44827. return iconv_strpos($haystack, $needle, $offset, $encoding);
  44828. }
  44829. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  44830. {
  44831. $encoding = self::getEncoding($encoding);
  44832. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44833. return strrpos($haystack, $needle, $offset);
  44834. }
  44835. if ($offset != (int) $offset) {
  44836. $offset = 0;
  44837. } elseif ($offset = (int) $offset) {
  44838. if ($offset < 0) {
  44839. if (0 > $offset += self::mb_strlen($needle)) {
  44840. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  44841. }
  44842. $offset = 0;
  44843. } else {
  44844. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  44845. }
  44846. }
  44847. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44848. return false !== $pos ? $offset + $pos : false;
  44849. }
  44850. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  44851. {
  44852. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  44853. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  44854. return null;
  44855. }
  44856. if (1 > $split_length = (int) $split_length) {
  44857. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  44858. return false;
  44859. }
  44860. if (null === $encoding) {
  44861. $encoding = mb_internal_encoding();
  44862. }
  44863. if ('UTF-8' === $encoding = self::getEncoding($encoding)) {
  44864. $rx = '/(';
  44865. while (65535 < $split_length) {
  44866. $rx .= '.{65535}';
  44867. $split_length -= 65535;
  44868. }
  44869. $rx .= '.{'.$split_length.'})/us';
  44870. return preg_split($rx, $string, null, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
  44871. }
  44872. $result = array();
  44873. $length = mb_strlen($string, $encoding);
  44874. for ($i = 0; $i < $length; $i += $split_length) {
  44875. $result[] = mb_substr($string, $i, $split_length, $encoding);
  44876. }
  44877. return $result;
  44878. }
  44879. public static function mb_strtolower($s, $encoding = null)
  44880. {
  44881. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  44882. }
  44883. public static function mb_strtoupper($s, $encoding = null)
  44884. {
  44885. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  44886. }
  44887. public static function mb_substitute_character($c = null)
  44888. {
  44889. if (0 === strcasecmp($c, 'none')) {
  44890. return true;
  44891. }
  44892. return null !== $c ? false : 'none';
  44893. }
  44894. public static function mb_substr($s, $start, $length = null, $encoding = null)
  44895. {
  44896. $encoding = self::getEncoding($encoding);
  44897. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44898. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  44899. }
  44900. if ($start < 0) {
  44901. $start = iconv_strlen($s, $encoding) + $start;
  44902. if ($start < 0) {
  44903. $start = 0;
  44904. }
  44905. }
  44906. if (null === $length) {
  44907. $length = 2147483647;
  44908. } elseif ($length < 0) {
  44909. $length = iconv_strlen($s, $encoding) + $length - $start;
  44910. if ($length < 0) {
  44911. return '';
  44912. }
  44913. }
  44914. return (string) iconv_substr($s, $start, $length, $encoding);
  44915. }
  44916. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  44917. {
  44918. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44919. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44920. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  44921. }
  44922. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  44923. {
  44924. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  44925. return self::getSubpart($pos, $part, $haystack, $encoding);
  44926. }
  44927. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  44928. {
  44929. $encoding = self::getEncoding($encoding);
  44930. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  44931. return strrchr($haystack, $needle, $part);
  44932. }
  44933. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44934. $pos = iconv_strrpos($haystack, $needle, $encoding);
  44935. return self::getSubpart($pos, $part, $haystack, $encoding);
  44936. }
  44937. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  44938. {
  44939. $needle = self::mb_substr($needle, 0, 1, $encoding);
  44940. $pos = self::mb_strripos($haystack, $needle, $encoding);
  44941. return self::getSubpart($pos, $part, $haystack, $encoding);
  44942. }
  44943. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  44944. {
  44945. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  44946. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  44947. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  44948. }
  44949. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  44950. {
  44951. $pos = strpos($haystack, $needle);
  44952. if (false === $pos) {
  44953. return false;
  44954. }
  44955. if ($part) {
  44956. return substr($haystack, 0, $pos);
  44957. }
  44958. return substr($haystack, $pos);
  44959. }
  44960. public static function mb_get_info($type = 'all')
  44961. {
  44962. $info = array(
  44963. 'internal_encoding' => self::$internalEncoding,
  44964. 'http_output' => 'pass',
  44965. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  44966. 'func_overload' => 0,
  44967. 'func_overload_list' => 'no overload',
  44968. 'mail_charset' => 'UTF-8',
  44969. 'mail_header_encoding' => 'BASE64',
  44970. 'mail_body_encoding' => 'BASE64',
  44971. 'illegal_chars' => 0,
  44972. 'encoding_translation' => 'Off',
  44973. 'language' => self::$language,
  44974. 'detect_order' => self::$encodingList,
  44975. 'substitute_character' => 'none',
  44976. 'strict_detection' => 'Off',
  44977. );
  44978. if ('all' === $type) {
  44979. return $info;
  44980. }
  44981. if (isset($info[$type])) {
  44982. return $info[$type];
  44983. }
  44984. return false;
  44985. }
  44986. public static function mb_http_input($type = '')
  44987. {
  44988. return false;
  44989. }
  44990. public static function mb_http_output($encoding = null)
  44991. {
  44992. return null !== $encoding ? 'pass' === $encoding : 'pass';
  44993. }
  44994. public static function mb_strwidth($s, $encoding = null)
  44995. {
  44996. $encoding = self::getEncoding($encoding);
  44997. if ('UTF-8' !== $encoding) {
  44998. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  44999. }
  45000. $s = preg_replace('/[\x{1100}-\x{115F}\x{2329}\x{232A}\x{2E80}-\x{303E}\x{3040}-\x{A4CF}\x{AC00}-\x{D7A3}\x{F900}-\x{FAFF}\x{FE10}-\x{FE19}\x{FE30}-\x{FE6F}\x{FF00}-\x{FF60}\x{FFE0}-\x{FFE6}\x{20000}-\x{2FFFD}\x{30000}-\x{3FFFD}]/u', '', $s, -1, $wide);
  45001. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  45002. }
  45003. public static function mb_substr_count($haystack, $needle, $encoding = null)
  45004. {
  45005. return substr_count($haystack, $needle);
  45006. }
  45007. public static function mb_output_handler($contents, $status)
  45008. {
  45009. return $contents;
  45010. }
  45011. public static function mb_chr($code, $encoding = null)
  45012. {
  45013. if (0x80 > $code %= 0x200000) {
  45014. $s = \chr($code);
  45015. } elseif (0x800 > $code) {
  45016. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  45017. } elseif (0x10000 > $code) {
  45018. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  45019. } else {
  45020. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  45021. }
  45022. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  45023. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  45024. }
  45025. return $s;
  45026. }
  45027. public static function mb_ord($s, $encoding = null)
  45028. {
  45029. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  45030. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  45031. }
  45032. if (1 === \strlen($s)) {
  45033. return \ord($s);
  45034. }
  45035. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  45036. if (0xF0 <= $code) {
  45037. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  45038. }
  45039. if (0xE0 <= $code) {
  45040. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  45041. }
  45042. if (0xC0 <= $code) {
  45043. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  45044. }
  45045. return $code;
  45046. }
  45047. private static function getSubpart($pos, $part, $haystack, $encoding)
  45048. {
  45049. if (false === $pos) {
  45050. return false;
  45051. }
  45052. if ($part) {
  45053. return self::mb_substr($haystack, 0, $pos, $encoding);
  45054. }
  45055. return self::mb_substr($haystack, $pos, null, $encoding);
  45056. }
  45057. private static function html_encoding_callback(array $m)
  45058. {
  45059. $i = 1;
  45060. $entities = '';
  45061. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  45062. while (isset($m[$i])) {
  45063. if (0x80 > $m[$i]) {
  45064. $entities .= \chr($m[$i++]);
  45065. continue;
  45066. }
  45067. if (0xF0 <= $m[$i]) {
  45068. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45069. } elseif (0xE0 <= $m[$i]) {
  45070. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  45071. } else {
  45072. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  45073. }
  45074. $entities .= '&#'.$c.';';
  45075. }
  45076. return $entities;
  45077. }
  45078. private static function title_case(array $s)
  45079. {
  45080. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  45081. }
  45082. private static function getData($file)
  45083. {
  45084. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  45085. return require $file;
  45086. }
  45087. return false;
  45088. }
  45089. private static function getEncoding($encoding)
  45090. {
  45091. if (null === $encoding) {
  45092. return self::$internalEncoding;
  45093. }
  45094. if ('UTF-8' === $encoding) {
  45095. return 'UTF-8';
  45096. }
  45097. $encoding = strtoupper($encoding);
  45098. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  45099. return 'CP850';
  45100. }
  45101. if ('UTF8' === $encoding) {
  45102. return 'UTF-8';
  45103. }
  45104. return $encoding;
  45105. }
  45106. }
  45107. <?php
  45108. return array (
  45109. 'A' => 'a',
  45110. 'B' => 'b',
  45111. 'C' => 'c',
  45112. 'D' => 'd',
  45113. 'E' => 'e',
  45114. 'F' => 'f',
  45115. 'G' => 'g',
  45116. 'H' => 'h',
  45117. 'I' => 'i',
  45118. 'J' => 'j',
  45119. 'K' => 'k',
  45120. 'L' => 'l',
  45121. 'M' => 'm',
  45122. 'N' => 'n',
  45123. 'O' => 'o',
  45124. 'P' => 'p',
  45125. 'Q' => 'q',
  45126. 'R' => 'r',
  45127. 'S' => 's',
  45128. 'T' => 't',
  45129. 'U' => 'u',
  45130. 'V' => 'v',
  45131. 'W' => 'w',
  45132. 'X' => 'x',
  45133. 'Y' => 'y',
  45134. 'Z' => 'z',
  45135. 'À' => 'à',
  45136. '�' => 'á',
  45137. 'Â' => 'â',
  45138. 'Ã' => 'ã',
  45139. 'Ä' => 'ä',
  45140. 'Ã…' => 'Ã¥',
  45141. 'Æ' => 'æ',
  45142. 'Ç' => 'ç',
  45143. 'È' => 'è',
  45144. 'É' => 'é',
  45145. 'Ê' => 'ê',
  45146. 'Ë' => 'ë',
  45147. 'Ì' => 'ì',
  45148. '�' => 'í',
  45149. 'Î' => 'î',
  45150. '�' => 'ï',
  45151. '�' => 'ð',
  45152. 'Ñ' => 'ñ',
  45153. 'Ò' => 'ò',
  45154. 'Ó' => 'ó',
  45155. 'Ô' => 'ô',
  45156. 'Õ' => 'õ',
  45157. 'Ö' => 'ö',
  45158. 'Ø' => 'ø',
  45159. 'Ù' => 'ù',
  45160. 'Ú' => 'ú',
  45161. 'Û' => 'û',
  45162. 'Ü' => 'ü',
  45163. '�' => 'ý',
  45164. 'Þ' => 'þ',
  45165. 'Ā' => '�',
  45166. 'Ă' => 'ă',
  45167. 'Ä„' => 'Ä…',
  45168. 'Ć' => 'ć',
  45169. 'Ĉ' => 'ĉ',
  45170. 'ÄŠ' => 'Ä‹',
  45171. 'Č' => '�',
  45172. 'Ď' => '�',
  45173. '�' => 'đ',
  45174. 'Ä’' => 'Ä“',
  45175. 'Ä”' => 'Ä•',
  45176. 'Ä–' => 'Ä—',
  45177. 'Ę' => 'ę',
  45178. 'Äš' => 'Ä›',
  45179. 'Ĝ' => '�',
  45180. 'Äž' => 'ÄŸ',
  45181. 'Ä ' => 'Ä¡',
  45182. 'Ä¢' => 'Ä£',
  45183. 'Ĥ' => 'ĥ',
  45184. 'Ħ' => 'ħ',
  45185. 'Ĩ' => 'ĩ',
  45186. 'Ī' => 'ī',
  45187. 'Ĭ' => 'ĭ',
  45188. 'Į' => 'į',
  45189. 'İ' => 'i',
  45190. 'IJ' => 'ij',
  45191. 'Ĵ' => 'ĵ',
  45192. 'Ķ' => 'ķ',
  45193. 'Ĺ' => 'ĺ',
  45194. 'Ļ' => 'ļ',
  45195. 'Ľ' => 'ľ',
  45196. 'Ä¿' => 'Å€',
  45197. '�' => 'ł',
  45198. 'Ń' => 'ń',
  45199. 'Ņ' => 'ņ',
  45200. 'Ň' => 'ň',
  45201. 'ÅŠ' => 'Å‹',
  45202. 'Ō' => '�',
  45203. 'Ŏ' => '�',
  45204. '�' => 'ő',
  45205. 'Å’' => 'Å“',
  45206. 'Å”' => 'Å•',
  45207. 'Å–' => 'Å—',
  45208. 'Ř' => 'ř',
  45209. 'Åš' => 'Å›',
  45210. 'Ŝ' => '�',
  45211. 'Åž' => 'ÅŸ',
  45212. 'Å ' => 'Å¡',
  45213. 'Å¢' => 'Å£',
  45214. 'Ť' => 'ť',
  45215. 'Ŧ' => 'ŧ',
  45216. 'Ũ' => 'ũ',
  45217. 'Ū' => 'ū',
  45218. 'Ŭ' => 'ŭ',
  45219. 'Ů' => 'ů',
  45220. 'Ű' => 'ű',
  45221. 'Ų' => 'ų',
  45222. 'Ŵ' => 'ŵ',
  45223. 'Ŷ' => 'ŷ',
  45224. 'Ÿ' => 'ÿ',
  45225. 'Ź' => 'ź',
  45226. 'Ż' => 'ż',
  45227. 'Ž' => 'ž',
  45228. '�' => 'ɓ',
  45229. 'Ƃ' => 'ƃ',
  45230. 'Æ„' => 'Æ…',
  45231. 'Ɔ' => 'ɔ',
  45232. 'Ƈ' => 'ƈ',
  45233. 'Ɖ' => 'ɖ',
  45234. 'ÆŠ' => 'É—',
  45235. 'Ƌ' => 'ƌ',
  45236. 'Ǝ' => '�',
  45237. '�' => 'ə',
  45238. '�' => 'ɛ',
  45239. 'Æ‘' => 'Æ’',
  45240. 'Æ“' => 'É ',
  45241. 'Æ”' => 'É£',
  45242. 'Æ–' => 'É©',
  45243. 'Ɨ' => 'ɨ',
  45244. 'Ƙ' => 'ƙ',
  45245. 'Ɯ' => 'ɯ',
  45246. '�' => 'ɲ',
  45247. 'Ɵ' => 'ɵ',
  45248. 'Æ ' => 'Æ¡',
  45249. 'Æ¢' => 'Æ£',
  45250. 'Ƥ' => 'ƥ',
  45251. 'Ʀ' => 'ʀ',
  45252. 'Ƨ' => 'ƨ',
  45253. 'Ʃ' => 'ʃ',
  45254. 'Ƭ' => 'ƭ',
  45255. 'Ʈ' => 'ʈ',
  45256. 'Ư' => 'ư',
  45257. 'Ʊ' => 'ʊ',
  45258. 'Ʋ' => 'ʋ',
  45259. 'Ƴ' => 'ƴ',
  45260. 'Ƶ' => 'ƶ',
  45261. 'Æ·' => 'Ê’',
  45262. 'Ƹ' => 'ƹ',
  45263. 'Ƽ' => 'ƽ',
  45264. 'DŽ' => 'dž',
  45265. 'Dž' => 'dž',
  45266. 'LJ' => 'lj',
  45267. 'Lj' => 'lj',
  45268. 'NJ' => 'nj',
  45269. 'Nj' => 'nj',
  45270. '�' => 'ǎ',
  45271. '�' => '�',
  45272. 'Ç‘' => 'Ç’',
  45273. 'Ç“' => 'Ç”',
  45274. 'Ç•' => 'Ç–',
  45275. 'Ǘ' => 'ǘ',
  45276. 'Ç™' => 'Çš',
  45277. 'Ǜ' => 'ǜ',
  45278. 'Çž' => 'ÇŸ',
  45279. 'Ç ' => 'Ç¡',
  45280. 'Ç¢' => 'Ç£',
  45281. 'Ǥ' => 'ǥ',
  45282. 'Ǧ' => 'ǧ',
  45283. 'Ǩ' => 'ǩ',
  45284. 'Ǫ' => 'ǫ',
  45285. 'Ǭ' => 'ǭ',
  45286. 'Ǯ' => 'ǯ',
  45287. 'DZ' => 'dz',
  45288. 'Dz' => 'dz',
  45289. 'Ǵ' => 'ǵ',
  45290. 'Ƕ' => 'ƕ',
  45291. 'Ç·' => 'Æ¿',
  45292. 'Ǹ' => 'ǹ',
  45293. 'Ǻ' => 'ǻ',
  45294. 'Ǽ' => 'ǽ',
  45295. 'Ǿ' => 'ǿ',
  45296. 'Ȁ' => '�',
  45297. 'Ȃ' => 'ȃ',
  45298. 'È„' => 'È…',
  45299. 'Ȇ' => 'ȇ',
  45300. 'Ȉ' => 'ȉ',
  45301. 'ÈŠ' => 'È‹',
  45302. 'Ȍ' => '�',
  45303. 'Ȏ' => '�',
  45304. '�' => 'ȑ',
  45305. 'È’' => 'È“',
  45306. 'È”' => 'È•',
  45307. 'È–' => 'È—',
  45308. 'Ș' => 'ș',
  45309. 'Èš' => 'È›',
  45310. 'Ȝ' => '�',
  45311. 'Èž' => 'ÈŸ',
  45312. 'È ' => 'Æž',
  45313. 'È¢' => 'È£',
  45314. 'Ȥ' => 'ȥ',
  45315. 'Ȧ' => 'ȧ',
  45316. 'Ȩ' => 'ȩ',
  45317. 'Ȫ' => 'ȫ',
  45318. 'Ȭ' => 'ȭ',
  45319. 'Ȯ' => 'ȯ',
  45320. 'Ȱ' => 'ȱ',
  45321. 'Ȳ' => 'ȳ',
  45322. 'Ⱥ' => 'ⱥ',
  45323. 'Ȼ' => 'ȼ',
  45324. 'Ƚ' => 'ƚ',
  45325. 'Ⱦ' => 'ⱦ',
  45326. '�' => 'ɂ',
  45327. 'Ƀ' => 'ƀ',
  45328. 'Ʉ' => 'ʉ',
  45329. 'Ʌ' => 'ʌ',
  45330. 'Ɇ' => 'ɇ',
  45331. 'Ɉ' => 'ɉ',
  45332. 'ÉŠ' => 'É‹',
  45333. 'Ɍ' => '�',
  45334. 'Ɏ' => '�',
  45335. 'Ͱ' => 'ͱ',
  45336. 'Ͳ' => 'ͳ',
  45337. 'Ͷ' => 'ͷ',
  45338. 'Ϳ' => 'ϳ',
  45339. 'Ά' => 'ά',
  45340. 'Έ' => 'έ',
  45341. 'Ή' => 'ή',
  45342. 'Ί' => 'ί',
  45343. 'Ό' => 'ό',
  45344. 'Ύ' => '�',
  45345. '�' => 'ώ',
  45346. 'Α' => 'α',
  45347. 'Β' => 'β',
  45348. 'Γ' => 'γ',
  45349. 'Δ' => 'δ',
  45350. 'Ε' => 'ε',
  45351. 'Ζ' => 'ζ',
  45352. 'Η' => 'η',
  45353. 'Θ' => 'θ',
  45354. 'Ι' => 'ι',
  45355. 'Κ' => 'κ',
  45356. 'Λ' => 'λ',
  45357. 'Μ' => 'μ',
  45358. '�' => 'ν',
  45359. 'Ξ' => 'ξ',
  45360. 'Ο' => 'ο',
  45361. 'Π' => 'π',
  45362. 'Ρ' => '�',
  45363. 'Σ' => 'σ',
  45364. 'Τ' => 'τ',
  45365. 'Î¥' => 'Ï…',
  45366. 'Φ' => 'φ',
  45367. 'Χ' => 'χ',
  45368. 'Ψ' => 'ψ',
  45369. 'Ω' => 'ω',
  45370. 'Ϊ' => 'ϊ',
  45371. 'Ϋ' => 'ϋ',
  45372. '�' => 'ϗ',
  45373. 'Ϙ' => 'ϙ',
  45374. 'Ïš' => 'Ï›',
  45375. 'Ϝ' => '�',
  45376. 'Ïž' => 'ÏŸ',
  45377. 'Ï ' => 'Ï¡',
  45378. 'Ï¢' => 'Ï£',
  45379. 'Ϥ' => 'ϥ',
  45380. 'Ϧ' => 'ϧ',
  45381. 'Ϩ' => 'ϩ',
  45382. 'Ϫ' => 'ϫ',
  45383. 'Ϭ' => 'ϭ',
  45384. 'Ϯ' => 'ϯ',
  45385. 'ϴ' => 'θ',
  45386. 'Ϸ' => 'ϸ',
  45387. 'Ϲ' => 'ϲ',
  45388. 'Ϻ' => 'ϻ',
  45389. 'Ͻ' => 'ͻ',
  45390. 'Ͼ' => 'ͼ',
  45391. 'Ͽ' => 'ͽ',
  45392. 'Ѐ' => '�',
  45393. '�' => 'ё',
  45394. 'Ђ' => 'ђ',
  45395. 'Ѓ' => 'ѓ',
  45396. 'Є' => 'є',
  45397. 'Ð…' => 'Ñ•',
  45398. 'І' => 'і',
  45399. 'Ї' => 'ї',
  45400. 'Ј' => 'ј',
  45401. 'Љ' => 'љ',
  45402. 'Њ' => 'њ',
  45403. 'Ћ' => 'ћ',
  45404. 'Ќ' => 'ќ',
  45405. '�' => '�',
  45406. 'ÐŽ' => 'Ñž',
  45407. '�' => 'џ',
  45408. '�' => 'а',
  45409. 'Б' => 'б',
  45410. 'В' => 'в',
  45411. 'Г' => 'г',
  45412. 'Д' => 'д',
  45413. 'Е' => 'е',
  45414. 'Ж' => 'ж',
  45415. 'З' => 'з',
  45416. 'И' => 'и',
  45417. 'Й' => 'й',
  45418. 'К' => 'к',
  45419. 'Л' => 'л',
  45420. 'М' => 'м',
  45421. '�' => 'н',
  45422. 'О' => 'о',
  45423. 'П' => 'п',
  45424. 'Р' => 'р',
  45425. 'С' => '�',
  45426. 'Т' => 'т',
  45427. 'У' => 'у',
  45428. 'Ф' => 'ф',
  45429. 'Ð¥' => 'Ñ…',
  45430. 'Ц' => 'ц',
  45431. 'Ч' => 'ч',
  45432. 'Ш' => 'ш',
  45433. 'Щ' => 'щ',
  45434. 'Ъ' => 'ъ',
  45435. 'Ы' => 'ы',
  45436. 'Ь' => 'ь',
  45437. 'Э' => '�',
  45438. 'Ю' => 'ю',
  45439. 'Я' => '�',
  45440. 'Ñ ' => 'Ñ¡',
  45441. 'Ñ¢' => 'Ñ£',
  45442. 'Ѥ' => 'ѥ',
  45443. 'Ѧ' => 'ѧ',
  45444. 'Ѩ' => 'ѩ',
  45445. 'Ѫ' => 'ѫ',
  45446. 'Ѭ' => 'ѭ',
  45447. 'Ѯ' => 'ѯ',
  45448. 'Ѱ' => 'ѱ',
  45449. 'Ѳ' => 'ѳ',
  45450. 'Ѵ' => 'ѵ',
  45451. 'Ѷ' => 'ѷ',
  45452. 'Ѹ' => 'ѹ',
  45453. 'Ѻ' => 'ѻ',
  45454. 'Ѽ' => 'ѽ',
  45455. 'Ѿ' => 'ѿ',
  45456. 'Ò€' => 'Ò�',
  45457. 'ÒŠ' => 'Ò‹',
  45458. 'Ҍ' => '�',
  45459. 'ÒŽ' => 'Ò�',
  45460. 'Ò�' => 'Ò‘',
  45461. 'Ò’' => 'Ò“',
  45462. 'Ò”' => 'Ò•',
  45463. 'Ò–' => 'Ò—',
  45464. 'Ò˜' => 'Ò™',
  45465. 'Òš' => 'Ò›',
  45466. 'Ҝ' => '�',
  45467. 'Òž' => 'ÒŸ',
  45468. 'Ò ' => 'Ò¡',
  45469. 'Ò¢' => 'Ò£',
  45470. 'Ò¤' => 'Ò¥',
  45471. 'Ò¦' => 'Ò§',
  45472. 'Ò¨' => 'Ò©',
  45473. 'Òª' => 'Ò«',
  45474. 'Ò¬' => 'Ò­',
  45475. 'Ò®' => 'Ò¯',
  45476. 'Ò°' => 'Ò±',
  45477. 'Ò²' => 'Ò³',
  45478. 'Ò´' => 'Òµ',
  45479. 'Ò¶' => 'Ò·',
  45480. 'Ò¸' => 'Ò¹',
  45481. 'Òº' => 'Ò»',
  45482. 'Ò¼' => 'Ò½',
  45483. 'Ò¾' => 'Ò¿',
  45484. 'Ó€' => 'Ó�',
  45485. 'Ó�' => 'Ó‚',
  45486. 'Óƒ' => 'Ó„',
  45487. 'Ó…' => 'Ó†',
  45488. 'Ó‡' => 'Óˆ',
  45489. 'Ó‰' => 'ÓŠ',
  45490. 'Ӌ' => 'ӌ',
  45491. 'Ó�' => 'ÓŽ',
  45492. 'Ó�' => 'Ó‘',
  45493. 'Ó’' => 'Ó“',
  45494. 'Ó”' => 'Ó•',
  45495. 'Ó–' => 'Ó—',
  45496. 'Ó˜' => 'Ó™',
  45497. 'Óš' => 'Ó›',
  45498. 'Ӝ' => '�',
  45499. 'Óž' => 'ÓŸ',
  45500. 'Ó ' => 'Ó¡',
  45501. 'Ó¢' => 'Ó£',
  45502. 'Ó¤' => 'Ó¥',
  45503. 'Ó¦' => 'Ó§',
  45504. 'Ó¨' => 'Ó©',
  45505. 'Óª' => 'Ó«',
  45506. 'Ó¬' => 'Ó­',
  45507. 'Ó®' => 'Ó¯',
  45508. 'Ó°' => 'Ó±',
  45509. 'Ó²' => 'Ó³',
  45510. 'Ó´' => 'Óµ',
  45511. 'Ó¶' => 'Ó·',
  45512. 'Ó¸' => 'Ó¹',
  45513. 'Óº' => 'Ó»',
  45514. 'Ó¼' => 'Ó½',
  45515. 'Ó¾' => 'Ó¿',
  45516. 'Ô€' => 'Ô�',
  45517. 'Ô‚' => 'Ôƒ',
  45518. 'Ô„' => 'Ô…',
  45519. 'Ô†' => 'Ô‡',
  45520. 'Ôˆ' => 'Ô‰',
  45521. 'ÔŠ' => 'Ô‹',
  45522. 'Ԍ' => '�',
  45523. 'ÔŽ' => 'Ô�',
  45524. 'Ô�' => 'Ô‘',
  45525. 'Ô’' => 'Ô“',
  45526. 'Ô”' => 'Ô•',
  45527. 'Ô–' => 'Ô—',
  45528. 'Ô˜' => 'Ô™',
  45529. 'Ôš' => 'Ô›',
  45530. 'Ԝ' => '�',
  45531. 'Ôž' => 'ÔŸ',
  45532. 'Ô ' => 'Ô¡',
  45533. 'Ô¢' => 'Ô£',
  45534. 'Ô¤' => 'Ô¥',
  45535. 'Ô¦' => 'Ô§',
  45536. 'Ô¨' => 'Ô©',
  45537. 'Ôª' => 'Ô«',
  45538. 'Ô¬' => 'Ô­',
  45539. 'Ô®' => 'Ô¯',
  45540. 'Ô±' => 'Õ¡',
  45541. 'Ô²' => 'Õ¢',
  45542. 'Ô³' => 'Õ£',
  45543. 'Ô´' => 'Õ¤',
  45544. 'Ôµ' => 'Õ¥',
  45545. 'Ô¶' => 'Õ¦',
  45546. 'Ô·' => 'Õ§',
  45547. 'Ô¸' => 'Õ¨',
  45548. 'Ô¹' => 'Õ©',
  45549. 'Ôº' => 'Õª',
  45550. 'Ô»' => 'Õ«',
  45551. 'Ô¼' => 'Õ¬',
  45552. 'Ô½' => 'Õ­',
  45553. 'Ô¾' => 'Õ®',
  45554. 'Ô¿' => 'Õ¯',
  45555. 'Õ€' => 'Õ°',
  45556. 'Õ�' => 'Õ±',
  45557. 'Õ‚' => 'Õ²',
  45558. 'Õƒ' => 'Õ³',
  45559. 'Õ„' => 'Õ´',
  45560. 'Õ…' => 'Õµ',
  45561. 'Õ†' => 'Õ¶',
  45562. 'Õ‡' => 'Õ·',
  45563. 'Õˆ' => 'Õ¸',
  45564. 'Õ‰' => 'Õ¹',
  45565. 'ÕŠ' => 'Õº',
  45566. 'Õ‹' => 'Õ»',
  45567. 'Ռ' => 'ռ',
  45568. 'Õ�' => 'Õ½',
  45569. 'ÕŽ' => 'Õ¾',
  45570. 'Õ�' => 'Õ¿',
  45571. 'Õ�' => 'Ö€',
  45572. 'Õ‘' => 'Ö�',
  45573. 'Õ’' => 'Ö‚',
  45574. 'Õ“' => 'Öƒ',
  45575. 'Õ”' => 'Ö„',
  45576. 'Õ•' => 'Ö…',
  45577. 'Õ–' => 'Ö†',
  45578. 'á‚ ' => 'â´€',
  45579. 'á‚¡' => 'â´�',
  45580. 'á‚¢' => 'â´‚',
  45581. 'á‚£' => 'â´ƒ',
  45582. 'Ⴄ' => 'ⴄ',
  45583. 'á‚¥' => 'â´…',
  45584. 'Ⴆ' => 'ⴆ',
  45585. 'á‚§' => 'â´‡',
  45586. 'Ⴈ' => 'ⴈ',
  45587. 'á‚©' => 'â´‰',
  45588. 'Ⴊ' => 'ⴊ',
  45589. 'á‚«' => 'â´‹',
  45590. 'Ⴌ' => 'ⴌ',
  45591. 'á‚­' => 'â´�',
  45592. 'á‚®' => 'â´Ž',
  45593. 'Ⴏ' => '�',
  45594. 'á‚°' => 'â´�',
  45595. 'Ⴑ' => 'ⴑ',
  45596. 'Ⴒ' => 'ⴒ',
  45597. 'Ⴓ' => 'ⴓ',
  45598. 'á‚´' => 'â´”',
  45599. 'Ⴕ' => 'ⴕ',
  45600. 'á‚¶' => 'â´–',
  45601. 'á‚·' => 'â´—',
  45602. 'Ⴘ' => 'ⴘ',
  45603. 'Ⴙ' => 'ⴙ',
  45604. 'Ⴚ' => 'ⴚ',
  45605. 'á‚»' => 'â´›',
  45606. 'Ⴜ' => 'ⴜ',
  45607. 'Ⴝ' => '�',
  45608. 'Ⴞ' => 'ⴞ',
  45609. 'á‚¿' => 'â´Ÿ',
  45610. 'Ⴠ' => 'ⴠ',
  45611. '�' => 'ⴡ',
  45612. 'Ⴢ' => 'ⴢ',
  45613. 'Ⴣ' => 'ⴣ',
  45614. 'Ⴤ' => 'ⴤ',
  45615. 'Ⴥ' => 'ⴥ',
  45616. 'Ⴧ' => 'ⴧ',
  45617. '�' => 'ⴭ',
  45618. 'Ꭰ' => 'ꭰ',
  45619. 'Ꭱ' => 'ꭱ',
  45620. 'Ꭲ' => 'ꭲ',
  45621. 'Ꭳ' => 'ꭳ',
  45622. 'Ꭴ' => 'ꭴ',
  45623. 'Ꭵ' => 'ꭵ',
  45624. 'Ꭶ' => 'ꭶ',
  45625. 'Ꭷ' => 'ꭷ',
  45626. 'Ꭸ' => 'ꭸ',
  45627. 'Ꭹ' => 'ꭹ',
  45628. 'Ꭺ' => 'ꭺ',
  45629. 'Ꭻ' => 'ꭻ',
  45630. 'Ꭼ' => 'ꭼ',
  45631. 'Ꭽ' => 'ꭽ',
  45632. 'Ꭾ' => 'ꭾ',
  45633. 'Ꭿ' => 'ꭿ',
  45634. 'Ꮀ' => 'ꮀ',
  45635. 'Ꮁ' => '�',
  45636. 'Ꮂ' => 'ꮂ',
  45637. 'Ꮃ' => 'ꮃ',
  45638. 'Ꮄ' => 'ꮄ',
  45639. 'Ꮅ' => 'ꮅ',
  45640. 'Ꮆ' => 'ꮆ',
  45641. 'Ꮇ' => 'ꮇ',
  45642. 'Ꮈ' => 'ꮈ',
  45643. 'Ꮉ' => 'ꮉ',
  45644. 'Ꮊ' => 'ꮊ',
  45645. 'Ꮋ' => 'ꮋ',
  45646. 'Ꮌ' => 'ꮌ',
  45647. 'Ꮍ' => '�',
  45648. 'Ꮎ' => 'ꮎ',
  45649. 'Ꮏ' => '�',
  45650. '�' => '�',
  45651. '�' => 'ꮑ',
  45652. '�' => 'ꮒ',
  45653. '�' => 'ꮓ',
  45654. '�' => 'ꮔ',
  45655. '�' => 'ꮕ',
  45656. '�' => 'ꮖ',
  45657. '�' => 'ꮗ',
  45658. '�' => 'ꮘ',
  45659. '�' => 'ꮙ',
  45660. '�' => 'ꮚ',
  45661. '�' => 'ꮛ',
  45662. '�' => 'ꮜ',
  45663. '�' => '�',
  45664. '�' => 'ꮞ',
  45665. '�' => 'ꮟ',
  45666. '�' => 'ꮠ',
  45667. '�' => 'ꮡ',
  45668. '�' => 'ꮢ',
  45669. '�' => 'ꮣ',
  45670. '�' => 'ꮤ',
  45671. '�' => 'ꮥ',
  45672. '�' => 'ꮦ',
  45673. '�' => 'ꮧ',
  45674. '�' => 'ꮨ',
  45675. '�' => 'ꮩ',
  45676. '�' => 'ꮪ',
  45677. '�' => 'ꮫ',
  45678. '�' => 'ꮬ',
  45679. '�' => 'ꮭ',
  45680. '�' => 'ꮮ',
  45681. '�' => 'ꮯ',
  45682. '�' => 'ꮰ',
  45683. '�' => 'ꮱ',
  45684. '�' => 'ꮲ',
  45685. '�' => 'ꮳ',
  45686. '�' => 'ꮴ',
  45687. '�' => 'ꮵ',
  45688. '�' => 'ꮶ',
  45689. '�' => 'ꮷ',
  45690. '�' => 'ꮸ',
  45691. '�' => 'ꮹ',
  45692. '�' => 'ꮺ',
  45693. '�' => 'ꮻ',
  45694. '�' => 'ꮼ',
  45695. '�' => 'ꮽ',
  45696. '�' => 'ꮾ',
  45697. '�' => 'ꮿ',
  45698. '�' => '�',
  45699. '�' => '�',
  45700. '�' => '�',
  45701. '�' => '�',
  45702. '�' => '�',
  45703. '�' => '�',
  45704. '�' => '�',
  45705. 'Ბ' => 'ბ',
  45706. 'Გ' => 'გ',
  45707. 'Დ' => 'დ',
  45708. 'Ე' => 'ე',
  45709. 'Ვ' => 'ვ',
  45710. 'Ზ' => 'ზ',
  45711. 'Თ' => 'თ',
  45712. 'Ი' => 'ი',
  45713. 'Კ' => 'კ',
  45714. 'Ლ' => 'ლ',
  45715. 'Მ' => 'მ',
  45716. 'Ნ' => 'ნ',
  45717. '�' => '�',
  45718. 'Პ' => 'პ',
  45719. 'Ჟ' => 'ჟ',
  45720. 'Რ' => 'რ',
  45721. 'Ს' => 'ს',
  45722. 'Ტ' => 'ტ',
  45723. 'Უ' => 'უ',
  45724. 'Ფ' => 'ფ',
  45725. 'Ქ' => 'ქ',
  45726. 'Ღ' => 'ღ',
  45727. 'Ყ' => 'ყ',
  45728. 'Შ' => 'შ',
  45729. 'Ჩ' => 'ჩ',
  45730. 'Ც' => 'ც',
  45731. 'Ძ' => 'ძ',
  45732. 'Წ' => 'წ',
  45733. 'Ჭ' => 'ჭ',
  45734. 'Ხ' => 'ხ',
  45735. 'Ჯ' => 'ჯ',
  45736. 'Ჰ' => 'ჰ',
  45737. 'Ჱ' => 'ჱ',
  45738. 'Ჲ' => 'ჲ',
  45739. 'Ჳ' => 'ჳ',
  45740. 'Ჴ' => 'ჴ',
  45741. 'Ჵ' => 'ჵ',
  45742. 'Ჶ' => 'ჶ',
  45743. 'Ჷ' => 'ჷ',
  45744. 'Ჸ' => 'ჸ',
  45745. 'Ჹ' => 'ჹ',
  45746. 'Ჺ' => 'ჺ',
  45747. 'Ჽ' => 'ჽ',
  45748. 'Ჾ' => 'ჾ',
  45749. 'Ჿ' => 'ჿ',
  45750. 'Ḁ' => '�',
  45751. 'Ḃ' => 'ḃ',
  45752. 'Ḅ' => 'ḅ',
  45753. 'Ḇ' => 'ḇ',
  45754. 'Ḉ' => 'ḉ',
  45755. 'Ḋ' => 'ḋ',
  45756. 'Ḍ' => '�',
  45757. 'Ḏ' => '�',
  45758. '�' => 'ḑ',
  45759. 'Ḓ' => 'ḓ',
  45760. 'Ḕ' => 'ḕ',
  45761. 'Ḗ' => 'ḗ',
  45762. 'Ḙ' => 'ḙ',
  45763. 'Ḛ' => 'ḛ',
  45764. 'Ḝ' => '�',
  45765. 'Ḟ' => 'ḟ',
  45766. 'Ḡ' => 'ḡ',
  45767. 'Ḣ' => 'ḣ',
  45768. 'Ḥ' => 'ḥ',
  45769. 'Ḧ' => 'ḧ',
  45770. 'Ḩ' => 'ḩ',
  45771. 'Ḫ' => 'ḫ',
  45772. 'Ḭ' => 'ḭ',
  45773. 'Ḯ' => 'ḯ',
  45774. 'Ḱ' => 'ḱ',
  45775. 'Ḳ' => 'ḳ',
  45776. 'Ḵ' => 'ḵ',
  45777. 'Ḷ' => 'ḷ',
  45778. 'Ḹ' => 'ḹ',
  45779. 'Ḻ' => 'ḻ',
  45780. 'Ḽ' => 'ḽ',
  45781. 'Ḿ' => 'ḿ',
  45782. 'Ṁ' => '�',
  45783. 'Ṃ' => 'ṃ',
  45784. 'Ṅ' => 'ṅ',
  45785. 'Ṇ' => 'ṇ',
  45786. 'Ṉ' => 'ṉ',
  45787. 'Ṋ' => 'ṋ',
  45788. 'Ṍ' => '�',
  45789. 'Ṏ' => '�',
  45790. '�' => 'ṑ',
  45791. 'Ṓ' => 'ṓ',
  45792. 'Ṕ' => 'ṕ',
  45793. 'á¹–' => 'á¹—',
  45794. 'Ṙ' => 'ṙ',
  45795. 'Ṛ' => 'ṛ',
  45796. 'Ṝ' => '�',
  45797. 'Ṟ' => 'ṟ',
  45798. 'Ṡ' => 'ṡ',
  45799. 'á¹¢' => 'á¹£',
  45800. 'Ṥ' => 'ṥ',
  45801. 'Ṧ' => 'ṧ',
  45802. 'Ṩ' => 'ṩ',
  45803. 'Ṫ' => 'ṫ',
  45804. 'Ṭ' => 'ṭ',
  45805. 'Ṯ' => 'ṯ',
  45806. 'á¹°' => 'á¹±',
  45807. 'á¹²' => 'á¹³',
  45808. 'á¹´' => 'á¹µ',
  45809. 'á¹¶' => 'á¹·',
  45810. 'Ṹ' => 'ṹ',
  45811. 'Ṻ' => 'ṻ',
  45812. 'á¹¼' => 'á¹½',
  45813. 'Ṿ' => 'ṿ',
  45814. 'Ẁ' => '�',
  45815. 'Ẃ' => 'ẃ',
  45816. 'Ẅ' => 'ẅ',
  45817. 'Ẇ' => 'ẇ',
  45818. 'Ẉ' => 'ẉ',
  45819. 'Ẋ' => 'ẋ',
  45820. 'Ẍ' => '�',
  45821. 'Ẏ' => '�',
  45822. '�' => 'ẑ',
  45823. 'Ẓ' => 'ẓ',
  45824. 'Ẕ' => 'ẕ',
  45825. 'ẞ' => 'ß',
  45826. 'Ạ' => 'ạ',
  45827. 'Ả' => 'ả',
  45828. 'Ấ' => 'ấ',
  45829. 'Ầ' => 'ầ',
  45830. 'Ẩ' => 'ẩ',
  45831. 'Ẫ' => 'ẫ',
  45832. 'Ậ' => 'ậ',
  45833. 'Ắ' => 'ắ',
  45834. 'Ằ' => 'ằ',
  45835. 'Ẳ' => 'ẳ',
  45836. 'Ẵ' => 'ẵ',
  45837. 'Ặ' => 'ặ',
  45838. 'Ẹ' => 'ẹ',
  45839. 'Ẻ' => 'ẻ',
  45840. 'Ẽ' => 'ẽ',
  45841. 'Ế' => 'ế',
  45842. 'Ề' => '�',
  45843. 'Ể' => 'ể',
  45844. 'Ễ' => 'ễ',
  45845. 'Ệ' => 'ệ',
  45846. 'Ỉ' => 'ỉ',
  45847. 'Ị' => 'ị',
  45848. 'Ọ' => '�',
  45849. 'Ỏ' => '�',
  45850. '�' => 'ố',
  45851. 'Ồ' => 'ồ',
  45852. 'Ổ' => 'ổ',
  45853. 'á»–' => 'á»—',
  45854. 'Ộ' => 'ộ',
  45855. 'Ớ' => 'ớ',
  45856. 'Ờ' => '�',
  45857. 'Ở' => 'ở',
  45858. 'Ỡ' => 'ỡ',
  45859. 'Ợ' => 'ợ',
  45860. 'Ụ' => 'ụ',
  45861. 'Ủ' => 'ủ',
  45862. 'Ứ' => 'ứ',
  45863. 'Ừ' => 'ừ',
  45864. 'Ử' => 'ử',
  45865. 'Ữ' => 'ữ',
  45866. 'á»°' => 'á»±',
  45867. 'Ỳ' => 'ỳ',
  45868. 'Ỵ' => 'ỵ',
  45869. 'á»¶' => 'á»·',
  45870. 'Ỹ' => 'ỹ',
  45871. 'Ỻ' => 'ỻ',
  45872. 'Ỽ' => 'ỽ',
  45873. 'Ỿ' => 'ỿ',
  45874. 'Ἀ' => 'ἀ',
  45875. 'Ἁ' => '�',
  45876. 'Ἂ' => 'ἂ',
  45877. 'Ἃ' => 'ἃ',
  45878. 'Ἄ' => 'ἄ',
  45879. '�' => 'ἅ',
  45880. 'Ἆ' => 'ἆ',
  45881. '�' => 'ἇ',
  45882. 'Ἐ' => '�',
  45883. 'Ἑ' => 'ἑ',
  45884. 'Ἒ' => 'ἒ',
  45885. 'Ἓ' => 'ἓ',
  45886. 'Ἔ' => 'ἔ',
  45887. '�' => 'ἕ',
  45888. 'Ἠ' => 'ἠ',
  45889. 'Ἡ' => 'ἡ',
  45890. 'Ἢ' => 'ἢ',
  45891. 'Ἣ' => 'ἣ',
  45892. 'Ἤ' => 'ἤ',
  45893. 'á¼­' => 'á¼¥',
  45894. 'Ἦ' => 'ἦ',
  45895. 'Ἧ' => 'ἧ',
  45896. 'Ἰ' => 'ἰ',
  45897. 'á¼¹' => 'á¼±',
  45898. 'Ἲ' => 'ἲ',
  45899. 'á¼»' => 'á¼³',
  45900. 'á¼¼' => 'á¼´',
  45901. 'á¼½' => 'á¼µ',
  45902. 'á¼¾' => 'á¼¶',
  45903. 'Ἷ' => 'ἷ',
  45904. 'Ὀ' => 'ὀ',
  45905. 'Ὁ' => '�',
  45906. 'Ὂ' => 'ὂ',
  45907. 'Ὃ' => 'ὃ',
  45908. 'Ὄ' => 'ὄ',
  45909. '�' => 'ὅ',
  45910. 'Ὑ' => 'ὑ',
  45911. 'Ὓ' => 'ὓ',
  45912. '�' => 'ὕ',
  45913. 'Ὗ' => 'ὗ',
  45914. 'Ὠ' => 'ὠ',
  45915. 'Ὡ' => 'ὡ',
  45916. 'Ὢ' => 'ὢ',
  45917. 'Ὣ' => 'ὣ',
  45918. 'Ὤ' => 'ὤ',
  45919. 'á½­' => 'á½¥',
  45920. 'Ὦ' => 'ὦ',
  45921. 'Ὧ' => 'ὧ',
  45922. 'ᾈ' => 'ᾀ',
  45923. 'ᾉ' => '�',
  45924. 'ᾊ' => 'ᾂ',
  45925. 'ᾋ' => 'ᾃ',
  45926. 'ᾌ' => 'ᾄ',
  45927. '�' => 'ᾅ',
  45928. 'ᾎ' => 'ᾆ',
  45929. '�' => 'ᾇ',
  45930. 'ᾘ' => '�',
  45931. 'ᾙ' => 'ᾑ',
  45932. 'ᾚ' => 'ᾒ',
  45933. 'ᾛ' => 'ᾓ',
  45934. 'ᾜ' => 'ᾔ',
  45935. '�' => 'ᾕ',
  45936. 'ᾞ' => 'ᾖ',
  45937. 'ᾟ' => 'ᾗ',
  45938. 'ᾨ' => 'ᾠ',
  45939. 'ᾩ' => 'ᾡ',
  45940. 'ᾪ' => 'ᾢ',
  45941. 'ᾫ' => 'ᾣ',
  45942. 'ᾬ' => 'ᾤ',
  45943. 'á¾­' => 'á¾¥',
  45944. 'ᾮ' => 'ᾦ',
  45945. 'ᾯ' => 'ᾧ',
  45946. 'Ᾰ' => 'ᾰ',
  45947. 'á¾¹' => 'á¾±',
  45948. 'Ὰ' => 'ὰ',
  45949. 'á¾»' => 'á½±',
  45950. 'á¾¼' => 'á¾³',
  45951. 'Ὲ' => 'ὲ',
  45952. 'Έ' => 'έ',
  45953. 'Ὴ' => 'ὴ',
  45954. 'á¿‹' => 'á½µ',
  45955. 'ῌ' => 'ῃ',
  45956. 'Ῐ' => '�',
  45957. 'á¿™' => 'á¿‘',
  45958. 'Ὶ' => 'ὶ',
  45959. 'á¿›' => 'á½·',
  45960. 'Ῠ' => 'ῠ',
  45961. 'á¿©' => 'á¿¡',
  45962. 'Ὺ' => 'ὺ',
  45963. 'á¿«' => 'á½»',
  45964. 'Ῥ' => 'ῥ',
  45965. 'Ὸ' => 'ὸ',
  45966. 'Ό' => 'ό',
  45967. 'Ὼ' => 'ὼ',
  45968. 'á¿»' => 'á½½',
  45969. 'ῼ' => 'ῳ',
  45970. 'Ω' => 'ω',
  45971. 'K' => 'k',
  45972. 'â„«' => 'Ã¥',
  45973. 'Ⅎ' => 'ⅎ',
  45974. 'â… ' => 'â…°',
  45975. 'â…¡' => 'â…±',
  45976. 'â…¢' => 'â…²',
  45977. 'â…£' => 'â…³',
  45978. 'â…¤' => 'â…´',
  45979. 'â…¥' => 'â…µ',
  45980. 'â…¦' => 'â…¶',
  45981. 'â…§' => 'â…·',
  45982. 'â…¨' => 'â…¸',
  45983. 'â…©' => 'â…¹',
  45984. 'â…ª' => 'â…º',
  45985. 'â…«' => 'â…»',
  45986. 'â…¬' => 'â…¼',
  45987. 'â…­' => 'â…½',
  45988. 'â…®' => 'â…¾',
  45989. 'â…¯' => 'â…¿',
  45990. 'Ↄ' => 'ↄ',
  45991. 'Ⓐ' => '�',
  45992. 'â’·' => 'â“‘',
  45993. 'â’¸' => 'â“’',
  45994. 'â’¹' => 'â““',
  45995. 'â’º' => 'â“”',
  45996. 'â’»' => 'â“•',
  45997. 'â’¼' => 'â“–',
  45998. 'â’½' => 'â“—',
  45999. 'Ⓘ' => 'ⓘ',
  46000. 'â’¿' => 'â“™',
  46001. 'Ⓚ' => 'ⓚ',
  46002. '�' => 'ⓛ',
  46003. 'Ⓜ' => 'ⓜ',
  46004. 'Ⓝ' => '�',
  46005. 'Ⓞ' => 'ⓞ',
  46006. 'Ⓟ' => 'ⓟ',
  46007. 'Ⓠ' => 'ⓠ',
  46008. 'Ⓡ' => 'ⓡ',
  46009. 'Ⓢ' => 'ⓢ',
  46010. 'Ⓣ' => 'ⓣ',
  46011. 'Ⓤ' => 'ⓤ',
  46012. 'â“‹' => 'â“¥',
  46013. 'Ⓦ' => 'ⓦ',
  46014. '�' => 'ⓧ',
  46015. 'Ⓨ' => 'ⓨ',
  46016. '�' => 'ⓩ',
  46017. 'â°€' => 'â°°',
  46018. 'â°�' => 'â°±',
  46019. 'â°‚' => 'â°²',
  46020. 'â°ƒ' => 'â°³',
  46021. 'â°„' => 'â°´',
  46022. 'â°…' => 'â°µ',
  46023. 'â°†' => 'â°¶',
  46024. 'â°‡' => 'â°·',
  46025. 'â°ˆ' => 'â°¸',
  46026. 'â°‰' => 'â°¹',
  46027. 'â°Š' => 'â°º',
  46028. 'â°‹' => 'â°»',
  46029. 'Ⰼ' => 'ⰼ',
  46030. 'â°�' => 'â°½',
  46031. 'â°Ž' => 'â°¾',
  46032. 'â°�' => 'â°¿',
  46033. 'â°�' => 'â±€',
  46034. 'Ⱁ' => '�',
  46035. 'Ⱂ' => 'ⱂ',
  46036. 'Ⱃ' => 'ⱃ',
  46037. 'Ⱄ' => 'ⱄ',
  46038. 'â°•' => 'â±…',
  46039. 'Ⱆ' => 'ⱆ',
  46040. 'Ⱇ' => 'ⱇ',
  46041. 'Ⱈ' => 'ⱈ',
  46042. 'Ⱉ' => 'ⱉ',
  46043. 'Ⱊ' => 'ⱊ',
  46044. 'Ⱋ' => 'ⱋ',
  46045. 'Ⱌ' => 'ⱌ',
  46046. '�' => '�',
  46047. 'Ⱎ' => 'ⱎ',
  46048. 'Ⱏ' => '�',
  46049. 'Ⱐ' => '�',
  46050. 'Ⱑ' => 'ⱑ',
  46051. 'â°¢' => 'â±’',
  46052. 'Ⱓ' => 'ⱓ',
  46053. 'â°¤' => 'â±”',
  46054. 'Ⱕ' => 'ⱕ',
  46055. 'â°¦' => 'â±–',
  46056. 'â°§' => 'â±—',
  46057. 'Ⱘ' => 'ⱘ',
  46058. 'â°©' => 'â±™',
  46059. 'Ⱚ' => 'ⱚ',
  46060. 'â°«' => 'â±›',
  46061. 'Ⱜ' => 'ⱜ',
  46062. 'Ⱝ' => '�',
  46063. 'Ⱞ' => 'ⱞ',
  46064. 'Ⱡ' => 'ⱡ',
  46065. 'â±¢' => 'É«',
  46066. 'â±£' => 'áµ½',
  46067. 'Ɽ' => 'ɽ',
  46068. 'Ⱨ' => 'ⱨ',
  46069. 'Ⱪ' => 'ⱪ',
  46070. 'Ⱬ' => 'ⱬ',
  46071. 'â±­' => 'É‘',
  46072. 'Ɱ' => 'ɱ',
  46073. 'Ɐ' => '�',
  46074. 'â±°' => 'É’',
  46075. 'â±²' => 'â±³',
  46076. 'â±µ' => 'â±¶',
  46077. 'â±¾' => 'È¿',
  46078. 'Ɀ' => 'ɀ',
  46079. 'Ⲁ' => '�',
  46080. 'Ⲃ' => 'ⲃ',
  46081. 'Ⲅ' => 'ⲅ',
  46082. 'Ⲇ' => 'ⲇ',
  46083. 'Ⲉ' => 'ⲉ',
  46084. 'Ⲋ' => 'ⲋ',
  46085. 'Ⲍ' => '�',
  46086. 'Ⲏ' => '�',
  46087. '�' => 'ⲑ',
  46088. 'Ⲓ' => 'ⲓ',
  46089. 'Ⲕ' => 'ⲕ',
  46090. 'â²–' => 'â²—',
  46091. 'Ⲙ' => 'ⲙ',
  46092. 'Ⲛ' => 'ⲛ',
  46093. 'Ⲝ' => '�',
  46094. 'Ⲟ' => 'ⲟ',
  46095. 'Ⲡ' => 'ⲡ',
  46096. 'â²¢' => 'â²£',
  46097. 'Ⲥ' => 'ⲥ',
  46098. 'Ⲧ' => 'ⲧ',
  46099. 'Ⲩ' => 'ⲩ',
  46100. 'Ⲫ' => 'ⲫ',
  46101. 'Ⲭ' => 'ⲭ',
  46102. 'Ⲯ' => 'ⲯ',
  46103. 'â²°' => 'â²±',
  46104. 'â²²' => 'â²³',
  46105. 'â²´' => 'â²µ',
  46106. 'â²¶' => 'â²·',
  46107. 'Ⲹ' => 'ⲹ',
  46108. 'Ⲻ' => 'ⲻ',
  46109. 'â²¼' => 'â²½',
  46110. 'Ⲿ' => 'ⲿ',
  46111. 'Ⳁ' => '�',
  46112. 'Ⳃ' => 'ⳃ',
  46113. 'Ⳅ' => 'ⳅ',
  46114. 'Ⳇ' => 'ⳇ',
  46115. 'Ⳉ' => 'ⳉ',
  46116. 'Ⳋ' => 'ⳋ',
  46117. 'Ⳍ' => '�',
  46118. 'Ⳏ' => '�',
  46119. '�' => 'ⳑ',
  46120. 'Ⳓ' => 'ⳓ',
  46121. 'Ⳕ' => 'ⳕ',
  46122. 'â³–' => 'â³—',
  46123. 'Ⳙ' => 'ⳙ',
  46124. 'Ⳛ' => 'ⳛ',
  46125. 'Ⳝ' => '�',
  46126. 'Ⳟ' => 'ⳟ',
  46127. 'Ⳡ' => 'ⳡ',
  46128. 'â³¢' => 'â³£',
  46129. 'Ⳬ' => 'ⳬ',
  46130. 'â³­' => 'â³®',
  46131. 'â³²' => 'â³³',
  46132. 'Ꙁ' => '�',
  46133. 'Ꙃ' => 'ꙃ',
  46134. 'Ꙅ' => 'ꙅ',
  46135. 'Ꙇ' => 'ꙇ',
  46136. 'Ꙉ' => 'ꙉ',
  46137. 'Ꙋ' => 'ꙋ',
  46138. 'Ꙍ' => '�',
  46139. 'Ꙏ' => '�',
  46140. '�' => 'ꙑ',
  46141. 'Ꙓ' => 'ꙓ',
  46142. 'Ꙕ' => 'ꙕ',
  46143. 'ê™–' => 'ê™—',
  46144. 'Ꙙ' => 'ꙙ',
  46145. 'Ꙛ' => 'ꙛ',
  46146. 'Ꙝ' => '�',
  46147. 'Ꙟ' => 'ꙟ',
  46148. 'Ꙡ' => 'ꙡ',
  46149. 'Ꙣ' => 'ꙣ',
  46150. 'Ꙥ' => 'ꙥ',
  46151. 'Ꙧ' => 'ꙧ',
  46152. 'Ꙩ' => 'ꙩ',
  46153. 'Ꙫ' => 'ꙫ',
  46154. 'Ꙭ' => 'ꙭ',
  46155. 'Ꚁ' => '�',
  46156. 'Ꚃ' => 'ꚃ',
  46157. 'êš„' => 'êš…',
  46158. 'Ꚇ' => 'ꚇ',
  46159. 'Ꚉ' => 'ꚉ',
  46160. 'Ꚋ' => 'ꚋ',
  46161. 'Ꚍ' => '�',
  46162. 'Ꚏ' => '�',
  46163. '�' => 'ꚑ',
  46164. 'êš’' => 'êš“',
  46165. 'êš”' => 'êš•',
  46166. 'êš–' => 'êš—',
  46167. 'Ꚙ' => 'ꚙ',
  46168. 'êšš' => 'êš›',
  46169. 'Ꜣ' => 'ꜣ',
  46170. 'Ꜥ' => 'ꜥ',
  46171. 'Ꜧ' => 'ꜧ',
  46172. 'Ꜩ' => 'ꜩ',
  46173. 'Ꜫ' => 'ꜫ',
  46174. 'Ꜭ' => 'ꜭ',
  46175. 'Ꜯ' => 'ꜯ',
  46176. 'Ꜳ' => 'ꜳ',
  46177. 'Ꜵ' => 'ꜵ',
  46178. 'Ꜷ' => 'ꜷ',
  46179. 'Ꜹ' => 'ꜹ',
  46180. 'Ꜻ' => 'ꜻ',
  46181. 'Ꜽ' => 'ꜽ',
  46182. 'Ꜿ' => 'ꜿ',
  46183. '�' => '�',
  46184. '�' => '�',
  46185. '�' => '�',
  46186. '�' => '�',
  46187. '�' => '�',
  46188. '�' => '�',
  46189. '�' => '�',
  46190. '�' => '�',
  46191. '�' => '�',
  46192. '�' => '�',
  46193. '�' => '�',
  46194. '�' => '�',
  46195. '�' => '�',
  46196. '�' => '�',
  46197. '�' => '�',
  46198. '�' => '�',
  46199. '�' => '�',
  46200. '�' => '�',
  46201. '�' => '�',
  46202. '�' => '�',
  46203. '�' => '�',
  46204. '�' => '�',
  46205. '�' => '�',
  46206. '�' => '�',
  46207. '�' => '�',
  46208. '�' => '�',
  46209. '�' => 'ᵹ',
  46210. '�' => '�',
  46211. 'Ꞁ' => '�',
  46212. 'Ꞃ' => 'ꞃ',
  46213. 'êž„' => 'êž…',
  46214. 'Ꞇ' => 'ꞇ',
  46215. 'Ꞌ' => 'ꞌ',
  46216. '�' => 'ɥ',
  46217. '�' => 'ꞑ',
  46218. 'êž’' => 'êž“',
  46219. 'êž–' => 'êž—',
  46220. 'Ꞙ' => 'ꞙ',
  46221. 'êžš' => 'êž›',
  46222. 'Ꞝ' => '�',
  46223. 'Ꞟ' => 'ꞟ',
  46224. 'êž ' => 'êž¡',
  46225. 'Ꞣ' => 'ꞣ',
  46226. 'Ꞥ' => 'ꞥ',
  46227. 'Ꞧ' => 'ꞧ',
  46228. 'Ꞩ' => 'ꞩ',
  46229. 'Ɦ' => 'ɦ',
  46230. 'Ɜ' => 'ɜ',
  46231. 'Ɡ' => 'ɡ',
  46232. 'Ɬ' => 'ɬ',
  46233. 'Ɪ' => 'ɪ',
  46234. 'êž°' => 'Êž',
  46235. 'Ʇ' => 'ʇ',
  46236. 'Ʝ' => '�',
  46237. 'êž³' => 'ê­“',
  46238. 'êž´' => 'êžµ',
  46239. 'êž¶' => 'êž·',
  46240. 'Ꞹ' => 'ꞹ',
  46241. 'Ꞻ' => 'ꞻ',
  46242. 'êž¼' => 'êž½',
  46243. 'êž¾' => 'êž¿',
  46244. 'Ꟃ' => 'ꟃ',
  46245. 'Ꞔ' => 'ꞔ',
  46246. 'Ʂ' => 'ʂ',
  46247. 'Ᶎ' => 'ᶎ',
  46248. 'Ꟈ' => 'ꟈ',
  46249. 'Ꟊ' => 'ꟊ',
  46250. 'Ꟶ' => 'ꟶ',
  46251. 'A' => '�',
  46252. 'B' => 'b',
  46253. 'C' => 'c',
  46254. 'D' => 'd',
  46255. 'ï¼¥' => 'ï½…',
  46256. 'F' => 'f',
  46257. 'G' => 'g',
  46258. 'H' => 'h',
  46259. 'I' => 'i',
  46260. 'J' => 'j',
  46261. 'K' => 'k',
  46262. 'L' => 'l',
  46263. 'M' => '�',
  46264. 'N' => 'n',
  46265. 'O' => '�',
  46266. 'P' => '�',
  46267. 'Q' => 'q',
  46268. 'ï¼²' => 'ï½’',
  46269. 'S' => 's',
  46270. 'ï¼´' => 'ï½”',
  46271. 'U' => 'u',
  46272. 'ï¼¶' => 'ï½–',
  46273. 'ï¼·' => 'ï½—',
  46274. 'X' => 'x',
  46275. 'ï¼¹' => 'ï½™',
  46276. 'Z' => 'z',
  46277. '�' => '�',
  46278. '�' => '�',
  46279. '�' => '�',
  46280. '�' => '�',
  46281. '�' => '�',
  46282. '�' => '�',
  46283. '�' => '�',
  46284. '�' => '�',
  46285. '�' => '�',
  46286. '�' => '�',
  46287. '�' => '�',
  46288. '�' => '�',
  46289. '�' => '�',
  46290. '�' => '�',
  46291. '�' => '�',
  46292. '�' => '�',
  46293. '�' => '�',
  46294. '�' => '�',
  46295. '�' => '�',
  46296. '�' => '�',
  46297. '�' => '�',
  46298. '�' => '�',
  46299. '�' => '�',
  46300. '�' => '�',
  46301. '�' => '�',
  46302. '�' => '�',
  46303. '�' => '�',
  46304. '�' => '�',
  46305. '�' => '�',
  46306. '�' => '�',
  46307. '�' => '�',
  46308. '�' => '�',
  46309. '�' => '�',
  46310. '�' => '�',
  46311. '�' => '�',
  46312. '�' => '�',
  46313. '�' => '�',
  46314. '�' => '�',
  46315. '�' => '�',
  46316. '�' => '�',
  46317. '�' => '�',
  46318. '�' => '�',
  46319. '�' => '�',
  46320. '�' => '�',
  46321. '�' => '�',
  46322. '�' => '�',
  46323. '�' => '�',
  46324. '�' => '�',
  46325. '�' => '�',
  46326. '�' => '�',
  46327. '�' => '�',
  46328. '�' => '�',
  46329. '�' => '�',
  46330. '�' => '�',
  46331. '�' => '�',
  46332. '�' => '�',
  46333. '�' => '�',
  46334. '�' => '�',
  46335. '�' => '�',
  46336. '�' => '�',
  46337. '�' => '�',
  46338. '�' => '�',
  46339. '�' => '�',
  46340. '�' => '�',
  46341. '�' => '�',
  46342. '�' => '�',
  46343. '�' => '�',
  46344. '�' => '�',
  46345. '�' => '�',
  46346. '�' => '�',
  46347. '�' => '�',
  46348. '�' => '�',
  46349. '�' => '�',
  46350. '�' => '�',
  46351. '�' => '�',
  46352. '�' => '�',
  46353. '�' => '�',
  46354. '�' => '�',
  46355. '�' => '�',
  46356. '�' => '�',
  46357. '�' => '�',
  46358. '�' => '�',
  46359. '�' => '�',
  46360. '�' => '�',
  46361. '�' => '�',
  46362. '�' => '�',
  46363. '�' => '�',
  46364. '�' => '�',
  46365. '�' => '�',
  46366. '�' => '�',
  46367. '�' => '�',
  46368. '�' => '�',
  46369. '�' => '�',
  46370. '�' => '�',
  46371. '�' => '�',
  46372. '�' => '�',
  46373. '�' => '�',
  46374. '�' => '�',
  46375. '�' => '�',
  46376. '�' => '�',
  46377. '�' => '�',
  46378. '�' => '�',
  46379. '�' => '�',
  46380. '�' => '�',
  46381. '�' => '�',
  46382. '�' => '�',
  46383. '�' => '�',
  46384. '�' => '�',
  46385. '�' => '�',
  46386. '�' => '�',
  46387. '�' => '�',
  46388. '�' => '�',
  46389. '�' => '�',
  46390. '�' => '�',
  46391. '�' => '�',
  46392. '�' => '�',
  46393. '�' => '�',
  46394. '�' => '�',
  46395. '�' => '�',
  46396. '�' => '�',
  46397. '�' => '�',
  46398. '�' => '�',
  46399. '�' => '�',
  46400. '�' => '�',
  46401. '�' => '�',
  46402. '�' => '�',
  46403. '�' => '�',
  46404. 'ð‘¢ ' => 'ð‘£€',
  46405. '𑢡' => '�',
  46406. '𑢢' => '𑣂',
  46407. '𑢣' => '𑣃',
  46408. '𑢤' => '𑣄',
  46409. 'ð‘¢¥' => 'ð‘£…',
  46410. '𑢦' => '𑣆',
  46411. '𑢧' => '𑣇',
  46412. '𑢨' => '𑣈',
  46413. '𑢩' => '𑣉',
  46414. '𑢪' => '𑣊',
  46415. '𑢫' => '𑣋',
  46416. '𑢬' => '𑣌',
  46417. '𑢭' => '�',
  46418. '𑢮' => '𑣎',
  46419. '𑢯' => '�',
  46420. '𑢰' => '�',
  46421. '𑢱' => '𑣑',
  46422. 'ð‘¢²' => 'ð‘£’',
  46423. '𑢳' => '𑣓',
  46424. 'ð‘¢´' => 'ð‘£”',
  46425. '𑢵' => '𑣕',
  46426. 'ð‘¢¶' => 'ð‘£–',
  46427. 'ð‘¢·' => 'ð‘£—',
  46428. '𑢸' => '𑣘',
  46429. 'ð‘¢¹' => 'ð‘£™',
  46430. '𑢺' => '𑣚',
  46431. 'ð‘¢»' => 'ð‘£›',
  46432. '𑢼' => '𑣜',
  46433. '𑢽' => '�',
  46434. '𑢾' => '𑣞',
  46435. '𑢿' => '𑣟',
  46436. 'ð–¹€' => 'ð–¹ ',
  46437. '�' => '𖹡',
  46438. '𖹂' => '𖹢',
  46439. '𖹃' => '𖹣',
  46440. '𖹄' => '𖹤',
  46441. 'ð–¹…' => 'ð–¹¥',
  46442. '𖹆' => '𖹦',
  46443. '𖹇' => '𖹧',
  46444. '𖹈' => '𖹨',
  46445. '𖹉' => '𖹩',
  46446. '𖹊' => '𖹪',
  46447. '𖹋' => '𖹫',
  46448. '𖹌' => '𖹬',
  46449. '�' => '𖹭',
  46450. '𖹎' => '𖹮',
  46451. '�' => '𖹯',
  46452. '�' => '𖹰',
  46453. '𖹑' => '𖹱',
  46454. 'ð–¹’' => 'ð–¹²',
  46455. '𖹓' => '𖹳',
  46456. 'ð–¹”' => 'ð–¹´',
  46457. '𖹕' => '𖹵',
  46458. 'ð–¹–' => 'ð–¹¶',
  46459. 'ð–¹—' => 'ð–¹·',
  46460. '𖹘' => '𖹸',
  46461. 'ð–¹™' => 'ð–¹¹',
  46462. '𖹚' => '𖹺',
  46463. 'ð–¹›' => 'ð–¹»',
  46464. '𖹜' => '𖹼',
  46465. '�' => '𖹽',
  46466. '𖹞' => '𖹾',
  46467. '𖹟' => '𖹿',
  46468. '𞤀' => '𞤢',
  46469. '�' => '𞤣',
  46470. '𞤂' => '𞤤',
  46471. '𞤃' => '𞤥',
  46472. '𞤄' => '𞤦',
  46473. '𞤅' => '𞤧',
  46474. '𞤆' => '𞤨',
  46475. '𞤇' => '𞤩',
  46476. '𞤈' => '𞤪',
  46477. '𞤉' => '𞤫',
  46478. '𞤊' => '𞤬',
  46479. '𞤋' => '𞤭',
  46480. '𞤌' => '𞤮',
  46481. '�' => '𞤯',
  46482. '𞤎' => '𞤰',
  46483. '�' => '𞤱',
  46484. '�' => '𞤲',
  46485. '𞤑' => '𞤳',
  46486. '𞤒' => '𞤴',
  46487. '𞤓' => '𞤵',
  46488. '𞤔' => '𞤶',
  46489. '𞤕' => '𞤷',
  46490. '𞤖' => '𞤸',
  46491. '𞤗' => '𞤹',
  46492. '𞤘' => '𞤺',
  46493. '𞤙' => '𞤻',
  46494. '𞤚' => '𞤼',
  46495. '𞤛' => '𞤽',
  46496. '𞤜' => '𞤾',
  46497. '�' => '𞤿',
  46498. '𞤞' => '𞥀',
  46499. '𞤟' => '�',
  46500. '𞤠' => '𞥂',
  46501. '𞤡' => '𞥃',
  46502. );
  46503. <?php
  46504. return '/(?<![\x{0027}\x{002E}\x{003A}\x{005E}\x{0060}\x{00A8}\x{00AD}\x{00AF}\x{00B4}\x{00B7}\x{00B8}\x{02B0}-\x{02C1}\x{02C2}-\x{02C5}\x{02C6}-\x{02D1}\x{02D2}-\x{02DF}\x{02E0}-\x{02E4}\x{02E5}-\x{02EB}\x{02EC}\x{02ED}\x{02EE}\x{02EF}-\x{02FF}\x{0300}-\x{036F}\x{0374}\x{0375}\x{037A}\x{0384}-\x{0385}\x{0387}\x{0483}-\x{0487}\x{0488}-\x{0489}\x{0559}\x{0591}-\x{05BD}\x{05BF}\x{05C1}-\x{05C2}\x{05C4}-\x{05C5}\x{05C7}\x{05F4}\x{0600}-\x{0605}\x{0610}-\x{061A}\x{061C}\x{0640}\x{064B}-\x{065F}\x{0670}\x{06D6}-\x{06DC}\x{06DD}\x{06DF}-\x{06E4}\x{06E5}-\x{06E6}\x{06E7}-\x{06E8}\x{06EA}-\x{06ED}\x{070F}\x{0711}\x{0730}-\x{074A}\x{07A6}-\x{07B0}\x{07EB}-\x{07F3}\x{07F4}-\x{07F5}\x{07FA}\x{07FD}\x{0816}-\x{0819}\x{081A}\x{081B}-\x{0823}\x{0824}\x{0825}-\x{0827}\x{0828}\x{0829}-\x{082D}\x{0859}-\x{085B}\x{08D3}-\x{08E1}\x{08E2}\x{08E3}-\x{0902}\x{093A}\x{093C}\x{0941}-\x{0948}\x{094D}\x{0951}-\x{0957}\x{0962}-\x{0963}\x{0971}\x{0981}\x{09BC}\x{09C1}-\x{09C4}\x{09CD}\x{09E2}-\x{09E3}\x{09FE}\x{0A01}-\x{0A02}\x{0A3C}\x{0A41}-\x{0A42}\x{0A47}-\x{0A48}\x{0A4B}-\x{0A4D}\x{0A51}\x{0A70}-\x{0A71}\x{0A75}\x{0A81}-\x{0A82}\x{0ABC}\x{0AC1}-\x{0AC5}\x{0AC7}-\x{0AC8}\x{0ACD}\x{0AE2}-\x{0AE3}\x{0AFA}-\x{0AFF}\x{0B01}\x{0B3C}\x{0B3F}\x{0B41}-\x{0B44}\x{0B4D}\x{0B56}\x{0B62}-\x{0B63}\x{0B82}\x{0BC0}\x{0BCD}\x{0C00}\x{0C04}\x{0C3E}-\x{0C40}\x{0C46}-\x{0C48}\x{0C4A}-\x{0C4D}\x{0C55}-\x{0C56}\x{0C62}-\x{0C63}\x{0C81}\x{0CBC}\x{0CBF}\x{0CC6}\x{0CCC}-\x{0CCD}\x{0CE2}-\x{0CE3}\x{0D00}-\x{0D01}\x{0D3B}-\x{0D3C}\x{0D41}-\x{0D44}\x{0D4D}\x{0D62}-\x{0D63}\x{0DCA}\x{0DD2}-\x{0DD4}\x{0DD6}\x{0E31}\x{0E34}-\x{0E3A}\x{0E46}\x{0E47}-\x{0E4E}\x{0EB1}\x{0EB4}-\x{0EB9}\x{0EBB}-\x{0EBC}\x{0EC6}\x{0EC8}-\x{0ECD}\x{0F18}-\x{0F19}\x{0F35}\x{0F37}\x{0F39}\x{0F71}-\x{0F7E}\x{0F80}-\x{0F84}\x{0F86}-\x{0F87}\x{0F8D}-\x{0F97}\x{0F99}-\x{0FBC}\x{0FC6}\x{102D}-\x{1030}\x{1032}-\x{1037}\x{1039}-\x{103A}\x{103D}-\x{103E}\x{1058}-\x{1059}\x{105E}-\x{1060}\x{1071}-\x{1074}\x{1082}\x{1085}-\x{1086}\x{108D}\x{109D}\x{10FC}\x{135D}-\x{135F}\x{1712}-\x{1714}\x{1732}-\x{1734}\x{1752}-\x{1753}\x{1772}-\x{1773}\x{17B4}-\x{17B5}\x{17B7}-\x{17BD}\x{17C6}\x{17C9}-\x{17D3}\x{17D7}\x{17DD}\x{180B}-\x{180D}\x{180E}\x{1843}\x{1885}-\x{1886}\x{18A9}\x{1920}-\x{1922}\x{1927}-\x{1928}\x{1932}\x{1939}-\x{193B}\x{1A17}-\x{1A18}\x{1A1B}\x{1A56}\x{1A58}-\x{1A5E}\x{1A60}\x{1A62}\x{1A65}-\x{1A6C}\x{1A73}-\x{1A7C}\x{1A7F}\x{1AA7}\x{1AB0}-\x{1ABD}\x{1ABE}\x{1B00}-\x{1B03}\x{1B34}\x{1B36}-\x{1B3A}\x{1B3C}\x{1B42}\x{1B6B}-\x{1B73}\x{1B80}-\x{1B81}\x{1BA2}-\x{1BA5}\x{1BA8}-\x{1BA9}\x{1BAB}-\x{1BAD}\x{1BE6}\x{1BE8}-\x{1BE9}\x{1BED}\x{1BEF}-\x{1BF1}\x{1C2C}-\x{1C33}\x{1C36}-\x{1C37}\x{1C78}-\x{1C7D}\x{1CD0}-\x{1CD2}\x{1CD4}-\x{1CE0}\x{1CE2}-\x{1CE8}\x{1CED}\x{1CF4}\x{1CF8}-\x{1CF9}\x{1D2C}-\x{1D6A}\x{1D78}\x{1D9B}-\x{1DBF}\x{1DC0}-\x{1DF9}\x{1DFB}-\x{1DFF}\x{1FBD}\x{1FBF}-\x{1FC1}\x{1FCD}-\x{1FCF}\x{1FDD}-\x{1FDF}\x{1FED}-\x{1FEF}\x{1FFD}-\x{1FFE}\x{200B}-\x{200F}\x{2018}\x{2019}\x{2024}\x{2027}\x{202A}-\x{202E}\x{2060}-\x{2064}\x{2066}-\x{206F}\x{2071}\x{207F}\x{2090}-\x{209C}\x{20D0}-\x{20DC}\x{20DD}-\x{20E0}\x{20E1}\x{20E2}-\x{20E4}\x{20E5}-\x{20F0}\x{2C7C}-\x{2C7D}\x{2CEF}-\x{2CF1}\x{2D6F}\x{2D7F}\x{2DE0}-\x{2DFF}\x{2E2F}\x{3005}\x{302A}-\x{302D}\x{3031}-\x{3035}\x{303B}\x{3099}-\x{309A}\x{309B}-\x{309C}\x{309D}-\x{309E}\x{30FC}-\x{30FE}\x{A015}\x{A4F8}-\x{A4FD}\x{A60C}\x{A66F}\x{A670}-\x{A672}\x{A674}-\x{A67D}\x{A67F}\x{A69C}-\x{A69D}\x{A69E}-\x{A69F}\x{A6F0}-\x{A6F1}\x{A700}-\x{A716}\x{A717}-\x{A71F}\x{A720}-\x{A721}\x{A770}\x{A788}\x{A789}-\x{A78A}\x{A7F8}-\x{A7F9}\x{A802}\x{A806}\x{A80B}\x{A825}-\x{A826}\x{A8C4}-\x{A8C5}\x{A8E0}-\x{A8F1}\x{A8FF}\x{A926}-\x{A92D}\x{A947}-\x{A951}\x{A980}-\x{A982}\x{A9B3}\x{A9B6}-\x{A9B9}\x{A9BC}\x{A9CF}\x{A9E5}\x{A9E6}\x{AA29}-\x{AA2E}\x{AA31}-\x{AA32}\x{AA35}-\x{AA36}\x{AA43}\x{AA4C}\x{AA70}\x{AA7C}\x{AAB0}\x{AAB2}-\x{AAB4}\x{AAB7}-\x{AAB8}\x{AABE}-\x{AABF}\x{AAC1}\x{AADD}\x{AAEC}-\x{AAED}\x{AAF3}-\x{AAF4}\x{AAF6}\x{AB5B}\x{AB5C}-\x{AB5F}\x{ABE5}\x{ABE8}\x{ABED}\x{FB1E}\x{FBB2}-\x{FBC1}\x{FE00}-\x{FE0F}\x{FE13}\x{FE20}-\x{FE2F}\x{FE52}\x{FE55}\x{FEFF}\x{FF07}\x{FF0E}\x{FF1A}\x{FF3E}\x{FF40}\x{FF70}\x{FF9E}-\x{FF9F}\x{FFE3}\x{FFF9}-\x{FFFB}\x{101FD}\x{102E0}\x{10376}-\x{1037A}\x{10A01}-\x{10A03}\x{10A05}-\x{10A06}\x{10A0C}-\x{10A0F}\x{10A38}-\x{10A3A}\x{10A3F}\x{10AE5}-\x{10AE6}\x{10D24}-\x{10D27}\x{10F46}-\x{10F50}\x{11001}\x{11038}-\x{11046}\x{1107F}-\x{11081}\x{110B3}-\x{110B6}\x{110B9}-\x{110BA}\x{110BD}\x{110CD}\x{11100}-\x{11102}\x{11127}-\x{1112B}\x{1112D}-\x{11134}\x{11173}\x{11180}-\x{11181}\x{111B6}-\x{111BE}\x{111C9}-\x{111CC}\x{1122F}-\x{11231}\x{11234}\x{11236}-\x{11237}\x{1123E}\x{112DF}\x{112E3}-\x{112EA}\x{11300}-\x{11301}\x{1133B}-\x{1133C}\x{11340}\x{11366}-\x{1136C}\x{11370}-\x{11374}\x{11438}-\x{1143F}\x{11442}-\x{11444}\x{11446}\x{1145E}\x{114B3}-\x{114B8}\x{114BA}\x{114BF}-\x{114C0}\x{114C2}-\x{114C3}\x{115B2}-\x{115B5}\x{115BC}-\x{115BD}\x{115BF}-\x{115C0}\x{115DC}-\x{115DD}\x{11633}-\x{1163A}\x{1163D}\x{1163F}-\x{11640}\x{116AB}\x{116AD}\x{116B0}-\x{116B5}\x{116B7}\x{1171D}-\x{1171F}\x{11722}-\x{11725}\x{11727}-\x{1172B}\x{1182F}-\x{11837}\x{11839}-\x{1183A}\x{11A01}-\x{11A0A}\x{11A33}-\x{11A38}\x{11A3B}-\x{11A3E}\x{11A47}\x{11A51}-\x{11A56}\x{11A59}-\x{11A5B}\x{11A8A}-\x{11A96}\x{11A98}-\x{11A99}\x{11C30}-\x{11C36}\x{11C38}-\x{11C3D}\x{11C3F}\x{11C92}-\x{11CA7}\x{11CAA}-\x{11CB0}\x{11CB2}-\x{11CB3}\x{11CB5}-\x{11CB6}\x{11D31}-\x{11D36}\x{11D3A}\x{11D3C}-\x{11D3D}\x{11D3F}-\x{11D45}\x{11D47}\x{11D90}-\x{11D91}\x{11D95}\x{11D97}\x{11EF3}-\x{11EF4}\x{16AF0}-\x{16AF4}\x{16B30}-\x{16B36}\x{16B40}-\x{16B43}\x{16F8F}-\x{16F92}\x{16F93}-\x{16F9F}\x{16FE0}-\x{16FE1}\x{1BC9D}-\x{1BC9E}\x{1BCA0}-\x{1BCA3}\x{1D167}-\x{1D169}\x{1D173}-\x{1D17A}\x{1D17B}-\x{1D182}\x{1D185}-\x{1D18B}\x{1D1AA}-\x{1D1AD}\x{1D242}-\x{1D244}\x{1DA00}-\x{1DA36}\x{1DA3B}-\x{1DA6C}\x{1DA75}\x{1DA84}\x{1DA9B}-\x{1DA9F}\x{1DAA1}-\x{1DAAF}\x{1E000}-\x{1E006}\x{1E008}-\x{1E018}\x{1E01B}-\x{1E021}\x{1E023}-\x{1E024}\x{1E026}-\x{1E02A}\x{1E8D0}-\x{1E8D6}\x{1E944}-\x{1E94A}\x{1F3FB}-\x{1F3FF}\x{E0001}\x{E0020}-\x{E007F}\x{E0100}-\x{E01EF}])(\pL)(\pL*+)/u';
  46505. <?php
  46506. return array (
  46507. 'a' => 'A',
  46508. 'b' => 'B',
  46509. 'c' => 'C',
  46510. 'd' => 'D',
  46511. 'e' => 'E',
  46512. 'f' => 'F',
  46513. 'g' => 'G',
  46514. 'h' => 'H',
  46515. 'i' => 'I',
  46516. 'j' => 'J',
  46517. 'k' => 'K',
  46518. 'l' => 'L',
  46519. 'm' => 'M',
  46520. 'n' => 'N',
  46521. 'o' => 'O',
  46522. 'p' => 'P',
  46523. 'q' => 'Q',
  46524. 'r' => 'R',
  46525. 's' => 'S',
  46526. 't' => 'T',
  46527. 'u' => 'U',
  46528. 'v' => 'V',
  46529. 'w' => 'W',
  46530. 'x' => 'X',
  46531. 'y' => 'Y',
  46532. 'z' => 'Z',
  46533. 'µ' => 'Μ',
  46534. 'à' => 'À',
  46535. 'á' => '�',
  46536. 'â' => 'Â',
  46537. 'ã' => 'Ã',
  46538. 'ä' => 'Ä',
  46539. 'Ã¥' => 'Ã…',
  46540. 'æ' => 'Æ',
  46541. 'ç' => 'Ç',
  46542. 'è' => 'È',
  46543. 'é' => 'É',
  46544. 'ê' => 'Ê',
  46545. 'ë' => 'Ë',
  46546. 'ì' => 'Ì',
  46547. 'í' => '�',
  46548. 'î' => 'Î',
  46549. 'ï' => '�',
  46550. 'ð' => '�',
  46551. 'ñ' => 'Ñ',
  46552. 'ò' => 'Ò',
  46553. 'ó' => 'Ó',
  46554. 'ô' => 'Ô',
  46555. 'õ' => 'Õ',
  46556. 'ö' => 'Ö',
  46557. 'ø' => 'Ø',
  46558. 'ù' => 'Ù',
  46559. 'ú' => 'Ú',
  46560. 'û' => 'Û',
  46561. 'ü' => 'Ü',
  46562. 'ý' => '�',
  46563. 'þ' => 'Þ',
  46564. 'ÿ' => 'Ÿ',
  46565. '�' => 'Ā',
  46566. 'ă' => 'Ă',
  46567. 'Ä…' => 'Ä„',
  46568. 'ć' => 'Ć',
  46569. 'ĉ' => 'Ĉ',
  46570. 'Ä‹' => 'ÄŠ',
  46571. '�' => 'Č',
  46572. '�' => 'Ď',
  46573. 'đ' => '�',
  46574. 'Ä“' => 'Ä’',
  46575. 'Ä•' => 'Ä”',
  46576. 'Ä—' => 'Ä–',
  46577. 'ę' => 'Ę',
  46578. 'Ä›' => 'Äš',
  46579. '�' => 'Ĝ',
  46580. 'ÄŸ' => 'Äž',
  46581. 'Ä¡' => 'Ä ',
  46582. 'Ä£' => 'Ä¢',
  46583. 'ĥ' => 'Ĥ',
  46584. 'ħ' => 'Ħ',
  46585. 'ĩ' => 'Ĩ',
  46586. 'ī' => 'Ī',
  46587. 'ĭ' => 'Ĭ',
  46588. 'į' => 'Į',
  46589. 'ı' => 'I',
  46590. 'ij' => 'IJ',
  46591. 'ĵ' => 'Ĵ',
  46592. 'ķ' => 'Ķ',
  46593. 'ĺ' => 'Ĺ',
  46594. 'ļ' => 'Ļ',
  46595. 'ľ' => 'Ľ',
  46596. 'Å€' => 'Ä¿',
  46597. 'ł' => '�',
  46598. 'ń' => 'Ń',
  46599. 'ņ' => 'Ņ',
  46600. 'ň' => 'Ň',
  46601. 'Å‹' => 'ÅŠ',
  46602. '�' => 'Ō',
  46603. '�' => 'Ŏ',
  46604. 'ő' => '�',
  46605. 'Å“' => 'Å’',
  46606. 'Å•' => 'Å”',
  46607. 'Å—' => 'Å–',
  46608. 'ř' => 'Ř',
  46609. 'Å›' => 'Åš',
  46610. '�' => 'Ŝ',
  46611. 'ÅŸ' => 'Åž',
  46612. 'Å¡' => 'Å ',
  46613. 'Å£' => 'Å¢',
  46614. 'ť' => 'Ť',
  46615. 'ŧ' => 'Ŧ',
  46616. 'ũ' => 'Ũ',
  46617. 'ū' => 'Ū',
  46618. 'ŭ' => 'Ŭ',
  46619. 'ů' => 'Ů',
  46620. 'ű' => 'Ű',
  46621. 'ų' => 'Ų',
  46622. 'ŵ' => 'Ŵ',
  46623. 'ŷ' => 'Ŷ',
  46624. 'ź' => 'Ź',
  46625. 'ż' => 'Ż',
  46626. 'ž' => 'Ž',
  46627. 'Å¿' => 'S',
  46628. 'ƀ' => 'Ƀ',
  46629. 'ƃ' => 'Ƃ',
  46630. 'Æ…' => 'Æ„',
  46631. 'ƈ' => 'Ƈ',
  46632. 'ƌ' => 'Ƌ',
  46633. 'Æ’' => 'Æ‘',
  46634. 'ƕ' => 'Ƕ',
  46635. 'ƙ' => 'Ƙ',
  46636. 'ƚ' => 'Ƚ',
  46637. 'Æž' => 'È ',
  46638. 'Æ¡' => 'Æ ',
  46639. 'Æ£' => 'Æ¢',
  46640. 'ƥ' => 'Ƥ',
  46641. 'ƨ' => 'Ƨ',
  46642. 'ƭ' => 'Ƭ',
  46643. 'ư' => 'Ư',
  46644. 'ƴ' => 'Ƴ',
  46645. 'ƶ' => 'Ƶ',
  46646. 'ƹ' => 'Ƹ',
  46647. 'ƽ' => 'Ƽ',
  46648. 'Æ¿' => 'Ç·',
  46649. 'Ç…' => 'Ç„',
  46650. 'dž' => 'DŽ',
  46651. 'Lj' => 'LJ',
  46652. 'lj' => 'LJ',
  46653. 'Ç‹' => 'ÇŠ',
  46654. 'nj' => 'NJ',
  46655. 'ǎ' => '�',
  46656. '�' => '�',
  46657. 'Ç’' => 'Ç‘',
  46658. 'Ç”' => 'Ç“',
  46659. 'Ç–' => 'Ç•',
  46660. 'ǘ' => 'Ǘ',
  46661. 'Çš' => 'Ç™',
  46662. 'ǜ' => 'Ǜ',
  46663. '�' => 'Ǝ',
  46664. 'ÇŸ' => 'Çž',
  46665. 'Ç¡' => 'Ç ',
  46666. 'Ç£' => 'Ç¢',
  46667. 'ǥ' => 'Ǥ',
  46668. 'ǧ' => 'Ǧ',
  46669. 'ǩ' => 'Ǩ',
  46670. 'ǫ' => 'Ǫ',
  46671. 'ǭ' => 'Ǭ',
  46672. 'ǯ' => 'Ǯ',
  46673. 'Dz' => 'DZ',
  46674. 'dz' => 'DZ',
  46675. 'ǵ' => 'Ǵ',
  46676. 'ǹ' => 'Ǹ',
  46677. 'ǻ' => 'Ǻ',
  46678. 'ǽ' => 'Ǽ',
  46679. 'ǿ' => 'Ǿ',
  46680. '�' => 'Ȁ',
  46681. 'ȃ' => 'Ȃ',
  46682. 'È…' => 'È„',
  46683. 'ȇ' => 'Ȇ',
  46684. 'ȉ' => 'Ȉ',
  46685. 'È‹' => 'ÈŠ',
  46686. '�' => 'Ȍ',
  46687. '�' => 'Ȏ',
  46688. 'ȑ' => '�',
  46689. 'È“' => 'È’',
  46690. 'È•' => 'È”',
  46691. 'È—' => 'È–',
  46692. 'ș' => 'Ș',
  46693. 'È›' => 'Èš',
  46694. '�' => 'Ȝ',
  46695. 'ÈŸ' => 'Èž',
  46696. 'È£' => 'È¢',
  46697. 'ȥ' => 'Ȥ',
  46698. 'ȧ' => 'Ȧ',
  46699. 'ȩ' => 'Ȩ',
  46700. 'ȫ' => 'Ȫ',
  46701. 'ȭ' => 'Ȭ',
  46702. 'ȯ' => 'Ȯ',
  46703. 'ȱ' => 'Ȱ',
  46704. 'ȳ' => 'Ȳ',
  46705. 'ȼ' => 'Ȼ',
  46706. 'È¿' => 'â±¾',
  46707. 'ɀ' => 'Ɀ',
  46708. 'ɂ' => '�',
  46709. 'ɇ' => 'Ɇ',
  46710. 'ɉ' => 'Ɉ',
  46711. 'É‹' => 'ÉŠ',
  46712. '�' => 'Ɍ',
  46713. '�' => 'Ɏ',
  46714. '�' => 'Ɐ',
  46715. 'É‘' => 'â±­',
  46716. 'É’' => 'â±°',
  46717. 'ɓ' => '�',
  46718. 'ɔ' => 'Ɔ',
  46719. 'ɖ' => 'Ɖ',
  46720. 'É—' => 'ÆŠ',
  46721. 'ə' => '�',
  46722. 'ɛ' => '�',
  46723. 'ɜ' => 'Ɜ',
  46724. 'É ' => 'Æ“',
  46725. 'ɡ' => 'Ɡ',
  46726. 'É£' => 'Æ”',
  46727. 'ɥ' => '�',
  46728. 'ɦ' => 'Ɦ',
  46729. 'ɨ' => 'Ɨ',
  46730. 'É©' => 'Æ–',
  46731. 'ɪ' => 'Ɪ',
  46732. 'É«' => 'â±¢',
  46733. 'ɬ' => 'Ɬ',
  46734. 'ɯ' => 'Ɯ',
  46735. 'ɱ' => 'Ɱ',
  46736. 'ɲ' => '�',
  46737. 'ɵ' => 'Ɵ',
  46738. 'ɽ' => 'Ɽ',
  46739. 'ʀ' => 'Ʀ',
  46740. 'ʂ' => 'Ʂ',
  46741. 'ʃ' => 'Ʃ',
  46742. 'ʇ' => 'Ʇ',
  46743. 'ʈ' => 'Ʈ',
  46744. 'ʉ' => 'Ʉ',
  46745. 'ʊ' => 'Ʊ',
  46746. 'ʋ' => 'Ʋ',
  46747. 'ʌ' => 'Ʌ',
  46748. 'Ê’' => 'Æ·',
  46749. '�' => 'Ʝ',
  46750. 'Êž' => 'êž°',
  46751. 'ͅ' => 'Ι',
  46752. 'ͱ' => 'Ͱ',
  46753. 'ͳ' => 'Ͳ',
  46754. 'ͷ' => 'Ͷ',
  46755. 'ͻ' => 'Ͻ',
  46756. 'ͼ' => 'Ͼ',
  46757. 'ͽ' => 'Ͽ',
  46758. 'ά' => 'Ά',
  46759. 'έ' => 'Έ',
  46760. 'ή' => 'Ή',
  46761. 'ί' => 'Ί',
  46762. 'α' => 'Α',
  46763. 'β' => 'Β',
  46764. 'γ' => 'Γ',
  46765. 'δ' => 'Δ',
  46766. 'ε' => 'Ε',
  46767. 'ζ' => 'Ζ',
  46768. 'η' => 'Η',
  46769. 'θ' => 'Θ',
  46770. 'ι' => 'Ι',
  46771. 'κ' => 'Κ',
  46772. 'λ' => 'Λ',
  46773. 'μ' => 'Μ',
  46774. 'ν' => '�',
  46775. 'ξ' => 'Ξ',
  46776. 'ο' => 'Ο',
  46777. 'π' => 'Π',
  46778. '�' => 'Ρ',
  46779. 'ς' => 'Σ',
  46780. 'σ' => 'Σ',
  46781. 'τ' => 'Τ',
  46782. 'Ï…' => 'Î¥',
  46783. 'φ' => 'Φ',
  46784. 'χ' => 'Χ',
  46785. 'ψ' => 'Ψ',
  46786. 'ω' => 'Ω',
  46787. 'ϊ' => 'Ϊ',
  46788. 'ϋ' => 'Ϋ',
  46789. 'ό' => 'Ό',
  46790. '�' => 'Ύ',
  46791. 'ώ' => '�',
  46792. '�' => 'Β',
  46793. 'ϑ' => 'Θ',
  46794. 'ϕ' => 'Φ',
  46795. 'ϖ' => 'Π',
  46796. 'ϗ' => '�',
  46797. 'ϙ' => 'Ϙ',
  46798. 'Ï›' => 'Ïš',
  46799. '�' => 'Ϝ',
  46800. 'ÏŸ' => 'Ïž',
  46801. 'Ï¡' => 'Ï ',
  46802. 'Ï£' => 'Ï¢',
  46803. 'ϥ' => 'Ϥ',
  46804. 'ϧ' => 'Ϧ',
  46805. 'ϩ' => 'Ϩ',
  46806. 'ϫ' => 'Ϫ',
  46807. 'ϭ' => 'Ϭ',
  46808. 'ϯ' => 'Ϯ',
  46809. 'ϰ' => 'Κ',
  46810. 'ϱ' => 'Ρ',
  46811. 'ϲ' => 'Ϲ',
  46812. 'ϳ' => 'Ϳ',
  46813. 'ϵ' => 'Ε',
  46814. 'ϸ' => 'Ϸ',
  46815. 'ϻ' => 'Ϻ',
  46816. 'а' => '�',
  46817. 'б' => 'Б',
  46818. 'в' => 'В',
  46819. 'г' => 'Г',
  46820. 'д' => 'Д',
  46821. 'е' => 'Е',
  46822. 'ж' => 'Ж',
  46823. 'з' => 'З',
  46824. 'и' => 'И',
  46825. 'й' => 'Й',
  46826. 'к' => 'К',
  46827. 'л' => 'Л',
  46828. 'м' => 'М',
  46829. 'н' => '�',
  46830. 'о' => 'О',
  46831. 'п' => 'П',
  46832. 'р' => 'Р',
  46833. '�' => 'С',
  46834. 'т' => 'Т',
  46835. 'у' => 'У',
  46836. 'ф' => 'Ф',
  46837. 'Ñ…' => 'Ð¥',
  46838. 'ц' => 'Ц',
  46839. 'ч' => 'Ч',
  46840. 'ш' => 'Ш',
  46841. 'щ' => 'Щ',
  46842. 'ъ' => 'Ъ',
  46843. 'ы' => 'Ы',
  46844. 'ь' => 'Ь',
  46845. '�' => 'Э',
  46846. 'ю' => 'Ю',
  46847. '�' => 'Я',
  46848. '�' => 'Ѐ',
  46849. 'ё' => '�',
  46850. 'ђ' => 'Ђ',
  46851. 'ѓ' => 'Ѓ',
  46852. 'є' => 'Є',
  46853. 'Ñ•' => 'Ð…',
  46854. 'і' => 'І',
  46855. 'ї' => 'Ї',
  46856. 'ј' => 'Ј',
  46857. 'љ' => 'Љ',
  46858. 'њ' => 'Њ',
  46859. 'ћ' => 'Ћ',
  46860. 'ќ' => 'Ќ',
  46861. '�' => '�',
  46862. 'Ñž' => 'ÐŽ',
  46863. 'џ' => '�',
  46864. 'Ñ¡' => 'Ñ ',
  46865. 'Ñ£' => 'Ñ¢',
  46866. 'ѥ' => 'Ѥ',
  46867. 'ѧ' => 'Ѧ',
  46868. 'ѩ' => 'Ѩ',
  46869. 'ѫ' => 'Ѫ',
  46870. 'ѭ' => 'Ѭ',
  46871. 'ѯ' => 'Ѯ',
  46872. 'ѱ' => 'Ѱ',
  46873. 'ѳ' => 'Ѳ',
  46874. 'ѵ' => 'Ѵ',
  46875. 'ѷ' => 'Ѷ',
  46876. 'ѹ' => 'Ѹ',
  46877. 'ѻ' => 'Ѻ',
  46878. 'ѽ' => 'Ѽ',
  46879. 'ѿ' => 'Ѿ',
  46880. 'Ò�' => 'Ò€',
  46881. 'Ò‹' => 'ÒŠ',
  46882. '�' => 'Ҍ',
  46883. 'Ò�' => 'ÒŽ',
  46884. 'Ò‘' => 'Ò�',
  46885. 'Ò“' => 'Ò’',
  46886. 'Ò•' => 'Ò”',
  46887. 'Ò—' => 'Ò–',
  46888. 'Ò™' => 'Ò˜',
  46889. 'Ò›' => 'Òš',
  46890. '�' => 'Ҝ',
  46891. 'ÒŸ' => 'Òž',
  46892. 'Ò¡' => 'Ò ',
  46893. 'Ò£' => 'Ò¢',
  46894. 'Ò¥' => 'Ò¤',
  46895. 'Ò§' => 'Ò¦',
  46896. 'Ò©' => 'Ò¨',
  46897. 'Ò«' => 'Òª',
  46898. 'Ò­' => 'Ò¬',
  46899. 'Ò¯' => 'Ò®',
  46900. 'Ò±' => 'Ò°',
  46901. 'Ò³' => 'Ò²',
  46902. 'Òµ' => 'Ò´',
  46903. 'Ò·' => 'Ò¶',
  46904. 'Ò¹' => 'Ò¸',
  46905. 'Ò»' => 'Òº',
  46906. 'Ò½' => 'Ò¼',
  46907. 'Ò¿' => 'Ò¾',
  46908. 'Ó‚' => 'Ó�',
  46909. 'Ó„' => 'Óƒ',
  46910. 'Ó†' => 'Ó…',
  46911. 'Óˆ' => 'Ó‡',
  46912. 'ÓŠ' => 'Ó‰',
  46913. 'ӌ' => 'Ӌ',
  46914. 'ÓŽ' => 'Ó�',
  46915. 'Ó�' => 'Ó€',
  46916. 'Ó‘' => 'Ó�',
  46917. 'Ó“' => 'Ó’',
  46918. 'Ó•' => 'Ó”',
  46919. 'Ó—' => 'Ó–',
  46920. 'Ó™' => 'Ó˜',
  46921. 'Ó›' => 'Óš',
  46922. '�' => 'Ӝ',
  46923. 'ÓŸ' => 'Óž',
  46924. 'Ó¡' => 'Ó ',
  46925. 'Ó£' => 'Ó¢',
  46926. 'Ó¥' => 'Ó¤',
  46927. 'Ó§' => 'Ó¦',
  46928. 'Ó©' => 'Ó¨',
  46929. 'Ó«' => 'Óª',
  46930. 'Ó­' => 'Ó¬',
  46931. 'Ó¯' => 'Ó®',
  46932. 'Ó±' => 'Ó°',
  46933. 'Ó³' => 'Ó²',
  46934. 'Óµ' => 'Ó´',
  46935. 'Ó·' => 'Ó¶',
  46936. 'Ó¹' => 'Ó¸',
  46937. 'Ó»' => 'Óº',
  46938. 'Ó½' => 'Ó¼',
  46939. 'Ó¿' => 'Ó¾',
  46940. 'Ô�' => 'Ô€',
  46941. 'Ôƒ' => 'Ô‚',
  46942. 'Ô…' => 'Ô„',
  46943. 'Ô‡' => 'Ô†',
  46944. 'Ô‰' => 'Ôˆ',
  46945. 'Ô‹' => 'ÔŠ',
  46946. '�' => 'Ԍ',
  46947. 'Ô�' => 'ÔŽ',
  46948. 'Ô‘' => 'Ô�',
  46949. 'Ô“' => 'Ô’',
  46950. 'Ô•' => 'Ô”',
  46951. 'Ô—' => 'Ô–',
  46952. 'Ô™' => 'Ô˜',
  46953. 'Ô›' => 'Ôš',
  46954. '�' => 'Ԝ',
  46955. 'ÔŸ' => 'Ôž',
  46956. 'Ô¡' => 'Ô ',
  46957. 'Ô£' => 'Ô¢',
  46958. 'Ô¥' => 'Ô¤',
  46959. 'Ô§' => 'Ô¦',
  46960. 'Ô©' => 'Ô¨',
  46961. 'Ô«' => 'Ôª',
  46962. 'Ô­' => 'Ô¬',
  46963. 'Ô¯' => 'Ô®',
  46964. 'Õ¡' => 'Ô±',
  46965. 'Õ¢' => 'Ô²',
  46966. 'Õ£' => 'Ô³',
  46967. 'Õ¤' => 'Ô´',
  46968. 'Õ¥' => 'Ôµ',
  46969. 'Õ¦' => 'Ô¶',
  46970. 'Õ§' => 'Ô·',
  46971. 'Õ¨' => 'Ô¸',
  46972. 'Õ©' => 'Ô¹',
  46973. 'Õª' => 'Ôº',
  46974. 'Õ«' => 'Ô»',
  46975. 'Õ¬' => 'Ô¼',
  46976. 'Õ­' => 'Ô½',
  46977. 'Õ®' => 'Ô¾',
  46978. 'Õ¯' => 'Ô¿',
  46979. 'Õ°' => 'Õ€',
  46980. 'Õ±' => 'Õ�',
  46981. 'Õ²' => 'Õ‚',
  46982. 'Õ³' => 'Õƒ',
  46983. 'Õ´' => 'Õ„',
  46984. 'Õµ' => 'Õ…',
  46985. 'Õ¶' => 'Õ†',
  46986. 'Õ·' => 'Õ‡',
  46987. 'Õ¸' => 'Õˆ',
  46988. 'Õ¹' => 'Õ‰',
  46989. 'Õº' => 'ÕŠ',
  46990. 'Õ»' => 'Õ‹',
  46991. 'ռ' => 'Ռ',
  46992. 'Õ½' => 'Õ�',
  46993. 'Õ¾' => 'ÕŽ',
  46994. 'Õ¿' => 'Õ�',
  46995. 'Ö€' => 'Õ�',
  46996. 'Ö�' => 'Õ‘',
  46997. 'Ö‚' => 'Õ’',
  46998. 'Öƒ' => 'Õ“',
  46999. 'Ö„' => 'Õ”',
  47000. 'Ö…' => 'Õ•',
  47001. 'Ö†' => 'Õ–',
  47002. '�' => '�',
  47003. 'ბ' => 'Ბ',
  47004. 'გ' => 'Გ',
  47005. 'დ' => 'Დ',
  47006. 'ე' => 'Ე',
  47007. 'ვ' => 'Ვ',
  47008. 'ზ' => 'Ზ',
  47009. 'თ' => 'Თ',
  47010. 'ი' => 'Ი',
  47011. 'კ' => 'Კ',
  47012. 'ლ' => 'Ლ',
  47013. 'მ' => 'Მ',
  47014. 'ნ' => 'Ნ',
  47015. '�' => '�',
  47016. 'პ' => 'Პ',
  47017. 'ჟ' => 'Ჟ',
  47018. 'რ' => 'Რ',
  47019. 'ს' => 'Ს',
  47020. 'ტ' => 'Ტ',
  47021. 'უ' => 'Უ',
  47022. 'ფ' => 'Ფ',
  47023. 'ქ' => 'Ქ',
  47024. 'ღ' => 'Ღ',
  47025. 'ყ' => 'Ყ',
  47026. 'შ' => 'Შ',
  47027. 'ჩ' => 'Ჩ',
  47028. 'ც' => 'Ც',
  47029. 'ძ' => 'Ძ',
  47030. 'წ' => 'Წ',
  47031. 'ჭ' => 'Ჭ',
  47032. 'ხ' => 'Ხ',
  47033. 'ჯ' => 'Ჯ',
  47034. 'ჰ' => 'Ჰ',
  47035. 'ჱ' => 'Ჱ',
  47036. 'ჲ' => 'Ჲ',
  47037. 'ჳ' => 'Ჳ',
  47038. 'ჴ' => 'Ჴ',
  47039. 'ჵ' => 'Ჵ',
  47040. 'ჶ' => 'Ჶ',
  47041. 'ჷ' => 'Ჷ',
  47042. 'ჸ' => 'Ჸ',
  47043. 'ჹ' => 'Ჹ',
  47044. 'ჺ' => 'Ჺ',
  47045. 'ჽ' => 'Ჽ',
  47046. 'ჾ' => 'Ჾ',
  47047. 'ჿ' => 'Ჿ',
  47048. '�' => '�',
  47049. '�' => '�',
  47050. '�' => '�',
  47051. '�' => '�',
  47052. '�' => '�',
  47053. '�' => '�',
  47054. 'á²€' => 'Ð’',
  47055. '�' => 'Д',
  47056. 'ᲂ' => 'О',
  47057. 'ᲃ' => 'С',
  47058. 'ᲄ' => 'Т',
  47059. 'ᲅ' => 'Т',
  47060. 'ᲆ' => 'Ъ',
  47061. 'ᲇ' => 'Ѣ',
  47062. 'ᲈ' => 'Ꙋ',
  47063. 'ᵹ' => '�',
  47064. 'áµ½' => 'â±£',
  47065. 'ᶎ' => 'Ᶎ',
  47066. '�' => 'Ḁ',
  47067. 'ḃ' => 'Ḃ',
  47068. 'ḅ' => 'Ḅ',
  47069. 'ḇ' => 'Ḇ',
  47070. 'ḉ' => 'Ḉ',
  47071. 'ḋ' => 'Ḋ',
  47072. '�' => 'Ḍ',
  47073. '�' => 'Ḏ',
  47074. 'ḑ' => '�',
  47075. 'ḓ' => 'Ḓ',
  47076. 'ḕ' => 'Ḕ',
  47077. 'ḗ' => 'Ḗ',
  47078. 'ḙ' => 'Ḙ',
  47079. 'ḛ' => 'Ḛ',
  47080. '�' => 'Ḝ',
  47081. 'ḟ' => 'Ḟ',
  47082. 'ḡ' => 'Ḡ',
  47083. 'ḣ' => 'Ḣ',
  47084. 'ḥ' => 'Ḥ',
  47085. 'ḧ' => 'Ḧ',
  47086. 'ḩ' => 'Ḩ',
  47087. 'ḫ' => 'Ḫ',
  47088. 'ḭ' => 'Ḭ',
  47089. 'ḯ' => 'Ḯ',
  47090. 'ḱ' => 'Ḱ',
  47091. 'ḳ' => 'Ḳ',
  47092. 'ḵ' => 'Ḵ',
  47093. 'ḷ' => 'Ḷ',
  47094. 'ḹ' => 'Ḹ',
  47095. 'ḻ' => 'Ḻ',
  47096. 'ḽ' => 'Ḽ',
  47097. 'ḿ' => 'Ḿ',
  47098. '�' => 'Ṁ',
  47099. 'ṃ' => 'Ṃ',
  47100. 'ṅ' => 'Ṅ',
  47101. 'ṇ' => 'Ṇ',
  47102. 'ṉ' => 'Ṉ',
  47103. 'ṋ' => 'Ṋ',
  47104. '�' => 'Ṍ',
  47105. '�' => 'Ṏ',
  47106. 'ṑ' => '�',
  47107. 'ṓ' => 'Ṓ',
  47108. 'ṕ' => 'Ṕ',
  47109. 'á¹—' => 'á¹–',
  47110. 'ṙ' => 'Ṙ',
  47111. 'ṛ' => 'Ṛ',
  47112. '�' => 'Ṝ',
  47113. 'ṟ' => 'Ṟ',
  47114. 'ṡ' => 'Ṡ',
  47115. 'á¹£' => 'á¹¢',
  47116. 'ṥ' => 'Ṥ',
  47117. 'ṧ' => 'Ṧ',
  47118. 'ṩ' => 'Ṩ',
  47119. 'ṫ' => 'Ṫ',
  47120. 'ṭ' => 'Ṭ',
  47121. 'ṯ' => 'Ṯ',
  47122. 'á¹±' => 'á¹°',
  47123. 'á¹³' => 'á¹²',
  47124. 'á¹µ' => 'á¹´',
  47125. 'á¹·' => 'á¹¶',
  47126. 'ṹ' => 'Ṹ',
  47127. 'ṻ' => 'Ṻ',
  47128. 'á¹½' => 'á¹¼',
  47129. 'ṿ' => 'Ṿ',
  47130. '�' => 'Ẁ',
  47131. 'ẃ' => 'Ẃ',
  47132. 'ẅ' => 'Ẅ',
  47133. 'ẇ' => 'Ẇ',
  47134. 'ẉ' => 'Ẉ',
  47135. 'ẋ' => 'Ẋ',
  47136. '�' => 'Ẍ',
  47137. '�' => 'Ẏ',
  47138. 'ẑ' => '�',
  47139. 'ẓ' => 'Ẓ',
  47140. 'ẕ' => 'Ẕ',
  47141. 'ẛ' => 'Ṡ',
  47142. 'ạ' => 'Ạ',
  47143. 'ả' => 'Ả',
  47144. 'ấ' => 'Ấ',
  47145. 'ầ' => 'Ầ',
  47146. 'ẩ' => 'Ẩ',
  47147. 'ẫ' => 'Ẫ',
  47148. 'ậ' => 'Ậ',
  47149. 'ắ' => 'Ắ',
  47150. 'ằ' => 'Ằ',
  47151. 'ẳ' => 'Ẳ',
  47152. 'ẵ' => 'Ẵ',
  47153. 'ặ' => 'Ặ',
  47154. 'ẹ' => 'Ẹ',
  47155. 'ẻ' => 'Ẻ',
  47156. 'ẽ' => 'Ẽ',
  47157. 'ế' => 'Ế',
  47158. '�' => 'Ề',
  47159. 'ể' => 'Ể',
  47160. 'ễ' => 'Ễ',
  47161. 'ệ' => 'Ệ',
  47162. 'ỉ' => 'Ỉ',
  47163. 'ị' => 'Ị',
  47164. '�' => 'Ọ',
  47165. '�' => 'Ỏ',
  47166. 'ố' => '�',
  47167. 'ồ' => 'Ồ',
  47168. 'ổ' => 'Ổ',
  47169. 'á»—' => 'á»–',
  47170. 'ộ' => 'Ộ',
  47171. 'ớ' => 'Ớ',
  47172. '�' => 'Ờ',
  47173. 'ở' => 'Ở',
  47174. 'ỡ' => 'Ỡ',
  47175. 'ợ' => 'Ợ',
  47176. 'ụ' => 'Ụ',
  47177. 'ủ' => 'Ủ',
  47178. 'ứ' => 'Ứ',
  47179. 'ừ' => 'Ừ',
  47180. 'ử' => 'Ử',
  47181. 'ữ' => 'Ữ',
  47182. 'á»±' => 'á»°',
  47183. 'ỳ' => 'Ỳ',
  47184. 'ỵ' => 'Ỵ',
  47185. 'á»·' => 'á»¶',
  47186. 'ỹ' => 'Ỹ',
  47187. 'ỻ' => 'Ỻ',
  47188. 'ỽ' => 'Ỽ',
  47189. 'ỿ' => 'Ỿ',
  47190. 'ἀ' => 'Ἀ',
  47191. '�' => 'Ἁ',
  47192. 'ἂ' => 'Ἂ',
  47193. 'ἃ' => 'Ἃ',
  47194. 'ἄ' => 'Ἄ',
  47195. 'ἅ' => '�',
  47196. 'ἆ' => 'Ἆ',
  47197. 'ἇ' => '�',
  47198. '�' => 'Ἐ',
  47199. 'ἑ' => 'Ἑ',
  47200. 'ἒ' => 'Ἒ',
  47201. 'ἓ' => 'Ἓ',
  47202. 'ἔ' => 'Ἔ',
  47203. 'ἕ' => '�',
  47204. 'ἠ' => 'Ἠ',
  47205. 'ἡ' => 'Ἡ',
  47206. 'ἢ' => 'Ἢ',
  47207. 'ἣ' => 'Ἣ',
  47208. 'ἤ' => 'Ἤ',
  47209. 'á¼¥' => 'á¼­',
  47210. 'ἦ' => 'Ἦ',
  47211. 'ἧ' => 'Ἧ',
  47212. 'ἰ' => 'Ἰ',
  47213. 'á¼±' => 'á¼¹',
  47214. 'ἲ' => 'Ἲ',
  47215. 'á¼³' => 'á¼»',
  47216. 'á¼´' => 'á¼¼',
  47217. 'á¼µ' => 'á¼½',
  47218. 'á¼¶' => 'á¼¾',
  47219. 'ἷ' => 'Ἷ',
  47220. 'ὀ' => 'Ὀ',
  47221. '�' => 'Ὁ',
  47222. 'ὂ' => 'Ὂ',
  47223. 'ὃ' => 'Ὃ',
  47224. 'ὄ' => 'Ὄ',
  47225. 'ὅ' => '�',
  47226. 'ὑ' => 'Ὑ',
  47227. 'ὓ' => 'Ὓ',
  47228. 'ὕ' => '�',
  47229. 'ὗ' => 'Ὗ',
  47230. 'ὠ' => 'Ὠ',
  47231. 'ὡ' => 'Ὡ',
  47232. 'ὢ' => 'Ὢ',
  47233. 'ὣ' => 'Ὣ',
  47234. 'ὤ' => 'Ὤ',
  47235. 'á½¥' => 'á½­',
  47236. 'ὦ' => 'Ὦ',
  47237. 'ὧ' => 'Ὧ',
  47238. 'ὰ' => 'Ὰ',
  47239. 'á½±' => 'á¾»',
  47240. 'ὲ' => 'Ὲ',
  47241. 'έ' => 'Έ',
  47242. 'ὴ' => 'Ὴ',
  47243. 'á½µ' => 'á¿‹',
  47244. 'ὶ' => 'Ὶ',
  47245. 'á½·' => 'á¿›',
  47246. 'ὸ' => 'Ὸ',
  47247. 'ό' => 'Ό',
  47248. 'ὺ' => 'Ὺ',
  47249. 'á½»' => 'á¿«',
  47250. 'ὼ' => 'Ὼ',
  47251. 'á½½' => 'á¿»',
  47252. 'ᾀ' => 'ᾈ',
  47253. '�' => 'ᾉ',
  47254. 'ᾂ' => 'ᾊ',
  47255. 'ᾃ' => 'ᾋ',
  47256. 'ᾄ' => 'ᾌ',
  47257. 'ᾅ' => '�',
  47258. 'ᾆ' => 'ᾎ',
  47259. 'ᾇ' => '�',
  47260. '�' => 'ᾘ',
  47261. 'ᾑ' => 'ᾙ',
  47262. 'ᾒ' => 'ᾚ',
  47263. 'ᾓ' => 'ᾛ',
  47264. 'ᾔ' => 'ᾜ',
  47265. 'ᾕ' => '�',
  47266. 'ᾖ' => 'ᾞ',
  47267. 'ᾗ' => 'ᾟ',
  47268. 'ᾠ' => 'ᾨ',
  47269. 'ᾡ' => 'ᾩ',
  47270. 'ᾢ' => 'ᾪ',
  47271. 'ᾣ' => 'ᾫ',
  47272. 'ᾤ' => 'ᾬ',
  47273. 'á¾¥' => 'á¾­',
  47274. 'ᾦ' => 'ᾮ',
  47275. 'ᾧ' => 'ᾯ',
  47276. 'ᾰ' => 'Ᾰ',
  47277. 'á¾±' => 'á¾¹',
  47278. 'á¾³' => 'á¾¼',
  47279. 'ι' => 'Ι',
  47280. 'ῃ' => 'ῌ',
  47281. '�' => 'Ῐ',
  47282. 'á¿‘' => 'á¿™',
  47283. 'ῠ' => 'Ῠ',
  47284. 'á¿¡' => 'á¿©',
  47285. 'ῥ' => 'Ῥ',
  47286. 'ῳ' => 'ῼ',
  47287. 'ⅎ' => 'Ⅎ',
  47288. 'â…°' => 'â… ',
  47289. 'â…±' => 'â…¡',
  47290. 'â…²' => 'â…¢',
  47291. 'â…³' => 'â…£',
  47292. 'â…´' => 'â…¤',
  47293. 'â…µ' => 'â…¥',
  47294. 'â…¶' => 'â…¦',
  47295. 'â…·' => 'â…§',
  47296. 'â…¸' => 'â…¨',
  47297. 'â…¹' => 'â…©',
  47298. 'â…º' => 'â…ª',
  47299. 'â…»' => 'â…«',
  47300. 'â…¼' => 'â…¬',
  47301. 'â…½' => 'â…­',
  47302. 'â…¾' => 'â…®',
  47303. 'â…¿' => 'â…¯',
  47304. 'ↄ' => 'Ↄ',
  47305. '�' => 'Ⓐ',
  47306. 'â“‘' => 'â’·',
  47307. 'â“’' => 'â’¸',
  47308. 'â““' => 'â’¹',
  47309. 'â“”' => 'â’º',
  47310. 'â“•' => 'â’»',
  47311. 'â“–' => 'â’¼',
  47312. 'â“—' => 'â’½',
  47313. 'ⓘ' => 'Ⓘ',
  47314. 'â“™' => 'â’¿',
  47315. 'ⓚ' => 'Ⓚ',
  47316. 'ⓛ' => '�',
  47317. 'ⓜ' => 'Ⓜ',
  47318. '�' => 'Ⓝ',
  47319. 'ⓞ' => 'Ⓞ',
  47320. 'ⓟ' => 'Ⓟ',
  47321. 'ⓠ' => 'Ⓠ',
  47322. 'ⓡ' => 'Ⓡ',
  47323. 'ⓢ' => 'Ⓢ',
  47324. 'ⓣ' => 'Ⓣ',
  47325. 'ⓤ' => 'Ⓤ',
  47326. 'â“¥' => 'â“‹',
  47327. 'ⓦ' => 'Ⓦ',
  47328. 'ⓧ' => '�',
  47329. 'ⓨ' => 'Ⓨ',
  47330. 'ⓩ' => '�',
  47331. 'â°°' => 'â°€',
  47332. 'â°±' => 'â°�',
  47333. 'â°²' => 'â°‚',
  47334. 'â°³' => 'â°ƒ',
  47335. 'â°´' => 'â°„',
  47336. 'â°µ' => 'â°…',
  47337. 'â°¶' => 'â°†',
  47338. 'â°·' => 'â°‡',
  47339. 'â°¸' => 'â°ˆ',
  47340. 'â°¹' => 'â°‰',
  47341. 'â°º' => 'â°Š',
  47342. 'â°»' => 'â°‹',
  47343. 'ⰼ' => 'Ⰼ',
  47344. 'â°½' => 'â°�',
  47345. 'â°¾' => 'â°Ž',
  47346. 'â°¿' => 'â°�',
  47347. 'â±€' => 'â°�',
  47348. '�' => 'Ⱁ',
  47349. 'ⱂ' => 'Ⱂ',
  47350. 'ⱃ' => 'Ⱃ',
  47351. 'ⱄ' => 'Ⱄ',
  47352. 'â±…' => 'â°•',
  47353. 'ⱆ' => 'Ⱆ',
  47354. 'ⱇ' => 'Ⱇ',
  47355. 'ⱈ' => 'Ⱈ',
  47356. 'ⱉ' => 'Ⱉ',
  47357. 'ⱊ' => 'Ⱊ',
  47358. 'ⱋ' => 'Ⱋ',
  47359. 'ⱌ' => 'Ⱌ',
  47360. '�' => '�',
  47361. 'ⱎ' => 'Ⱎ',
  47362. '�' => 'Ⱏ',
  47363. '�' => 'Ⱐ',
  47364. 'ⱑ' => 'Ⱑ',
  47365. 'â±’' => 'â°¢',
  47366. 'ⱓ' => 'Ⱓ',
  47367. 'â±”' => 'â°¤',
  47368. 'ⱕ' => 'Ⱕ',
  47369. 'â±–' => 'â°¦',
  47370. 'â±—' => 'â°§',
  47371. 'ⱘ' => 'Ⱘ',
  47372. 'â±™' => 'â°©',
  47373. 'ⱚ' => 'Ⱚ',
  47374. 'â±›' => 'â°«',
  47375. 'ⱜ' => 'Ⱜ',
  47376. '�' => 'Ⱝ',
  47377. 'ⱞ' => 'Ⱞ',
  47378. 'ⱡ' => 'Ⱡ',
  47379. 'ⱥ' => 'Ⱥ',
  47380. 'ⱦ' => 'Ⱦ',
  47381. 'ⱨ' => 'Ⱨ',
  47382. 'ⱪ' => 'Ⱪ',
  47383. 'ⱬ' => 'Ⱬ',
  47384. 'â±³' => 'â±²',
  47385. 'â±¶' => 'â±µ',
  47386. '�' => 'Ⲁ',
  47387. 'ⲃ' => 'Ⲃ',
  47388. 'ⲅ' => 'Ⲅ',
  47389. 'ⲇ' => 'Ⲇ',
  47390. 'ⲉ' => 'Ⲉ',
  47391. 'ⲋ' => 'Ⲋ',
  47392. '�' => 'Ⲍ',
  47393. '�' => 'Ⲏ',
  47394. 'ⲑ' => '�',
  47395. 'ⲓ' => 'Ⲓ',
  47396. 'ⲕ' => 'Ⲕ',
  47397. 'â²—' => 'â²–',
  47398. 'ⲙ' => 'Ⲙ',
  47399. 'ⲛ' => 'Ⲛ',
  47400. '�' => 'Ⲝ',
  47401. 'ⲟ' => 'Ⲟ',
  47402. 'ⲡ' => 'Ⲡ',
  47403. 'â²£' => 'â²¢',
  47404. 'ⲥ' => 'Ⲥ',
  47405. 'ⲧ' => 'Ⲧ',
  47406. 'ⲩ' => 'Ⲩ',
  47407. 'ⲫ' => 'Ⲫ',
  47408. 'ⲭ' => 'Ⲭ',
  47409. 'ⲯ' => 'Ⲯ',
  47410. 'â²±' => 'â²°',
  47411. 'â²³' => 'â²²',
  47412. 'â²µ' => 'â²´',
  47413. 'â²·' => 'â²¶',
  47414. 'ⲹ' => 'Ⲹ',
  47415. 'ⲻ' => 'Ⲻ',
  47416. 'â²½' => 'â²¼',
  47417. 'ⲿ' => 'Ⲿ',
  47418. '�' => 'Ⳁ',
  47419. 'ⳃ' => 'Ⳃ',
  47420. 'ⳅ' => 'Ⳅ',
  47421. 'ⳇ' => 'Ⳇ',
  47422. 'ⳉ' => 'Ⳉ',
  47423. 'ⳋ' => 'Ⳋ',
  47424. '�' => 'Ⳍ',
  47425. '�' => 'Ⳏ',
  47426. 'ⳑ' => '�',
  47427. 'ⳓ' => 'Ⳓ',
  47428. 'ⳕ' => 'Ⳕ',
  47429. 'â³—' => 'â³–',
  47430. 'ⳙ' => 'Ⳙ',
  47431. 'ⳛ' => 'Ⳛ',
  47432. '�' => 'Ⳝ',
  47433. 'ⳟ' => 'Ⳟ',
  47434. 'ⳡ' => 'Ⳡ',
  47435. 'â³£' => 'â³¢',
  47436. 'ⳬ' => 'Ⳬ',
  47437. 'â³®' => 'â³­',
  47438. 'â³³' => 'â³²',
  47439. 'â´€' => 'á‚ ',
  47440. 'â´�' => 'á‚¡',
  47441. 'â´‚' => 'á‚¢',
  47442. 'â´ƒ' => 'á‚£',
  47443. 'ⴄ' => 'Ⴄ',
  47444. 'â´…' => 'á‚¥',
  47445. 'ⴆ' => 'Ⴆ',
  47446. 'â´‡' => 'á‚§',
  47447. 'ⴈ' => 'Ⴈ',
  47448. 'â´‰' => 'á‚©',
  47449. 'ⴊ' => 'Ⴊ',
  47450. 'â´‹' => 'á‚«',
  47451. 'ⴌ' => 'Ⴌ',
  47452. 'â´�' => 'á‚­',
  47453. 'â´Ž' => 'á‚®',
  47454. '�' => 'Ⴏ',
  47455. 'â´�' => 'á‚°',
  47456. 'ⴑ' => 'Ⴑ',
  47457. 'ⴒ' => 'Ⴒ',
  47458. 'ⴓ' => 'Ⴓ',
  47459. 'â´”' => 'á‚´',
  47460. 'ⴕ' => 'Ⴕ',
  47461. 'â´–' => 'á‚¶',
  47462. 'â´—' => 'á‚·',
  47463. 'ⴘ' => 'Ⴘ',
  47464. 'ⴙ' => 'Ⴙ',
  47465. 'ⴚ' => 'Ⴚ',
  47466. 'â´›' => 'á‚»',
  47467. 'ⴜ' => 'Ⴜ',
  47468. '�' => 'Ⴝ',
  47469. 'ⴞ' => 'Ⴞ',
  47470. 'â´Ÿ' => 'á‚¿',
  47471. 'ⴠ' => 'Ⴠ',
  47472. 'ⴡ' => '�',
  47473. 'ⴢ' => 'Ⴢ',
  47474. 'ⴣ' => 'Ⴣ',
  47475. 'ⴤ' => 'Ⴤ',
  47476. 'ⴥ' => 'Ⴥ',
  47477. 'ⴧ' => 'Ⴧ',
  47478. 'ⴭ' => '�',
  47479. '�' => 'Ꙁ',
  47480. 'ꙃ' => 'Ꙃ',
  47481. 'ꙅ' => 'Ꙅ',
  47482. 'ꙇ' => 'Ꙇ',
  47483. 'ꙉ' => 'Ꙉ',
  47484. 'ꙋ' => 'Ꙋ',
  47485. '�' => 'Ꙍ',
  47486. '�' => 'Ꙏ',
  47487. 'ꙑ' => '�',
  47488. 'ꙓ' => 'Ꙓ',
  47489. 'ꙕ' => 'Ꙕ',
  47490. 'ê™—' => 'ê™–',
  47491. 'ꙙ' => 'Ꙙ',
  47492. 'ꙛ' => 'Ꙛ',
  47493. '�' => 'Ꙝ',
  47494. 'ꙟ' => 'Ꙟ',
  47495. 'ꙡ' => 'Ꙡ',
  47496. 'ꙣ' => 'Ꙣ',
  47497. 'ꙥ' => 'Ꙥ',
  47498. 'ꙧ' => 'Ꙧ',
  47499. 'ꙩ' => 'Ꙩ',
  47500. 'ꙫ' => 'Ꙫ',
  47501. 'ꙭ' => 'Ꙭ',
  47502. '�' => 'Ꚁ',
  47503. 'ꚃ' => 'Ꚃ',
  47504. 'êš…' => 'êš„',
  47505. 'ꚇ' => 'Ꚇ',
  47506. 'ꚉ' => 'Ꚉ',
  47507. 'ꚋ' => 'Ꚋ',
  47508. '�' => 'Ꚍ',
  47509. '�' => 'Ꚏ',
  47510. 'ꚑ' => '�',
  47511. 'êš“' => 'êš’',
  47512. 'êš•' => 'êš”',
  47513. 'êš—' => 'êš–',
  47514. 'ꚙ' => 'Ꚙ',
  47515. 'êš›' => 'êšš',
  47516. 'ꜣ' => 'Ꜣ',
  47517. 'ꜥ' => 'Ꜥ',
  47518. 'ꜧ' => 'Ꜧ',
  47519. 'ꜩ' => 'Ꜩ',
  47520. 'ꜫ' => 'Ꜫ',
  47521. 'ꜭ' => 'Ꜭ',
  47522. 'ꜯ' => 'Ꜯ',
  47523. 'ꜳ' => 'Ꜳ',
  47524. 'ꜵ' => 'Ꜵ',
  47525. 'ꜷ' => 'Ꜷ',
  47526. 'ꜹ' => 'Ꜹ',
  47527. 'ꜻ' => 'Ꜻ',
  47528. 'ꜽ' => 'Ꜽ',
  47529. 'ꜿ' => 'Ꜿ',
  47530. '�' => '�',
  47531. '�' => '�',
  47532. '�' => '�',
  47533. '�' => '�',
  47534. '�' => '�',
  47535. '�' => '�',
  47536. '�' => '�',
  47537. '�' => '�',
  47538. '�' => '�',
  47539. '�' => '�',
  47540. '�' => '�',
  47541. '�' => '�',
  47542. '�' => '�',
  47543. '�' => '�',
  47544. '�' => '�',
  47545. '�' => '�',
  47546. '�' => '�',
  47547. '�' => '�',
  47548. '�' => '�',
  47549. '�' => '�',
  47550. '�' => '�',
  47551. '�' => '�',
  47552. '�' => '�',
  47553. '�' => '�',
  47554. '�' => '�',
  47555. '�' => '�',
  47556. '�' => '�',
  47557. '�' => 'Ꞁ',
  47558. 'ꞃ' => 'Ꞃ',
  47559. 'êž…' => 'êž„',
  47560. 'ꞇ' => 'Ꞇ',
  47561. 'ꞌ' => 'Ꞌ',
  47562. 'ꞑ' => '�',
  47563. 'êž“' => 'êž’',
  47564. 'ꞔ' => 'Ꞔ',
  47565. 'êž—' => 'êž–',
  47566. 'ꞙ' => 'Ꞙ',
  47567. 'êž›' => 'êžš',
  47568. '�' => 'Ꞝ',
  47569. 'ꞟ' => 'Ꞟ',
  47570. 'êž¡' => 'êž ',
  47571. 'ꞣ' => 'Ꞣ',
  47572. 'ꞥ' => 'Ꞥ',
  47573. 'ꞧ' => 'Ꞧ',
  47574. 'ꞩ' => 'Ꞩ',
  47575. 'êžµ' => 'êž´',
  47576. 'êž·' => 'êž¶',
  47577. 'ꞹ' => 'Ꞹ',
  47578. 'ꞻ' => 'Ꞻ',
  47579. 'êž½' => 'êž¼',
  47580. 'êž¿' => 'êž¾',
  47581. 'ꟃ' => 'Ꟃ',
  47582. 'ꟈ' => 'Ꟈ',
  47583. 'ꟊ' => 'Ꟊ',
  47584. 'ꟶ' => 'Ꟶ',
  47585. 'ê­“' => 'êž³',
  47586. 'ꭰ' => 'Ꭰ',
  47587. 'ꭱ' => 'Ꭱ',
  47588. 'ꭲ' => 'Ꭲ',
  47589. 'ꭳ' => 'Ꭳ',
  47590. 'ꭴ' => 'Ꭴ',
  47591. 'ꭵ' => 'Ꭵ',
  47592. 'ꭶ' => 'Ꭶ',
  47593. 'ꭷ' => 'Ꭷ',
  47594. 'ꭸ' => 'Ꭸ',
  47595. 'ꭹ' => 'Ꭹ',
  47596. 'ꭺ' => 'Ꭺ',
  47597. 'ꭻ' => 'Ꭻ',
  47598. 'ꭼ' => 'Ꭼ',
  47599. 'ꭽ' => 'Ꭽ',
  47600. 'ꭾ' => 'Ꭾ',
  47601. 'ꭿ' => 'Ꭿ',
  47602. 'ꮀ' => 'Ꮀ',
  47603. '�' => 'Ꮁ',
  47604. 'ꮂ' => 'Ꮂ',
  47605. 'ꮃ' => 'Ꮃ',
  47606. 'ꮄ' => 'Ꮄ',
  47607. 'ꮅ' => 'Ꮅ',
  47608. 'ꮆ' => 'Ꮆ',
  47609. 'ꮇ' => 'Ꮇ',
  47610. 'ꮈ' => 'Ꮈ',
  47611. 'ꮉ' => 'Ꮉ',
  47612. 'ꮊ' => 'Ꮊ',
  47613. 'ꮋ' => 'Ꮋ',
  47614. 'ꮌ' => 'Ꮌ',
  47615. '�' => 'Ꮍ',
  47616. 'ꮎ' => 'Ꮎ',
  47617. '�' => 'Ꮏ',
  47618. '�' => '�',
  47619. 'ꮑ' => '�',
  47620. 'ꮒ' => '�',
  47621. 'ꮓ' => '�',
  47622. 'ꮔ' => '�',
  47623. 'ꮕ' => '�',
  47624. 'ꮖ' => '�',
  47625. 'ꮗ' => '�',
  47626. 'ꮘ' => '�',
  47627. 'ꮙ' => '�',
  47628. 'ꮚ' => '�',
  47629. 'ꮛ' => '�',
  47630. 'ꮜ' => '�',
  47631. '�' => '�',
  47632. 'ꮞ' => '�',
  47633. 'ꮟ' => '�',
  47634. 'ꮠ' => '�',
  47635. 'ꮡ' => '�',
  47636. 'ꮢ' => '�',
  47637. 'ꮣ' => '�',
  47638. 'ꮤ' => '�',
  47639. 'ꮥ' => '�',
  47640. 'ꮦ' => '�',
  47641. 'ꮧ' => '�',
  47642. 'ꮨ' => '�',
  47643. 'ꮩ' => '�',
  47644. 'ꮪ' => '�',
  47645. 'ꮫ' => '�',
  47646. 'ꮬ' => '�',
  47647. 'ꮭ' => '�',
  47648. 'ꮮ' => '�',
  47649. 'ꮯ' => '�',
  47650. 'ꮰ' => '�',
  47651. 'ꮱ' => '�',
  47652. 'ꮲ' => '�',
  47653. 'ꮳ' => '�',
  47654. 'ꮴ' => '�',
  47655. 'ꮵ' => '�',
  47656. 'ꮶ' => '�',
  47657. 'ꮷ' => '�',
  47658. 'ꮸ' => '�',
  47659. 'ꮹ' => '�',
  47660. 'ꮺ' => '�',
  47661. 'ꮻ' => '�',
  47662. 'ꮼ' => '�',
  47663. 'ꮽ' => '�',
  47664. 'ꮾ' => '�',
  47665. 'ꮿ' => '�',
  47666. '�' => 'A',
  47667. 'b' => 'B',
  47668. 'c' => 'C',
  47669. 'd' => 'D',
  47670. 'ï½…' => 'ï¼¥',
  47671. 'f' => 'F',
  47672. 'g' => 'G',
  47673. 'h' => 'H',
  47674. 'i' => 'I',
  47675. 'j' => 'J',
  47676. 'k' => 'K',
  47677. 'l' => 'L',
  47678. '�' => 'M',
  47679. 'n' => 'N',
  47680. '�' => 'O',
  47681. '�' => 'P',
  47682. 'q' => 'Q',
  47683. 'ï½’' => 'ï¼²',
  47684. 's' => 'S',
  47685. 'ï½”' => 'ï¼´',
  47686. 'u' => 'U',
  47687. 'ï½–' => 'ï¼¶',
  47688. 'ï½—' => 'ï¼·',
  47689. 'x' => 'X',
  47690. 'ï½™' => 'ï¼¹',
  47691. 'z' => 'Z',
  47692. '�' => '�',
  47693. '�' => '�',
  47694. '�' => '�',
  47695. '�' => '�',
  47696. '�' => '�',
  47697. '�' => '�',
  47698. '�' => '�',
  47699. '�' => '�',
  47700. '�' => '�',
  47701. '�' => '�',
  47702. '�' => '�',
  47703. '�' => '�',
  47704. '�' => '�',
  47705. '�' => '�',
  47706. '�' => '�',
  47707. '�' => '�',
  47708. '�' => '�',
  47709. '�' => '�',
  47710. '�' => '�',
  47711. '�' => '�',
  47712. '�' => '�',
  47713. '�' => '�',
  47714. '�' => '�',
  47715. '�' => '�',
  47716. '�' => '�',
  47717. '�' => '�',
  47718. '�' => '�',
  47719. '�' => '�',
  47720. '�' => '�',
  47721. '�' => '�',
  47722. '�' => '�',
  47723. '�' => '�',
  47724. '�' => '�',
  47725. '�' => '�',
  47726. '�' => '�',
  47727. '�' => '�',
  47728. '�' => '�',
  47729. '�' => '�',
  47730. '�' => '�',
  47731. '�' => '�',
  47732. '�' => '�',
  47733. '�' => '�',
  47734. '�' => '�',
  47735. '�' => '�',
  47736. '�' => '�',
  47737. '�' => '�',
  47738. '�' => '�',
  47739. '�' => '�',
  47740. '�' => '�',
  47741. '�' => '�',
  47742. '�' => '�',
  47743. '�' => '�',
  47744. '�' => '�',
  47745. '�' => '�',
  47746. '�' => '�',
  47747. '�' => '�',
  47748. '�' => '�',
  47749. '�' => '�',
  47750. '�' => '�',
  47751. '�' => '�',
  47752. '�' => '�',
  47753. '�' => '�',
  47754. '�' => '�',
  47755. '�' => '�',
  47756. '�' => '�',
  47757. '�' => '�',
  47758. '�' => '�',
  47759. '�' => '�',
  47760. '�' => '�',
  47761. '�' => '�',
  47762. '�' => '�',
  47763. '�' => '�',
  47764. '�' => '�',
  47765. '�' => '�',
  47766. '�' => '�',
  47767. '�' => '�',
  47768. '�' => '�',
  47769. '�' => '�',
  47770. '�' => '�',
  47771. '�' => '�',
  47772. '�' => '�',
  47773. '�' => '�',
  47774. '�' => '�',
  47775. '�' => '�',
  47776. '�' => '�',
  47777. '�' => '�',
  47778. '�' => '�',
  47779. '�' => '�',
  47780. '�' => '�',
  47781. '�' => '�',
  47782. '�' => '�',
  47783. '�' => '�',
  47784. '�' => '�',
  47785. '�' => '�',
  47786. '�' => '�',
  47787. '�' => '�',
  47788. '�' => '�',
  47789. '�' => '�',
  47790. '�' => '�',
  47791. '�' => '�',
  47792. '�' => '�',
  47793. '�' => '�',
  47794. '�' => '�',
  47795. '�' => '�',
  47796. '�' => '�',
  47797. '�' => '�',
  47798. '�' => '�',
  47799. '�' => '�',
  47800. '�' => '�',
  47801. '�' => '�',
  47802. '�' => '�',
  47803. '�' => '�',
  47804. '�' => '�',
  47805. '�' => '�',
  47806. '�' => '�',
  47807. '�' => '�',
  47808. '�' => '�',
  47809. '�' => '�',
  47810. '�' => '�',
  47811. '�' => '�',
  47812. '�' => '�',
  47813. '�' => '�',
  47814. '�' => '�',
  47815. '�' => '�',
  47816. '�' => '�',
  47817. '�' => '�',
  47818. '�' => '�',
  47819. 'ð‘£€' => 'ð‘¢ ',
  47820. '�' => '𑢡',
  47821. '𑣂' => '𑢢',
  47822. '𑣃' => '𑢣',
  47823. '𑣄' => '𑢤',
  47824. 'ð‘£…' => 'ð‘¢¥',
  47825. '𑣆' => '𑢦',
  47826. '𑣇' => '𑢧',
  47827. '𑣈' => '𑢨',
  47828. '𑣉' => '𑢩',
  47829. '𑣊' => '𑢪',
  47830. '𑣋' => '𑢫',
  47831. '𑣌' => '𑢬',
  47832. '�' => '𑢭',
  47833. '𑣎' => '𑢮',
  47834. '�' => '𑢯',
  47835. '�' => '𑢰',
  47836. '𑣑' => '𑢱',
  47837. 'ð‘£’' => 'ð‘¢²',
  47838. '𑣓' => '𑢳',
  47839. 'ð‘£”' => 'ð‘¢´',
  47840. '𑣕' => '𑢵',
  47841. 'ð‘£–' => 'ð‘¢¶',
  47842. 'ð‘£—' => 'ð‘¢·',
  47843. '𑣘' => '𑢸',
  47844. 'ð‘£™' => 'ð‘¢¹',
  47845. '𑣚' => '𑢺',
  47846. 'ð‘£›' => 'ð‘¢»',
  47847. '𑣜' => '𑢼',
  47848. '�' => '𑢽',
  47849. '𑣞' => '𑢾',
  47850. '𑣟' => '𑢿',
  47851. 'ð–¹ ' => 'ð–¹€',
  47852. '𖹡' => '�',
  47853. '𖹢' => '𖹂',
  47854. '𖹣' => '𖹃',
  47855. '𖹤' => '𖹄',
  47856. 'ð–¹¥' => 'ð–¹…',
  47857. '𖹦' => '𖹆',
  47858. '𖹧' => '𖹇',
  47859. '𖹨' => '𖹈',
  47860. '𖹩' => '𖹉',
  47861. '𖹪' => '𖹊',
  47862. '𖹫' => '𖹋',
  47863. '𖹬' => '𖹌',
  47864. '𖹭' => '�',
  47865. '𖹮' => '𖹎',
  47866. '𖹯' => '�',
  47867. '𖹰' => '�',
  47868. '𖹱' => '𖹑',
  47869. 'ð–¹²' => 'ð–¹’',
  47870. '𖹳' => '𖹓',
  47871. 'ð–¹´' => 'ð–¹”',
  47872. '𖹵' => '𖹕',
  47873. 'ð–¹¶' => 'ð–¹–',
  47874. 'ð–¹·' => 'ð–¹—',
  47875. '𖹸' => '𖹘',
  47876. 'ð–¹¹' => 'ð–¹™',
  47877. '𖹺' => '𖹚',
  47878. 'ð–¹»' => 'ð–¹›',
  47879. '𖹼' => '𖹜',
  47880. '𖹽' => '�',
  47881. '𖹾' => '𖹞',
  47882. '𖹿' => '𖹟',
  47883. '𞤢' => '𞤀',
  47884. '𞤣' => '�',
  47885. '𞤤' => '𞤂',
  47886. '𞤥' => '𞤃',
  47887. '𞤦' => '𞤄',
  47888. '𞤧' => '𞤅',
  47889. '𞤨' => '𞤆',
  47890. '𞤩' => '𞤇',
  47891. '𞤪' => '𞤈',
  47892. '𞤫' => '𞤉',
  47893. '𞤬' => '𞤊',
  47894. '𞤭' => '𞤋',
  47895. '𞤮' => '𞤌',
  47896. '𞤯' => '�',
  47897. '𞤰' => '𞤎',
  47898. '𞤱' => '�',
  47899. '𞤲' => '�',
  47900. '𞤳' => '𞤑',
  47901. '𞤴' => '𞤒',
  47902. '𞤵' => '𞤓',
  47903. '𞤶' => '𞤔',
  47904. '𞤷' => '𞤕',
  47905. '𞤸' => '𞤖',
  47906. '𞤹' => '𞤗',
  47907. '𞤺' => '𞤘',
  47908. '𞤻' => '𞤙',
  47909. '𞤼' => '𞤚',
  47910. '𞤽' => '𞤛',
  47911. '𞤾' => '𞤜',
  47912. '𞤿' => '�',
  47913. '𞥀' => '𞤞',
  47914. '�' => '𞤟',
  47915. '𞥂' => '𞤠',
  47916. '𞥃' => '𞤡',
  47917. );
  47918. <?php
  47919. use Symfony\Polyfill\Mbstring as p;
  47920. if (!function_exists('mb_convert_encoding')) {
  47921. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  47922. }
  47923. if (!function_exists('mb_decode_mimeheader')) {
  47924. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  47925. }
  47926. if (!function_exists('mb_encode_mimeheader')) {
  47927. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  47928. }
  47929. if (!function_exists('mb_decode_numericentity')) {
  47930. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  47931. }
  47932. if (!function_exists('mb_encode_numericentity')) {
  47933. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  47934. }
  47935. if (!function_exists('mb_convert_case')) {
  47936. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  47937. }
  47938. if (!function_exists('mb_internal_encoding')) {
  47939. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  47940. }
  47941. if (!function_exists('mb_language')) {
  47942. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  47943. }
  47944. if (!function_exists('mb_list_encodings')) {
  47945. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  47946. }
  47947. if (!function_exists('mb_encoding_aliases')) {
  47948. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  47949. }
  47950. if (!function_exists('mb_check_encoding')) {
  47951. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  47952. }
  47953. if (!function_exists('mb_detect_encoding')) {
  47954. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  47955. }
  47956. if (!function_exists('mb_detect_order')) {
  47957. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  47958. }
  47959. if (!function_exists('mb_parse_str')) {
  47960. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  47961. }
  47962. if (!function_exists('mb_strlen')) {
  47963. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  47964. }
  47965. if (!function_exists('mb_strpos')) {
  47966. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  47967. }
  47968. if (!function_exists('mb_strtolower')) {
  47969. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  47970. }
  47971. if (!function_exists('mb_strtoupper')) {
  47972. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  47973. }
  47974. if (!function_exists('mb_substitute_character')) {
  47975. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  47976. }
  47977. if (!function_exists('mb_substr')) {
  47978. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  47979. }
  47980. if (!function_exists('mb_stripos')) {
  47981. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  47982. }
  47983. if (!function_exists('mb_stristr')) {
  47984. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  47985. }
  47986. if (!function_exists('mb_strrchr')) {
  47987. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  47988. }
  47989. if (!function_exists('mb_strrichr')) {
  47990. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  47991. }
  47992. if (!function_exists('mb_strripos')) {
  47993. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  47994. }
  47995. if (!function_exists('mb_strrpos')) {
  47996. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  47997. }
  47998. if (!function_exists('mb_strstr')) {
  47999. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  48000. }
  48001. if (!function_exists('mb_get_info')) {
  48002. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  48003. }
  48004. if (!function_exists('mb_http_output')) {
  48005. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  48006. }
  48007. if (!function_exists('mb_strwidth')) {
  48008. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  48009. }
  48010. if (!function_exists('mb_substr_count')) {
  48011. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  48012. }
  48013. if (!function_exists('mb_output_handler')) {
  48014. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  48015. }
  48016. if (!function_exists('mb_http_input')) {
  48017. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  48018. }
  48019. if (!function_exists('mb_convert_variables')) {
  48020. function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null) { return p\Mbstring::mb_convert_variables($toEncoding, $fromEncoding, $a, $b, $c, $d, $e, $f); }
  48021. }
  48022. if (!function_exists('mb_ord')) {
  48023. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  48024. }
  48025. if (!function_exists('mb_chr')) {
  48026. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  48027. }
  48028. if (!function_exists('mb_scrub')) {
  48029. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  48030. }
  48031. if (!function_exists('mb_str_split')) {
  48032. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  48033. }
  48034. if (extension_loaded('mbstring')) {
  48035. return;
  48036. }
  48037. if (!defined('MB_CASE_UPPER')) {
  48038. define('MB_CASE_UPPER', 0);
  48039. }
  48040. if (!defined('MB_CASE_LOWER')) {
  48041. define('MB_CASE_LOWER', 1);
  48042. }
  48043. if (!defined('MB_CASE_TITLE')) {
  48044. define('MB_CASE_TITLE', 2);
  48045. }
  48046. <?php
  48047. namespace Symfony\Component\Process\Exception;
  48048. interface ExceptionInterface
  48049. {
  48050. }
  48051. <?php
  48052. namespace Symfony\Component\Process\Exception;
  48053. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  48054. {
  48055. }
  48056. <?php
  48057. namespace Symfony\Component\Process\Exception;
  48058. class LogicException extends \LogicException implements ExceptionInterface
  48059. {
  48060. }
  48061. <?php
  48062. namespace Symfony\Component\Process\Exception;
  48063. use Symfony\Component\Process\Process;
  48064. class ProcessFailedException extends RuntimeException
  48065. {
  48066. private $process;
  48067. public function __construct(Process $process)
  48068. {
  48069. if ($process->isSuccessful()) {
  48070. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  48071. }
  48072. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  48073. $process->getCommandLine(),
  48074. $process->getExitCode(),
  48075. $process->getExitCodeText(),
  48076. $process->getWorkingDirectory()
  48077. );
  48078. if (!$process->isOutputDisabled()) {
  48079. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  48080. $process->getOutput(),
  48081. $process->getErrorOutput()
  48082. );
  48083. }
  48084. parent::__construct($error);
  48085. $this->process = $process;
  48086. }
  48087. public function getProcess()
  48088. {
  48089. return $this->process;
  48090. }
  48091. }
  48092. <?php
  48093. namespace Symfony\Component\Process\Exception;
  48094. use Symfony\Component\Process\Process;
  48095. class ProcessTimedOutException extends RuntimeException
  48096. {
  48097. const TYPE_GENERAL = 1;
  48098. const TYPE_IDLE = 2;
  48099. private $process;
  48100. private $timeoutType;
  48101. public function __construct(Process $process, $timeoutType)
  48102. {
  48103. $this->process = $process;
  48104. $this->timeoutType = $timeoutType;
  48105. parent::__construct(sprintf(
  48106. 'The process "%s" exceeded the timeout of %s seconds.',
  48107. $process->getCommandLine(),
  48108. $this->getExceededTimeout()
  48109. ));
  48110. }
  48111. public function getProcess()
  48112. {
  48113. return $this->process;
  48114. }
  48115. public function isGeneralTimeout()
  48116. {
  48117. return self::TYPE_GENERAL === $this->timeoutType;
  48118. }
  48119. public function isIdleTimeout()
  48120. {
  48121. return self::TYPE_IDLE === $this->timeoutType;
  48122. }
  48123. public function getExceededTimeout()
  48124. {
  48125. switch ($this->timeoutType) {
  48126. case self::TYPE_GENERAL:
  48127. return $this->process->getTimeout();
  48128. case self::TYPE_IDLE:
  48129. return $this->process->getIdleTimeout();
  48130. default:
  48131. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  48132. }
  48133. }
  48134. }
  48135. <?php
  48136. namespace Symfony\Component\Process\Exception;
  48137. class RuntimeException extends \RuntimeException implements ExceptionInterface
  48138. {
  48139. }
  48140. <?php
  48141. namespace Symfony\Component\Process;
  48142. class ExecutableFinder
  48143. {
  48144. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  48145. public function setSuffixes(array $suffixes)
  48146. {
  48147. $this->suffixes = $suffixes;
  48148. }
  48149. public function addSuffix($suffix)
  48150. {
  48151. $this->suffixes[] = $suffix;
  48152. }
  48153. public function find($name, $default = null, array $extraDirs = array())
  48154. {
  48155. if (ini_get('open_basedir')) {
  48156. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  48157. $dirs = array();
  48158. foreach ($searchPath as $path) {
  48159. if (@is_dir($path)) {
  48160. $dirs[] = $path;
  48161. } else {
  48162. if (basename($path) == $name && @is_executable($path)) {
  48163. return $path;
  48164. }
  48165. }
  48166. }
  48167. } else {
  48168. $dirs = array_merge(
  48169. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  48170. $extraDirs
  48171. );
  48172. }
  48173. $suffixes = array('');
  48174. if ('\\' === \DIRECTORY_SEPARATOR) {
  48175. $pathExt = getenv('PATHEXT');
  48176. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  48177. }
  48178. foreach ($suffixes as $suffix) {
  48179. foreach ($dirs as $dir) {
  48180. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  48181. return $file;
  48182. }
  48183. }
  48184. }
  48185. return $default;
  48186. }
  48187. }
  48188. Copyright (c) 2004-2018 Fabien Potencier
  48189. Permission is hereby granted, free of charge, to any person obtaining a copy
  48190. of this software and associated documentation files (the "Software"), to deal
  48191. in the Software without restriction, including without limitation the rights
  48192. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48193. copies of the Software, and to permit persons to whom the Software is furnished
  48194. to do so, subject to the following conditions:
  48195. The above copyright notice and this permission notice shall be included in all
  48196. copies or substantial portions of the Software.
  48197. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48198. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48199. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48200. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48201. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48202. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  48203. THE SOFTWARE.
  48204. <?php
  48205. namespace Symfony\Component\Process;
  48206. class PhpExecutableFinder
  48207. {
  48208. private $executableFinder;
  48209. public function __construct()
  48210. {
  48211. $this->executableFinder = new ExecutableFinder();
  48212. }
  48213. public function find($includeArgs = true)
  48214. {
  48215. $args = $this->findArguments();
  48216. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  48217. if (\defined('HHVM_VERSION')) {
  48218. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  48219. }
  48220. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  48221. return PHP_BINARY.$args;
  48222. }
  48223. if ($php = getenv('PHP_PATH')) {
  48224. if (!@is_executable($php)) {
  48225. return false;
  48226. }
  48227. return $php;
  48228. }
  48229. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  48230. if (@is_executable($php)) {
  48231. return $php;
  48232. }
  48233. }
  48234. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  48235. return $php;
  48236. }
  48237. $dirs = array(PHP_BINDIR);
  48238. if ('\\' === \DIRECTORY_SEPARATOR) {
  48239. $dirs[] = 'C:\xampp\php\\';
  48240. }
  48241. return $this->executableFinder->find('php', false, $dirs);
  48242. }
  48243. public function findArguments()
  48244. {
  48245. $arguments = array();
  48246. if (\defined('HHVM_VERSION')) {
  48247. $arguments[] = '--php';
  48248. } elseif ('phpdbg' === \PHP_SAPI) {
  48249. $arguments[] = '-qrr';
  48250. }
  48251. return $arguments;
  48252. }
  48253. }
  48254. <?php
  48255. namespace Symfony\Component\Process;
  48256. use Symfony\Component\Process\Exception\RuntimeException;
  48257. class PhpProcess extends Process
  48258. {
  48259. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  48260. {
  48261. $executableFinder = new PhpExecutableFinder();
  48262. if (false === $php = $executableFinder->find()) {
  48263. $php = null;
  48264. }
  48265. if ('phpdbg' === \PHP_SAPI) {
  48266. $file = tempnam(sys_get_temp_dir(), 'dbg');
  48267. file_put_contents($file, $script);
  48268. register_shutdown_function('unlink', $file);
  48269. $php .= ' '.ProcessUtils::escapeArgument($file);
  48270. $script = null;
  48271. }
  48272. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  48273. $php = 'exec '.$php;
  48274. }
  48275. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  48276. }
  48277. public function setPhpBinary($php)
  48278. {
  48279. $this->setCommandLine($php);
  48280. }
  48281. public function start($callback = null)
  48282. {
  48283. if (null === $this->getCommandLine()) {
  48284. throw new RuntimeException('Unable to find the PHP executable.');
  48285. }
  48286. parent::start($callback);
  48287. }
  48288. }
  48289. <?php
  48290. namespace Symfony\Component\Process\Pipes;
  48291. abstract class AbstractPipes implements PipesInterface
  48292. {
  48293. public $pipes = array();
  48294. private $inputBuffer = '';
  48295. private $input;
  48296. private $blocked = true;
  48297. private $lastError;
  48298. public function __construct($input)
  48299. {
  48300. if (\is_resource($input)) {
  48301. $this->input = $input;
  48302. } elseif (\is_string($input)) {
  48303. $this->inputBuffer = $input;
  48304. } else {
  48305. $this->inputBuffer = (string) $input;
  48306. }
  48307. }
  48308. public function close()
  48309. {
  48310. foreach ($this->pipes as $pipe) {
  48311. fclose($pipe);
  48312. }
  48313. $this->pipes = array();
  48314. }
  48315. protected function hasSystemCallBeenInterrupted()
  48316. {
  48317. $lastError = $this->lastError;
  48318. $this->lastError = null;
  48319. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  48320. }
  48321. protected function unblock()
  48322. {
  48323. if (!$this->blocked) {
  48324. return;
  48325. }
  48326. foreach ($this->pipes as $pipe) {
  48327. stream_set_blocking($pipe, 0);
  48328. }
  48329. if (null !== $this->input) {
  48330. stream_set_blocking($this->input, 0);
  48331. }
  48332. $this->blocked = false;
  48333. }
  48334. protected function write()
  48335. {
  48336. if (!isset($this->pipes[0])) {
  48337. return;
  48338. }
  48339. $input = $this->input;
  48340. $r = $e = array();
  48341. $w = array($this->pipes[0]);
  48342. if (false === @stream_select($r, $w, $e, 0, 0)) {
  48343. return;
  48344. }
  48345. foreach ($w as $stdin) {
  48346. if (isset($this->inputBuffer[0])) {
  48347. $written = fwrite($stdin, $this->inputBuffer);
  48348. $this->inputBuffer = substr($this->inputBuffer, $written);
  48349. if (isset($this->inputBuffer[0])) {
  48350. return array($this->pipes[0]);
  48351. }
  48352. }
  48353. if ($input) {
  48354. for (;;) {
  48355. $data = fread($input, self::CHUNK_SIZE);
  48356. if (!isset($data[0])) {
  48357. break;
  48358. }
  48359. $written = fwrite($stdin, $data);
  48360. $data = substr($data, $written);
  48361. if (isset($data[0])) {
  48362. $this->inputBuffer = $data;
  48363. return array($this->pipes[0]);
  48364. }
  48365. }
  48366. if (feof($input)) {
  48367. $this->input = null;
  48368. }
  48369. }
  48370. }
  48371. if (null === $this->input && !isset($this->inputBuffer[0])) {
  48372. fclose($this->pipes[0]);
  48373. unset($this->pipes[0]);
  48374. } elseif (!$w) {
  48375. return array($this->pipes[0]);
  48376. }
  48377. }
  48378. public function handleError($type, $msg)
  48379. {
  48380. $this->lastError = $msg;
  48381. }
  48382. }
  48383. <?php
  48384. namespace Symfony\Component\Process\Pipes;
  48385. interface PipesInterface
  48386. {
  48387. const CHUNK_SIZE = 16384;
  48388. public function getDescriptors();
  48389. public function getFiles();
  48390. public function readAndWrite($blocking, $close = false);
  48391. public function areOpen();
  48392. public function close();
  48393. }
  48394. <?php
  48395. namespace Symfony\Component\Process\Pipes;
  48396. use Symfony\Component\Process\Process;
  48397. class UnixPipes extends AbstractPipes
  48398. {
  48399. private $ttyMode;
  48400. private $ptyMode;
  48401. private $disableOutput;
  48402. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  48403. {
  48404. $this->ttyMode = (bool) $ttyMode;
  48405. $this->ptyMode = (bool) $ptyMode;
  48406. $this->disableOutput = (bool) $disableOutput;
  48407. parent::__construct($input);
  48408. }
  48409. public function __destruct()
  48410. {
  48411. $this->close();
  48412. }
  48413. public function getDescriptors()
  48414. {
  48415. if ($this->disableOutput) {
  48416. $nullstream = fopen('/dev/null', 'c');
  48417. return array(
  48418. array('pipe', 'r'),
  48419. $nullstream,
  48420. $nullstream,
  48421. );
  48422. }
  48423. if ($this->ttyMode) {
  48424. return array(
  48425. array('file', '/dev/tty', 'r'),
  48426. array('file', '/dev/tty', 'w'),
  48427. array('file', '/dev/tty', 'w'),
  48428. );
  48429. }
  48430. if ($this->ptyMode && Process::isPtySupported()) {
  48431. return array(
  48432. array('pty'),
  48433. array('pty'),
  48434. array('pty'),
  48435. );
  48436. }
  48437. return array(
  48438. array('pipe', 'r'),
  48439. array('pipe', 'w'),
  48440. array('pipe', 'w'),
  48441. );
  48442. }
  48443. public function getFiles()
  48444. {
  48445. return array();
  48446. }
  48447. public function readAndWrite($blocking, $close = false)
  48448. {
  48449. $this->unblock();
  48450. $w = $this->write();
  48451. $read = $e = array();
  48452. $r = $this->pipes;
  48453. unset($r[0]);
  48454. set_error_handler(array($this, 'handleError'));
  48455. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  48456. restore_error_handler();
  48457. if (!$this->hasSystemCallBeenInterrupted()) {
  48458. $this->pipes = array();
  48459. }
  48460. return $read;
  48461. }
  48462. restore_error_handler();
  48463. foreach ($r as $pipe) {
  48464. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  48465. do {
  48466. $data = fread($pipe, self::CHUNK_SIZE);
  48467. $read[$type] .= $data;
  48468. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  48469. if (!isset($read[$type][0])) {
  48470. unset($read[$type]);
  48471. }
  48472. if ($close && feof($pipe)) {
  48473. fclose($pipe);
  48474. unset($this->pipes[$type]);
  48475. }
  48476. }
  48477. return $read;
  48478. }
  48479. public function areOpen()
  48480. {
  48481. return (bool) $this->pipes;
  48482. }
  48483. public static function create(Process $process, $input)
  48484. {
  48485. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  48486. }
  48487. }
  48488. <?php
  48489. namespace Symfony\Component\Process\Pipes;
  48490. use Symfony\Component\Process\Exception\RuntimeException;
  48491. use Symfony\Component\Process\Process;
  48492. class WindowsPipes extends AbstractPipes
  48493. {
  48494. private $files = array();
  48495. private $fileHandles = array();
  48496. private $lockHandles = array();
  48497. private $readBytes = array(
  48498. Process::STDOUT => 0,
  48499. Process::STDERR => 0,
  48500. );
  48501. private $disableOutput;
  48502. public function __construct($disableOutput, $input)
  48503. {
  48504. $this->disableOutput = (bool) $disableOutput;
  48505. if (!$this->disableOutput) {
  48506. $pipes = array(
  48507. Process::STDOUT => Process::OUT,
  48508. Process::STDERR => Process::ERR,
  48509. );
  48510. $tmpDir = sys_get_temp_dir();
  48511. $lastError = 'unknown reason';
  48512. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  48513. for ($i = 0;; ++$i) {
  48514. foreach ($pipes as $pipe => $name) {
  48515. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  48516. if (!$h = fopen($file.'.lock', 'w')) {
  48517. restore_error_handler();
  48518. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  48519. }
  48520. if (!flock($h, LOCK_EX | LOCK_NB)) {
  48521. continue 2;
  48522. }
  48523. if (isset($this->lockHandles[$pipe])) {
  48524. flock($this->lockHandles[$pipe], LOCK_UN);
  48525. fclose($this->lockHandles[$pipe]);
  48526. }
  48527. $this->lockHandles[$pipe] = $h;
  48528. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  48529. flock($this->lockHandles[$pipe], LOCK_UN);
  48530. fclose($this->lockHandles[$pipe]);
  48531. unset($this->lockHandles[$pipe]);
  48532. continue 2;
  48533. }
  48534. $this->fileHandles[$pipe] = $h;
  48535. $this->files[$pipe] = $file;
  48536. }
  48537. break;
  48538. }
  48539. restore_error_handler();
  48540. }
  48541. parent::__construct($input);
  48542. }
  48543. public function __destruct()
  48544. {
  48545. $this->close();
  48546. }
  48547. public function getDescriptors()
  48548. {
  48549. if ($this->disableOutput) {
  48550. $nullstream = fopen('NUL', 'c');
  48551. return array(
  48552. array('pipe', 'r'),
  48553. $nullstream,
  48554. $nullstream,
  48555. );
  48556. }
  48557. return array(
  48558. array('pipe', 'r'),
  48559. array('file', 'NUL', 'w'),
  48560. array('file', 'NUL', 'w'),
  48561. );
  48562. }
  48563. public function getFiles()
  48564. {
  48565. return $this->files;
  48566. }
  48567. public function readAndWrite($blocking, $close = false)
  48568. {
  48569. $this->unblock();
  48570. $w = $this->write();
  48571. $read = $r = $e = array();
  48572. if ($blocking) {
  48573. if ($w) {
  48574. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  48575. } elseif ($this->fileHandles) {
  48576. usleep(Process::TIMEOUT_PRECISION * 1E6);
  48577. }
  48578. }
  48579. foreach ($this->fileHandles as $type => $fileHandle) {
  48580. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  48581. if (isset($data[0])) {
  48582. $this->readBytes[$type] += \strlen($data);
  48583. $read[$type] = $data;
  48584. }
  48585. if ($close) {
  48586. ftruncate($fileHandle, 0);
  48587. fclose($fileHandle);
  48588. flock($this->lockHandles[$type], LOCK_UN);
  48589. fclose($this->lockHandles[$type]);
  48590. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  48591. }
  48592. }
  48593. return $read;
  48594. }
  48595. public function areOpen()
  48596. {
  48597. return $this->pipes && $this->fileHandles;
  48598. }
  48599. public function close()
  48600. {
  48601. parent::close();
  48602. foreach ($this->fileHandles as $type => $handle) {
  48603. ftruncate($handle, 0);
  48604. fclose($handle);
  48605. flock($this->lockHandles[$type], LOCK_UN);
  48606. fclose($this->lockHandles[$type]);
  48607. }
  48608. $this->fileHandles = $this->lockHandles = array();
  48609. }
  48610. public static function create(Process $process, $input)
  48611. {
  48612. return new static($process->isOutputDisabled(), $input);
  48613. }
  48614. }
  48615. <?php
  48616. namespace Symfony\Component\Process;
  48617. use Symfony\Component\Process\Exception\InvalidArgumentException;
  48618. use Symfony\Component\Process\Exception\LogicException;
  48619. use Symfony\Component\Process\Exception\ProcessFailedException;
  48620. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  48621. use Symfony\Component\Process\Exception\RuntimeException;
  48622. use Symfony\Component\Process\Pipes\PipesInterface;
  48623. use Symfony\Component\Process\Pipes\UnixPipes;
  48624. use Symfony\Component\Process\Pipes\WindowsPipes;
  48625. class Process
  48626. {
  48627. const ERR = 'err';
  48628. const OUT = 'out';
  48629. const STATUS_READY = 'ready';
  48630. const STATUS_STARTED = 'started';
  48631. const STATUS_TERMINATED = 'terminated';
  48632. const STDIN = 0;
  48633. const STDOUT = 1;
  48634. const STDERR = 2;
  48635. const TIMEOUT_PRECISION = 0.2;
  48636. private $callback;
  48637. private $commandline;
  48638. private $cwd;
  48639. private $env;
  48640. private $input;
  48641. private $starttime;
  48642. private $lastOutputTime;
  48643. private $timeout;
  48644. private $idleTimeout;
  48645. private $options;
  48646. private $exitcode;
  48647. private $fallbackStatus = array();
  48648. private $processInformation;
  48649. private $outputDisabled = false;
  48650. private $stdout;
  48651. private $stderr;
  48652. private $enhanceWindowsCompatibility = true;
  48653. private $enhanceSigchildCompatibility;
  48654. private $process;
  48655. private $status = self::STATUS_READY;
  48656. private $incrementalOutputOffset = 0;
  48657. private $incrementalErrorOutputOffset = 0;
  48658. private $tty;
  48659. private $pty;
  48660. private $useFileHandles = false;
  48661. private $processPipes;
  48662. private $latestSignal;
  48663. private static $sigchild;
  48664. public static $exitCodes = array(
  48665. 0 => 'OK',
  48666. 1 => 'General error',
  48667. 2 => 'Misuse of shell builtins',
  48668. 126 => 'Invoked command cannot execute',
  48669. 127 => 'Command not found',
  48670. 128 => 'Invalid exit argument',
  48671. 129 => 'Hangup',
  48672. 130 => 'Interrupt',
  48673. 131 => 'Quit and dump core',
  48674. 132 => 'Illegal instruction',
  48675. 133 => 'Trace/breakpoint trap',
  48676. 134 => 'Process aborted',
  48677. 135 => 'Bus error: "access to undefined portion of memory object"',
  48678. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  48679. 137 => 'Kill (terminate immediately)',
  48680. 138 => 'User-defined 1',
  48681. 139 => 'Segmentation violation',
  48682. 140 => 'User-defined 2',
  48683. 141 => 'Write to pipe with no one reading',
  48684. 142 => 'Signal raised by alarm',
  48685. 143 => 'Termination (request to terminate)',
  48686. 145 => 'Child process terminated, stopped (or continued*)',
  48687. 146 => 'Continue if stopped',
  48688. 147 => 'Stop executing temporarily',
  48689. 148 => 'Terminal stop signal',
  48690. 149 => 'Background process attempting to read from tty ("in")',
  48691. 150 => 'Background process attempting to write to tty ("out")',
  48692. 151 => 'Urgent data available on socket',
  48693. 152 => 'CPU time limit exceeded',
  48694. 153 => 'File size limit exceeded',
  48695. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  48696. 155 => 'Profiling timer expired',
  48697. 157 => 'Pollable event',
  48698. 159 => 'Bad syscall',
  48699. );
  48700. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  48701. {
  48702. if (!\function_exists('proc_open')) {
  48703. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  48704. }
  48705. $this->commandline = $commandline;
  48706. $this->cwd = $cwd;
  48707. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  48708. $this->cwd = getcwd();
  48709. }
  48710. if (null !== $env) {
  48711. $this->setEnv($env);
  48712. }
  48713. $this->setInput($input);
  48714. $this->setTimeout($timeout);
  48715. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  48716. $this->pty = false;
  48717. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  48718. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  48719. }
  48720. public function __destruct()
  48721. {
  48722. $this->stop(0);
  48723. }
  48724. public function __clone()
  48725. {
  48726. $this->resetProcessData();
  48727. }
  48728. public function run($callback = null)
  48729. {
  48730. $this->start($callback);
  48731. return $this->wait();
  48732. }
  48733. public function mustRun($callback = null)
  48734. {
  48735. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48736. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48737. }
  48738. if (0 !== $this->run($callback)) {
  48739. throw new ProcessFailedException($this);
  48740. }
  48741. return $this;
  48742. }
  48743. public function start($callback = null)
  48744. {
  48745. if ($this->isRunning()) {
  48746. throw new RuntimeException('Process is already running');
  48747. }
  48748. if ($this->outputDisabled && null !== $callback) {
  48749. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  48750. }
  48751. $this->resetProcessData();
  48752. $this->starttime = $this->lastOutputTime = microtime(true);
  48753. $this->callback = $this->buildCallback($callback);
  48754. $descriptors = $this->getDescriptors();
  48755. $commandline = $this->commandline;
  48756. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  48757. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  48758. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  48759. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  48760. }
  48761. $commandline .= '"';
  48762. if (!isset($this->options['bypass_shell'])) {
  48763. $this->options['bypass_shell'] = true;
  48764. }
  48765. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48766. $descriptors[3] = array('pipe', 'w');
  48767. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  48768. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  48769. $ptsWorkaround = fopen(__FILE__, 'r');
  48770. }
  48771. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  48772. if (!\is_resource($this->process)) {
  48773. throw new RuntimeException('Unable to launch a new process.');
  48774. }
  48775. $this->status = self::STATUS_STARTED;
  48776. if (isset($descriptors[3])) {
  48777. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  48778. }
  48779. if ($this->tty) {
  48780. return;
  48781. }
  48782. $this->updateStatus(false);
  48783. $this->checkTimeout();
  48784. }
  48785. public function restart($callback = null)
  48786. {
  48787. if ($this->isRunning()) {
  48788. throw new RuntimeException('Process is already running');
  48789. }
  48790. $process = clone $this;
  48791. $process->start($callback);
  48792. return $process;
  48793. }
  48794. public function wait($callback = null)
  48795. {
  48796. $this->requireProcessIsStarted(__FUNCTION__);
  48797. $this->updateStatus(false);
  48798. if (null !== $callback) {
  48799. $this->callback = $this->buildCallback($callback);
  48800. }
  48801. do {
  48802. $this->checkTimeout();
  48803. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  48804. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  48805. } while ($running);
  48806. while ($this->isRunning()) {
  48807. usleep(1000);
  48808. }
  48809. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  48810. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  48811. }
  48812. return $this->exitcode;
  48813. }
  48814. public function getPid()
  48815. {
  48816. return $this->isRunning() ? $this->processInformation['pid'] : null;
  48817. }
  48818. public function signal($signal)
  48819. {
  48820. $this->doSignal($signal, true);
  48821. return $this;
  48822. }
  48823. public function disableOutput()
  48824. {
  48825. if ($this->isRunning()) {
  48826. throw new RuntimeException('Disabling output while the process is running is not possible.');
  48827. }
  48828. if (null !== $this->idleTimeout) {
  48829. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  48830. }
  48831. $this->outputDisabled = true;
  48832. return $this;
  48833. }
  48834. public function enableOutput()
  48835. {
  48836. if ($this->isRunning()) {
  48837. throw new RuntimeException('Enabling output while the process is running is not possible.');
  48838. }
  48839. $this->outputDisabled = false;
  48840. return $this;
  48841. }
  48842. public function isOutputDisabled()
  48843. {
  48844. return $this->outputDisabled;
  48845. }
  48846. public function getOutput()
  48847. {
  48848. $this->readPipesForOutput(__FUNCTION__);
  48849. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  48850. return '';
  48851. }
  48852. return $ret;
  48853. }
  48854. public function getIncrementalOutput()
  48855. {
  48856. $this->readPipesForOutput(__FUNCTION__);
  48857. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  48858. $this->incrementalOutputOffset = ftell($this->stdout);
  48859. if (false === $latest) {
  48860. return '';
  48861. }
  48862. return $latest;
  48863. }
  48864. public function clearOutput()
  48865. {
  48866. ftruncate($this->stdout, 0);
  48867. fseek($this->stdout, 0);
  48868. $this->incrementalOutputOffset = 0;
  48869. return $this;
  48870. }
  48871. public function getErrorOutput()
  48872. {
  48873. $this->readPipesForOutput(__FUNCTION__);
  48874. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  48875. return '';
  48876. }
  48877. return $ret;
  48878. }
  48879. public function getIncrementalErrorOutput()
  48880. {
  48881. $this->readPipesForOutput(__FUNCTION__);
  48882. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  48883. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  48884. if (false === $latest) {
  48885. return '';
  48886. }
  48887. return $latest;
  48888. }
  48889. public function clearErrorOutput()
  48890. {
  48891. ftruncate($this->stderr, 0);
  48892. fseek($this->stderr, 0);
  48893. $this->incrementalErrorOutputOffset = 0;
  48894. return $this;
  48895. }
  48896. public function getExitCode()
  48897. {
  48898. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48899. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  48900. }
  48901. $this->updateStatus(false);
  48902. return $this->exitcode;
  48903. }
  48904. public function getExitCodeText()
  48905. {
  48906. if (null === $exitcode = $this->getExitCode()) {
  48907. return;
  48908. }
  48909. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  48910. }
  48911. public function isSuccessful()
  48912. {
  48913. return 0 === $this->getExitCode();
  48914. }
  48915. public function hasBeenSignaled()
  48916. {
  48917. $this->requireProcessIsTerminated(__FUNCTION__);
  48918. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  48919. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48920. }
  48921. return $this->processInformation['signaled'];
  48922. }
  48923. public function getTermSignal()
  48924. {
  48925. $this->requireProcessIsTerminated(__FUNCTION__);
  48926. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  48927. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  48928. }
  48929. return $this->processInformation['termsig'];
  48930. }
  48931. public function hasBeenStopped()
  48932. {
  48933. $this->requireProcessIsTerminated(__FUNCTION__);
  48934. return $this->processInformation['stopped'];
  48935. }
  48936. public function getStopSignal()
  48937. {
  48938. $this->requireProcessIsTerminated(__FUNCTION__);
  48939. return $this->processInformation['stopsig'];
  48940. }
  48941. public function isRunning()
  48942. {
  48943. if (self::STATUS_STARTED !== $this->status) {
  48944. return false;
  48945. }
  48946. $this->updateStatus(false);
  48947. return $this->processInformation['running'];
  48948. }
  48949. public function isStarted()
  48950. {
  48951. return self::STATUS_READY != $this->status;
  48952. }
  48953. public function isTerminated()
  48954. {
  48955. $this->updateStatus(false);
  48956. return self::STATUS_TERMINATED == $this->status;
  48957. }
  48958. public function getStatus()
  48959. {
  48960. $this->updateStatus(false);
  48961. return $this->status;
  48962. }
  48963. public function stop($timeout = 10, $signal = null)
  48964. {
  48965. $timeoutMicro = microtime(true) + $timeout;
  48966. if ($this->isRunning()) {
  48967. $this->doSignal(15, false);
  48968. do {
  48969. usleep(1000);
  48970. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  48971. if ($this->isRunning()) {
  48972. $this->doSignal($signal ?: 9, false);
  48973. }
  48974. }
  48975. if ($this->isRunning()) {
  48976. if (isset($this->fallbackStatus['pid'])) {
  48977. unset($this->fallbackStatus['pid']);
  48978. return $this->stop(0, $signal);
  48979. }
  48980. $this->close();
  48981. }
  48982. return $this->exitcode;
  48983. }
  48984. public function addOutput($line)
  48985. {
  48986. $this->lastOutputTime = microtime(true);
  48987. fseek($this->stdout, 0, SEEK_END);
  48988. fwrite($this->stdout, $line);
  48989. fseek($this->stdout, $this->incrementalOutputOffset);
  48990. }
  48991. public function addErrorOutput($line)
  48992. {
  48993. $this->lastOutputTime = microtime(true);
  48994. fseek($this->stderr, 0, SEEK_END);
  48995. fwrite($this->stderr, $line);
  48996. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  48997. }
  48998. public function getCommandLine()
  48999. {
  49000. return $this->commandline;
  49001. }
  49002. public function setCommandLine($commandline)
  49003. {
  49004. $this->commandline = $commandline;
  49005. return $this;
  49006. }
  49007. public function getTimeout()
  49008. {
  49009. return $this->timeout;
  49010. }
  49011. public function getIdleTimeout()
  49012. {
  49013. return $this->idleTimeout;
  49014. }
  49015. public function setTimeout($timeout)
  49016. {
  49017. $this->timeout = $this->validateTimeout($timeout);
  49018. return $this;
  49019. }
  49020. public function setIdleTimeout($timeout)
  49021. {
  49022. if (null !== $timeout && $this->outputDisabled) {
  49023. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  49024. }
  49025. $this->idleTimeout = $this->validateTimeout($timeout);
  49026. return $this;
  49027. }
  49028. public function setTty($tty)
  49029. {
  49030. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  49031. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  49032. }
  49033. if ($tty) {
  49034. static $isTtySupported;
  49035. if (null === $isTtySupported) {
  49036. $isTtySupported = (bool) @proc_open('echo 1 >/dev/null', array(array('file', '/dev/tty', 'r'), array('file', '/dev/tty', 'w'), array('file', '/dev/tty', 'w')), $pipes);
  49037. }
  49038. if (!$isTtySupported) {
  49039. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  49040. }
  49041. }
  49042. $this->tty = (bool) $tty;
  49043. return $this;
  49044. }
  49045. public function isTty()
  49046. {
  49047. return $this->tty;
  49048. }
  49049. public function setPty($bool)
  49050. {
  49051. $this->pty = (bool) $bool;
  49052. return $this;
  49053. }
  49054. public function isPty()
  49055. {
  49056. return $this->pty;
  49057. }
  49058. public function getWorkingDirectory()
  49059. {
  49060. if (null === $this->cwd) {
  49061. return getcwd() ?: null;
  49062. }
  49063. return $this->cwd;
  49064. }
  49065. public function setWorkingDirectory($cwd)
  49066. {
  49067. $this->cwd = $cwd;
  49068. return $this;
  49069. }
  49070. public function getEnv()
  49071. {
  49072. return $this->env;
  49073. }
  49074. public function setEnv(array $env)
  49075. {
  49076. $env = array_filter($env, function ($value) {
  49077. return !\is_array($value);
  49078. });
  49079. $this->env = array();
  49080. foreach ($env as $key => $value) {
  49081. $this->env[$key] = (string) $value;
  49082. }
  49083. return $this;
  49084. }
  49085. public function getStdin()
  49086. {
  49087. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the getInput() method instead.', E_USER_DEPRECATED);
  49088. return $this->getInput();
  49089. }
  49090. public function getInput()
  49091. {
  49092. return $this->input;
  49093. }
  49094. public function setStdin($stdin)
  49095. {
  49096. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0. Use the setInput() method instead.', E_USER_DEPRECATED);
  49097. return $this->setInput($stdin);
  49098. }
  49099. public function setInput($input)
  49100. {
  49101. if ($this->isRunning()) {
  49102. throw new LogicException('Input can not be set while the process is running.');
  49103. }
  49104. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49105. return $this;
  49106. }
  49107. public function getOptions()
  49108. {
  49109. return $this->options;
  49110. }
  49111. public function setOptions(array $options)
  49112. {
  49113. $this->options = $options;
  49114. return $this;
  49115. }
  49116. public function getEnhanceWindowsCompatibility()
  49117. {
  49118. return $this->enhanceWindowsCompatibility;
  49119. }
  49120. public function setEnhanceWindowsCompatibility($enhance)
  49121. {
  49122. $this->enhanceWindowsCompatibility = (bool) $enhance;
  49123. return $this;
  49124. }
  49125. public function getEnhanceSigchildCompatibility()
  49126. {
  49127. return $this->enhanceSigchildCompatibility;
  49128. }
  49129. public function setEnhanceSigchildCompatibility($enhance)
  49130. {
  49131. $this->enhanceSigchildCompatibility = (bool) $enhance;
  49132. return $this;
  49133. }
  49134. public function checkTimeout()
  49135. {
  49136. if (self::STATUS_STARTED !== $this->status) {
  49137. return;
  49138. }
  49139. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  49140. $this->stop(0);
  49141. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  49142. }
  49143. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  49144. $this->stop(0);
  49145. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  49146. }
  49147. }
  49148. public static function isPtySupported()
  49149. {
  49150. static $result;
  49151. if (null !== $result) {
  49152. return $result;
  49153. }
  49154. if ('\\' === \DIRECTORY_SEPARATOR) {
  49155. return $result = false;
  49156. }
  49157. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  49158. }
  49159. private function getDescriptors()
  49160. {
  49161. if ('\\' === \DIRECTORY_SEPARATOR) {
  49162. $this->processPipes = WindowsPipes::create($this, $this->input);
  49163. } else {
  49164. $this->processPipes = UnixPipes::create($this, $this->input);
  49165. }
  49166. return $this->processPipes->getDescriptors();
  49167. }
  49168. protected function buildCallback($callback)
  49169. {
  49170. $that = $this;
  49171. $out = self::OUT;
  49172. $callback = function ($type, $data) use ($that, $callback, $out) {
  49173. if ($out == $type) {
  49174. $that->addOutput($data);
  49175. } else {
  49176. $that->addErrorOutput($data);
  49177. }
  49178. if (null !== $callback) {
  49179. \call_user_func($callback, $type, $data);
  49180. }
  49181. };
  49182. return $callback;
  49183. }
  49184. protected function updateStatus($blocking)
  49185. {
  49186. if (self::STATUS_STARTED !== $this->status) {
  49187. return;
  49188. }
  49189. $this->processInformation = proc_get_status($this->process);
  49190. $running = $this->processInformation['running'];
  49191. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  49192. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49193. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  49194. }
  49195. if (!$running) {
  49196. $this->close();
  49197. }
  49198. }
  49199. protected function isSigchildEnabled()
  49200. {
  49201. if (null !== self::$sigchild) {
  49202. return self::$sigchild;
  49203. }
  49204. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  49205. return self::$sigchild = false;
  49206. }
  49207. ob_start();
  49208. phpinfo(INFO_GENERAL);
  49209. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  49210. }
  49211. private function readPipesForOutput($caller)
  49212. {
  49213. if ($this->outputDisabled) {
  49214. throw new LogicException('Output has been disabled.');
  49215. }
  49216. $this->requireProcessIsStarted($caller);
  49217. $this->updateStatus(false);
  49218. }
  49219. private function validateTimeout($timeout)
  49220. {
  49221. $timeout = (float) $timeout;
  49222. if (0.0 === $timeout) {
  49223. $timeout = null;
  49224. } elseif ($timeout < 0) {
  49225. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49226. }
  49227. return $timeout;
  49228. }
  49229. private function readPipes($blocking, $close)
  49230. {
  49231. $result = $this->processPipes->readAndWrite($blocking, $close);
  49232. $callback = $this->callback;
  49233. foreach ($result as $type => $data) {
  49234. if (3 !== $type) {
  49235. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  49236. } elseif (!isset($this->fallbackStatus['signaled'])) {
  49237. $this->fallbackStatus['exitcode'] = (int) $data;
  49238. }
  49239. }
  49240. }
  49241. private function close()
  49242. {
  49243. $this->processPipes->close();
  49244. if (\is_resource($this->process)) {
  49245. proc_close($this->process);
  49246. }
  49247. $this->exitcode = $this->processInformation['exitcode'];
  49248. $this->status = self::STATUS_TERMINATED;
  49249. if (-1 === $this->exitcode) {
  49250. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  49251. $this->exitcode = 128 + $this->processInformation['termsig'];
  49252. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  49253. $this->processInformation['signaled'] = true;
  49254. $this->processInformation['termsig'] = -1;
  49255. }
  49256. }
  49257. $this->callback = null;
  49258. return $this->exitcode;
  49259. }
  49260. private function resetProcessData()
  49261. {
  49262. $this->starttime = null;
  49263. $this->callback = null;
  49264. $this->exitcode = null;
  49265. $this->fallbackStatus = array();
  49266. $this->processInformation = null;
  49267. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49268. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  49269. $this->process = null;
  49270. $this->latestSignal = null;
  49271. $this->status = self::STATUS_READY;
  49272. $this->incrementalOutputOffset = 0;
  49273. $this->incrementalErrorOutputOffset = 0;
  49274. }
  49275. private function doSignal($signal, $throwException)
  49276. {
  49277. if (null === $pid = $this->getPid()) {
  49278. if ($throwException) {
  49279. throw new LogicException('Can not send signal on a non running process.');
  49280. }
  49281. return false;
  49282. }
  49283. if ('\\' === \DIRECTORY_SEPARATOR) {
  49284. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  49285. if ($exitCode && $this->isRunning()) {
  49286. if ($throwException) {
  49287. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  49288. }
  49289. return false;
  49290. }
  49291. } else {
  49292. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  49293. $ok = @proc_terminate($this->process, $signal);
  49294. } elseif (\function_exists('posix_kill')) {
  49295. $ok = @posix_kill($pid, $signal);
  49296. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  49297. $ok = false === fgets($pipes[2]);
  49298. }
  49299. if (!$ok) {
  49300. if ($throwException) {
  49301. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  49302. }
  49303. return false;
  49304. }
  49305. }
  49306. $this->latestSignal = (int) $signal;
  49307. $this->fallbackStatus['signaled'] = true;
  49308. $this->fallbackStatus['exitcode'] = -1;
  49309. $this->fallbackStatus['termsig'] = $this->latestSignal;
  49310. return true;
  49311. }
  49312. private function requireProcessIsStarted($functionName)
  49313. {
  49314. if (!$this->isStarted()) {
  49315. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  49316. }
  49317. }
  49318. private function requireProcessIsTerminated($functionName)
  49319. {
  49320. if (!$this->isTerminated()) {
  49321. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  49322. }
  49323. }
  49324. }
  49325. <?php
  49326. namespace Symfony\Component\Process;
  49327. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49328. use Symfony\Component\Process\Exception\LogicException;
  49329. class ProcessBuilder
  49330. {
  49331. private $arguments;
  49332. private $cwd;
  49333. private $env = array();
  49334. private $input;
  49335. private $timeout = 60;
  49336. private $options = array();
  49337. private $inheritEnv = true;
  49338. private $prefix = array();
  49339. private $outputDisabled = false;
  49340. public function __construct(array $arguments = array())
  49341. {
  49342. $this->arguments = $arguments;
  49343. }
  49344. public static function create(array $arguments = array())
  49345. {
  49346. return new static($arguments);
  49347. }
  49348. public function add($argument)
  49349. {
  49350. $this->arguments[] = $argument;
  49351. return $this;
  49352. }
  49353. public function setPrefix($prefix)
  49354. {
  49355. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  49356. return $this;
  49357. }
  49358. public function setArguments(array $arguments)
  49359. {
  49360. $this->arguments = $arguments;
  49361. return $this;
  49362. }
  49363. public function setWorkingDirectory($cwd)
  49364. {
  49365. $this->cwd = $cwd;
  49366. return $this;
  49367. }
  49368. public function inheritEnvironmentVariables($inheritEnv = true)
  49369. {
  49370. $this->inheritEnv = $inheritEnv;
  49371. return $this;
  49372. }
  49373. public function setEnv($name, $value)
  49374. {
  49375. $this->env[$name] = $value;
  49376. return $this;
  49377. }
  49378. public function addEnvironmentVariables(array $variables)
  49379. {
  49380. $this->env = array_replace($this->env, $variables);
  49381. return $this;
  49382. }
  49383. public function setInput($input)
  49384. {
  49385. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  49386. return $this;
  49387. }
  49388. public function setTimeout($timeout)
  49389. {
  49390. if (null === $timeout) {
  49391. $this->timeout = null;
  49392. return $this;
  49393. }
  49394. $timeout = (float) $timeout;
  49395. if ($timeout < 0) {
  49396. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  49397. }
  49398. $this->timeout = $timeout;
  49399. return $this;
  49400. }
  49401. public function setOption($name, $value)
  49402. {
  49403. $this->options[$name] = $value;
  49404. return $this;
  49405. }
  49406. public function disableOutput()
  49407. {
  49408. $this->outputDisabled = true;
  49409. return $this;
  49410. }
  49411. public function enableOutput()
  49412. {
  49413. $this->outputDisabled = false;
  49414. return $this;
  49415. }
  49416. public function getProcess()
  49417. {
  49418. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  49419. throw new LogicException('You must add() command arguments before calling getProcess().');
  49420. }
  49421. $options = $this->options;
  49422. $arguments = array_merge($this->prefix, $this->arguments);
  49423. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  49424. if ($this->inheritEnv) {
  49425. $env = array_replace($_ENV, $_SERVER, $this->env);
  49426. } else {
  49427. $env = $this->env;
  49428. }
  49429. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  49430. if ($this->outputDisabled) {
  49431. $process->disableOutput();
  49432. }
  49433. return $process;
  49434. }
  49435. }
  49436. <?php
  49437. namespace Symfony\Component\Process;
  49438. use Symfony\Component\Process\Exception\InvalidArgumentException;
  49439. class ProcessUtils
  49440. {
  49441. private function __construct()
  49442. {
  49443. }
  49444. public static function escapeArgument($argument)
  49445. {
  49446. if ('\\' === \DIRECTORY_SEPARATOR) {
  49447. if ('' === $argument) {
  49448. return escapeshellarg($argument);
  49449. }
  49450. $escapedArgument = '';
  49451. $quote = false;
  49452. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  49453. if ('"' === $part) {
  49454. $escapedArgument .= '\\"';
  49455. } elseif (self::isSurroundedBy($part, '%')) {
  49456. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  49457. } else {
  49458. if ('\\' === substr($part, -1)) {
  49459. $part .= '\\';
  49460. }
  49461. $quote = true;
  49462. $escapedArgument .= $part;
  49463. }
  49464. }
  49465. if ($quote) {
  49466. $escapedArgument = '"'.$escapedArgument.'"';
  49467. }
  49468. return $escapedArgument;
  49469. }
  49470. return "'".str_replace("'", "'\\''", $argument)."'";
  49471. }
  49472. public static function validateInput($caller, $input)
  49473. {
  49474. if (null !== $input) {
  49475. if (\is_resource($input)) {
  49476. return $input;
  49477. }
  49478. if (\is_string($input)) {
  49479. return $input;
  49480. }
  49481. if (is_scalar($input)) {
  49482. return (string) $input;
  49483. }
  49484. if (\is_object($input) && method_exists($input, '__toString')) {
  49485. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  49486. return (string) $input;
  49487. }
  49488. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  49489. }
  49490. return $input;
  49491. }
  49492. private static function isSurroundedBy($arg, $char)
  49493. {
  49494. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  49495. }
  49496. }
  49497. Copyright (c) 2011 Jordi Boggiano
  49498. Permission is hereby granted, free of charge, to any person obtaining a copy
  49499. of this software and associated documentation files (the "Software"), to deal
  49500. in the Software without restriction, including without limitation the rights
  49501. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  49502. copies of the Software, and to permit persons to whom the Software is furnished
  49503. to do so, subject to the following conditions:
  49504. The above copyright notice and this permission notice shall be included in all
  49505. copies or substantial portions of the Software.
  49506. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  49507. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  49508. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  49509. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  49510. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  49511. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  49512. THE SOFTWARE.
  49513. <?php
  49514. namespace Seld\JsonLint;
  49515. class DuplicateKeyException extends ParsingException
  49516. {
  49517. public function __construct($message, $key, array $details = array())
  49518. {
  49519. $details['key'] = $key;
  49520. parent::__construct($message, $details);
  49521. }
  49522. public function getKey()
  49523. {
  49524. return $this->details['key'];
  49525. }
  49526. public function getDetails()
  49527. {
  49528. return $this->details;
  49529. }
  49530. }
  49531. <?php
  49532. namespace Seld\JsonLint;
  49533. use stdClass;
  49534. class JsonParser
  49535. {
  49536. const DETECT_KEY_CONFLICTS = 1;
  49537. const ALLOW_DUPLICATE_KEYS = 2;
  49538. const PARSE_TO_ASSOC = 4;
  49539. private $lexer;
  49540. private $flags;
  49541. private $stack;
  49542. private $vstack;
  49543. private $lstack;
  49544. private $symbols = array(
  49545. 'error' => 2,
  49546. 'JSONString' => 3,
  49547. 'STRING' => 4,
  49548. 'JSONNumber' => 5,
  49549. 'NUMBER' => 6,
  49550. 'JSONNullLiteral' => 7,
  49551. 'NULL' => 8,
  49552. 'JSONBooleanLiteral' => 9,
  49553. 'TRUE' => 10,
  49554. 'FALSE' => 11,
  49555. 'JSONText' => 12,
  49556. 'JSONValue' => 13,
  49557. 'EOF' => 14,
  49558. 'JSONObject' => 15,
  49559. 'JSONArray' => 16,
  49560. '{' => 17,
  49561. '}' => 18,
  49562. 'JSONMemberList' => 19,
  49563. 'JSONMember' => 20,
  49564. ':' => 21,
  49565. ',' => 22,
  49566. '[' => 23,
  49567. ']' => 24,
  49568. 'JSONElementList' => 25,
  49569. '$accept' => 0,
  49570. '$end' => 1,
  49571. );
  49572. private $terminals_ = array(
  49573. 2 => "error",
  49574. 4 => "STRING",
  49575. 6 => "NUMBER",
  49576. 8 => "NULL",
  49577. 10 => "TRUE",
  49578. 11 => "FALSE",
  49579. 14 => "EOF",
  49580. 17 => "{",
  49581. 18 => "}",
  49582. 21 => ":",
  49583. 22 => ",",
  49584. 23 => "[",
  49585. 24 => "]",
  49586. );
  49587. private $productions_ = array(
  49588. 0,
  49589. array(3, 1),
  49590. array(5, 1),
  49591. array(7, 1),
  49592. array(9, 1),
  49593. array(9, 1),
  49594. array(12, 2),
  49595. array(13, 1),
  49596. array(13, 1),
  49597. array(13, 1),
  49598. array(13, 1),
  49599. array(13, 1),
  49600. array(13, 1),
  49601. array(15, 2),
  49602. array(15, 3),
  49603. array(20, 3),
  49604. array(19, 1),
  49605. array(19, 3),
  49606. array(16, 2),
  49607. array(16, 3),
  49608. array(25, 1),
  49609. array(25, 3)
  49610. );
  49611. private $table = array(array(3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 12 => 1, 13 => 2, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 1 => array(3)), array( 14 => array(1,16)), array( 14 => array(2,7), 18 => array(2,7), 22 => array(2,7), 24 => array(2,7)), array( 14 => array(2,8), 18 => array(2,8), 22 => array(2,8), 24 => array(2,8)), array( 14 => array(2,9), 18 => array(2,9), 22 => array(2,9), 24 => array(2,9)), array( 14 => array(2,10), 18 => array(2,10), 22 => array(2,10), 24 => array(2,10)), array( 14 => array(2,11), 18 => array(2,11), 22 => array(2,11), 24 => array(2,11)), array( 14 => array(2,12), 18 => array(2,12), 22 => array(2,12), 24 => array(2,12)), array( 14 => array(2,3), 18 => array(2,3), 22 => array(2,3), 24 => array(2,3)), array( 14 => array(2,4), 18 => array(2,4), 22 => array(2,4), 24 => array(2,4)), array( 14 => array(2,5), 18 => array(2,5), 22 => array(2,5), 24 => array(2,5)), array( 14 => array(2,1), 18 => array(2,1), 21 => array(2,1), 22 => array(2,1), 24 => array(2,1)), array( 14 => array(2,2), 18 => array(2,2), 22 => array(2,2), 24 => array(2,2)), array( 3 => 20, 4 => array(1,12), 18 => array(1,17), 19 => 18, 20 => 19 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 23, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15), 24 => array(1,21), 25 => 22 ), array( 1 => array(2,6)), array( 14 => array(2,13), 18 => array(2,13), 22 => array(2,13), 24 => array(2,13)), array( 18 => array(1,24), 22 => array(1,25)), array( 18 => array(2,16), 22 => array(2,16)), array( 21 => array(1,26)), array( 14 => array(2,18), 18 => array(2,18), 22 => array(2,18), 24 => array(2,18)), array( 22 => array(1,28), 24 => array(1,27)), array( 22 => array(2,20), 24 => array(2,20)), array( 14 => array(2,14), 18 => array(2,14), 22 => array(2,14), 24 => array(2,14)), array( 3 => 20, 4 => array(1,12), 20 => 29 ), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 30, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 14 => array(2,19), 18 => array(2,19), 22 => array(2,19), 24 => array(2,19)), array( 3 => 5, 4 => array(1,12), 5 => 6, 6 => array(1,13), 7 => 3, 8 => array(1,9), 9 => 4, 10 => array(1,10), 11 => array(1,11), 13 => 31, 15 => 7, 16 => 8, 17 => array(1,14), 23 => array(1,15)), array( 18 => array(2,17), 22 => array(2,17)), array( 18 => array(2,15), 22 => array(2,15)), array( 22 => array(2,21), 24 => array(2,21)),
  49612. );
  49613. private $defaultActions = array(
  49614. 16 => array(2, 6)
  49615. );
  49616. public function lint($input, $flags = 0)
  49617. {
  49618. try {
  49619. $this->parse($input, $flags);
  49620. } catch (ParsingException $e) {
  49621. return $e;
  49622. }
  49623. return null;
  49624. }
  49625. public function parse($input, $flags = 0)
  49626. {
  49627. $this->failOnBOM($input);
  49628. $this->flags = $flags;
  49629. $this->stack = array(0);
  49630. $this->vstack = array(null);
  49631. $this->lstack = array();
  49632. $yytext = '';
  49633. $yylineno = 0;
  49634. $yyleng = 0;
  49635. $recovering = 0;
  49636. $TERROR = 2;
  49637. $EOF = 1;
  49638. $this->lexer = new Lexer();
  49639. $this->lexer->setInput($input);
  49640. $yyloc = $this->lexer->yylloc;
  49641. $this->lstack[] = $yyloc;
  49642. $symbol = null;
  49643. $preErrorSymbol = null;
  49644. $state = null;
  49645. $action = null;
  49646. $a = null;
  49647. $r = null;
  49648. $yyval = new stdClass;
  49649. $p = null;
  49650. $len = null;
  49651. $newState = null;
  49652. $expected = null;
  49653. $errStr = null;
  49654. while (true) {
  49655. $state = $this->stack[\count($this->stack)-1];
  49656. if (isset($this->defaultActions[$state])) {
  49657. $action = $this->defaultActions[$state];
  49658. } else {
  49659. if ($symbol == null) {
  49660. $symbol = $this->lex();
  49661. }
  49662. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  49663. }
  49664. if (!$action || !$action[0]) {
  49665. if (!$recovering) {
  49666. $expected = array();
  49667. foreach ($this->table[$state] as $p => $ignore) {
  49668. if (isset($this->terminals_[$p]) && $p > 2) {
  49669. $expected[] = "'" . $this->terminals_[$p] . "'";
  49670. }
  49671. }
  49672. $message = null;
  49673. if (\in_array("'STRING'", $expected) && \in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  49674. $message = "Invalid string";
  49675. if ("'" === substr($this->lexer->match, 0, 1)) {
  49676. $message .= ", it appears you used single quotes instead of double quotes";
  49677. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u](...)?)}', $this->lexer->getFullUpcomingInput(), $match)) {
  49678. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  49679. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getFullUpcomingInput())) {
  49680. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  49681. }
  49682. }
  49683. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49684. $errStr .= $this->lexer->showPosition() . "\n";
  49685. if ($message) {
  49686. $errStr .= $message;
  49687. } else {
  49688. $errStr .= (\count($expected) > 1) ? "Expected one of: " : "Expected: ";
  49689. $errStr .= implode(', ', $expected);
  49690. }
  49691. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  49692. $errStr .= " - It appears you have an extra trailing comma";
  49693. }
  49694. $this->parseError($errStr, array(
  49695. 'text' => $this->lexer->match,
  49696. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  49697. 'line' => $this->lexer->yylineno,
  49698. 'loc' => $yyloc,
  49699. 'expected' => $expected,
  49700. ));
  49701. }
  49702. if ($recovering == 3) {
  49703. if ($symbol == $EOF) {
  49704. throw new ParsingException($errStr ?: 'Parsing halted.');
  49705. }
  49706. $yyleng = $this->lexer->yyleng;
  49707. $yytext = $this->lexer->yytext;
  49708. $yylineno = $this->lexer->yylineno;
  49709. $yyloc = $this->lexer->yylloc;
  49710. $symbol = $this->lex();
  49711. }
  49712. while (true) {
  49713. if (\array_key_exists($TERROR, $this->table[$state])) {
  49714. break;
  49715. }
  49716. if ($state == 0) {
  49717. throw new ParsingException($errStr ?: 'Parsing halted.');
  49718. }
  49719. $this->popStack(1);
  49720. $state = $this->stack[\count($this->stack)-1];
  49721. }
  49722. $preErrorSymbol = $symbol;
  49723. $symbol = $TERROR;
  49724. $state = $this->stack[\count($this->stack)-1];
  49725. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  49726. $recovering = 3;
  49727. }
  49728. if (\is_array($action[0]) && \count($action) > 1) {
  49729. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  49730. }
  49731. switch ($action[0]) {
  49732. case 1:
  49733. $this->stack[] = $symbol;
  49734. $this->vstack[] = $this->lexer->yytext;
  49735. $this->lstack[] = $this->lexer->yylloc;
  49736. $this->stack[] = $action[1];
  49737. $symbol = null;
  49738. if (!$preErrorSymbol) {
  49739. $yyleng = $this->lexer->yyleng;
  49740. $yytext = $this->lexer->yytext;
  49741. $yylineno = $this->lexer->yylineno;
  49742. $yyloc = $this->lexer->yylloc;
  49743. if ($recovering > 0) {
  49744. $recovering--;
  49745. }
  49746. } else {
  49747. $symbol = $preErrorSymbol;
  49748. $preErrorSymbol = null;
  49749. }
  49750. break;
  49751. case 2:
  49752. $len = $this->productions_[$action[1]][1];
  49753. $yyval->token = $this->vstack[\count($this->vstack) - $len];
  49754. $yyval->store = array(
  49755. 'first_line' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_line'],
  49756. 'last_line' => $this->lstack[\count($this->lstack) - 1]['last_line'],
  49757. 'first_column' => $this->lstack[\count($this->lstack) - ($len ?: 1)]['first_column'],
  49758. 'last_column' => $this->lstack[\count($this->lstack) - 1]['last_column'],
  49759. );
  49760. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack);
  49761. if (!$r instanceof Undefined) {
  49762. return $r;
  49763. }
  49764. if ($len) {
  49765. $this->popStack($len);
  49766. }
  49767. $this->stack[] = $this->productions_[$action[1]][0];
  49768. $this->vstack[] = $yyval->token;
  49769. $this->lstack[] = $yyval->store;
  49770. $newState = $this->table[$this->stack[\count($this->stack)-2]][$this->stack[\count($this->stack)-1]];
  49771. $this->stack[] = $newState;
  49772. break;
  49773. case 3:
  49774. return true;
  49775. }
  49776. }
  49777. }
  49778. protected function parseError($str, $hash)
  49779. {
  49780. throw new ParsingException($str, $hash);
  49781. }
  49782. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  49783. {
  49784. $len = \count($tokens) - 1;
  49785. switch ($yystate) {
  49786. case 1:
  49787. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  49788. $yyval->token = $yytext;
  49789. break;
  49790. case 2:
  49791. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  49792. $yyval->token = \floatval($yytext);
  49793. } else {
  49794. $yyval->token = strpos($yytext, '.') === false ? \intval($yytext) : \floatval($yytext);
  49795. }
  49796. break;
  49797. case 3:
  49798. $yyval->token = null;
  49799. break;
  49800. case 4:
  49801. $yyval->token = true;
  49802. break;
  49803. case 5:
  49804. $yyval->token = false;
  49805. break;
  49806. case 6:
  49807. return $yyval->token = $tokens[$len-1];
  49808. case 13:
  49809. if ($this->flags & self::PARSE_TO_ASSOC) {
  49810. $yyval->token = array();
  49811. } else {
  49812. $yyval->token = new stdClass;
  49813. }
  49814. break;
  49815. case 14:
  49816. $yyval->token = $tokens[$len-1];
  49817. break;
  49818. case 15:
  49819. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  49820. break;
  49821. case 16:
  49822. if (PHP_VERSION_ID < 70100) {
  49823. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49824. } else {
  49825. $property = $tokens[$len][0];
  49826. }
  49827. if ($this->flags & self::PARSE_TO_ASSOC) {
  49828. $yyval->token = array();
  49829. $yyval->token[$property] = $tokens[$len][1];
  49830. } else {
  49831. $yyval->token = new stdClass;
  49832. $yyval->token->$property = $tokens[$len][1];
  49833. }
  49834. break;
  49835. case 17:
  49836. if ($this->flags & self::PARSE_TO_ASSOC) {
  49837. $yyval->token =& $tokens[$len-2];
  49838. $key = $tokens[$len][0];
  49839. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  49840. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49841. $errStr .= $this->lexer->showPosition() . "\n";
  49842. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49843. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49844. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  49845. $duplicateCount = 1;
  49846. do {
  49847. $duplicateKey = $key . '.' . $duplicateCount++;
  49848. } while (isset($tokens[$len-2][$duplicateKey]));
  49849. $key = $duplicateKey;
  49850. }
  49851. $tokens[$len-2][$key] = $tokens[$len][1];
  49852. } else {
  49853. $yyval->token = $tokens[$len-2];
  49854. if (PHP_VERSION_ID < 70100) {
  49855. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  49856. } else {
  49857. $key = $tokens[$len][0];
  49858. }
  49859. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  49860. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  49861. $errStr .= $this->lexer->showPosition() . "\n";
  49862. $errStr .= "Duplicate key: ".$tokens[$len][0];
  49863. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  49864. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  49865. $duplicateCount = 1;
  49866. do {
  49867. $duplicateKey = $key . '.' . $duplicateCount++;
  49868. } while (isset($tokens[$len-2]->$duplicateKey));
  49869. $key = $duplicateKey;
  49870. }
  49871. $tokens[$len-2]->$key = $tokens[$len][1];
  49872. }
  49873. break;
  49874. case 18:
  49875. $yyval->token = array();
  49876. break;
  49877. case 19:
  49878. $yyval->token = $tokens[$len-1];
  49879. break;
  49880. case 20:
  49881. $yyval->token = array($tokens[$len]);
  49882. break;
  49883. case 21:
  49884. $tokens[$len-2][] = $tokens[$len];
  49885. $yyval->token = $tokens[$len-2];
  49886. break;
  49887. }
  49888. return new Undefined();
  49889. }
  49890. private function stringInterpolation($match)
  49891. {
  49892. switch ($match[0]) {
  49893. case '\\\\':
  49894. return '\\';
  49895. case '\"':
  49896. return '"';
  49897. case '\b':
  49898. return \chr(8);
  49899. case '\f':
  49900. return \chr(12);
  49901. case '\n':
  49902. return "\n";
  49903. case '\r':
  49904. return "\r";
  49905. case '\t':
  49906. return "\t";
  49907. case '\/':
  49908. return "/";
  49909. default:
  49910. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  49911. }
  49912. }
  49913. private function popStack($n)
  49914. {
  49915. $this->stack = \array_slice($this->stack, 0, - (2 * $n));
  49916. $this->vstack = \array_slice($this->vstack, 0, - $n);
  49917. $this->lstack = \array_slice($this->lstack, 0, - $n);
  49918. }
  49919. private function lex()
  49920. {
  49921. $token = $this->lexer->lex() ?: 1;
  49922. if (!is_numeric($token)) {
  49923. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  49924. }
  49925. return $token;
  49926. }
  49927. private function failOnBOM($input)
  49928. {
  49929. $bom = "\xEF\xBB\xBF";
  49930. if (substr($input, 0, 3) === $bom) {
  49931. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  49932. }
  49933. }
  49934. }
  49935. <?php
  49936. namespace Seld\JsonLint;
  49937. class Lexer
  49938. {
  49939. private $EOF = 1;
  49940. private $rules = array(
  49941. 0 => '/\G\s+/',
  49942. 1 => '/\G-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  49943. 2 => '{\G"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  49944. 3 => '/\G\{/',
  49945. 4 => '/\G\}/',
  49946. 5 => '/\G\[/',
  49947. 6 => '/\G\]/',
  49948. 7 => '/\G,/',
  49949. 8 => '/\G:/',
  49950. 9 => '/\Gtrue\b/',
  49951. 10 => '/\Gfalse\b/',
  49952. 11 => '/\Gnull\b/',
  49953. 12 => '/\G$/',
  49954. 13 => '/\G./',
  49955. );
  49956. private $conditions = array(
  49957. "INITIAL" => array(
  49958. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  49959. "inclusive" => true,
  49960. ),
  49961. );
  49962. private $conditionStack;
  49963. private $input;
  49964. private $more;
  49965. private $done;
  49966. private $offset;
  49967. public $match;
  49968. public $yylineno;
  49969. public $yyleng;
  49970. public $yytext;
  49971. public $yylloc;
  49972. public function lex()
  49973. {
  49974. $r = $this->next();
  49975. if (!$r instanceof Undefined) {
  49976. return $r;
  49977. }
  49978. return $this->lex();
  49979. }
  49980. public function setInput($input)
  49981. {
  49982. $this->input = $input;
  49983. $this->more = false;
  49984. $this->done = false;
  49985. $this->offset = 0;
  49986. $this->yylineno = $this->yyleng = 0;
  49987. $this->yytext = $this->match = '';
  49988. $this->conditionStack = array('INITIAL');
  49989. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  49990. return $this;
  49991. }
  49992. public function showPosition()
  49993. {
  49994. $pre = str_replace("\n", '', $this->getPastInput());
  49995. $c = str_repeat('-', max(0, \strlen($pre) - 1));
  49996. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  49997. }
  49998. public function getPastInput()
  49999. {
  50000. $pastLength = $this->offset - \strlen($this->match);
  50001. return ($pastLength > 20 ? '...' : '') . substr($this->input, max(0, $pastLength - 20), min(20, $pastLength));
  50002. }
  50003. public function getUpcomingInput()
  50004. {
  50005. $next = $this->match;
  50006. if (\strlen($next) < 20) {
  50007. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  50008. }
  50009. return substr($next, 0, 20) . (\strlen($next) > 20 ? '...' : '');
  50010. }
  50011. public function getFullUpcomingInput()
  50012. {
  50013. $next = $this->match;
  50014. if (substr($next, 0, 1) === '"' && substr_count($next, '"') === 1) {
  50015. $len = \strlen($this->input);
  50016. $strEnd = min(strpos($this->input, '"', $this->offset + 1) ?: $len, strpos($this->input, "\n", $this->offset + 1) ?: $len);
  50017. $next .= substr($this->input, $this->offset, $strEnd - $this->offset);
  50018. } elseif (\strlen($next) < 20) {
  50019. $next .= substr($this->input, $this->offset, 20 - \strlen($next));
  50020. }
  50021. return $next;
  50022. }
  50023. protected function parseError($str, $hash)
  50024. {
  50025. throw new \Exception($str);
  50026. }
  50027. private function next()
  50028. {
  50029. if ($this->done) {
  50030. return $this->EOF;
  50031. }
  50032. if ($this->offset === \strlen($this->input)) {
  50033. $this->done = true;
  50034. }
  50035. $token = null;
  50036. $match = null;
  50037. $col = null;
  50038. $lines = null;
  50039. if (!$this->more) {
  50040. $this->yytext = '';
  50041. $this->match = '';
  50042. }
  50043. $rules = $this->getCurrentRules();
  50044. $rulesLen = \count($rules);
  50045. for ($i=0; $i < $rulesLen; $i++) {
  50046. if (preg_match($this->rules[$rules[$i]], $this->input, $match, 0, $this->offset)) {
  50047. preg_match_all('/\n.*/', $match[0], $lines);
  50048. $lines = $lines[0];
  50049. if ($lines) {
  50050. $this->yylineno += \count($lines);
  50051. }
  50052. $this->yylloc = array(
  50053. 'first_line' => $this->yylloc['last_line'],
  50054. 'last_line' => $this->yylineno+1,
  50055. 'first_column' => $this->yylloc['last_column'],
  50056. 'last_column' => $lines ? \strlen($lines[\count($lines) - 1]) - 1 : $this->yylloc['last_column'] + \strlen($match[0]),
  50057. );
  50058. $this->yytext .= $match[0];
  50059. $this->match .= $match[0];
  50060. $this->yyleng = \strlen($this->yytext);
  50061. $this->more = false;
  50062. $this->offset += \strlen($match[0]);
  50063. $token = $this->performAction($rules[$i], $this->conditionStack[\count($this->conditionStack)-1]);
  50064. if ($token) {
  50065. return $token;
  50066. }
  50067. return new Undefined();
  50068. }
  50069. }
  50070. if ($this->offset === \strlen($this->input)) {
  50071. return $this->EOF;
  50072. }
  50073. $this->parseError(
  50074. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  50075. array(
  50076. 'text' => "",
  50077. 'token' => null,
  50078. 'line' => $this->yylineno,
  50079. )
  50080. );
  50081. }
  50082. private function getCurrentRules()
  50083. {
  50084. return $this->conditions[$this->conditionStack[\count($this->conditionStack)-1]]['rules'];
  50085. }
  50086. private function performAction($avoiding_name_collisions, $YY_START)
  50087. {
  50088. switch ($avoiding_name_collisions) {
  50089. case 0:
  50090. break;
  50091. case 1:
  50092. return 6;
  50093. case 2:
  50094. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  50095. return 4;
  50096. case 3:
  50097. return 17;
  50098. case 4:
  50099. return 18;
  50100. case 5:
  50101. return 23;
  50102. case 6:
  50103. return 24;
  50104. case 7:
  50105. return 22;
  50106. case 8:
  50107. return 21;
  50108. case 9:
  50109. return 10;
  50110. case 10:
  50111. return 11;
  50112. case 11:
  50113. return 8;
  50114. case 12:
  50115. return 14;
  50116. case 13:
  50117. return 'INVALID';
  50118. }
  50119. }
  50120. }
  50121. <?php
  50122. namespace Seld\JsonLint;
  50123. class ParsingException extends \Exception
  50124. {
  50125. protected $details;
  50126. public function __construct($message, $details = array())
  50127. {
  50128. $this->details = $details;
  50129. parent::__construct($message);
  50130. }
  50131. public function getDetails()
  50132. {
  50133. return $this->details;
  50134. }
  50135. }
  50136. <?php
  50137. namespace Seld\JsonLint;
  50138. class Undefined
  50139. {
  50140. }
  50141. MIT License
  50142. Copyright (c) 2016
  50143. Permission is hereby granted, free of charge, to any person obtaining a copy
  50144. of this software and associated documentation files (the "Software"), to deal
  50145. in the Software without restriction, including without limitation the rights
  50146. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  50147. copies of the Software, and to permit persons to whom the Software is
  50148. furnished to do so, subject to the following conditions:
  50149. The above copyright notice and this permission notice shall be included in all
  50150. copies or substantial portions of the Software.
  50151. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50152. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50153. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50154. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50155. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50156. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50157. SOFTWARE.
  50158. <?php
  50159. require __DIR__ . '/../vendor/autoload.php';
  50160. $data = json_decode(file_get_contents('data.json'));
  50161. $validator = new JsonSchema\Validator();
  50162. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  50163. if ($validator->isValid()) {
  50164. echo "The supplied JSON validates against the schema.\n";
  50165. } else {
  50166. echo "JSON does not validate. Violations:\n";
  50167. foreach ($validator->getErrors() as $error) {
  50168. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  50169. }
  50170. }
  50171. <?php
  50172. namespace JsonSchema\Constraints;
  50173. use JsonSchema\Entity\JsonPointer;
  50174. use JsonSchema\Exception\InvalidArgumentException;
  50175. use JsonSchema\Exception\ValidationException;
  50176. use JsonSchema\Validator;
  50177. class BaseConstraint
  50178. {
  50179. protected $errors = array();
  50180. protected $errorMask = Validator::ERROR_NONE;
  50181. protected $factory;
  50182. public function __construct(Factory $factory = null)
  50183. {
  50184. $this->factory = $factory ?: new Factory();
  50185. }
  50186. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  50187. {
  50188. $error = array(
  50189. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  50190. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  50191. 'message' => $message,
  50192. 'constraint' => $constraint,
  50193. 'context' => $this->factory->getErrorContext(),
  50194. );
  50195. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  50196. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  50197. }
  50198. if (is_array($more) && count($more) > 0) {
  50199. $error += $more;
  50200. }
  50201. $this->errors[] = $error;
  50202. $this->errorMask |= $error['context'];
  50203. }
  50204. public function addErrors(array $errors)
  50205. {
  50206. if ($errors) {
  50207. $this->errors = array_merge($this->errors, $errors);
  50208. $errorMask = &$this->errorMask;
  50209. array_walk($errors, function ($error) use (&$errorMask) {
  50210. if (isset($error['context'])) {
  50211. $errorMask |= $error['context'];
  50212. }
  50213. });
  50214. }
  50215. }
  50216. public function getErrors($errorContext = Validator::ERROR_ALL)
  50217. {
  50218. if ($errorContext === Validator::ERROR_ALL) {
  50219. return $this->errors;
  50220. }
  50221. return array_filter($this->errors, function ($error) use ($errorContext) {
  50222. if ($errorContext & $error['context']) {
  50223. return true;
  50224. }
  50225. });
  50226. }
  50227. public function numErrors($errorContext = Validator::ERROR_ALL)
  50228. {
  50229. if ($errorContext === Validator::ERROR_ALL) {
  50230. return count($this->errors);
  50231. }
  50232. return count($this->getErrors($errorContext));
  50233. }
  50234. public function isValid()
  50235. {
  50236. return !$this->getErrors();
  50237. }
  50238. public function reset()
  50239. {
  50240. $this->errors = array();
  50241. $this->errorMask = Validator::ERROR_NONE;
  50242. }
  50243. public function getErrorMask()
  50244. {
  50245. return $this->errorMask;
  50246. }
  50247. public static function arrayToObjectRecursive($array)
  50248. {
  50249. $json = json_encode($array);
  50250. if (json_last_error() !== \JSON_ERROR_NONE) {
  50251. $message = 'Unable to encode schema array as JSON';
  50252. if (function_exists('json_last_error_msg')) {
  50253. $message .= ': ' . json_last_error_msg();
  50254. }
  50255. throw new InvalidArgumentException($message);
  50256. }
  50257. return (object) json_decode($json);
  50258. }
  50259. }
  50260. <?php
  50261. namespace JsonSchema\Constraints;
  50262. use JsonSchema\Entity\JsonPointer;
  50263. class CollectionConstraint extends Constraint
  50264. {
  50265. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50266. {
  50267. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  50268. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  50269. }
  50270. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  50271. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  50272. }
  50273. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  50274. $unique = $value;
  50275. if (is_array($value) && count($value)) {
  50276. $unique = array_map(function ($e) {
  50277. return var_export($e, true);
  50278. }, $value);
  50279. }
  50280. if (count(array_unique($unique)) != count($value)) {
  50281. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  50282. }
  50283. }
  50284. if (isset($schema->items)) {
  50285. $this->validateItems($value, $schema, $path, $i);
  50286. }
  50287. }
  50288. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50289. {
  50290. if (is_object($schema->items)) {
  50291. foreach ($value as $k => &$v) {
  50292. $initErrors = $this->getErrors();
  50293. $this->checkUndefined($v, $schema->items, $path, $k);
  50294. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  50295. $secondErrors = $this->getErrors();
  50296. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50297. }
  50298. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  50299. $this->errors = $secondErrors;
  50300. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  50301. $this->errors = $initErrors;
  50302. }
  50303. }
  50304. unset($v);
  50305. } else {
  50306. foreach ($value as $k => &$v) {
  50307. if (array_key_exists($k, $schema->items)) {
  50308. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  50309. } else {
  50310. if (property_exists($schema, 'additionalItems')) {
  50311. if ($schema->additionalItems !== false) {
  50312. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  50313. } else {
  50314. $this->addError(
  50315. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  50316. }
  50317. } else {
  50318. $this->checkUndefined($v, new \stdClass(), $path, $k);
  50319. }
  50320. }
  50321. }
  50322. unset($v);
  50323. if (count($value) > 0) {
  50324. for ($k = count($value); $k < count($schema->items); $k++) {
  50325. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  50326. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  50327. }
  50328. }
  50329. }
  50330. }
  50331. }
  50332. <?php
  50333. namespace JsonSchema\Constraints;
  50334. use JsonSchema\Entity\JsonPointer;
  50335. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  50336. {
  50337. protected $inlineSchemaProperty = '$schema';
  50338. const CHECK_MODE_NONE = 0x00000000;
  50339. const CHECK_MODE_NORMAL = 0x00000001;
  50340. const CHECK_MODE_TYPE_CAST = 0x00000002;
  50341. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  50342. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  50343. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  50344. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  50345. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  50346. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  50347. protected function incrementPath(JsonPointer $path = null, $i)
  50348. {
  50349. $path = $path ?: new JsonPointer('');
  50350. $path = $path->withPropertyPaths(
  50351. array_merge(
  50352. $path->getPropertyPaths(),
  50353. array_filter(array($i), 'strlen')
  50354. )
  50355. );
  50356. return $path;
  50357. }
  50358. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50359. {
  50360. $validator = $this->factory->createInstanceFor('collection');
  50361. $validator->check($value, $schema, $path, $i);
  50362. $this->addErrors($validator->getErrors());
  50363. }
  50364. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  50365. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  50366. {
  50367. $validator = $this->factory->createInstanceFor('object');
  50368. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  50369. $this->addErrors($validator->getErrors());
  50370. }
  50371. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  50372. {
  50373. $validator = $this->factory->createInstanceFor('type');
  50374. $validator->check($value, $schema, $path, $i);
  50375. $this->addErrors($validator->getErrors());
  50376. }
  50377. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  50378. {
  50379. $validator = $this->factory->createInstanceFor('undefined');
  50380. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  50381. $this->addErrors($validator->getErrors());
  50382. }
  50383. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  50384. {
  50385. $validator = $this->factory->createInstanceFor('string');
  50386. $validator->check($value, $schema, $path, $i);
  50387. $this->addErrors($validator->getErrors());
  50388. }
  50389. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  50390. {
  50391. $validator = $this->factory->createInstanceFor('number');
  50392. $validator->check($value, $schema, $path, $i);
  50393. $this->addErrors($validator->getErrors());
  50394. }
  50395. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  50396. {
  50397. $validator = $this->factory->createInstanceFor('enum');
  50398. $validator->check($value, $schema, $path, $i);
  50399. $this->addErrors($validator->getErrors());
  50400. }
  50401. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  50402. {
  50403. $validator = $this->factory->createInstanceFor('format');
  50404. $validator->check($value, $schema, $path, $i);
  50405. $this->addErrors($validator->getErrors());
  50406. }
  50407. protected function getTypeCheck()
  50408. {
  50409. return $this->factory->getTypeCheck();
  50410. }
  50411. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  50412. {
  50413. $result = array_map(
  50414. function ($path) {
  50415. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  50416. },
  50417. $pointer->getPropertyPaths()
  50418. );
  50419. return trim(implode('', $result), '.');
  50420. }
  50421. }
  50422. <?php
  50423. namespace JsonSchema\Constraints;
  50424. use JsonSchema\Entity\JsonPointer;
  50425. interface ConstraintInterface
  50426. {
  50427. public function getErrors();
  50428. public function addErrors(array $errors);
  50429. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  50430. public function isValid();
  50431. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  50432. }
  50433. <?php
  50434. namespace JsonSchema\Constraints;
  50435. use JsonSchema\Entity\JsonPointer;
  50436. class EnumConstraint extends Constraint
  50437. {
  50438. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50439. {
  50440. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  50441. return;
  50442. }
  50443. $type = gettype($element);
  50444. foreach ($schema->enum as $enum) {
  50445. $enumType = gettype($enum);
  50446. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  50447. if ((object) $element == $enum) {
  50448. return;
  50449. }
  50450. }
  50451. if ($type === gettype($enum)) {
  50452. if ($type == 'object') {
  50453. if ($element == $enum) {
  50454. return;
  50455. }
  50456. } elseif ($element === $enum) {
  50457. return;
  50458. }
  50459. }
  50460. }
  50461. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  50462. }
  50463. }
  50464. <?php
  50465. namespace JsonSchema\Constraints;
  50466. use JsonSchema\Exception\InvalidArgumentException;
  50467. use JsonSchema\SchemaStorage;
  50468. use JsonSchema\SchemaStorageInterface;
  50469. use JsonSchema\Uri\UriRetriever;
  50470. use JsonSchema\UriRetrieverInterface;
  50471. use JsonSchema\Validator;
  50472. class Factory
  50473. {
  50474. protected $schemaStorage;
  50475. protected $uriRetriever;
  50476. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  50477. private $typeCheck = array();
  50478. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  50479. protected $constraintMap = array(
  50480. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  50481. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  50482. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  50483. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  50484. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  50485. 'string' => 'JsonSchema\Constraints\StringConstraint',
  50486. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  50487. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  50488. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  50489. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  50490. 'validator' => 'JsonSchema\Validator'
  50491. );
  50492. private $instanceCache = array();
  50493. public function __construct(
  50494. SchemaStorageInterface $schemaStorage = null,
  50495. UriRetrieverInterface $uriRetriever = null,
  50496. $checkMode = Constraint::CHECK_MODE_NORMAL
  50497. ) {
  50498. $this->setConfig($checkMode);
  50499. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  50500. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  50501. }
  50502. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  50503. {
  50504. $this->checkMode = $checkMode;
  50505. }
  50506. public function addConfig($options)
  50507. {
  50508. $this->checkMode |= $options;
  50509. }
  50510. public function removeConfig($options)
  50511. {
  50512. $this->checkMode &= ~$options;
  50513. }
  50514. public function getConfig($options = null)
  50515. {
  50516. if ($options === null) {
  50517. return $this->checkMode;
  50518. }
  50519. return $this->checkMode & $options;
  50520. }
  50521. public function getUriRetriever()
  50522. {
  50523. return $this->uriRetriever;
  50524. }
  50525. public function getSchemaStorage()
  50526. {
  50527. return $this->schemaStorage;
  50528. }
  50529. public function getTypeCheck()
  50530. {
  50531. if (!isset($this->typeCheck[$this->checkMode])) {
  50532. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  50533. ? new TypeCheck\LooseTypeCheck()
  50534. : new TypeCheck\StrictTypeCheck();
  50535. }
  50536. return $this->typeCheck[$this->checkMode];
  50537. }
  50538. public function setConstraintClass($name, $class)
  50539. {
  50540. if (!class_exists($class)) {
  50541. throw new InvalidArgumentException('Unknown constraint ' . $name);
  50542. }
  50543. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  50544. throw new InvalidArgumentException('Invalid class ' . $name);
  50545. }
  50546. $this->constraintMap[$name] = $class;
  50547. return $this;
  50548. }
  50549. public function createInstanceFor($constraintName)
  50550. {
  50551. if (!isset($this->constraintMap[$constraintName])) {
  50552. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  50553. }
  50554. if (!isset($this->instanceCache[$constraintName])) {
  50555. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  50556. }
  50557. return clone $this->instanceCache[$constraintName];
  50558. }
  50559. public function getErrorContext()
  50560. {
  50561. return $this->errorContext;
  50562. }
  50563. public function setErrorContext($errorContext)
  50564. {
  50565. $this->errorContext = $errorContext;
  50566. }
  50567. }
  50568. <?php
  50569. namespace JsonSchema\Constraints;
  50570. use JsonSchema\Entity\JsonPointer;
  50571. use JsonSchema\Rfc3339;
  50572. class FormatConstraint extends Constraint
  50573. {
  50574. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50575. {
  50576. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  50577. return;
  50578. }
  50579. switch ($schema->format) {
  50580. case 'date':
  50581. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  50582. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  50583. }
  50584. break;
  50585. case 'time':
  50586. if (!$this->validateDateTime($element, 'H:i:s')) {
  50587. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  50588. }
  50589. break;
  50590. case 'date-time':
  50591. if (null === Rfc3339::createFromString($element)) {
  50592. $this->addError($path, sprintf('Invalid date-time %s, expected format YYYY-MM-DDThh:mm:ssZ or YYYY-MM-DDThh:mm:ss+hh:mm', json_encode($element)), 'format', array('format' => $schema->format));
  50593. }
  50594. break;
  50595. case 'utc-millisec':
  50596. if (!$this->validateDateTime($element, 'U')) {
  50597. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  50598. }
  50599. break;
  50600. case 'regex':
  50601. if (!$this->validateRegex($element)) {
  50602. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  50603. }
  50604. break;
  50605. case 'color':
  50606. if (!$this->validateColor($element)) {
  50607. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  50608. }
  50609. break;
  50610. case 'style':
  50611. if (!$this->validateStyle($element)) {
  50612. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  50613. }
  50614. break;
  50615. case 'phone':
  50616. if (!$this->validatePhone($element)) {
  50617. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  50618. }
  50619. break;
  50620. case 'uri':
  50621. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50622. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50623. }
  50624. break;
  50625. case 'uriref':
  50626. case 'uri-reference':
  50627. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  50628. if (substr($element, 0, 2) === '//') {
  50629. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50630. } elseif (substr($element, 0, 1) === '/') {
  50631. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50632. } elseif (strlen($element)) {
  50633. $pathParts = explode('/', $element, 2);
  50634. if (strpos($pathParts[0], ':') !== false) {
  50635. $validURL = null;
  50636. } else {
  50637. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  50638. }
  50639. } else {
  50640. $validURL = null;
  50641. }
  50642. if ($validURL === null) {
  50643. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  50644. }
  50645. }
  50646. break;
  50647. case 'email':
  50648. $filterFlags = FILTER_NULL_ON_FAILURE;
  50649. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  50650. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  50651. }
  50652. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  50653. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  50654. }
  50655. break;
  50656. case 'ip-address':
  50657. case 'ipv4':
  50658. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  50659. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50660. }
  50661. break;
  50662. case 'ipv6':
  50663. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  50664. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  50665. }
  50666. break;
  50667. case 'host-name':
  50668. case 'hostname':
  50669. if (!$this->validateHostname($element)) {
  50670. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  50671. }
  50672. break;
  50673. default:
  50674. break;
  50675. }
  50676. }
  50677. protected function validateDateTime($datetime, $format)
  50678. {
  50679. $dt = \DateTime::createFromFormat($format, $datetime);
  50680. if (!$dt) {
  50681. return false;
  50682. }
  50683. if ($datetime === $dt->format($format)) {
  50684. return true;
  50685. }
  50686. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  50687. return true;
  50688. }
  50689. return false;
  50690. }
  50691. protected function validateRegex($regex)
  50692. {
  50693. return false !== @preg_match('/' . $regex . '/u', '');
  50694. }
  50695. protected function validateColor($color)
  50696. {
  50697. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  50698. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  50699. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  50700. return true;
  50701. }
  50702. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  50703. }
  50704. protected function validateStyle($style)
  50705. {
  50706. $properties = explode(';', rtrim($style, ';'));
  50707. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  50708. return empty($invalidEntries);
  50709. }
  50710. protected function validatePhone($phone)
  50711. {
  50712. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  50713. }
  50714. protected function validateHostname($host)
  50715. {
  50716. $hostnameRegex = '/^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$/i';
  50717. return preg_match($hostnameRegex, $host);
  50718. }
  50719. }
  50720. <?php
  50721. namespace JsonSchema\Constraints;
  50722. use JsonSchema\Entity\JsonPointer;
  50723. class NumberConstraint extends Constraint
  50724. {
  50725. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50726. {
  50727. if (isset($schema->exclusiveMinimum)) {
  50728. if (isset($schema->minimum)) {
  50729. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  50730. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  50731. } elseif ($element < $schema->minimum) {
  50732. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50733. }
  50734. } else {
  50735. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  50736. }
  50737. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  50738. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  50739. }
  50740. if (isset($schema->exclusiveMaximum)) {
  50741. if (isset($schema->maximum)) {
  50742. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  50743. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  50744. } elseif ($element > $schema->maximum) {
  50745. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50746. }
  50747. } else {
  50748. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  50749. }
  50750. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  50751. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  50752. }
  50753. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  50754. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  50755. }
  50756. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  50757. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  50758. }
  50759. $this->checkFormat($element, $schema, $path, $i);
  50760. }
  50761. private function fmod($number1, $number2)
  50762. {
  50763. $modulus = ($number1 - round($number1 / $number2) * $number2);
  50764. $precision = 0.0000000001;
  50765. if (-$precision < $modulus && $modulus < $precision) {
  50766. return 0.0;
  50767. }
  50768. return $modulus;
  50769. }
  50770. }
  50771. <?php
  50772. namespace JsonSchema\Constraints;
  50773. use JsonSchema\Entity\JsonPointer;
  50774. class ObjectConstraint extends Constraint
  50775. {
  50776. protected $appliedDefaults = array();
  50777. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  50778. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  50779. {
  50780. if ($element instanceof UndefinedConstraint) {
  50781. return;
  50782. }
  50783. $this->appliedDefaults = $appliedDefaults;
  50784. $matches = array();
  50785. if ($patternProperties) {
  50786. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  50787. }
  50788. if ($properties) {
  50789. $this->validateProperties($element, $properties, $path);
  50790. }
  50791. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  50792. }
  50793. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  50794. {
  50795. $try = array('/', '#', '+', '~', '%');
  50796. $matches = array();
  50797. foreach ($patternProperties as $pregex => $schema) {
  50798. $delimiter = '/';
  50799. foreach ($try as $delimiter) {
  50800. if (strpos($pregex, $delimiter) === false) {
  50801. break;
  50802. }
  50803. }
  50804. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  50805. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  50806. continue;
  50807. }
  50808. foreach ($element as $i => $value) {
  50809. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  50810. $matches[] = $i;
  50811. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  50812. }
  50813. }
  50814. }
  50815. return $matches;
  50816. }
  50817. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  50818. $properties = null, $additionalProp = null)
  50819. {
  50820. $this->validateMinMaxConstraint($element, $schema, $path);
  50821. foreach ($element as $i => $value) {
  50822. $definition = $this->getProperty($properties, $i);
  50823. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  50824. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  50825. }
  50826. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  50827. if ($additionalProp === true) {
  50828. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  50829. } else {
  50830. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  50831. }
  50832. }
  50833. $require = $this->getProperty($definition, 'requires');
  50834. if ($require && !$this->getProperty($element, $require)) {
  50835. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  50836. }
  50837. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  50838. if (is_object($property)) {
  50839. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  50840. }
  50841. }
  50842. }
  50843. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  50844. {
  50845. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  50846. foreach ($properties as $i => $value) {
  50847. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  50848. $definition = $this->getProperty($properties, $i);
  50849. if (is_object($definition)) {
  50850. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  50851. }
  50852. }
  50853. }
  50854. protected function &getProperty(&$element, $property, $fallback = null)
  50855. {
  50856. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  50857. return $element[$property];
  50858. } elseif (is_object($element) && property_exists($element, $property)) {
  50859. return $element->$property;
  50860. }
  50861. return $fallback;
  50862. }
  50863. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  50864. {
  50865. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  50866. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  50867. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  50868. }
  50869. }
  50870. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  50871. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  50872. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  50873. }
  50874. }
  50875. }
  50876. }
  50877. <?php
  50878. namespace JsonSchema\Constraints;
  50879. use JsonSchema\Entity\JsonPointer;
  50880. use JsonSchema\Exception\InvalidArgumentException;
  50881. use JsonSchema\Exception\InvalidSchemaException;
  50882. use JsonSchema\Exception\RuntimeException;
  50883. use JsonSchema\Validator;
  50884. class SchemaConstraint extends Constraint
  50885. {
  50886. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  50887. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50888. {
  50889. if ($schema !== null) {
  50890. $validationSchema = $schema;
  50891. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  50892. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  50893. } else {
  50894. throw new InvalidArgumentException('no schema found to verify against');
  50895. }
  50896. if (is_array($validationSchema)) {
  50897. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  50898. }
  50899. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  50900. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  50901. throw new RuntimeException('Cannot validate the schema of a non-object');
  50902. }
  50903. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  50904. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  50905. } else {
  50906. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  50907. }
  50908. $schemaStorage = $this->factory->getSchemaStorage();
  50909. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  50910. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  50911. }
  50912. $initialErrorCount = $this->numErrors();
  50913. $initialConfig = $this->factory->getConfig();
  50914. $initialContext = $this->factory->getErrorContext();
  50915. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  50916. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  50917. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  50918. try {
  50919. $this->check($validationSchema, $schemaSpec);
  50920. } catch (\Exception $e) {
  50921. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  50922. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  50923. }
  50924. }
  50925. if ($this->numErrors() > $initialErrorCount) {
  50926. $this->addError($path, 'Schema is not valid', 'schema');
  50927. }
  50928. $this->factory->setConfig($initialConfig);
  50929. $this->factory->setErrorContext($initialContext);
  50930. }
  50931. $this->checkUndefined($element, $validationSchema, $path, $i);
  50932. }
  50933. }
  50934. <?php
  50935. namespace JsonSchema\Constraints;
  50936. use JsonSchema\Entity\JsonPointer;
  50937. class StringConstraint extends Constraint
  50938. {
  50939. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  50940. {
  50941. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  50942. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  50943. 'maxLength' => $schema->maxLength,
  50944. ));
  50945. }
  50946. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  50947. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  50948. 'minLength' => $schema->minLength,
  50949. ));
  50950. }
  50951. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  50952. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  50953. 'pattern' => $schema->pattern,
  50954. ));
  50955. }
  50956. $this->checkFormat($element, $schema, $path, $i);
  50957. }
  50958. private function strlen($string)
  50959. {
  50960. if (extension_loaded('mbstring')) {
  50961. return mb_strlen($string, mb_detect_encoding($string));
  50962. }
  50963. return strlen($string);
  50964. }
  50965. }
  50966. <?php
  50967. namespace JsonSchema\Constraints\TypeCheck;
  50968. class LooseTypeCheck implements TypeCheckInterface
  50969. {
  50970. public static function isObject($value)
  50971. {
  50972. return
  50973. is_object($value) ||
  50974. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  50975. }
  50976. public static function isArray($value)
  50977. {
  50978. return
  50979. is_array($value) &&
  50980. (count($value) == 0 || !self::isAssociativeArray($value));
  50981. }
  50982. public static function propertyGet($value, $property)
  50983. {
  50984. if (is_object($value)) {
  50985. return $value->{$property};
  50986. }
  50987. return $value[$property];
  50988. }
  50989. public static function propertySet(&$value, $property, $data)
  50990. {
  50991. if (is_object($value)) {
  50992. $value->{$property} = $data;
  50993. } else {
  50994. $value[$property] = $data;
  50995. }
  50996. }
  50997. public static function propertyExists($value, $property)
  50998. {
  50999. if (is_object($value)) {
  51000. return property_exists($value, $property);
  51001. }
  51002. return array_key_exists($property, $value);
  51003. }
  51004. public static function propertyCount($value)
  51005. {
  51006. if (is_object($value)) {
  51007. return count(get_object_vars($value));
  51008. }
  51009. return count($value);
  51010. }
  51011. private static function isAssociativeArray($arr)
  51012. {
  51013. return array_keys($arr) !== range(0, count($arr) - 1);
  51014. }
  51015. }
  51016. <?php
  51017. namespace JsonSchema\Constraints\TypeCheck;
  51018. class StrictTypeCheck implements TypeCheckInterface
  51019. {
  51020. public static function isObject($value)
  51021. {
  51022. return is_object($value);
  51023. }
  51024. public static function isArray($value)
  51025. {
  51026. return is_array($value);
  51027. }
  51028. public static function propertyGet($value, $property)
  51029. {
  51030. return $value->{$property};
  51031. }
  51032. public static function propertySet(&$value, $property, $data)
  51033. {
  51034. $value->{$property} = $data;
  51035. }
  51036. public static function propertyExists($value, $property)
  51037. {
  51038. return property_exists($value, $property);
  51039. }
  51040. public static function propertyCount($value)
  51041. {
  51042. if (!is_object($value)) {
  51043. return 0;
  51044. }
  51045. return count(get_object_vars($value));
  51046. }
  51047. }
  51048. <?php
  51049. namespace JsonSchema\Constraints\TypeCheck;
  51050. interface TypeCheckInterface
  51051. {
  51052. public static function isObject($value);
  51053. public static function isArray($value);
  51054. public static function propertyGet($value, $property);
  51055. public static function propertySet(&$value, $property, $data);
  51056. public static function propertyExists($value, $property);
  51057. public static function propertyCount($value);
  51058. }
  51059. <?php
  51060. namespace JsonSchema\Constraints;
  51061. use JsonSchema\Entity\JsonPointer;
  51062. use JsonSchema\Exception\InvalidArgumentException;
  51063. use UnexpectedValueException as StandardUnexpectedValueException;
  51064. class TypeConstraint extends Constraint
  51065. {
  51066. public static $wording = array(
  51067. 'integer' => 'an integer',
  51068. 'number' => 'a number',
  51069. 'boolean' => 'a boolean',
  51070. 'object' => 'an object',
  51071. 'array' => 'an array',
  51072. 'string' => 'a string',
  51073. 'null' => 'a null',
  51074. 'any' => null,
  51075. 0 => null,
  51076. );
  51077. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  51078. {
  51079. $type = isset($schema->type) ? $schema->type : null;
  51080. $isValid = false;
  51081. $wording = array();
  51082. if (is_array($type)) {
  51083. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  51084. } elseif (is_object($type)) {
  51085. $this->checkUndefined($value, $type, $path);
  51086. return;
  51087. } else {
  51088. $isValid = $this->validateType($value, $type);
  51089. }
  51090. if ($isValid === false) {
  51091. if (!is_array($type)) {
  51092. $this->validateTypeNameWording($type);
  51093. $wording[] = self::$wording[$type];
  51094. }
  51095. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  51096. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  51097. }
  51098. }
  51099. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  51100. {
  51101. foreach ($type as $tp) {
  51102. if (is_object($tp)) {
  51103. if (!$isValid) {
  51104. $validator = $this->factory->createInstanceFor('type');
  51105. $subSchema = new \stdClass();
  51106. $subSchema->type = $tp;
  51107. $validator->check($value, $subSchema, $path, null);
  51108. $error = $validator->getErrors();
  51109. $isValid = !(bool) $error;
  51110. $validTypesWording[] = self::$wording['object'];
  51111. }
  51112. } else {
  51113. $this->validateTypeNameWording($tp);
  51114. $validTypesWording[] = self::$wording[$tp];
  51115. if (!$isValid) {
  51116. $isValid = $this->validateType($value, $tp);
  51117. }
  51118. }
  51119. }
  51120. }
  51121. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  51122. {
  51123. if ($listEnd === false || !isset($elements[1])) {
  51124. return implode($delimiter, $elements);
  51125. }
  51126. $lastElement = array_slice($elements, -1);
  51127. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  51128. $implodedElements = array_merge(array($firsElements), $lastElement);
  51129. return join(" $listEnd ", $implodedElements);
  51130. }
  51131. protected function validateTypeNameWording($type)
  51132. {
  51133. if (!isset(self::$wording[$type])) {
  51134. throw new StandardUnexpectedValueException(
  51135. sprintf(
  51136. 'No wording for %s available, expected wordings are: [%s]',
  51137. var_export($type, true),
  51138. implode(', ', array_filter(self::$wording)))
  51139. );
  51140. }
  51141. }
  51142. protected function validateType(&$value, $type)
  51143. {
  51144. if (!$type) {
  51145. return true;
  51146. }
  51147. if ('any' === $type) {
  51148. return true;
  51149. }
  51150. if ('object' === $type) {
  51151. return $this->getTypeCheck()->isObject($value);
  51152. }
  51153. if ('array' === $type) {
  51154. return $this->getTypeCheck()->isArray($value);
  51155. }
  51156. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  51157. if ('integer' === $type) {
  51158. if ($coerce) {
  51159. $value = $this->toInteger($value);
  51160. }
  51161. return is_int($value);
  51162. }
  51163. if ('number' === $type) {
  51164. if ($coerce) {
  51165. $value = $this->toNumber($value);
  51166. }
  51167. return is_numeric($value) && !is_string($value);
  51168. }
  51169. if ('boolean' === $type) {
  51170. if ($coerce) {
  51171. $value = $this->toBoolean($value);
  51172. }
  51173. return is_bool($value);
  51174. }
  51175. if ('string' === $type) {
  51176. return is_string($value);
  51177. }
  51178. if ('email' === $type) {
  51179. return is_string($value);
  51180. }
  51181. if ('null' === $type) {
  51182. return is_null($value);
  51183. }
  51184. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  51185. }
  51186. protected function toBoolean($value)
  51187. {
  51188. if ($value === 'true') {
  51189. return true;
  51190. }
  51191. if ($value === 'false') {
  51192. return false;
  51193. }
  51194. return $value;
  51195. }
  51196. protected function toNumber($value)
  51197. {
  51198. if (is_numeric($value)) {
  51199. return $value + 0;
  51200. }
  51201. return $value;
  51202. }
  51203. protected function toInteger($value)
  51204. {
  51205. if (is_numeric($value) && (int) $value == $value) {
  51206. return (int) $value;
  51207. }
  51208. return $value;
  51209. }
  51210. }
  51211. <?php
  51212. namespace JsonSchema\Constraints;
  51213. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  51214. use JsonSchema\Entity\JsonPointer;
  51215. use JsonSchema\Exception\ValidationException;
  51216. use JsonSchema\Uri\UriResolver;
  51217. class UndefinedConstraint extends Constraint
  51218. {
  51219. protected $appliedDefaults = array();
  51220. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  51221. {
  51222. if (is_null($schema) || !is_object($schema)) {
  51223. return;
  51224. }
  51225. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  51226. if ($fromDefault) {
  51227. $path->setFromDefault();
  51228. }
  51229. $this->validateCommonProperties($value, $schema, $path, $i);
  51230. $this->validateOfProperties($value, $schema, $path, '');
  51231. $this->validateTypes($value, $schema, $path, $i);
  51232. }
  51233. public function validateTypes(&$value, $schema, JsonPointer $path, $i = null)
  51234. {
  51235. if ($this->getTypeCheck()->isArray($value)) {
  51236. $this->checkArray($value, $schema, $path, $i);
  51237. }
  51238. if (LooseTypeCheck::isObject($value)) {
  51239. $this->checkObject(
  51240. $value,
  51241. $schema,
  51242. $path,
  51243. isset($schema->properties) ? $schema->properties : null,
  51244. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  51245. isset($schema->patternProperties) ? $schema->patternProperties : null,
  51246. $this->appliedDefaults
  51247. );
  51248. }
  51249. if (is_string($value)) {
  51250. $this->checkString($value, $schema, $path, $i);
  51251. }
  51252. if (is_numeric($value)) {
  51253. $this->checkNumber($value, $schema, $path, $i);
  51254. }
  51255. if (isset($schema->enum)) {
  51256. $this->checkEnum($value, $schema, $path, $i);
  51257. }
  51258. }
  51259. protected function validateCommonProperties(&$value, $schema, JsonPointer $path, $i = '')
  51260. {
  51261. if (isset($schema->extends)) {
  51262. if (is_string($schema->extends)) {
  51263. $schema->extends = $this->validateUri($schema, $schema->extends);
  51264. }
  51265. if (is_array($schema->extends)) {
  51266. foreach ($schema->extends as $extends) {
  51267. $this->checkUndefined($value, $extends, $path, $i);
  51268. }
  51269. } else {
  51270. $this->checkUndefined($value, $schema->extends, $path, $i);
  51271. }
  51272. }
  51273. if (!$path->fromDefault()) {
  51274. $this->applyDefaultValues($value, $schema, $path);
  51275. }
  51276. if ($this->getTypeCheck()->isObject($value)) {
  51277. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  51278. foreach ($schema->required as $required) {
  51279. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  51280. $this->addError(
  51281. $this->incrementPath($path ?: new JsonPointer(''), $required),
  51282. 'The property ' . $required . ' is required',
  51283. 'required'
  51284. );
  51285. }
  51286. }
  51287. } elseif (isset($schema->required) && !is_array($schema->required)) {
  51288. if ($schema->required && $value instanceof self) {
  51289. $propertyPaths = $path->getPropertyPaths();
  51290. $propertyName = end($propertyPaths);
  51291. $this->addError(
  51292. $path,
  51293. 'The property ' . $propertyName . ' is required',
  51294. 'required'
  51295. );
  51296. }
  51297. } else {
  51298. if ($value instanceof self) {
  51299. return;
  51300. }
  51301. }
  51302. }
  51303. if (!($value instanceof self)) {
  51304. $this->checkType($value, $schema, $path, $i);
  51305. }
  51306. if (isset($schema->disallow)) {
  51307. $initErrors = $this->getErrors();
  51308. $typeSchema = new \stdClass();
  51309. $typeSchema->type = $schema->disallow;
  51310. $this->checkType($value, $typeSchema, $path);
  51311. if (count($this->getErrors()) == count($initErrors)) {
  51312. $this->addError($path, 'Disallowed value was matched', 'disallow');
  51313. } else {
  51314. $this->errors = $initErrors;
  51315. }
  51316. }
  51317. if (isset($schema->not)) {
  51318. $initErrors = $this->getErrors();
  51319. $this->checkUndefined($value, $schema->not, $path, $i);
  51320. if (count($this->getErrors()) == count($initErrors)) {
  51321. $this->addError($path, 'Matched a schema which it should not', 'not');
  51322. } else {
  51323. $this->errors = $initErrors;
  51324. }
  51325. }
  51326. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  51327. $this->validateDependencies($value, $schema->dependencies, $path);
  51328. }
  51329. }
  51330. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  51331. {
  51332. if (!$requiredOnly) {
  51333. return true;
  51334. }
  51335. if (
  51336. $name !== null
  51337. && isset($parentSchema->required)
  51338. && is_array($parentSchema->required)
  51339. && in_array($name, $parentSchema->required)
  51340. ) {
  51341. return true;
  51342. }
  51343. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  51344. return true;
  51345. }
  51346. return false;
  51347. }
  51348. protected function applyDefaultValues(&$value, $schema, $path)
  51349. {
  51350. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  51351. return;
  51352. }
  51353. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  51354. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  51355. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  51356. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  51357. if (
  51358. !LooseTypeCheck::propertyExists($value, $currentProperty)
  51359. && property_exists($propertyDefinition, 'default')
  51360. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  51361. ) {
  51362. if (is_object($propertyDefinition->default)) {
  51363. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  51364. } else {
  51365. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  51366. }
  51367. $this->appliedDefaults[] = $currentProperty;
  51368. }
  51369. }
  51370. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  51371. $items = array();
  51372. if (LooseTypeCheck::isArray($schema->items)) {
  51373. $items = $schema->items;
  51374. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  51375. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  51376. }
  51377. foreach ($items as $currentItem => $itemDefinition) {
  51378. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  51379. if (
  51380. !array_key_exists($currentItem, $value)
  51381. && property_exists($itemDefinition, 'default')
  51382. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  51383. if (is_object($itemDefinition->default)) {
  51384. $value[$currentItem] = clone $itemDefinition->default;
  51385. } else {
  51386. $value[$currentItem] = $itemDefinition->default;
  51387. }
  51388. }
  51389. $path->setFromDefault();
  51390. }
  51391. } elseif (
  51392. $value instanceof self
  51393. && property_exists($schema, 'default')
  51394. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  51395. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  51396. $path->setFromDefault();
  51397. }
  51398. }
  51399. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  51400. {
  51401. if ($value instanceof self) {
  51402. return;
  51403. }
  51404. if (isset($schema->allOf)) {
  51405. $isValid = true;
  51406. foreach ($schema->allOf as $allOf) {
  51407. $initErrors = $this->getErrors();
  51408. $this->checkUndefined($value, $allOf, $path, $i);
  51409. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  51410. }
  51411. if (!$isValid) {
  51412. $this->addError($path, 'Failed to match all schemas', 'allOf');
  51413. }
  51414. }
  51415. if (isset($schema->anyOf)) {
  51416. $isValid = false;
  51417. $startErrors = $this->getErrors();
  51418. $caughtException = null;
  51419. foreach ($schema->anyOf as $anyOf) {
  51420. $initErrors = $this->getErrors();
  51421. try {
  51422. $this->checkUndefined($value, $anyOf, $path, $i);
  51423. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  51424. break;
  51425. }
  51426. } catch (ValidationException $e) {
  51427. $isValid = false;
  51428. }
  51429. }
  51430. if (!$isValid) {
  51431. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  51432. } else {
  51433. $this->errors = $startErrors;
  51434. }
  51435. }
  51436. if (isset($schema->oneOf)) {
  51437. $allErrors = array();
  51438. $matchedSchemas = 0;
  51439. $startErrors = $this->getErrors();
  51440. foreach ($schema->oneOf as $oneOf) {
  51441. try {
  51442. $this->errors = array();
  51443. $this->checkUndefined($value, $oneOf, $path, $i);
  51444. if (count($this->getErrors()) == 0) {
  51445. $matchedSchemas++;
  51446. }
  51447. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  51448. } catch (ValidationException $e) {
  51449. }
  51450. }
  51451. if ($matchedSchemas !== 1) {
  51452. $this->addErrors(array_merge($allErrors, $startErrors));
  51453. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  51454. } else {
  51455. $this->errors = $startErrors;
  51456. }
  51457. }
  51458. }
  51459. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  51460. {
  51461. foreach ($dependencies as $key => $dependency) {
  51462. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  51463. if (is_string($dependency)) {
  51464. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  51465. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  51466. }
  51467. } elseif (is_array($dependency)) {
  51468. foreach ($dependency as $d) {
  51469. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  51470. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  51471. }
  51472. }
  51473. } elseif (is_object($dependency)) {
  51474. $this->checkUndefined($value, $dependency, $path, $i);
  51475. }
  51476. }
  51477. }
  51478. }
  51479. protected function validateUri($schema, $schemaUri = null)
  51480. {
  51481. $resolver = new UriResolver();
  51482. $retriever = $this->factory->getUriRetriever();
  51483. $jsonSchema = null;
  51484. if ($resolver->isValid($schemaUri)) {
  51485. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  51486. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  51487. }
  51488. return $jsonSchema;
  51489. }
  51490. }
  51491. <?php
  51492. namespace JsonSchema\Entity;
  51493. use JsonSchema\Exception\InvalidArgumentException;
  51494. class JsonPointer
  51495. {
  51496. private $filename;
  51497. private $propertyPaths = array();
  51498. private $fromDefault = false;
  51499. public function __construct($value)
  51500. {
  51501. if (!is_string($value)) {
  51502. throw new InvalidArgumentException('Ref value must be a string');
  51503. }
  51504. $splitRef = explode('#', $value, 2);
  51505. $this->filename = $splitRef[0];
  51506. if (array_key_exists(1, $splitRef)) {
  51507. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  51508. }
  51509. }
  51510. private function decodePropertyPaths($propertyPathString)
  51511. {
  51512. $paths = array();
  51513. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  51514. $path = $this->decodePath($path);
  51515. if (is_string($path) && '' !== $path) {
  51516. $paths[] = $path;
  51517. }
  51518. }
  51519. return $paths;
  51520. }
  51521. private function encodePropertyPaths()
  51522. {
  51523. return array_map(
  51524. array($this, 'encodePath'),
  51525. $this->getPropertyPaths()
  51526. );
  51527. }
  51528. private function decodePath($path)
  51529. {
  51530. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  51531. }
  51532. private function encodePath($path)
  51533. {
  51534. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  51535. }
  51536. public function getFilename()
  51537. {
  51538. return $this->filename;
  51539. }
  51540. public function getPropertyPaths()
  51541. {
  51542. return $this->propertyPaths;
  51543. }
  51544. public function withPropertyPaths(array $propertyPaths)
  51545. {
  51546. $new = clone $this;
  51547. $new->propertyPaths = $propertyPaths;
  51548. return $new;
  51549. }
  51550. public function getPropertyPathAsString()
  51551. {
  51552. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  51553. }
  51554. public function __toString()
  51555. {
  51556. return $this->getFilename() . $this->getPropertyPathAsString();
  51557. }
  51558. public function setFromDefault()
  51559. {
  51560. $this->fromDefault = true;
  51561. }
  51562. public function fromDefault()
  51563. {
  51564. return $this->fromDefault;
  51565. }
  51566. }
  51567. <?php
  51568. namespace JsonSchema\Exception;
  51569. interface ExceptionInterface
  51570. {
  51571. }
  51572. <?php
  51573. namespace JsonSchema\Exception;
  51574. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  51575. {
  51576. }
  51577. <?php
  51578. namespace JsonSchema\Exception;
  51579. class InvalidConfigException extends RuntimeException
  51580. {
  51581. }
  51582. <?php
  51583. namespace JsonSchema\Exception;
  51584. class InvalidSchemaException extends RuntimeException
  51585. {
  51586. }
  51587. <?php
  51588. namespace JsonSchema\Exception;
  51589. class InvalidSchemaMediaTypeException extends RuntimeException
  51590. {
  51591. }
  51592. <?php
  51593. namespace JsonSchema\Exception;
  51594. class InvalidSourceUriException extends InvalidArgumentException
  51595. {
  51596. }
  51597. <?php
  51598. namespace JsonSchema\Exception;
  51599. class JsonDecodingException extends RuntimeException
  51600. {
  51601. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  51602. {
  51603. switch ($code) {
  51604. case JSON_ERROR_DEPTH:
  51605. $message = 'The maximum stack depth has been exceeded';
  51606. break;
  51607. case JSON_ERROR_STATE_MISMATCH:
  51608. $message = 'Invalid or malformed JSON';
  51609. break;
  51610. case JSON_ERROR_CTRL_CHAR:
  51611. $message = 'Control character error, possibly incorrectly encoded';
  51612. break;
  51613. case JSON_ERROR_UTF8:
  51614. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  51615. break;
  51616. case JSON_ERROR_SYNTAX:
  51617. $message = 'JSON syntax is malformed';
  51618. break;
  51619. default:
  51620. $message = 'Syntax error';
  51621. }
  51622. parent::__construct($message, $code, $previous);
  51623. }
  51624. }
  51625. <?php
  51626. namespace JsonSchema\Exception;
  51627. class ResourceNotFoundException extends RuntimeException
  51628. {
  51629. }
  51630. <?php
  51631. namespace JsonSchema\Exception;
  51632. class RuntimeException extends \RuntimeException implements ExceptionInterface
  51633. {
  51634. }
  51635. <?php
  51636. namespace JsonSchema\Exception;
  51637. class UnresolvableJsonPointerException extends InvalidArgumentException
  51638. {
  51639. }
  51640. <?php
  51641. namespace JsonSchema\Exception;
  51642. class UriResolverException extends RuntimeException
  51643. {
  51644. }
  51645. <?php
  51646. namespace JsonSchema\Exception;
  51647. class ValidationException extends RuntimeException
  51648. {
  51649. }
  51650. <?php
  51651. namespace JsonSchema\Iterator;
  51652. class ObjectIterator implements \Iterator, \Countable
  51653. {
  51654. private $object;
  51655. private $position = 0;
  51656. private $data = array();
  51657. private $initialized = false;
  51658. public function __construct($object)
  51659. {
  51660. $this->object = $object;
  51661. }
  51662. public function current()
  51663. {
  51664. $this->initialize();
  51665. return $this->data[$this->position];
  51666. }
  51667. public function next()
  51668. {
  51669. $this->initialize();
  51670. $this->position++;
  51671. }
  51672. public function key()
  51673. {
  51674. $this->initialize();
  51675. return $this->position;
  51676. }
  51677. public function valid()
  51678. {
  51679. $this->initialize();
  51680. return isset($this->data[$this->position]);
  51681. }
  51682. public function rewind()
  51683. {
  51684. $this->initialize();
  51685. $this->position = 0;
  51686. }
  51687. public function count()
  51688. {
  51689. $this->initialize();
  51690. return count($this->data);
  51691. }
  51692. private function initialize()
  51693. {
  51694. if (!$this->initialized) {
  51695. $this->data = $this->buildDataFromObject($this->object);
  51696. $this->initialized = true;
  51697. }
  51698. }
  51699. private function buildDataFromObject($object)
  51700. {
  51701. $result = array();
  51702. $stack = new \SplStack();
  51703. $stack->push($object);
  51704. while (!$stack->isEmpty()) {
  51705. $current = $stack->pop();
  51706. if (is_object($current)) {
  51707. array_push($result, $current);
  51708. }
  51709. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  51710. if (is_object($propertyValue) || is_array($propertyValue)) {
  51711. $stack->push($propertyValue);
  51712. }
  51713. }
  51714. }
  51715. return $result;
  51716. }
  51717. private function getDataFromItem($item)
  51718. {
  51719. if (!is_object($item) && !is_array($item)) {
  51720. return array();
  51721. }
  51722. return is_object($item) ? get_object_vars($item) : $item;
  51723. }
  51724. }
  51725. <?php
  51726. namespace JsonSchema;
  51727. class Rfc3339
  51728. {
  51729. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  51730. public static function createFromString($string)
  51731. {
  51732. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  51733. return null;
  51734. }
  51735. $dateAndTime = $matches[1];
  51736. $microseconds = $matches[2] ?: '.000000';
  51737. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  51738. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  51739. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  51740. return $dateTime ?: null;
  51741. }
  51742. }
  51743. <?php
  51744. namespace JsonSchema;
  51745. use JsonSchema\Constraints\BaseConstraint;
  51746. use JsonSchema\Entity\JsonPointer;
  51747. use JsonSchema\Exception\UnresolvableJsonPointerException;
  51748. use JsonSchema\Uri\UriResolver;
  51749. use JsonSchema\Uri\UriRetriever;
  51750. class SchemaStorage implements SchemaStorageInterface
  51751. {
  51752. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  51753. protected $uriRetriever;
  51754. protected $uriResolver;
  51755. protected $schemas = array();
  51756. public function __construct(
  51757. UriRetrieverInterface $uriRetriever = null,
  51758. UriResolverInterface $uriResolver = null
  51759. ) {
  51760. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  51761. $this->uriResolver = $uriResolver ?: new UriResolver();
  51762. }
  51763. public function getUriRetriever()
  51764. {
  51765. return $this->uriRetriever;
  51766. }
  51767. public function getUriResolver()
  51768. {
  51769. return $this->uriResolver;
  51770. }
  51771. public function addSchema($id, $schema = null)
  51772. {
  51773. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  51774. $schema = $this->uriRetriever->retrieve($id);
  51775. }
  51776. if (is_array($schema)) {
  51777. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  51778. }
  51779. if (is_object($schema) && property_exists($schema, 'id')) {
  51780. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  51781. $schema->properties->id->format = 'uri-reference';
  51782. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  51783. $schema->properties->id->format = 'uri-reference';
  51784. $schema->properties->{'$ref'}->format = 'uri-reference';
  51785. }
  51786. }
  51787. $this->expandRefs($schema, $id);
  51788. $this->schemas[$id] = $schema;
  51789. }
  51790. private function expandRefs(&$schema, $base = null)
  51791. {
  51792. if (!is_object($schema)) {
  51793. if (is_array($schema)) {
  51794. foreach ($schema as &$member) {
  51795. $this->expandRefs($member, $base);
  51796. }
  51797. }
  51798. return;
  51799. }
  51800. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  51801. $base = $this->uriResolver->resolve($schema->id, $base);
  51802. }
  51803. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  51804. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  51805. $schema->{'$ref'} = (string) $refPointer;
  51806. }
  51807. foreach ($schema as &$member) {
  51808. $this->expandRefs($member, $base);
  51809. }
  51810. }
  51811. public function getSchema($id)
  51812. {
  51813. if (!array_key_exists($id, $this->schemas)) {
  51814. $this->addSchema($id);
  51815. }
  51816. return $this->schemas[$id];
  51817. }
  51818. public function resolveRef($ref)
  51819. {
  51820. $jsonPointer = new JsonPointer($ref);
  51821. $fileName = $jsonPointer->getFilename();
  51822. if (!strlen($fileName)) {
  51823. throw new UnresolvableJsonPointerException(sprintf(
  51824. "Could not resolve fragment '%s': no file is defined",
  51825. $jsonPointer->getPropertyPathAsString()
  51826. ));
  51827. }
  51828. $refSchema = $this->getSchema($fileName);
  51829. foreach ($jsonPointer->getPropertyPaths() as $path) {
  51830. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  51831. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  51832. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  51833. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  51834. } else {
  51835. throw new UnresolvableJsonPointerException(sprintf(
  51836. 'File: %s is found, but could not resolve fragment: %s',
  51837. $jsonPointer->getFilename(),
  51838. $jsonPointer->getPropertyPathAsString()
  51839. ));
  51840. }
  51841. }
  51842. return $refSchema;
  51843. }
  51844. public function resolveRefSchema($refSchema)
  51845. {
  51846. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  51847. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  51848. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  51849. unset($refSchema->{'$ref'});
  51850. }
  51851. return $refSchema;
  51852. }
  51853. }
  51854. <?php
  51855. namespace JsonSchema;
  51856. interface SchemaStorageInterface
  51857. {
  51858. public function addSchema($id, $schema = null);
  51859. public function getSchema($id);
  51860. public function resolveRef($ref);
  51861. public function resolveRefSchema($refSchema);
  51862. }
  51863. <?php
  51864. namespace JsonSchema\Uri\Retrievers;
  51865. abstract class AbstractRetriever implements UriRetrieverInterface
  51866. {
  51867. protected $contentType;
  51868. public function getContentType()
  51869. {
  51870. return $this->contentType;
  51871. }
  51872. }
  51873. <?php
  51874. namespace JsonSchema\Uri\Retrievers;
  51875. use JsonSchema\Exception\RuntimeException;
  51876. use JsonSchema\Validator;
  51877. class Curl extends AbstractRetriever
  51878. {
  51879. protected $messageBody;
  51880. public function __construct()
  51881. {
  51882. if (!function_exists('curl_init')) {
  51883. throw new RuntimeException('cURL not installed');
  51884. }
  51885. }
  51886. public function retrieve($uri)
  51887. {
  51888. $ch = curl_init();
  51889. curl_setopt($ch, CURLOPT_URL, $uri);
  51890. curl_setopt($ch, CURLOPT_HEADER, true);
  51891. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  51892. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  51893. $response = curl_exec($ch);
  51894. if (false === $response) {
  51895. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  51896. }
  51897. $this->fetchMessageBody($response);
  51898. $this->fetchContentType($response);
  51899. curl_close($ch);
  51900. return $this->messageBody;
  51901. }
  51902. private function fetchMessageBody($response)
  51903. {
  51904. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  51905. $this->messageBody = $match[1];
  51906. }
  51907. protected function fetchContentType($response)
  51908. {
  51909. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  51910. $this->contentType = trim($match[1]);
  51911. return true;
  51912. }
  51913. return false;
  51914. }
  51915. }
  51916. <?php
  51917. namespace JsonSchema\Uri\Retrievers;
  51918. use JsonSchema\Exception\ResourceNotFoundException;
  51919. class FileGetContents extends AbstractRetriever
  51920. {
  51921. protected $messageBody;
  51922. public function retrieve($uri)
  51923. {
  51924. $errorMessage = null;
  51925. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  51926. $errorMessage = $errstr;
  51927. });
  51928. $response = file_get_contents($uri);
  51929. restore_error_handler();
  51930. if ($errorMessage) {
  51931. throw new ResourceNotFoundException($errorMessage);
  51932. }
  51933. if (false === $response) {
  51934. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51935. }
  51936. if ($response == ''
  51937. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  51938. ) {
  51939. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  51940. }
  51941. $this->messageBody = $response;
  51942. if (!empty($http_response_header)) {
  51943. $this->fetchContentType($http_response_header);
  51944. } else {
  51945. $this->contentType = null;
  51946. }
  51947. return $this->messageBody;
  51948. }
  51949. private function fetchContentType(array $headers)
  51950. {
  51951. foreach ($headers as $header) {
  51952. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  51953. return true;
  51954. }
  51955. }
  51956. return false;
  51957. }
  51958. protected static function getContentTypeMatchInHeader($header)
  51959. {
  51960. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  51961. return trim($match[1]);
  51962. }
  51963. return null;
  51964. }
  51965. }
  51966. <?php
  51967. namespace JsonSchema\Uri\Retrievers;
  51968. use JsonSchema\Validator;
  51969. class PredefinedArray extends AbstractRetriever
  51970. {
  51971. private $schemas;
  51972. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  51973. {
  51974. $this->schemas = $schemas;
  51975. $this->contentType = $contentType;
  51976. }
  51977. public function retrieve($uri)
  51978. {
  51979. if (!array_key_exists($uri, $this->schemas)) {
  51980. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  51981. 'The JSON schema "%s" was not found.',
  51982. $uri
  51983. ));
  51984. }
  51985. return $this->schemas[$uri];
  51986. }
  51987. }
  51988. <?php
  51989. namespace JsonSchema\Uri\Retrievers;
  51990. interface UriRetrieverInterface
  51991. {
  51992. public function retrieve($uri);
  51993. public function getContentType();
  51994. }
  51995. <?php
  51996. namespace JsonSchema\Uri;
  51997. use JsonSchema\Exception\UriResolverException;
  51998. use JsonSchema\UriResolverInterface;
  51999. class UriResolver implements UriResolverInterface
  52000. {
  52001. public function parse($uri)
  52002. {
  52003. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  52004. $components = array();
  52005. if (5 < count($match)) {
  52006. $components = array(
  52007. 'scheme' => $match[2],
  52008. 'authority' => $match[4],
  52009. 'path' => $match[5]
  52010. );
  52011. }
  52012. if (7 < count($match)) {
  52013. $components['query'] = $match[7];
  52014. }
  52015. if (9 < count($match)) {
  52016. $components['fragment'] = $match[9];
  52017. }
  52018. return $components;
  52019. }
  52020. public function generate(array $components)
  52021. {
  52022. $uri = $components['scheme'] . '://'
  52023. . $components['authority']
  52024. . $components['path'];
  52025. if (array_key_exists('query', $components) && strlen($components['query'])) {
  52026. $uri .= '?' . $components['query'];
  52027. }
  52028. if (array_key_exists('fragment', $components)) {
  52029. $uri .= '#' . $components['fragment'];
  52030. }
  52031. return $uri;
  52032. }
  52033. public function resolve($uri, $baseUri = null)
  52034. {
  52035. if (
  52036. !is_null($baseUri) &&
  52037. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  52038. !preg_match('|^[^/]+://|u', $baseUri)
  52039. ) {
  52040. if (is_file($baseUri)) {
  52041. $baseUri = 'file://' . realpath($baseUri);
  52042. } elseif (is_dir($baseUri)) {
  52043. $baseUri = 'file://' . realpath($baseUri) . '/';
  52044. } else {
  52045. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  52046. }
  52047. }
  52048. if ($uri == '') {
  52049. return $baseUri;
  52050. }
  52051. $components = $this->parse($uri);
  52052. $path = $components['path'];
  52053. if (!empty($components['scheme'])) {
  52054. return $uri;
  52055. }
  52056. $baseComponents = $this->parse($baseUri);
  52057. $basePath = $baseComponents['path'];
  52058. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  52059. if (isset($components['fragment'])) {
  52060. $baseComponents['fragment'] = $components['fragment'];
  52061. }
  52062. return $this->generate($baseComponents);
  52063. }
  52064. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  52065. {
  52066. $relativePath = self::normalizePath($relativePath);
  52067. if ($relativePath == '') {
  52068. return $basePath;
  52069. }
  52070. if ($relativePath[0] == '/') {
  52071. return $relativePath;
  52072. }
  52073. $basePathSegments = explode('/', $basePath);
  52074. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  52075. $numLevelUp = strlen($match[0]) /3 + 1;
  52076. if ($numLevelUp >= count($basePathSegments)) {
  52077. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  52078. }
  52079. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  52080. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  52081. return implode('/', $basePathSegments) . '/' . $path;
  52082. }
  52083. private static function normalizePath($path)
  52084. {
  52085. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  52086. $path = preg_replace('|//|', '/', $path);
  52087. return $path;
  52088. }
  52089. public function isValid($uri)
  52090. {
  52091. $components = $this->parse($uri);
  52092. return !empty($components);
  52093. }
  52094. }
  52095. <?php
  52096. namespace JsonSchema\Uri;
  52097. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  52098. use JsonSchema\Exception\JsonDecodingException;
  52099. use JsonSchema\Exception\ResourceNotFoundException;
  52100. use JsonSchema\Uri\Retrievers\FileGetContents;
  52101. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  52102. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  52103. use JsonSchema\Validator;
  52104. class UriRetriever implements BaseUriRetrieverInterface
  52105. {
  52106. protected $translationMap = array(
  52107. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  52108. );
  52109. protected $allowedInvalidContentTypeEndpoints = array(
  52110. 'http://json-schema.org/',
  52111. 'https://json-schema.org/'
  52112. );
  52113. protected $uriRetriever = null;
  52114. private $schemaCache = array();
  52115. public function addInvalidContentTypeEndpoint($endpoint)
  52116. {
  52117. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  52118. }
  52119. public function confirmMediaType($uriRetriever, $uri)
  52120. {
  52121. $contentType = $uriRetriever->getContentType();
  52122. if (is_null($contentType)) {
  52123. return;
  52124. }
  52125. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  52126. return;
  52127. }
  52128. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  52129. if (strpos($uri, $endpoint) === 0) {
  52130. return true;
  52131. }
  52132. }
  52133. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  52134. }
  52135. public function getUriRetriever()
  52136. {
  52137. if (is_null($this->uriRetriever)) {
  52138. $this->setUriRetriever(new FileGetContents());
  52139. }
  52140. return $this->uriRetriever;
  52141. }
  52142. public function resolvePointer($jsonSchema, $uri)
  52143. {
  52144. $resolver = new UriResolver();
  52145. $parsed = $resolver->parse($uri);
  52146. if (empty($parsed['fragment'])) {
  52147. return $jsonSchema;
  52148. }
  52149. $path = explode('/', $parsed['fragment']);
  52150. while ($path) {
  52151. $pathElement = array_shift($path);
  52152. if (!empty($pathElement)) {
  52153. $pathElement = str_replace('~1', '/', $pathElement);
  52154. $pathElement = str_replace('~0', '~', $pathElement);
  52155. if (!empty($jsonSchema->$pathElement)) {
  52156. $jsonSchema = $jsonSchema->$pathElement;
  52157. } else {
  52158. throw new ResourceNotFoundException(
  52159. 'Fragment "' . $parsed['fragment'] . '" not found'
  52160. . ' in ' . $uri
  52161. );
  52162. }
  52163. if (!is_object($jsonSchema)) {
  52164. throw new ResourceNotFoundException(
  52165. 'Fragment part "' . $pathElement . '" is no object '
  52166. . ' in ' . $uri
  52167. );
  52168. }
  52169. }
  52170. }
  52171. return $jsonSchema;
  52172. }
  52173. public function retrieve($uri, $baseUri = null, $translate = true)
  52174. {
  52175. $resolver = new UriResolver();
  52176. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  52177. $arParts = $resolver->parse($resolvedUri);
  52178. if (isset($arParts['fragment'])) {
  52179. unset($arParts['fragment']);
  52180. $fetchUri = $resolver->generate($arParts);
  52181. }
  52182. if ($translate) {
  52183. $fetchUri = $this->translate($fetchUri);
  52184. }
  52185. $jsonSchema = $this->loadSchema($fetchUri);
  52186. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  52187. if ($jsonSchema instanceof \stdClass) {
  52188. $jsonSchema->id = $resolvedUri;
  52189. }
  52190. return $jsonSchema;
  52191. }
  52192. protected function loadSchema($fetchUri)
  52193. {
  52194. if (isset($this->schemaCache[$fetchUri])) {
  52195. return $this->schemaCache[$fetchUri];
  52196. }
  52197. $uriRetriever = $this->getUriRetriever();
  52198. $contents = $this->uriRetriever->retrieve($fetchUri);
  52199. $this->confirmMediaType($uriRetriever, $fetchUri);
  52200. $jsonSchema = json_decode($contents);
  52201. if (JSON_ERROR_NONE < $error = json_last_error()) {
  52202. throw new JsonDecodingException($error);
  52203. }
  52204. $this->schemaCache[$fetchUri] = $jsonSchema;
  52205. return $jsonSchema;
  52206. }
  52207. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  52208. {
  52209. $this->uriRetriever = $uriRetriever;
  52210. return $this;
  52211. }
  52212. public function parse($uri)
  52213. {
  52214. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  52215. $components = array();
  52216. if (5 < count($match)) {
  52217. $components = array(
  52218. 'scheme' => $match[2],
  52219. 'authority' => $match[4],
  52220. 'path' => $match[5]
  52221. );
  52222. }
  52223. if (7 < count($match)) {
  52224. $components['query'] = $match[7];
  52225. }
  52226. if (9 < count($match)) {
  52227. $components['fragment'] = $match[9];
  52228. }
  52229. return $components;
  52230. }
  52231. public function generate(array $components)
  52232. {
  52233. $uri = $components['scheme'] . '://'
  52234. . $components['authority']
  52235. . $components['path'];
  52236. if (array_key_exists('query', $components)) {
  52237. $uri .= $components['query'];
  52238. }
  52239. if (array_key_exists('fragment', $components)) {
  52240. $uri .= $components['fragment'];
  52241. }
  52242. return $uri;
  52243. }
  52244. public function resolve($uri, $baseUri = null)
  52245. {
  52246. $components = $this->parse($uri);
  52247. $path = $components['path'];
  52248. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  52249. return $uri;
  52250. }
  52251. $baseComponents = $this->parse($baseUri);
  52252. $basePath = $baseComponents['path'];
  52253. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  52254. return $this->generate($baseComponents);
  52255. }
  52256. public function isValid($uri)
  52257. {
  52258. $components = $this->parse($uri);
  52259. return !empty($components);
  52260. }
  52261. public function setTranslation($from, $to)
  52262. {
  52263. $this->translationMap[$from] = $to;
  52264. }
  52265. public function translate($uri)
  52266. {
  52267. foreach ($this->translationMap as $from => $to) {
  52268. $uri = preg_replace($from, $to, $uri);
  52269. }
  52270. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  52271. return $uri;
  52272. }
  52273. }
  52274. <?php
  52275. namespace JsonSchema;
  52276. interface UriResolverInterface
  52277. {
  52278. public function resolve($uri, $baseUri = null);
  52279. }
  52280. <?php
  52281. namespace JsonSchema;
  52282. interface UriRetrieverInterface
  52283. {
  52284. public function retrieve($uri, $baseUri = null);
  52285. }
  52286. <?php
  52287. namespace JsonSchema;
  52288. use JsonSchema\Constraints\BaseConstraint;
  52289. use JsonSchema\Constraints\Constraint;
  52290. class Validator extends BaseConstraint
  52291. {
  52292. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  52293. const ERROR_NONE = 0x00000000;
  52294. const ERROR_ALL = 0xFFFFFFFF;
  52295. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  52296. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  52297. public function validate(&$value, $schema = null, $checkMode = null)
  52298. {
  52299. if (is_array($schema)) {
  52300. $schema = self::arrayToObjectRecursive($schema);
  52301. }
  52302. $initialCheckMode = $this->factory->getConfig();
  52303. if ($checkMode !== null) {
  52304. $this->factory->setConfig($checkMode);
  52305. }
  52306. if (is_object($schema) && property_exists($schema, 'id')) {
  52307. $schemaURI = $schema->id;
  52308. } else {
  52309. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  52310. }
  52311. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  52312. $validator = $this->factory->createInstanceFor('schema');
  52313. $validator->check(
  52314. $value,
  52315. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  52316. );
  52317. $this->factory->setConfig($initialCheckMode);
  52318. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  52319. return $validator->getErrorMask();
  52320. }
  52321. public function check($value, $schema)
  52322. {
  52323. return $this->validate($value, $schema);
  52324. }
  52325. public function coerce(&$value, $schema)
  52326. {
  52327. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  52328. }
  52329. }
  52330. Copyright (C) 2015 Composer
  52331. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52332. this software and associated documentation files (the "Software"), to deal in
  52333. the Software without restriction, including without limitation the rights to
  52334. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52335. of the Software, and to permit persons to whom the Software is furnished to do
  52336. so, subject to the following conditions:
  52337. The above copyright notice and this permission notice shall be included in all
  52338. copies or substantial portions of the Software.
  52339. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52340. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52341. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52342. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52343. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52344. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52345. SOFTWARE.
  52346. <?php
  52347. namespace Composer\Spdx;
  52348. class SpdxLicenses
  52349. {
  52350. const LICENSES_FILE = 'spdx-licenses.json';
  52351. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  52352. private $licenses;
  52353. private $licensesExpression;
  52354. private $exceptions;
  52355. private $exceptionsExpression;
  52356. public function __construct()
  52357. {
  52358. $this->loadLicenses();
  52359. $this->loadExceptions();
  52360. }
  52361. public function getLicenseByIdentifier($identifier)
  52362. {
  52363. $key = strtolower($identifier);
  52364. if (!isset($this->licenses[$key])) {
  52365. return;
  52366. }
  52367. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  52368. return array(
  52369. $name,
  52370. $isOsiApproved,
  52371. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  52372. $isDeprecatedLicenseId,
  52373. );
  52374. }
  52375. public function getLicenses()
  52376. {
  52377. return $this->licenses;
  52378. }
  52379. public function getExceptionByIdentifier($identifier)
  52380. {
  52381. $key = strtolower($identifier);
  52382. if (!isset($this->exceptions[$key])) {
  52383. return;
  52384. }
  52385. list($identifier, $name) = $this->exceptions[$key];
  52386. return array(
  52387. $name,
  52388. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  52389. );
  52390. }
  52391. public function getIdentifierByName($name)
  52392. {
  52393. foreach ($this->licenses as $licenseData) {
  52394. if ($licenseData[1] === $name) {
  52395. return $licenseData[0];
  52396. }
  52397. }
  52398. foreach ($this->exceptions as $licenseData) {
  52399. if ($licenseData[1] === $name) {
  52400. return $licenseData[0];
  52401. }
  52402. }
  52403. }
  52404. public function isOsiApprovedByIdentifier($identifier)
  52405. {
  52406. return $this->licenses[strtolower($identifier)][2];
  52407. }
  52408. public function isDeprecatedByIdentifier($identifier)
  52409. {
  52410. return $this->licenses[strtolower($identifier)][3];
  52411. }
  52412. public function validate($license)
  52413. {
  52414. if (is_array($license)) {
  52415. $count = count($license);
  52416. if ($count !== count(array_filter($license, 'is_string'))) {
  52417. throw new \InvalidArgumentException('Array of strings expected.');
  52418. }
  52419. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  52420. }
  52421. if (!is_string($license)) {
  52422. throw new \InvalidArgumentException(sprintf(
  52423. 'Array or String expected, %s given.',
  52424. gettype($license)
  52425. ));
  52426. }
  52427. return $this->isValidLicenseString($license);
  52428. }
  52429. public static function getResourcesDir()
  52430. {
  52431. return dirname(__DIR__) . '/res';
  52432. }
  52433. private function loadLicenses()
  52434. {
  52435. if (null !== $this->licenses) {
  52436. return;
  52437. }
  52438. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  52439. $this->licenses = array();
  52440. foreach (json_decode($json, true) as $identifier => $license) {
  52441. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  52442. }
  52443. }
  52444. private function loadExceptions()
  52445. {
  52446. if (null !== $this->exceptions) {
  52447. return;
  52448. }
  52449. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  52450. $this->exceptions = array();
  52451. foreach (json_decode($json, true) as $identifier => $exception) {
  52452. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  52453. }
  52454. }
  52455. private function getLicensesExpression()
  52456. {
  52457. if (null === $this->licensesExpression) {
  52458. $licenses = array_map('preg_quote', array_keys($this->licenses));
  52459. rsort($licenses);
  52460. $licenses = implode('|', $licenses);
  52461. $this->licensesExpression = $licenses;
  52462. }
  52463. return $this->licensesExpression;
  52464. }
  52465. private function getExceptionsExpression()
  52466. {
  52467. if (null === $this->exceptionsExpression) {
  52468. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  52469. rsort($exceptions);
  52470. $exceptions = implode('|', $exceptions);
  52471. $this->exceptionsExpression = $exceptions;
  52472. }
  52473. return $this->exceptionsExpression;
  52474. }
  52475. private function isValidLicenseString($license)
  52476. {
  52477. if (isset($this->licenses[strtolower($license)])) {
  52478. return true;
  52479. }
  52480. $licenses = $this->getLicensesExpression();
  52481. $exceptions = $this->getExceptionsExpression();
  52482. $regex = <<<REGEX
  52483. {
  52484. (?(DEFINE)
  52485. # idstring: 1*( ALPHA / DIGIT / - / . )
  52486. (?<idstring>[\pL\pN.-]{1,})
  52487. # license-id: taken from list
  52488. (?<licenseid>${licenses})
  52489. # license-exception-id: taken from list
  52490. (?<licenseexceptionid>${exceptions})
  52491. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  52492. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  52493. # simple-expresssion: license-id / license-id+ / license-ref
  52494. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  52495. # compound-expression: 1*(
  52496. # simple-expression /
  52497. # simple-expression WITH license-exception-id /
  52498. # compound-expression AND compound-expression /
  52499. # compound-expression OR compound-expression
  52500. # ) / ( compound-expression ) )
  52501. (?<compound_head>
  52502. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  52503. | \( \s* (?&compound_expression) \s* \)
  52504. )
  52505. (?<compound_expression>
  52506. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  52507. )
  52508. # license-expression: 1*1(simple-expression / compound-expression)
  52509. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  52510. ) # end of define
  52511. ^(NONE | NOASSERTION | (?&license_expression))$
  52512. }xi
  52513. REGEX;
  52514. $match = preg_match($regex, $license);
  52515. if (0 === $match) {
  52516. return false;
  52517. }
  52518. if (false === $match) {
  52519. throw new \RuntimeException('Regex failed to compile/run.');
  52520. }
  52521. return true;
  52522. }
  52523. }
  52524. Copyright (C) 2015 Composer
  52525. Permission is hereby granted, free of charge, to any person obtaining a copy of
  52526. this software and associated documentation files (the "Software"), to deal in
  52527. the Software without restriction, including without limitation the rights to
  52528. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  52529. of the Software, and to permit persons to whom the Software is furnished to do
  52530. so, subject to the following conditions:
  52531. The above copyright notice and this permission notice shall be included in all
  52532. copies or substantial portions of the Software.
  52533. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  52534. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  52535. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  52536. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  52537. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  52538. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  52539. SOFTWARE.
  52540. <?php
  52541. namespace Composer\Semver;
  52542. use Composer\Semver\Constraint\Constraint;
  52543. class Comparator
  52544. {
  52545. public static function greaterThan($version1, $version2)
  52546. {
  52547. return self::compare($version1, '>', $version2);
  52548. }
  52549. public static function greaterThanOrEqualTo($version1, $version2)
  52550. {
  52551. return self::compare($version1, '>=', $version2);
  52552. }
  52553. public static function lessThan($version1, $version2)
  52554. {
  52555. return self::compare($version1, '<', $version2);
  52556. }
  52557. public static function lessThanOrEqualTo($version1, $version2)
  52558. {
  52559. return self::compare($version1, '<=', $version2);
  52560. }
  52561. public static function equalTo($version1, $version2)
  52562. {
  52563. return self::compare($version1, '==', $version2);
  52564. }
  52565. public static function notEqualTo($version1, $version2)
  52566. {
  52567. return self::compare($version1, '!=', $version2);
  52568. }
  52569. public static function compare($version1, $operator, $version2)
  52570. {
  52571. $constraint = new Constraint($operator, $version2);
  52572. return $constraint->matches(new Constraint('==', $version1));
  52573. }
  52574. }
  52575. <?php
  52576. namespace Composer\Semver\Constraint;
  52577. trigger_error('The ' . __NAMESPACE__ . '\AbstractConstraint abstract class is deprecated, there is no replacement for it, it will be removed in the next major version.', E_USER_DEPRECATED);
  52578. abstract class AbstractConstraint implements ConstraintInterface
  52579. {
  52580. protected $prettyString;
  52581. public function matches(ConstraintInterface $provider)
  52582. {
  52583. if ($provider instanceof $this) {
  52584. return $this->matchSpecific($provider);
  52585. }
  52586. return $provider->matches($this);
  52587. }
  52588. public function setPrettyString($prettyString)
  52589. {
  52590. $this->prettyString = $prettyString;
  52591. }
  52592. public function getPrettyString()
  52593. {
  52594. if ($this->prettyString) {
  52595. return $this->prettyString;
  52596. }
  52597. return $this->__toString();
  52598. }
  52599. }
  52600. <?php
  52601. namespace Composer\Semver\Constraint;
  52602. class Constraint implements ConstraintInterface
  52603. {
  52604. const OP_EQ = 0;
  52605. const OP_LT = 1;
  52606. const OP_LE = 2;
  52607. const OP_GT = 3;
  52608. const OP_GE = 4;
  52609. const OP_NE = 5;
  52610. private static $transOpStr = array(
  52611. '=' => self::OP_EQ,
  52612. '==' => self::OP_EQ,
  52613. '<' => self::OP_LT,
  52614. '<=' => self::OP_LE,
  52615. '>' => self::OP_GT,
  52616. '>=' => self::OP_GE,
  52617. '<>' => self::OP_NE,
  52618. '!=' => self::OP_NE,
  52619. );
  52620. private static $transOpInt = array(
  52621. self::OP_EQ => '==',
  52622. self::OP_LT => '<',
  52623. self::OP_LE => '<=',
  52624. self::OP_GT => '>',
  52625. self::OP_GE => '>=',
  52626. self::OP_NE => '!=',
  52627. );
  52628. protected $operator;
  52629. protected $version;
  52630. protected $prettyString;
  52631. public function matches(ConstraintInterface $provider)
  52632. {
  52633. if ($provider instanceof $this) {
  52634. return $this->matchSpecific($provider);
  52635. }
  52636. return $provider->matches($this);
  52637. }
  52638. public function setPrettyString($prettyString)
  52639. {
  52640. $this->prettyString = $prettyString;
  52641. }
  52642. public function getPrettyString()
  52643. {
  52644. if ($this->prettyString) {
  52645. return $this->prettyString;
  52646. }
  52647. return $this->__toString();
  52648. }
  52649. public static function getSupportedOperators()
  52650. {
  52651. return array_keys(self::$transOpStr);
  52652. }
  52653. public function __construct($operator, $version)
  52654. {
  52655. if (!isset(self::$transOpStr[$operator])) {
  52656. throw new \InvalidArgumentException(sprintf(
  52657. 'Invalid operator "%s" given, expected one of: %s',
  52658. $operator,
  52659. implode(', ', self::getSupportedOperators())
  52660. ));
  52661. }
  52662. $this->operator = self::$transOpStr[$operator];
  52663. $this->version = $version;
  52664. }
  52665. public function versionCompare($a, $b, $operator, $compareBranches = false)
  52666. {
  52667. if (!isset(self::$transOpStr[$operator])) {
  52668. throw new \InvalidArgumentException(sprintf(
  52669. 'Invalid operator "%s" given, expected one of: %s',
  52670. $operator,
  52671. implode(', ', self::getSupportedOperators())
  52672. ));
  52673. }
  52674. $aIsBranch = 'dev-' === substr($a, 0, 4);
  52675. $bIsBranch = 'dev-' === substr($b, 0, 4);
  52676. if ($aIsBranch && $bIsBranch) {
  52677. return $operator === '==' && $a === $b;
  52678. }
  52679. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  52680. return false;
  52681. }
  52682. return version_compare($a, $b, $operator);
  52683. }
  52684. public function matchSpecific(Constraint $provider, $compareBranches = false)
  52685. {
  52686. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  52687. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  52688. $isEqualOp = self::OP_EQ === $this->operator;
  52689. $isNonEqualOp = self::OP_NE === $this->operator;
  52690. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  52691. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  52692. if ($isNonEqualOp || $isProviderNonEqualOp) {
  52693. return (!$isEqualOp && !$isProviderEqualOp)
  52694. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  52695. }
  52696. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  52697. return true;
  52698. }
  52699. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  52700. return !($provider->version === $this->version
  52701. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  52702. && self::$transOpInt[$this->operator] !== $noEqualOp);
  52703. }
  52704. return false;
  52705. }
  52706. public function __toString()
  52707. {
  52708. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  52709. }
  52710. }
  52711. <?php
  52712. namespace Composer\Semver\Constraint;
  52713. interface ConstraintInterface
  52714. {
  52715. public function matches(ConstraintInterface $provider);
  52716. public function getPrettyString();
  52717. public function __toString();
  52718. }
  52719. <?php
  52720. namespace Composer\Semver\Constraint;
  52721. class EmptyConstraint implements ConstraintInterface
  52722. {
  52723. protected $prettyString;
  52724. public function matches(ConstraintInterface $provider)
  52725. {
  52726. return true;
  52727. }
  52728. public function setPrettyString($prettyString)
  52729. {
  52730. $this->prettyString = $prettyString;
  52731. }
  52732. public function getPrettyString()
  52733. {
  52734. if ($this->prettyString) {
  52735. return $this->prettyString;
  52736. }
  52737. return (string) $this;
  52738. }
  52739. public function __toString()
  52740. {
  52741. return '[]';
  52742. }
  52743. }
  52744. <?php
  52745. namespace Composer\Semver\Constraint;
  52746. class MultiConstraint implements ConstraintInterface
  52747. {
  52748. protected $constraints;
  52749. protected $prettyString;
  52750. protected $conjunctive;
  52751. public function __construct(array $constraints, $conjunctive = true)
  52752. {
  52753. $this->constraints = $constraints;
  52754. $this->conjunctive = $conjunctive;
  52755. }
  52756. public function getConstraints()
  52757. {
  52758. return $this->constraints;
  52759. }
  52760. public function isConjunctive()
  52761. {
  52762. return $this->conjunctive;
  52763. }
  52764. public function isDisjunctive()
  52765. {
  52766. return !$this->conjunctive;
  52767. }
  52768. public function matches(ConstraintInterface $provider)
  52769. {
  52770. if (false === $this->conjunctive) {
  52771. foreach ($this->constraints as $constraint) {
  52772. if ($constraint->matches($provider)) {
  52773. return true;
  52774. }
  52775. }
  52776. return false;
  52777. }
  52778. foreach ($this->constraints as $constraint) {
  52779. if (!$constraint->matches($provider)) {
  52780. return false;
  52781. }
  52782. }
  52783. return true;
  52784. }
  52785. public function setPrettyString($prettyString)
  52786. {
  52787. $this->prettyString = $prettyString;
  52788. }
  52789. public function getPrettyString()
  52790. {
  52791. if ($this->prettyString) {
  52792. return $this->prettyString;
  52793. }
  52794. return (string) $this;
  52795. }
  52796. public function __toString()
  52797. {
  52798. $constraints = array();
  52799. foreach ($this->constraints as $constraint) {
  52800. $constraints[] = (string) $constraint;
  52801. }
  52802. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  52803. }
  52804. }
  52805. <?php
  52806. namespace Composer\Semver;
  52807. use Composer\Semver\Constraint\Constraint;
  52808. class Semver
  52809. {
  52810. const SORT_ASC = 1;
  52811. const SORT_DESC = -1;
  52812. private static $versionParser;
  52813. public static function satisfies($version, $constraints)
  52814. {
  52815. if (null === self::$versionParser) {
  52816. self::$versionParser = new VersionParser();
  52817. }
  52818. $versionParser = self::$versionParser;
  52819. $provider = new Constraint('==', $versionParser->normalize($version));
  52820. $parsedConstraints = $versionParser->parseConstraints($constraints);
  52821. return $parsedConstraints->matches($provider);
  52822. }
  52823. public static function satisfiedBy(array $versions, $constraints)
  52824. {
  52825. $versions = array_filter($versions, function ($version) use ($constraints) {
  52826. return Semver::satisfies($version, $constraints);
  52827. });
  52828. return array_values($versions);
  52829. }
  52830. public static function sort(array $versions)
  52831. {
  52832. return self::usort($versions, self::SORT_ASC);
  52833. }
  52834. public static function rsort(array $versions)
  52835. {
  52836. return self::usort($versions, self::SORT_DESC);
  52837. }
  52838. private static function usort(array $versions, $direction)
  52839. {
  52840. if (null === self::$versionParser) {
  52841. self::$versionParser = new VersionParser();
  52842. }
  52843. $versionParser = self::$versionParser;
  52844. $normalized = array();
  52845. foreach ($versions as $key => $version) {
  52846. $normalized[] = array($versionParser->normalize($version), $key);
  52847. }
  52848. usort($normalized, function (array $left, array $right) use ($direction) {
  52849. if ($left[0] === $right[0]) {
  52850. return 0;
  52851. }
  52852. if (Comparator::lessThan($left[0], $right[0])) {
  52853. return -$direction;
  52854. }
  52855. return $direction;
  52856. });
  52857. $sorted = array();
  52858. foreach ($normalized as $item) {
  52859. $sorted[] = $versions[$item[1]];
  52860. }
  52861. return $sorted;
  52862. }
  52863. }
  52864. <?php
  52865. namespace Composer\Semver;
  52866. use Composer\Semver\Constraint\ConstraintInterface;
  52867. use Composer\Semver\Constraint\EmptyConstraint;
  52868. use Composer\Semver\Constraint\MultiConstraint;
  52869. use Composer\Semver\Constraint\Constraint;
  52870. class VersionParser
  52871. {
  52872. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  52873. private static $stabilitiesRegex = 'stable|RC|beta|alpha|dev';
  52874. public static function parseStability($version)
  52875. {
  52876. $version = preg_replace('{#.+$}i', '', $version);
  52877. if (strpos($version, 'dev-') === 0 || '-dev' === substr($version, -4)) {
  52878. return 'dev';
  52879. }
  52880. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  52881. if (!empty($match[3])) {
  52882. return 'dev';
  52883. }
  52884. if (!empty($match[1])) {
  52885. if ('beta' === $match[1] || 'b' === $match[1]) {
  52886. return 'beta';
  52887. }
  52888. if ('alpha' === $match[1] || 'a' === $match[1]) {
  52889. return 'alpha';
  52890. }
  52891. if ('rc' === $match[1]) {
  52892. return 'RC';
  52893. }
  52894. }
  52895. return 'stable';
  52896. }
  52897. public static function normalizeStability($stability)
  52898. {
  52899. $stability = strtolower($stability);
  52900. return $stability === 'rc' ? 'RC' : $stability;
  52901. }
  52902. public function normalize($version, $fullVersion = null)
  52903. {
  52904. $version = trim($version);
  52905. $origVersion = $version;
  52906. if (null === $fullVersion) {
  52907. $fullVersion = $version;
  52908. }
  52909. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  52910. $version = $match[1];
  52911. }
  52912. if (preg_match('{@(?:' . self::$stabilitiesRegex . ')$}i', $version, $match)) {
  52913. $version = substr($version, 0, strlen($version) - strlen($match[0]));
  52914. }
  52915. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  52916. return '9999999-dev';
  52917. }
  52918. if (stripos($version, 'dev-') === 0) {
  52919. return 'dev-' . substr($version, 4);
  52920. }
  52921. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  52922. $version = $match[1];
  52923. }
  52924. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  52925. $version = $matches[1]
  52926. . (!empty($matches[2]) ? $matches[2] : '.0')
  52927. . (!empty($matches[3]) ? $matches[3] : '.0')
  52928. . (!empty($matches[4]) ? $matches[4] : '.0');
  52929. $index = 5;
  52930. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  52931. $version = preg_replace('{\D}', '.', $matches[1]);
  52932. $index = 2;
  52933. }
  52934. if (isset($index)) {
  52935. if (!empty($matches[$index])) {
  52936. if ('stable' === $matches[$index]) {
  52937. return $version;
  52938. }
  52939. $version .= '-' . $this->expandStability($matches[$index]) . (isset($matches[$index + 1]) && '' !== $matches[$index + 1] ? ltrim($matches[$index + 1], '.-') : '');
  52940. }
  52941. if (!empty($matches[$index + 2])) {
  52942. $version .= '-dev';
  52943. }
  52944. return $version;
  52945. }
  52946. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  52947. try {
  52948. $normalized = $this->normalizeBranch($match[1]);
  52949. if (strpos($normalized, 'dev-') === false) {
  52950. return $normalized;
  52951. }
  52952. } catch (\Exception $e) {
  52953. }
  52954. }
  52955. $extraMessage = '';
  52956. if (preg_match('{ +as +' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))?$}', $fullVersion)) {
  52957. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  52958. } elseif (preg_match('{^' . preg_quote($version) . '(?:@(?:'.self::$stabilitiesRegex.'))? +as +}', $fullVersion)) {
  52959. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  52960. }
  52961. throw new \UnexpectedValueException('Invalid version string "' . $origVersion . '"' . $extraMessage);
  52962. }
  52963. public function parseNumericAliasPrefix($branch)
  52964. {
  52965. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  52966. return $matches['version'] . '.';
  52967. }
  52968. return false;
  52969. }
  52970. public function normalizeBranch($name)
  52971. {
  52972. $name = trim($name);
  52973. if (in_array($name, array('master', 'trunk', 'default'))) {
  52974. return $this->normalize($name);
  52975. }
  52976. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  52977. $version = '';
  52978. for ($i = 1; $i < 5; ++$i) {
  52979. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  52980. }
  52981. return str_replace('x', '9999999', $version) . '-dev';
  52982. }
  52983. return 'dev-' . $name;
  52984. }
  52985. public function parseConstraints($constraints)
  52986. {
  52987. $prettyConstraint = $constraints;
  52988. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  52989. $orGroups = array();
  52990. foreach ($orConstraints as $constraints) {
  52991. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  52992. if (count($andConstraints) > 1) {
  52993. $constraintObjects = array();
  52994. foreach ($andConstraints as $constraint) {
  52995. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  52996. $constraintObjects[] = $parsedConstraint;
  52997. }
  52998. }
  52999. } else {
  53000. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  53001. }
  53002. if (1 === count($constraintObjects)) {
  53003. $constraint = $constraintObjects[0];
  53004. } else {
  53005. $constraint = new MultiConstraint($constraintObjects);
  53006. }
  53007. $orGroups[] = $constraint;
  53008. }
  53009. if (1 === count($orGroups)) {
  53010. $constraint = $orGroups[0];
  53011. } elseif (2 === count($orGroups)
  53012. && $orGroups[0] instanceof MultiConstraint
  53013. && $orGroups[1] instanceof MultiConstraint
  53014. && 2 === count($orGroups[0]->getConstraints())
  53015. && 2 === count($orGroups[1]->getConstraints())
  53016. && ($a = (string) $orGroups[0])
  53017. && strpos($a, '[>=') === 0 && (false !== ($posA = strpos($a, '<', 4)))
  53018. && ($b = (string) $orGroups[1])
  53019. && strpos($b, '[>=') === 0 && (false !== ($posB = strpos($b, '<', 4)))
  53020. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  53021. ) {
  53022. $constraint = new MultiConstraint(array(
  53023. new Constraint('>=', substr($a, 4, $posA - 5)),
  53024. new Constraint('<', substr($b, $posB + 2, -1)),
  53025. ));
  53026. } else {
  53027. $constraint = new MultiConstraint($orGroups, false);
  53028. }
  53029. $constraint->setPrettyString($prettyConstraint);
  53030. return $constraint;
  53031. }
  53032. private function parseConstraint($constraint)
  53033. {
  53034. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $constraint, $match)) {
  53035. $constraint = $match[1];
  53036. }
  53037. if (preg_match('{^([^,\s]*?)@(' . self::$stabilitiesRegex . ')$}i', $constraint, $match)) {
  53038. $constraint = '' !== $match[1] ? $match[1] : '*';
  53039. if ($match[2] !== 'stable') {
  53040. $stabilityModifier = $match[2];
  53041. }
  53042. }
  53043. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraint, $match)) {
  53044. $constraint = $match[1];
  53045. }
  53046. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  53047. return array(new EmptyConstraint());
  53048. }
  53049. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?(?:' . self::$modifierRegex . '|\.([xX*][.-]?dev))(?:\+[^\s]+)?';
  53050. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  53051. if (strpos($constraint, '~>') === 0) {
  53052. throw new \UnexpectedValueException(
  53053. 'Could not parse version constraint ' . $constraint . ': ' .
  53054. 'Invalid operator "~>", you probably meant to use the "~" operator'
  53055. );
  53056. }
  53057. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  53058. $position = 4;
  53059. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53060. $position = 3;
  53061. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53062. $position = 2;
  53063. } else {
  53064. $position = 1;
  53065. }
  53066. if (!empty($matches[8])) {
  53067. $position++;
  53068. }
  53069. $stabilitySuffix = '';
  53070. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  53071. $stabilitySuffix .= '-dev';
  53072. }
  53073. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53074. $lowerBound = new Constraint('>=', $lowVersion);
  53075. $highPosition = max(1, $position - 1);
  53076. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  53077. $upperBound = new Constraint('<', $highVersion);
  53078. return array(
  53079. $lowerBound,
  53080. $upperBound,
  53081. );
  53082. }
  53083. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  53084. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  53085. $position = 1;
  53086. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  53087. $position = 2;
  53088. } else {
  53089. $position = 3;
  53090. }
  53091. $stabilitySuffix = '';
  53092. if (empty($matches[5]) && empty($matches[7]) && empty($matches[8])) {
  53093. $stabilitySuffix .= '-dev';
  53094. }
  53095. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  53096. $lowerBound = new Constraint('>=', $lowVersion);
  53097. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53098. $upperBound = new Constraint('<', $highVersion);
  53099. return array(
  53100. $lowerBound,
  53101. $upperBound,
  53102. );
  53103. }
  53104. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  53105. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  53106. $position = 3;
  53107. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  53108. $position = 2;
  53109. } else {
  53110. $position = 1;
  53111. }
  53112. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  53113. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  53114. if ($lowVersion === '0.0.0.0-dev') {
  53115. return array(new Constraint('<', $highVersion));
  53116. }
  53117. return array(
  53118. new Constraint('>=', $lowVersion),
  53119. new Constraint('<', $highVersion),
  53120. );
  53121. }
  53122. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  53123. $lowStabilitySuffix = '';
  53124. if (empty($matches[6]) && empty($matches[8]) && empty($matches[9])) {
  53125. $lowStabilitySuffix = '-dev';
  53126. }
  53127. $lowVersion = $this->normalize($matches['from']);
  53128. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  53129. $empty = function ($x) {
  53130. return ($x === 0 || $x === '0') ? false : empty($x);
  53131. };
  53132. if ((!$empty($matches[12]) && !$empty($matches[13])) || !empty($matches[15]) || !empty($matches[17]) || !empty($matches[18])) {
  53133. $highVersion = $this->normalize($matches['to']);
  53134. $upperBound = new Constraint('<=', $highVersion);
  53135. } else {
  53136. $highMatch = array('', $matches[11], $matches[12], $matches[13], $matches[14]);
  53137. $this->normalize($matches['to']);
  53138. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[12]) ? 1 : 2, 1) . '-dev';
  53139. $upperBound = new Constraint('<', $highVersion);
  53140. }
  53141. return array(
  53142. $lowerBound,
  53143. $upperBound,
  53144. );
  53145. }
  53146. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  53147. try {
  53148. try {
  53149. $version = $this->normalize($matches[2]);
  53150. } catch (\UnexpectedValueException $e) {
  53151. if (substr($matches[2], -4) === '-dev' && preg_match('{^[0-9a-zA-Z-./]+$}', $matches[2])) {
  53152. $version = $this->normalize('dev-'.substr($matches[2], 0, -4));
  53153. } else {
  53154. throw $e;
  53155. }
  53156. }
  53157. $op = $matches[1] ?: '=';
  53158. if ($op !== '==' && $op !== '=' && !empty($stabilityModifier) && self::parseStability($version) === 'stable') {
  53159. $version .= '-' . $stabilityModifier;
  53160. } elseif ('<' === $op || '>=' === $op) {
  53161. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  53162. if (strpos($matches[2], 'dev-') !== 0) {
  53163. $version .= '-dev';
  53164. }
  53165. }
  53166. }
  53167. return array(new Constraint($matches[1] ?: '=', $version));
  53168. } catch (\Exception $e) {
  53169. }
  53170. }
  53171. $message = 'Could not parse version constraint ' . $constraint;
  53172. if (isset($e)) {
  53173. $message .= ': ' . $e->getMessage();
  53174. }
  53175. throw new \UnexpectedValueException($message);
  53176. }
  53177. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  53178. {
  53179. for ($i = 4; $i > 0; --$i) {
  53180. if ($i > $position) {
  53181. $matches[$i] = $pad;
  53182. } elseif ($i === $position && $increment) {
  53183. $matches[$i] += $increment;
  53184. if ($matches[$i] < 0) {
  53185. $matches[$i] = $pad;
  53186. --$position;
  53187. if ($i === 1) {
  53188. return null;
  53189. }
  53190. }
  53191. }
  53192. }
  53193. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  53194. }
  53195. private function expandStability($stability)
  53196. {
  53197. $stability = strtolower($stability);
  53198. switch ($stability) {
  53199. case 'a':
  53200. return 'alpha';
  53201. case 'b':
  53202. return 'beta';
  53203. case 'p':
  53204. case 'pl':
  53205. return 'patch';
  53206. case 'rc':
  53207. return 'RC';
  53208. default:
  53209. return $stability;
  53210. }
  53211. }
  53212. }
  53213. Copyright (C) 2016 Composer
  53214. Permission is hereby granted, free of charge, to any person obtaining a copy of
  53215. this software and associated documentation files (the "Software"), to deal in
  53216. the Software without restriction, including without limitation the rights to
  53217. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  53218. of the Software, and to permit persons to whom the Software is furnished to do
  53219. so, subject to the following conditions:
  53220. The above copyright notice and this permission notice shall be included in all
  53221. copies or substantial portions of the Software.
  53222. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53223. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53224. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53225. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53226. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53227. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53228. SOFTWARE.
  53229. <?php
  53230. namespace Composer\CaBundle;
  53231. use Psr\Log\LoggerInterface;
  53232. use Symfony\Component\Process\PhpProcess;
  53233. class CaBundle
  53234. {
  53235. private static $caPath;
  53236. private static $caFileValidity = array();
  53237. private static $useOpensslParse;
  53238. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  53239. {
  53240. if (self::$caPath !== null) {
  53241. return self::$caPath;
  53242. }
  53243. $caBundlePaths = array();
  53244. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_FILE');
  53245. $caBundlePaths[] = self::getEnvVariable('SSL_CERT_DIR');
  53246. $caBundlePaths[] = ini_get('openssl.cafile');
  53247. $caBundlePaths[] = ini_get('openssl.capath');
  53248. $otherLocations = array(
  53249. '/etc/pki/tls/certs/ca-bundle.crt',
  53250. '/etc/ssl/certs/ca-certificates.crt',
  53251. '/etc/ssl/ca-bundle.pem',
  53252. '/usr/local/share/certs/ca-root-nss.crt',
  53253. '/usr/ssl/certs/ca-bundle.crt',
  53254. '/opt/local/share/curl/curl-ca-bundle.crt',
  53255. '/usr/local/share/curl/curl-ca-bundle.crt',
  53256. '/usr/share/ssl/certs/ca-bundle.crt',
  53257. '/etc/ssl/cert.pem',
  53258. '/usr/local/etc/ssl/cert.pem',
  53259. '/usr/local/etc/openssl/cert.pem',
  53260. '/usr/local/etc/openssl@1.1/cert.pem',
  53261. );
  53262. foreach($otherLocations as $location) {
  53263. $otherLocations[] = dirname($location);
  53264. }
  53265. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  53266. foreach ($caBundlePaths as $caBundle) {
  53267. if (self::caFileUsable($caBundle, $logger)) {
  53268. return self::$caPath = $caBundle;
  53269. }
  53270. if (self::caDirUsable($caBundle)) {
  53271. return self::$caPath = $caBundle;
  53272. }
  53273. }
  53274. return self::$caPath = static::getBundledCaBundlePath();
  53275. }
  53276. public static function getBundledCaBundlePath()
  53277. {
  53278. $caBundleFile = __DIR__.'/../res/cacert.pem';
  53279. if (0 === strpos($caBundleFile, 'phar://')) {
  53280. file_put_contents(
  53281. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  53282. file_get_contents($caBundleFile)
  53283. );
  53284. register_shutdown_function(function() use ($tempCaBundleFile) {
  53285. @unlink($tempCaBundleFile);
  53286. });
  53287. $caBundleFile = $tempCaBundleFile;
  53288. }
  53289. return $caBundleFile;
  53290. }
  53291. public static function validateCaFile($filename, LoggerInterface $logger = null)
  53292. {
  53293. static $warned = false;
  53294. if (isset(self::$caFileValidity[$filename])) {
  53295. return self::$caFileValidity[$filename];
  53296. }
  53297. $contents = file_get_contents($filename);
  53298. if (!static::isOpensslParseSafe()) {
  53299. if (!$warned && $logger) {
  53300. $logger->warning(sprintf(
  53301. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  53302. PHP_VERSION
  53303. ));
  53304. $warned = true;
  53305. }
  53306. $isValid = !empty($contents);
  53307. } else {
  53308. $contents = preg_replace("/^(\\-+(?:BEGIN|END))\\s+TRUSTED\\s+(CERTIFICATE\\-+)\$/m", '$1 $2', $contents);
  53309. $isValid = (bool) openssl_x509_parse($contents);
  53310. }
  53311. if ($logger) {
  53312. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  53313. }
  53314. return self::$caFileValidity[$filename] = $isValid;
  53315. }
  53316. public static function isOpensslParseSafe()
  53317. {
  53318. if (null !== self::$useOpensslParse) {
  53319. return self::$useOpensslParse;
  53320. }
  53321. if (PHP_VERSION_ID >= 50600) {
  53322. return self::$useOpensslParse = true;
  53323. }
  53324. if (
  53325. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  53326. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  53327. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  53328. ) {
  53329. return self::$useOpensslParse = true;
  53330. }
  53331. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53332. return self::$useOpensslParse = false;
  53333. }
  53334. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  53335. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  53336. if (preg_match($regex, PHP_VERSION, $m)) {
  53337. return ((int) $m[1]) >= $fixedVersion;
  53338. }
  53339. return false;
  53340. };
  53341. if (
  53342. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  53343. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  53344. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  53345. ) {
  53346. return self::$useOpensslParse = true;
  53347. }
  53348. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  53349. return self::$useOpensslParse = false;
  53350. }
  53351. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  53352. $script = <<<'EOT'
  53353. error_reporting(-1);
  53354. $info = openssl_x509_parse(base64_decode('%s'));
  53355. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  53356. EOT;
  53357. $script = '<'."?php\n".sprintf($script, $cert);
  53358. try {
  53359. $process = new PhpProcess($script);
  53360. $process->mustRun();
  53361. } catch (\Exception $e) {
  53362. return self::$useOpensslParse = false;
  53363. }
  53364. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  53365. $errorOutput = trim($process->getErrorOutput());
  53366. if (
  53367. count($output) === 3
  53368. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  53369. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  53370. && $output[2] === 'int(-1)'
  53371. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  53372. ) {
  53373. return self::$useOpensslParse = true;
  53374. }
  53375. return self::$useOpensslParse = false;
  53376. }
  53377. public static function reset()
  53378. {
  53379. self::$caFileValidity = array();
  53380. self::$caPath = null;
  53381. self::$useOpensslParse = null;
  53382. }
  53383. private static function getEnvVariable($name)
  53384. {
  53385. if (isset($_SERVER[$name])) {
  53386. return (string) $_SERVER[$name];
  53387. }
  53388. if (PHP_SAPI === 'cli' && ($value = getenv($name)) !== false && $value !== null) {
  53389. return (string) $value;
  53390. }
  53391. return false;
  53392. }
  53393. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  53394. {
  53395. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  53396. }
  53397. private static function caDirUsable($certDir)
  53398. {
  53399. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  53400. }
  53401. }
  53402. MIT License
  53403. Copyright (c) 2017 Composer
  53404. Permission is hereby granted, free of charge, to any person obtaining a copy
  53405. of this software and associated documentation files (the "Software"), to deal
  53406. in the Software without restriction, including without limitation the rights
  53407. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53408. copies of the Software, and to permit persons to whom the Software is
  53409. furnished to do so, subject to the following conditions:
  53410. The above copyright notice and this permission notice shall be included in all
  53411. copies or substantial portions of the Software.
  53412. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53413. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53414. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53415. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53416. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53417. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  53418. SOFTWARE.
  53419. <?php
  53420. namespace Composer\XdebugHandler;
  53421. class PhpConfig
  53422. {
  53423. public function useOriginal()
  53424. {
  53425. $this->getDataAndReset();
  53426. return array();
  53427. }
  53428. public function useStandard()
  53429. {
  53430. if ($data = $this->getDataAndReset()) {
  53431. return array('-n', '-c', $data['tmpIni']);
  53432. }
  53433. return array();
  53434. }
  53435. public function usePersistent()
  53436. {
  53437. if ($data = $this->getDataAndReset()) {
  53438. Process::setEnv('PHPRC', $data['tmpIni']);
  53439. Process::setEnv('PHP_INI_SCAN_DIR', '');
  53440. }
  53441. return array();
  53442. }
  53443. private function getDataAndReset()
  53444. {
  53445. if ($data = XdebugHandler::getRestartSettings()) {
  53446. Process::setEnv('PHPRC', $data['phprc']);
  53447. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  53448. }
  53449. return $data;
  53450. }
  53451. }
  53452. <?php
  53453. namespace Composer\XdebugHandler;
  53454. class Process
  53455. {
  53456. public static function addColorOption(array $args, $colorOption)
  53457. {
  53458. if (!$colorOption
  53459. || in_array($colorOption, $args)
  53460. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  53461. return $args;
  53462. }
  53463. if (isset($matches[2])) {
  53464. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  53465. $args[$index] = $colorOption;
  53466. return $args;
  53467. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  53468. return $args;
  53469. }
  53470. } elseif (in_array('--no-'.$matches[1], $args)) {
  53471. return $args;
  53472. }
  53473. if (false !== getenv('NO_COLOR')) {
  53474. return $args;
  53475. }
  53476. if (false !== ($index = array_search('--', $args))) {
  53477. array_splice($args, $index, 0, $colorOption);
  53478. } else {
  53479. $args[] = $colorOption;
  53480. }
  53481. return $args;
  53482. }
  53483. public static function escape($arg, $meta = true, $module = false)
  53484. {
  53485. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  53486. return "'".str_replace("'", "'\\''", $arg)."'";
  53487. }
  53488. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  53489. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  53490. if ($meta) {
  53491. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  53492. if (!$meta) {
  53493. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  53494. } elseif ($module && !$dquotes && $quote) {
  53495. $meta = false;
  53496. }
  53497. }
  53498. if ($quote) {
  53499. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  53500. }
  53501. if ($meta) {
  53502. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  53503. }
  53504. return $arg;
  53505. }
  53506. public static function supportsColor($output)
  53507. {
  53508. if ('Hyper' === getenv('TERM_PROGRAM')) {
  53509. return true;
  53510. }
  53511. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  53512. return (function_exists('sapi_windows_vt100_support')
  53513. && sapi_windows_vt100_support($output))
  53514. || false !== getenv('ANSICON')
  53515. || 'ON' === getenv('ConEmuANSI')
  53516. || 'xterm' === getenv('TERM');
  53517. }
  53518. if (function_exists('stream_isatty')) {
  53519. return stream_isatty($output);
  53520. }
  53521. if (function_exists('posix_isatty')) {
  53522. return posix_isatty($output);
  53523. }
  53524. $stat = fstat($output);
  53525. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  53526. }
  53527. public static function setEnv($name, $value = false)
  53528. {
  53529. $unset = false === $value;
  53530. if (!putenv($unset ? $name : $name.'='.$value)) {
  53531. return false;
  53532. }
  53533. if ($unset) {
  53534. unset($_SERVER[$name]);
  53535. } else {
  53536. $_SERVER[$name] = $value;
  53537. }
  53538. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  53539. if ($unset) {
  53540. unset($_ENV[$name]);
  53541. } else {
  53542. $_ENV[$name] = $value;
  53543. }
  53544. }
  53545. return true;
  53546. }
  53547. }
  53548. <?php
  53549. namespace Composer\XdebugHandler;
  53550. use Psr\Log\LoggerInterface;
  53551. use Psr\Log\LogLevel;
  53552. class Status
  53553. {
  53554. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  53555. const CHECK = 'Check';
  53556. const ERROR = 'Error';
  53557. const INFO = 'Info';
  53558. const NORESTART = 'NoRestart';
  53559. const RESTART = 'Restart';
  53560. const RESTARTING = 'Restarting';
  53561. const RESTARTED = 'Restarted';
  53562. private $debug;
  53563. private $envAllowXdebug;
  53564. private $loaded;
  53565. private $logger;
  53566. private $time;
  53567. public function __construct($envAllowXdebug, $debug)
  53568. {
  53569. $start = getenv(self::ENV_RESTART);
  53570. Process::setEnv(self::ENV_RESTART);
  53571. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  53572. $this->envAllowXdebug = $envAllowXdebug;
  53573. $this->debug = $debug && defined('STDERR');
  53574. }
  53575. public function setLogger(LoggerInterface $logger)
  53576. {
  53577. $this->logger = $logger;
  53578. }
  53579. public function report($op, $data)
  53580. {
  53581. if ($this->logger || $this->debug) {
  53582. call_user_func(array($this, 'report'.$op), $data);
  53583. }
  53584. }
  53585. private function output($text, $level = null)
  53586. {
  53587. if ($this->logger) {
  53588. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  53589. }
  53590. if ($this->debug) {
  53591. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  53592. }
  53593. }
  53594. private function reportCheck($loaded)
  53595. {
  53596. $this->loaded = $loaded;
  53597. $this->output('Checking '.$this->envAllowXdebug);
  53598. }
  53599. private function reportError($error)
  53600. {
  53601. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  53602. }
  53603. private function reportInfo($info)
  53604. {
  53605. $this->output($info);
  53606. }
  53607. private function reportNoRestart()
  53608. {
  53609. $this->output($this->getLoadedMessage());
  53610. if ($this->loaded) {
  53611. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  53612. if (!getenv($this->envAllowXdebug)) {
  53613. $text .= ' Allowed by application';
  53614. }
  53615. $this->output($text);
  53616. }
  53617. }
  53618. private function reportRestart()
  53619. {
  53620. $this->output($this->getLoadedMessage());
  53621. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  53622. }
  53623. private function reportRestarted()
  53624. {
  53625. $loaded = $this->getLoadedMessage();
  53626. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  53627. $level = $this->loaded ? LogLevel::WARNING : null;
  53628. $this->output($text, $level);
  53629. }
  53630. private function reportRestarting($command)
  53631. {
  53632. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  53633. $this->output($text);
  53634. $text = 'Running '.$command;
  53635. $this->output($text);
  53636. }
  53637. private function getEnvAllow()
  53638. {
  53639. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  53640. }
  53641. private function getLoadedMessage()
  53642. {
  53643. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  53644. return 'The Xdebug extension is '.$loaded;
  53645. }
  53646. }
  53647. <?php
  53648. namespace Composer\XdebugHandler;
  53649. use Psr\Log\LoggerInterface;
  53650. class XdebugHandler
  53651. {
  53652. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  53653. const SUFFIX_INIS = '_ORIGINAL_INIS';
  53654. const RESTART_ID = 'internal';
  53655. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  53656. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  53657. protected $tmpIni;
  53658. private static $inRestart;
  53659. private static $name;
  53660. private static $skipped;
  53661. private $cli;
  53662. private $colorOption;
  53663. private $debug;
  53664. private $envAllowXdebug;
  53665. private $envOriginalInis;
  53666. private $loaded;
  53667. private $persistent;
  53668. private $script;
  53669. private $statusWriter;
  53670. public function __construct($envPrefix, $colorOption = '')
  53671. {
  53672. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  53673. throw new \RuntimeException('Invalid constructor parameter');
  53674. }
  53675. self::$name = strtoupper($envPrefix);
  53676. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  53677. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  53678. $this->colorOption = $colorOption;
  53679. if (extension_loaded('xdebug')) {
  53680. $ext = new \ReflectionExtension('xdebug');
  53681. $this->loaded = $ext->getVersion() ?: 'unknown';
  53682. }
  53683. if ($this->cli = PHP_SAPI === 'cli') {
  53684. $this->debug = getenv(self::DEBUG);
  53685. }
  53686. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  53687. }
  53688. public function setLogger(LoggerInterface $logger)
  53689. {
  53690. $this->statusWriter->setLogger($logger);
  53691. return $this;
  53692. }
  53693. public function setMainScript($script)
  53694. {
  53695. $this->script = $script;
  53696. return $this;
  53697. }
  53698. public function setPersistent()
  53699. {
  53700. $this->persistent = true;
  53701. return $this;
  53702. }
  53703. public function check()
  53704. {
  53705. $this->notify(Status::CHECK, $this->loaded);
  53706. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  53707. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  53708. $this->notify(Status::RESTART);
  53709. if ($this->prepareRestart()) {
  53710. $command = $this->getCommand();
  53711. $this->restart($command);
  53712. }
  53713. return;
  53714. }
  53715. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  53716. $this->notify(Status::RESTARTED);
  53717. Process::setEnv($this->envAllowXdebug);
  53718. self::$inRestart = true;
  53719. if (!$this->loaded) {
  53720. self::$skipped = $envArgs[1];
  53721. }
  53722. $this->tryEnableSignals();
  53723. $this->setEnvRestartSettings($envArgs);
  53724. return;
  53725. }
  53726. $this->notify(Status::NORESTART);
  53727. if ($settings = self::getRestartSettings()) {
  53728. $this->syncSettings($settings);
  53729. }
  53730. }
  53731. public static function getAllIniFiles()
  53732. {
  53733. if (!empty(self::$name)) {
  53734. $env = getenv(self::$name.self::SUFFIX_INIS);
  53735. if (false !== $env) {
  53736. return explode(PATH_SEPARATOR, $env);
  53737. }
  53738. }
  53739. $paths = array((string) php_ini_loaded_file());
  53740. if ($scanned = php_ini_scanned_files()) {
  53741. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  53742. }
  53743. return $paths;
  53744. }
  53745. public static function getRestartSettings()
  53746. {
  53747. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  53748. if (count($envArgs) !== 6
  53749. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  53750. return;
  53751. }
  53752. return array(
  53753. 'tmpIni' => $envArgs[0],
  53754. 'scannedInis' => (bool) $envArgs[1],
  53755. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  53756. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  53757. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  53758. 'skipped' => $envArgs[5],
  53759. );
  53760. }
  53761. public static function getSkippedVersion()
  53762. {
  53763. return (string) self::$skipped;
  53764. }
  53765. protected function requiresRestart($isLoaded)
  53766. {
  53767. return $isLoaded;
  53768. }
  53769. protected function restart($command)
  53770. {
  53771. $this->doRestart($command);
  53772. }
  53773. private function doRestart($command)
  53774. {
  53775. $this->tryEnableSignals();
  53776. $this->notify(Status::RESTARTING, $command);
  53777. passthru($command, $exitCode);
  53778. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  53779. if ($this->debug === '2') {
  53780. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  53781. } else {
  53782. @unlink($this->tmpIni);
  53783. }
  53784. exit($exitCode);
  53785. }
  53786. private function prepareRestart()
  53787. {
  53788. $error = '';
  53789. $iniFiles = self::getAllIniFiles();
  53790. $scannedInis = count($iniFiles) > 1;
  53791. $tmpDir = sys_get_temp_dir();
  53792. if (!$this->cli) {
  53793. $error = 'Unsupported SAPI: '.PHP_SAPI;
  53794. } elseif (!defined('PHP_BINARY')) {
  53795. $error = 'PHP version is too old: '.PHP_VERSION;
  53796. } elseif (!$this->checkConfiguration($info)) {
  53797. $error = $info;
  53798. } elseif (!$this->checkScanDirConfig()) {
  53799. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  53800. } elseif (!$this->checkMainScript()) {
  53801. $error = 'Unable to access main script: '.$this->script;
  53802. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  53803. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  53804. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  53805. $error = 'Unable to set environment variables';
  53806. }
  53807. if ($error) {
  53808. $this->notify(Status::ERROR, $error);
  53809. }
  53810. return empty($error);
  53811. }
  53812. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  53813. {
  53814. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  53815. return false;
  53816. }
  53817. if (empty($iniFiles[0])) {
  53818. array_shift($iniFiles);
  53819. }
  53820. $content = '';
  53821. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  53822. foreach ($iniFiles as $file) {
  53823. if (($data = @file_get_contents($file)) === false) {
  53824. $error = 'Unable to read ini: '.$file;
  53825. return false;
  53826. }
  53827. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  53828. }
  53829. if ($config = parse_ini_string($content)) {
  53830. $loaded = ini_get_all(null, false);
  53831. $content .= $this->mergeLoadedConfig($loaded, $config);
  53832. }
  53833. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  53834. return @file_put_contents($this->tmpIni, $content);
  53835. }
  53836. private function getCommand()
  53837. {
  53838. $php = array(PHP_BINARY);
  53839. $args = array_slice($_SERVER['argv'], 1);
  53840. if (!$this->persistent) {
  53841. array_push($php, '-n', '-c', $this->tmpIni);
  53842. }
  53843. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  53844. $args = Process::addColorOption($args, $this->colorOption);
  53845. }
  53846. $args = array_merge($php, array($this->script), $args);
  53847. $cmd = Process::escape(array_shift($args), true, true);
  53848. foreach ($args as $arg) {
  53849. $cmd .= ' '.Process::escape($arg);
  53850. }
  53851. return $cmd;
  53852. }
  53853. private function setEnvironment($scannedInis, array $iniFiles)
  53854. {
  53855. $scanDir = getenv('PHP_INI_SCAN_DIR');
  53856. $phprc = getenv('PHPRC');
  53857. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  53858. return false;
  53859. }
  53860. if ($this->persistent) {
  53861. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  53862. return false;
  53863. }
  53864. }
  53865. $envArgs = array(
  53866. self::RESTART_ID,
  53867. $this->loaded,
  53868. (int) $scannedInis,
  53869. false === $scanDir ? '*' : $scanDir,
  53870. false === $phprc ? '*' : $phprc,
  53871. );
  53872. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  53873. }
  53874. private function notify($op, $data = null)
  53875. {
  53876. $this->statusWriter->report($op, $data);
  53877. }
  53878. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  53879. {
  53880. $content = '';
  53881. foreach ($loadedConfig as $name => $value) {
  53882. if (!is_string($value)
  53883. || strpos($name, 'xdebug') === 0
  53884. || $name === 'apc.mmap_file_mask') {
  53885. continue;
  53886. }
  53887. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  53888. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  53889. }
  53890. }
  53891. return $content;
  53892. }
  53893. private function checkMainScript()
  53894. {
  53895. if (null !== $this->script) {
  53896. return file_exists($this->script) || '--' === $this->script;
  53897. }
  53898. if (file_exists($this->script = $_SERVER['argv'][0])) {
  53899. return true;
  53900. }
  53901. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  53902. $trace = debug_backtrace($options);
  53903. if (($main = end($trace)) && isset($main['file'])) {
  53904. return file_exists($this->script = $main['file']);
  53905. }
  53906. return false;
  53907. }
  53908. private function setEnvRestartSettings($envArgs)
  53909. {
  53910. $settings = array(
  53911. php_ini_loaded_file(),
  53912. $envArgs[2],
  53913. $envArgs[3],
  53914. $envArgs[4],
  53915. getenv($this->envOriginalInis),
  53916. self::$skipped,
  53917. );
  53918. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  53919. }
  53920. private function syncSettings(array $settings)
  53921. {
  53922. if (false === getenv($this->envOriginalInis)) {
  53923. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  53924. }
  53925. self::$skipped = $settings['skipped'];
  53926. $this->notify(Status::INFO, 'Process called with existing restart settings');
  53927. }
  53928. private function checkScanDirConfig()
  53929. {
  53930. return !(getenv('PHP_INI_SCAN_DIR')
  53931. && !PHP_CONFIG_FILE_SCAN_DIR
  53932. && (PHP_VERSION_ID < 70113
  53933. || PHP_VERSION_ID === 70200));
  53934. }
  53935. private function checkConfiguration(&$info)
  53936. {
  53937. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  53938. $info = 'passthru function is disabled';
  53939. return false;
  53940. }
  53941. if (extension_loaded('uopz') && !ini_get('uopz.disable')) {
  53942. if (function_exists('uopz_allow_exit')) {
  53943. @uopz_allow_exit(true);
  53944. } else {
  53945. $info = 'uopz extension is not compatible';
  53946. return false;
  53947. }
  53948. }
  53949. return true;
  53950. }
  53951. private function tryEnableSignals()
  53952. {
  53953. if (!function_exists('pcntl_async_signals')) {
  53954. return;
  53955. }
  53956. pcntl_async_signals(true);
  53957. $message = 'Async signals enabled';
  53958. if (!self::$inRestart) {
  53959. pcntl_signal(SIGINT, SIG_IGN);
  53960. $message .= ' (SIGINT = SIG_IGN)';
  53961. } elseif (is_int(pcntl_signal_get_handler(SIGINT))) {
  53962. pcntl_signal(SIGINT, SIG_DFL);
  53963. $message .= ' (SIGINT = SIG_DFL)';
  53964. }
  53965. $this->notify(Status::INFO, $message);
  53966. }
  53967. }
  53968. Copyright (c) 2012 PHP Framework Interoperability Group
  53969. Permission is hereby granted, free of charge, to any person obtaining a copy
  53970. of this software and associated documentation files (the "Software"), to deal
  53971. in the Software without restriction, including without limitation the rights
  53972. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  53973. copies of the Software, and to permit persons to whom the Software is
  53974. furnished to do so, subject to the following conditions:
  53975. The above copyright notice and this permission notice shall be included in
  53976. all copies or substantial portions of the Software.
  53977. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  53978. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  53979. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  53980. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  53981. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  53982. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  53983. THE SOFTWARE.
  53984. <?php
  53985. namespace Psr\Log;
  53986. abstract class AbstractLogger implements LoggerInterface
  53987. {
  53988. public function emergency($message, array $context = array())
  53989. {
  53990. $this->log(LogLevel::EMERGENCY, $message, $context);
  53991. }
  53992. public function alert($message, array $context = array())
  53993. {
  53994. $this->log(LogLevel::ALERT, $message, $context);
  53995. }
  53996. public function critical($message, array $context = array())
  53997. {
  53998. $this->log(LogLevel::CRITICAL, $message, $context);
  53999. }
  54000. public function error($message, array $context = array())
  54001. {
  54002. $this->log(LogLevel::ERROR, $message, $context);
  54003. }
  54004. public function warning($message, array $context = array())
  54005. {
  54006. $this->log(LogLevel::WARNING, $message, $context);
  54007. }
  54008. public function notice($message, array $context = array())
  54009. {
  54010. $this->log(LogLevel::NOTICE, $message, $context);
  54011. }
  54012. public function info($message, array $context = array())
  54013. {
  54014. $this->log(LogLevel::INFO, $message, $context);
  54015. }
  54016. public function debug($message, array $context = array())
  54017. {
  54018. $this->log(LogLevel::DEBUG, $message, $context);
  54019. }
  54020. }
  54021. <?php
  54022. namespace Psr\Log;
  54023. class InvalidArgumentException extends \InvalidArgumentException
  54024. {
  54025. }
  54026. <?php
  54027. namespace Psr\Log;
  54028. class LogLevel
  54029. {
  54030. const EMERGENCY = 'emergency';
  54031. const ALERT = 'alert';
  54032. const CRITICAL = 'critical';
  54033. const ERROR = 'error';
  54034. const WARNING = 'warning';
  54035. const NOTICE = 'notice';
  54036. const INFO = 'info';
  54037. const DEBUG = 'debug';
  54038. }
  54039. <?php
  54040. namespace Psr\Log;
  54041. interface LoggerAwareInterface
  54042. {
  54043. public function setLogger(LoggerInterface $logger);
  54044. }
  54045. <?php
  54046. namespace Psr\Log;
  54047. trait LoggerAwareTrait
  54048. {
  54049. protected $logger;
  54050. public function setLogger(LoggerInterface $logger)
  54051. {
  54052. $this->logger = $logger;
  54053. }
  54054. }
  54055. <?php
  54056. namespace Psr\Log;
  54057. interface LoggerInterface
  54058. {
  54059. public function emergency($message, array $context = array());
  54060. public function alert($message, array $context = array());
  54061. public function critical($message, array $context = array());
  54062. public function error($message, array $context = array());
  54063. public function warning($message, array $context = array());
  54064. public function notice($message, array $context = array());
  54065. public function info($message, array $context = array());
  54066. public function debug($message, array $context = array());
  54067. public function log($level, $message, array $context = array());
  54068. }
  54069. <?php
  54070. namespace Psr\Log;
  54071. trait LoggerTrait
  54072. {
  54073. public function emergency($message, array $context = array())
  54074. {
  54075. $this->log(LogLevel::EMERGENCY, $message, $context);
  54076. }
  54077. public function alert($message, array $context = array())
  54078. {
  54079. $this->log(LogLevel::ALERT, $message, $context);
  54080. }
  54081. public function critical($message, array $context = array())
  54082. {
  54083. $this->log(LogLevel::CRITICAL, $message, $context);
  54084. }
  54085. public function error($message, array $context = array())
  54086. {
  54087. $this->log(LogLevel::ERROR, $message, $context);
  54088. }
  54089. public function warning($message, array $context = array())
  54090. {
  54091. $this->log(LogLevel::WARNING, $message, $context);
  54092. }
  54093. public function notice($message, array $context = array())
  54094. {
  54095. $this->log(LogLevel::NOTICE, $message, $context);
  54096. }
  54097. public function info($message, array $context = array())
  54098. {
  54099. $this->log(LogLevel::INFO, $message, $context);
  54100. }
  54101. public function debug($message, array $context = array())
  54102. {
  54103. $this->log(LogLevel::DEBUG, $message, $context);
  54104. }
  54105. abstract public function log($level, $message, array $context = array());
  54106. }
  54107. <?php
  54108. namespace Psr\Log;
  54109. class NullLogger extends AbstractLogger
  54110. {
  54111. public function log($level, $message, array $context = array())
  54112. {
  54113. }
  54114. }
  54115. <?php
  54116. namespace Psr\Log\Test;
  54117. class DummyTest
  54118. {
  54119. public function __toString()
  54120. {
  54121. return 'DummyTest';
  54122. }
  54123. }
  54124. <?php
  54125. namespace Psr\Log\Test;
  54126. use Psr\Log\LoggerInterface;
  54127. use Psr\Log\LogLevel;
  54128. use PHPUnit\Framework\TestCase;
  54129. abstract class LoggerInterfaceTest extends TestCase
  54130. {
  54131. abstract public function getLogger();
  54132. abstract public function getLogs();
  54133. public function testImplements()
  54134. {
  54135. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  54136. }
  54137. public function testLogsAtAllLevels($level, $message)
  54138. {
  54139. $logger = $this->getLogger();
  54140. $logger->{$level}($message, array('user' => 'Bob'));
  54141. $logger->log($level, $message, array('user' => 'Bob'));
  54142. $expected = array(
  54143. $level.' message of level '.$level.' with context: Bob',
  54144. $level.' message of level '.$level.' with context: Bob',
  54145. );
  54146. $this->assertEquals($expected, $this->getLogs());
  54147. }
  54148. public function provideLevelsAndMessages()
  54149. {
  54150. return array(
  54151. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  54152. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  54153. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  54154. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  54155. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  54156. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  54157. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  54158. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  54159. );
  54160. }
  54161. public function testThrowsOnInvalidLevel()
  54162. {
  54163. $logger = $this->getLogger();
  54164. $logger->log('invalid level', 'Foo');
  54165. }
  54166. public function testContextReplacement()
  54167. {
  54168. $logger = $this->getLogger();
  54169. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  54170. $expected = array('info {Message {nothing} Bob Bar a}');
  54171. $this->assertEquals($expected, $this->getLogs());
  54172. }
  54173. public function testObjectCastToString()
  54174. {
  54175. if (method_exists($this, 'createPartialMock')) {
  54176. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  54177. } else {
  54178. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  54179. }
  54180. $dummy->expects($this->once())
  54181. ->method('__toString')
  54182. ->will($this->returnValue('DUMMY'));
  54183. $this->getLogger()->warning($dummy);
  54184. $expected = array('warning DUMMY');
  54185. $this->assertEquals($expected, $this->getLogs());
  54186. }
  54187. public function testContextCanContainAnything()
  54188. {
  54189. $closed = fopen('php://memory', 'r');
  54190. fclose($closed);
  54191. $context = array(
  54192. 'bool' => true,
  54193. 'null' => null,
  54194. 'string' => 'Foo',
  54195. 'int' => 0,
  54196. 'float' => 0.5,
  54197. 'nested' => array('with object' => new DummyTest),
  54198. 'object' => new \DateTime,
  54199. 'resource' => fopen('php://memory', 'r'),
  54200. 'closed' => $closed,
  54201. );
  54202. $this->getLogger()->warning('Crazy context data', $context);
  54203. $expected = array('warning Crazy context data');
  54204. $this->assertEquals($expected, $this->getLogs());
  54205. }
  54206. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  54207. {
  54208. $logger = $this->getLogger();
  54209. $logger->warning('Random message', array('exception' => 'oops'));
  54210. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  54211. $expected = array(
  54212. 'warning Random message',
  54213. 'critical Uncaught Exception!'
  54214. );
  54215. $this->assertEquals($expected, $this->getLogs());
  54216. }
  54217. }
  54218. <?php
  54219. namespace Psr\Log\Test;
  54220. use Psr\Log\AbstractLogger;
  54221. class TestLogger extends AbstractLogger
  54222. {
  54223. public $records = [];
  54224. public $recordsByLevel = [];
  54225. public function log($level, $message, array $context = [])
  54226. {
  54227. $record = [
  54228. 'level' => $level,
  54229. 'message' => $message,
  54230. 'context' => $context,
  54231. ];
  54232. $this->recordsByLevel[$record['level']][] = $record;
  54233. $this->records[] = $record;
  54234. }
  54235. public function hasRecords($level)
  54236. {
  54237. return isset($this->recordsByLevel[$level]);
  54238. }
  54239. public function hasRecord($record, $level)
  54240. {
  54241. if (is_string($record)) {
  54242. $record = ['message' => $record];
  54243. }
  54244. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  54245. if ($rec['message'] !== $record['message']) {
  54246. return false;
  54247. }
  54248. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  54249. return false;
  54250. }
  54251. return true;
  54252. }, $level);
  54253. }
  54254. public function hasRecordThatContains($message, $level)
  54255. {
  54256. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  54257. return strpos($rec['message'], $message) !== false;
  54258. }, $level);
  54259. }
  54260. public function hasRecordThatMatches($regex, $level)
  54261. {
  54262. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  54263. return preg_match($regex, $rec['message']) > 0;
  54264. }, $level);
  54265. }
  54266. public function hasRecordThatPasses(callable $predicate, $level)
  54267. {
  54268. if (!isset($this->recordsByLevel[$level])) {
  54269. return false;
  54270. }
  54271. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  54272. if (call_user_func($predicate, $rec, $i)) {
  54273. return true;
  54274. }
  54275. }
  54276. return false;
  54277. }
  54278. public function __call($method, $args)
  54279. {
  54280. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  54281. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  54282. $level = strtolower($matches[2]);
  54283. if (method_exists($this, $genericMethod)) {
  54284. $args[] = $level;
  54285. return call_user_func_array([$this, $genericMethod], $args);
  54286. }
  54287. }
  54288. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  54289. }
  54290. public function reset()
  54291. {
  54292. $this->records = [];
  54293. $this->recordsByLevel = [];
  54294. }
  54295. }
  54296. <?php
  54297. require_once __DIR__ . '/composer/autoload_real.php';
  54298. return ComposerAutoloaderInitComposerPhar1602597549::getLoader();
  54299. <?php
  54300. $vendorDir = dirname(dirname(__FILE__));
  54301. $baseDir = dirname($vendorDir);
  54302. return array(
  54303. );
  54304. <?php
  54305. $vendorDir = dirname(dirname(__FILE__));
  54306. $baseDir = dirname($vendorDir);
  54307. return array(
  54308. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  54309. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  54310. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  54311. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  54312. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  54313. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  54314. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  54315. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  54316. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  54317. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  54318. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  54319. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  54320. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  54321. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  54322. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  54323. 'Composer\\' => array($baseDir . '/src/Composer'),
  54324. );
  54325. <?php
  54326. $vendorDir = dirname(dirname(__FILE__));
  54327. $baseDir = dirname($vendorDir);
  54328. return array(
  54329. );
  54330. <?php
  54331. $vendorDir = dirname(dirname(__FILE__));
  54332. $baseDir = dirname($vendorDir);
  54333. return array(
  54334. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  54335. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  54336. );
  54337. <?php
  54338. class ComposerAutoloaderInitComposerPhar1602597549
  54339. {
  54340. private static $loader;
  54341. public static function loadClassLoader($class)
  54342. {
  54343. if ('Composer\Autoload\ClassLoader' === $class) {
  54344. require __DIR__ . '/ClassLoader.php';
  54345. }
  54346. }
  54347. public static function getLoader()
  54348. {
  54349. if (null !== self::$loader) {
  54350. return self::$loader;
  54351. }
  54352. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1602597549', 'loadClassLoader'), true, true);
  54353. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  54354. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1602597549', 'loadClassLoader'));
  54355. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  54356. if ($useStaticLoader) {
  54357. require_once __DIR__ . '/autoload_static.php';
  54358. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1602597549::getInitializer($loader));
  54359. } else {
  54360. $map = require __DIR__ . '/autoload_namespaces.php';
  54361. foreach ($map as $namespace => $path) {
  54362. $loader->set($namespace, $path);
  54363. }
  54364. $map = require __DIR__ . '/autoload_psr4.php';
  54365. foreach ($map as $namespace => $path) {
  54366. $loader->setPsr4($namespace, $path);
  54367. }
  54368. $classMap = require __DIR__ . '/autoload_classmap.php';
  54369. if ($classMap) {
  54370. $loader->addClassMap($classMap);
  54371. }
  54372. }
  54373. $loader->register(true);
  54374. if ($useStaticLoader) {
  54375. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1602597549::$files;
  54376. } else {
  54377. $includeFiles = require __DIR__ . '/autoload_files.php';
  54378. }
  54379. foreach ($includeFiles as $fileIdentifier => $file) {
  54380. composerRequireComposerPhar1602597549($fileIdentifier, $file);
  54381. }
  54382. return $loader;
  54383. }
  54384. }
  54385. function composerRequireComposerPhar1602597549($fileIdentifier, $file)
  54386. {
  54387. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  54388. require $file;
  54389. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  54390. }
  54391. }
  54392. <?php
  54393. namespace Composer\Autoload;
  54394. class ComposerStaticInitComposerPhar1602597549
  54395. {
  54396. public static $files = array (
  54397. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  54398. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  54399. );
  54400. public static $prefixLengthsPsr4 = array (
  54401. 'S' =>
  54402. array (
  54403. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  54404. 'Symfony\\Polyfill\\Ctype\\' => 23,
  54405. 'Symfony\\Component\\Process\\' => 26,
  54406. 'Symfony\\Component\\Finder\\' => 25,
  54407. 'Symfony\\Component\\Filesystem\\' => 29,
  54408. 'Symfony\\Component\\Debug\\' => 24,
  54409. 'Symfony\\Component\\Console\\' => 26,
  54410. 'Seld\\PharUtils\\' => 15,
  54411. 'Seld\\JsonLint\\' => 14,
  54412. ),
  54413. 'P' =>
  54414. array (
  54415. 'Psr\\Log\\' => 8,
  54416. ),
  54417. 'J' =>
  54418. array (
  54419. 'JsonSchema\\' => 11,
  54420. ),
  54421. 'C' =>
  54422. array (
  54423. 'Composer\\XdebugHandler\\' => 23,
  54424. 'Composer\\Spdx\\' => 14,
  54425. 'Composer\\Semver\\' => 16,
  54426. 'Composer\\CaBundle\\' => 18,
  54427. 'Composer\\' => 9,
  54428. ),
  54429. );
  54430. public static $prefixDirsPsr4 = array (
  54431. 'Symfony\\Polyfill\\Mbstring\\' =>
  54432. array (
  54433. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  54434. ),
  54435. 'Symfony\\Polyfill\\Ctype\\' =>
  54436. array (
  54437. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  54438. ),
  54439. 'Symfony\\Component\\Process\\' =>
  54440. array (
  54441. 0 => __DIR__ . '/..' . '/symfony/process',
  54442. ),
  54443. 'Symfony\\Component\\Finder\\' =>
  54444. array (
  54445. 0 => __DIR__ . '/..' . '/symfony/finder',
  54446. ),
  54447. 'Symfony\\Component\\Filesystem\\' =>
  54448. array (
  54449. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  54450. ),
  54451. 'Symfony\\Component\\Debug\\' =>
  54452. array (
  54453. 0 => __DIR__ . '/..' . '/symfony/debug',
  54454. ),
  54455. 'Symfony\\Component\\Console\\' =>
  54456. array (
  54457. 0 => __DIR__ . '/..' . '/symfony/console',
  54458. ),
  54459. 'Seld\\PharUtils\\' =>
  54460. array (
  54461. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  54462. ),
  54463. 'Seld\\JsonLint\\' =>
  54464. array (
  54465. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  54466. ),
  54467. 'Psr\\Log\\' =>
  54468. array (
  54469. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  54470. ),
  54471. 'JsonSchema\\' =>
  54472. array (
  54473. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  54474. ),
  54475. 'Composer\\XdebugHandler\\' =>
  54476. array (
  54477. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  54478. ),
  54479. 'Composer\\Spdx\\' =>
  54480. array (
  54481. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  54482. ),
  54483. 'Composer\\Semver\\' =>
  54484. array (
  54485. 0 => __DIR__ . '/..' . '/composer/semver/src',
  54486. ),
  54487. 'Composer\\CaBundle\\' =>
  54488. array (
  54489. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  54490. ),
  54491. 'Composer\\' =>
  54492. array (
  54493. 0 => __DIR__ . '/../..' . '/src/Composer',
  54494. ),
  54495. );
  54496. public static function getInitializer(ClassLoader $loader)
  54497. {
  54498. return \Closure::bind(function () use ($loader) {
  54499. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1602597549::$prefixLengthsPsr4;
  54500. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1602597549::$prefixDirsPsr4;
  54501. }, null, ClassLoader::class);
  54502. }
  54503. }
  54504. <?php
  54505. namespace Composer\Autoload;
  54506. class ClassLoader
  54507. {
  54508. private $prefixLengthsPsr4 = array();
  54509. private $prefixDirsPsr4 = array();
  54510. private $fallbackDirsPsr4 = array();
  54511. private $prefixesPsr0 = array();
  54512. private $fallbackDirsPsr0 = array();
  54513. private $useIncludePath = false;
  54514. private $classMap = array();
  54515. private $classMapAuthoritative = false;
  54516. private $missingClasses = array();
  54517. private $apcuPrefix;
  54518. public function getPrefixes()
  54519. {
  54520. if (!empty($this->prefixesPsr0)) {
  54521. return call_user_func_array('array_merge', array_values($this->prefixesPsr0));
  54522. }
  54523. return array();
  54524. }
  54525. public function getPrefixesPsr4()
  54526. {
  54527. return $this->prefixDirsPsr4;
  54528. }
  54529. public function getFallbackDirs()
  54530. {
  54531. return $this->fallbackDirsPsr0;
  54532. }
  54533. public function getFallbackDirsPsr4()
  54534. {
  54535. return $this->fallbackDirsPsr4;
  54536. }
  54537. public function getClassMap()
  54538. {
  54539. return $this->classMap;
  54540. }
  54541. public function addClassMap(array $classMap)
  54542. {
  54543. if ($this->classMap) {
  54544. $this->classMap = array_merge($this->classMap, $classMap);
  54545. } else {
  54546. $this->classMap = $classMap;
  54547. }
  54548. }
  54549. public function add($prefix, $paths, $prepend = false)
  54550. {
  54551. if (!$prefix) {
  54552. if ($prepend) {
  54553. $this->fallbackDirsPsr0 = array_merge(
  54554. (array) $paths,
  54555. $this->fallbackDirsPsr0
  54556. );
  54557. } else {
  54558. $this->fallbackDirsPsr0 = array_merge(
  54559. $this->fallbackDirsPsr0,
  54560. (array) $paths
  54561. );
  54562. }
  54563. return;
  54564. }
  54565. $first = $prefix[0];
  54566. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  54567. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  54568. return;
  54569. }
  54570. if ($prepend) {
  54571. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54572. (array) $paths,
  54573. $this->prefixesPsr0[$first][$prefix]
  54574. );
  54575. } else {
  54576. $this->prefixesPsr0[$first][$prefix] = array_merge(
  54577. $this->prefixesPsr0[$first][$prefix],
  54578. (array) $paths
  54579. );
  54580. }
  54581. }
  54582. public function addPsr4($prefix, $paths, $prepend = false)
  54583. {
  54584. if (!$prefix) {
  54585. if ($prepend) {
  54586. $this->fallbackDirsPsr4 = array_merge(
  54587. (array) $paths,
  54588. $this->fallbackDirsPsr4
  54589. );
  54590. } else {
  54591. $this->fallbackDirsPsr4 = array_merge(
  54592. $this->fallbackDirsPsr4,
  54593. (array) $paths
  54594. );
  54595. }
  54596. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  54597. $length = strlen($prefix);
  54598. if ('\\' !== $prefix[$length - 1]) {
  54599. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54600. }
  54601. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54602. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54603. } elseif ($prepend) {
  54604. $this->prefixDirsPsr4[$prefix] = array_merge(
  54605. (array) $paths,
  54606. $this->prefixDirsPsr4[$prefix]
  54607. );
  54608. } else {
  54609. $this->prefixDirsPsr4[$prefix] = array_merge(
  54610. $this->prefixDirsPsr4[$prefix],
  54611. (array) $paths
  54612. );
  54613. }
  54614. }
  54615. public function set($prefix, $paths)
  54616. {
  54617. if (!$prefix) {
  54618. $this->fallbackDirsPsr0 = (array) $paths;
  54619. } else {
  54620. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  54621. }
  54622. }
  54623. public function setPsr4($prefix, $paths)
  54624. {
  54625. if (!$prefix) {
  54626. $this->fallbackDirsPsr4 = (array) $paths;
  54627. } else {
  54628. $length = strlen($prefix);
  54629. if ('\\' !== $prefix[$length - 1]) {
  54630. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  54631. }
  54632. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  54633. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  54634. }
  54635. }
  54636. public function setUseIncludePath($useIncludePath)
  54637. {
  54638. $this->useIncludePath = $useIncludePath;
  54639. }
  54640. public function getUseIncludePath()
  54641. {
  54642. return $this->useIncludePath;
  54643. }
  54644. public function setClassMapAuthoritative($classMapAuthoritative)
  54645. {
  54646. $this->classMapAuthoritative = $classMapAuthoritative;
  54647. }
  54648. public function isClassMapAuthoritative()
  54649. {
  54650. return $this->classMapAuthoritative;
  54651. }
  54652. public function setApcuPrefix($apcuPrefix)
  54653. {
  54654. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  54655. }
  54656. public function getApcuPrefix()
  54657. {
  54658. return $this->apcuPrefix;
  54659. }
  54660. public function register($prepend = false)
  54661. {
  54662. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  54663. }
  54664. public function unregister()
  54665. {
  54666. spl_autoload_unregister(array($this, 'loadClass'));
  54667. }
  54668. public function loadClass($class)
  54669. {
  54670. if ($file = $this->findFile($class)) {
  54671. includeFile($file);
  54672. return true;
  54673. }
  54674. }
  54675. public function findFile($class)
  54676. {
  54677. if (isset($this->classMap[$class])) {
  54678. return $this->classMap[$class];
  54679. }
  54680. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  54681. return false;
  54682. }
  54683. if (null !== $this->apcuPrefix) {
  54684. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  54685. if ($hit) {
  54686. return $file;
  54687. }
  54688. }
  54689. $file = $this->findFileWithExtension($class, '.php');
  54690. if (false === $file && defined('HHVM_VERSION')) {
  54691. $file = $this->findFileWithExtension($class, '.hh');
  54692. }
  54693. if (null !== $this->apcuPrefix) {
  54694. apcu_add($this->apcuPrefix.$class, $file);
  54695. }
  54696. if (false === $file) {
  54697. $this->missingClasses[$class] = true;
  54698. }
  54699. return $file;
  54700. }
  54701. private function findFileWithExtension($class, $ext)
  54702. {
  54703. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  54704. $first = $class[0];
  54705. if (isset($this->prefixLengthsPsr4[$first])) {
  54706. $subPath = $class;
  54707. while (false !== $lastPos = strrpos($subPath, '\\')) {
  54708. $subPath = substr($subPath, 0, $lastPos);
  54709. $search = $subPath . '\\';
  54710. if (isset($this->prefixDirsPsr4[$search])) {
  54711. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  54712. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  54713. if (file_exists($file = $dir . $pathEnd)) {
  54714. return $file;
  54715. }
  54716. }
  54717. }
  54718. }
  54719. }
  54720. foreach ($this->fallbackDirsPsr4 as $dir) {
  54721. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  54722. return $file;
  54723. }
  54724. }
  54725. if (false !== $pos = strrpos($class, '\\')) {
  54726. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  54727. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  54728. } else {
  54729. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  54730. }
  54731. if (isset($this->prefixesPsr0[$first])) {
  54732. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  54733. if (0 === strpos($class, $prefix)) {
  54734. foreach ($dirs as $dir) {
  54735. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54736. return $file;
  54737. }
  54738. }
  54739. }
  54740. }
  54741. }
  54742. foreach ($this->fallbackDirsPsr0 as $dir) {
  54743. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  54744. return $file;
  54745. }
  54746. }
  54747. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  54748. return $file;
  54749. }
  54750. return false;
  54751. }
  54752. }
  54753. function includeFile($file)
  54754. {
  54755. include $file;
  54756. }
  54757. ##
  54758. ## Bundle of CA Root Certificates
  54759. ##
  54760. ## Certificate data from Mozilla as of: Wed Jul 22 03:12:14 2020 GMT
  54761. ##
  54762. ## This is a bundle of X.509 certificates of public Certificate Authorities
  54763. ## (CA). These were automatically extracted from Mozilla's root certificates
  54764. ## file (certdata.txt). This file can be found in the mozilla source tree:
  54765. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  54766. ##
  54767. ## It contains the certificates in PEM format and therefore
  54768. ## can be directly used with curl / libcurl / php_curl, or with
  54769. ## an Apache+mod_ssl webserver for SSL client authentication.
  54770. ## Just configure this file as the SSLCACertificateFile.
  54771. ##
  54772. ## Conversion done with mk-ca-bundle.pl version 1.28.
  54773. ## SHA256: cc6408bd4be7fbfb8699bdb40ccb7f6de5780d681d87785ea362646e4dad5e8e
  54774. ##
  54775. GlobalSign Root CA
  54776. ==================
  54777. -----BEGIN CERTIFICATE-----
  54778. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  54779. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  54780. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  54781. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  54782. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  54783. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  54784. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  54785. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  54786. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  54787. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  54788. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  54789. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  54790. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  54791. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  54792. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  54793. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  54794. -----END CERTIFICATE-----
  54795. GlobalSign Root CA - R2
  54796. =======================
  54797. -----BEGIN CERTIFICATE-----
  54798. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  54799. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  54800. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  54801. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  54802. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  54803. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  54804. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  54805. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  54806. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  54807. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  54808. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  54809. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  54810. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  54811. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  54812. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  54813. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  54814. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  54815. -----END CERTIFICATE-----
  54816. Entrust.net Premium 2048 Secure Server CA
  54817. =========================================
  54818. -----BEGIN CERTIFICATE-----
  54819. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  54820. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  54821. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  54822. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  54823. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  54824. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  54825. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  54826. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  54827. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  54828. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  54829. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  54830. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  54831. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  54832. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  54833. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  54834. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  54835. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  54836. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  54837. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  54838. -----END CERTIFICATE-----
  54839. Baltimore CyberTrust Root
  54840. =========================
  54841. -----BEGIN CERTIFICATE-----
  54842. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  54843. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  54844. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  54845. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  54846. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  54847. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  54848. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  54849. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  54850. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  54851. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  54852. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  54853. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  54854. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  54855. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  54856. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  54857. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  54858. -----END CERTIFICATE-----
  54859. Entrust Root Certification Authority
  54860. ====================================
  54861. -----BEGIN CERTIFICATE-----
  54862. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  54863. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  54864. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  54865. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  54866. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  54867. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  54868. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  54869. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54870. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  54871. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  54872. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  54873. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  54874. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  54875. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  54876. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  54877. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  54878. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  54879. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  54880. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  54881. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  54882. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  54883. -----END CERTIFICATE-----
  54884. GeoTrust Global CA
  54885. ==================
  54886. -----BEGIN CERTIFICATE-----
  54887. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  54888. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  54889. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  54890. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  54891. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  54892. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  54893. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  54894. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  54895. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  54896. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  54897. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  54898. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  54899. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  54900. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  54901. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  54902. Mw==
  54903. -----END CERTIFICATE-----
  54904. GeoTrust Universal CA
  54905. =====================
  54906. -----BEGIN CERTIFICATE-----
  54907. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54908. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  54909. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  54910. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  54911. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  54912. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  54913. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  54914. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  54915. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  54916. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  54917. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  54918. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  54919. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  54920. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  54921. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  54922. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  54923. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  54924. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  54925. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  54926. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  54927. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  54928. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  54929. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  54930. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  54931. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  54932. -----END CERTIFICATE-----
  54933. GeoTrust Universal CA 2
  54934. =======================
  54935. -----BEGIN CERTIFICATE-----
  54936. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  54937. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  54938. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  54939. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  54940. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  54941. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  54942. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  54943. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  54944. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  54945. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  54946. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  54947. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  54948. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  54949. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  54950. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  54951. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  54952. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  54953. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  54954. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  54955. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  54956. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  54957. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  54958. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  54959. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  54960. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  54961. -----END CERTIFICATE-----
  54962. Comodo AAA Services root
  54963. ========================
  54964. -----BEGIN CERTIFICATE-----
  54965. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  54966. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  54967. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  54968. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  54969. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  54970. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  54971. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  54972. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  54973. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  54974. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  54975. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  54976. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  54977. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  54978. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  54979. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  54980. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  54981. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  54982. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  54983. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  54984. -----END CERTIFICATE-----
  54985. QuoVadis Root CA
  54986. ================
  54987. -----BEGIN CERTIFICATE-----
  54988. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  54989. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  54990. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  54991. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  54992. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  54993. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  54994. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  54995. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  54996. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  54997. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  54998. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  54999. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  55000. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  55001. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  55002. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  55003. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  55004. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  55005. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  55006. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  55007. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  55008. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  55009. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  55010. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  55011. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  55012. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  55013. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  55014. 5nrQNiOKSnQ2+Q==
  55015. -----END CERTIFICATE-----
  55016. QuoVadis Root CA 2
  55017. ==================
  55018. -----BEGIN CERTIFICATE-----
  55019. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  55020. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  55021. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55022. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55023. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  55024. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  55025. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  55026. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  55027. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  55028. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  55029. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  55030. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  55031. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  55032. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  55033. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  55034. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  55035. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  55036. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  55037. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  55038. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  55039. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  55040. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  55041. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  55042. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  55043. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  55044. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  55045. -----END CERTIFICATE-----
  55046. QuoVadis Root CA 3
  55047. ==================
  55048. -----BEGIN CERTIFICATE-----
  55049. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  55050. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  55051. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  55052. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55053. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  55054. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  55055. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  55056. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  55057. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  55058. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  55059. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  55060. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  55061. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  55062. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  55063. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  55064. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  55065. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  55066. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  55067. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  55068. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  55069. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  55070. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  55071. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  55072. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  55073. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  55074. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  55075. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  55076. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  55077. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  55078. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  55079. -----END CERTIFICATE-----
  55080. Security Communication Root CA
  55081. ==============================
  55082. -----BEGIN CERTIFICATE-----
  55083. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55084. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55085. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  55086. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  55087. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  55088. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  55089. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  55090. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  55091. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  55092. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  55093. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  55094. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  55095. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  55096. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  55097. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  55098. FL39vmwLAw==
  55099. -----END CERTIFICATE-----
  55100. Sonera Class 2 Root CA
  55101. ======================
  55102. -----BEGIN CERTIFICATE-----
  55103. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  55104. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  55105. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  55106. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  55107. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  55108. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  55109. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  55110. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  55111. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  55112. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  55113. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  55114. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  55115. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  55116. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  55117. llpwrN9M
  55118. -----END CERTIFICATE-----
  55119. XRamp Global CA Root
  55120. ====================
  55121. -----BEGIN CERTIFICATE-----
  55122. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  55123. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  55124. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  55125. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  55126. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  55127. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  55128. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  55129. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  55130. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  55131. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  55132. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  55133. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55134. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  55135. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  55136. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  55137. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  55138. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  55139. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  55140. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  55141. -----END CERTIFICATE-----
  55142. Go Daddy Class 2 CA
  55143. ===================
  55144. -----BEGIN CERTIFICATE-----
  55145. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  55146. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  55147. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  55148. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  55149. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  55150. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  55151. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  55152. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  55153. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  55154. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  55155. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  55156. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  55157. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  55158. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  55159. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  55160. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  55161. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  55162. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  55163. vZ8=
  55164. -----END CERTIFICATE-----
  55165. Starfield Class 2 CA
  55166. ====================
  55167. -----BEGIN CERTIFICATE-----
  55168. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  55169. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  55170. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  55171. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  55172. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  55173. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  55174. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  55175. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  55176. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  55177. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  55178. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  55179. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  55180. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  55181. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  55182. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  55183. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  55184. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  55185. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  55186. QBFGmh95DmK/D5fs4C8fF5Q=
  55187. -----END CERTIFICATE-----
  55188. Taiwan GRCA
  55189. ===========
  55190. -----BEGIN CERTIFICATE-----
  55191. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  55192. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  55193. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  55194. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55195. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  55196. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  55197. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  55198. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  55199. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  55200. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  55201. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  55202. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  55203. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  55204. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  55205. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  55206. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  55207. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  55208. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  55209. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  55210. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  55211. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  55212. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  55213. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  55214. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  55215. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  55216. -----END CERTIFICATE-----
  55217. DigiCert Assured ID Root CA
  55218. ===========================
  55219. -----BEGIN CERTIFICATE-----
  55220. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  55221. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  55222. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  55223. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  55224. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  55225. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  55226. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  55227. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  55228. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  55229. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  55230. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  55231. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  55232. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  55233. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  55234. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  55235. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  55236. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  55237. -----END CERTIFICATE-----
  55238. DigiCert Global Root CA
  55239. =======================
  55240. -----BEGIN CERTIFICATE-----
  55241. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  55242. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  55243. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  55244. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  55245. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  55246. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  55247. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  55248. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  55249. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  55250. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  55251. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  55252. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  55253. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  55254. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  55255. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  55256. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  55257. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  55258. -----END CERTIFICATE-----
  55259. DigiCert High Assurance EV Root CA
  55260. ==================================
  55261. -----BEGIN CERTIFICATE-----
  55262. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  55263. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  55264. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  55265. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  55266. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  55267. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  55268. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  55269. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  55270. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  55271. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  55272. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  55273. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  55274. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  55275. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  55276. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  55277. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  55278. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  55279. -----END CERTIFICATE-----
  55280. DST Root CA X3
  55281. ==============
  55282. -----BEGIN CERTIFICATE-----
  55283. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  55284. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  55285. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  55286. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  55287. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  55288. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  55289. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  55290. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  55291. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  55292. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  55293. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  55294. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  55295. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  55296. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  55297. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  55298. -----END CERTIFICATE-----
  55299. SwissSign Gold CA - G2
  55300. ======================
  55301. -----BEGIN CERTIFICATE-----
  55302. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  55303. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  55304. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  55305. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  55306. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  55307. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  55308. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  55309. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  55310. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  55311. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  55312. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  55313. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  55314. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  55315. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  55316. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  55317. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  55318. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  55319. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  55320. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  55321. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  55322. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  55323. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  55324. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  55325. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  55326. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  55327. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  55328. -----END CERTIFICATE-----
  55329. SwissSign Silver CA - G2
  55330. ========================
  55331. -----BEGIN CERTIFICATE-----
  55332. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  55333. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  55334. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  55335. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  55336. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  55337. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  55338. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  55339. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  55340. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  55341. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  55342. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  55343. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  55344. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  55345. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  55346. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  55347. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  55348. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  55349. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  55350. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  55351. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  55352. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  55353. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  55354. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  55355. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  55356. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  55357. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  55358. -----END CERTIFICATE-----
  55359. GeoTrust Primary Certification Authority
  55360. ========================================
  55361. -----BEGIN CERTIFICATE-----
  55362. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  55363. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  55364. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  55365. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  55366. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  55367. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  55368. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  55369. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  55370. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  55371. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55372. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  55373. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  55374. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  55375. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  55376. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  55377. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  55378. -----END CERTIFICATE-----
  55379. thawte Primary Root CA
  55380. ======================
  55381. -----BEGIN CERTIFICATE-----
  55382. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  55383. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55384. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55385. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  55386. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  55387. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  55388. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  55389. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  55390. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  55391. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  55392. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  55393. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  55394. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  55395. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  55396. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  55397. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  55398. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  55399. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  55400. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  55401. -----END CERTIFICATE-----
  55402. VeriSign Class 3 Public Primary Certification Authority - G5
  55403. ============================================================
  55404. -----BEGIN CERTIFICATE-----
  55405. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  55406. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55407. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55408. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  55409. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  55410. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  55411. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  55412. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  55413. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  55414. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  55415. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  55416. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  55417. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  55418. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  55419. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  55420. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  55421. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  55422. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  55423. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  55424. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  55425. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  55426. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  55427. -----END CERTIFICATE-----
  55428. SecureTrust CA
  55429. ==============
  55430. -----BEGIN CERTIFICATE-----
  55431. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  55432. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  55433. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  55434. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  55435. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  55436. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  55437. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  55438. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  55439. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  55440. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  55441. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  55442. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55443. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  55444. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  55445. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  55446. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  55447. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  55448. -----END CERTIFICATE-----
  55449. Secure Global CA
  55450. ================
  55451. -----BEGIN CERTIFICATE-----
  55452. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  55453. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  55454. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  55455. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  55456. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  55457. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  55458. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  55459. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  55460. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  55461. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  55462. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  55463. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  55464. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  55465. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  55466. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  55467. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  55468. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  55469. -----END CERTIFICATE-----
  55470. COMODO Certification Authority
  55471. ==============================
  55472. -----BEGIN CERTIFICATE-----
  55473. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  55474. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  55475. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  55476. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  55477. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  55478. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55479. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  55480. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  55481. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  55482. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  55483. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  55484. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  55485. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  55486. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  55487. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  55488. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  55489. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  55490. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  55491. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  55492. -----END CERTIFICATE-----
  55493. Network Solutions Certificate Authority
  55494. =======================================
  55495. -----BEGIN CERTIFICATE-----
  55496. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  55497. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  55498. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  55499. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  55500. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  55501. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  55502. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  55503. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  55504. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  55505. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  55506. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  55507. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  55508. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  55509. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  55510. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  55511. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  55512. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  55513. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  55514. -----END CERTIFICATE-----
  55515. COMODO ECC Certification Authority
  55516. ==================================
  55517. -----BEGIN CERTIFICATE-----
  55518. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  55519. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  55520. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  55521. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  55522. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  55523. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  55524. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  55525. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  55526. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  55527. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  55528. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  55529. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  55530. -----END CERTIFICATE-----
  55531. OISTE WISeKey Global Root GA CA
  55532. ===============================
  55533. -----BEGIN CERTIFICATE-----
  55534. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  55535. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  55536. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  55537. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  55538. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  55539. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  55540. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  55541. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  55542. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  55543. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  55544. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  55545. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  55546. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  55547. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  55548. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  55549. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  55550. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  55551. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  55552. -----END CERTIFICATE-----
  55553. Certigna
  55554. ========
  55555. -----BEGIN CERTIFICATE-----
  55556. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  55557. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  55558. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  55559. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  55560. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  55561. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  55562. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  55563. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  55564. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  55565. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  55566. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  55567. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  55568. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  55569. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  55570. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  55571. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  55572. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  55573. -----END CERTIFICATE-----
  55574. Cybertrust Global Root
  55575. ======================
  55576. -----BEGIN CERTIFICATE-----
  55577. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  55578. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  55579. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  55580. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  55581. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  55582. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  55583. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  55584. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  55585. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  55586. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  55587. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  55588. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  55589. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  55590. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  55591. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  55592. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  55593. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  55594. -----END CERTIFICATE-----
  55595. ePKI Root Certification Authority
  55596. =================================
  55597. -----BEGIN CERTIFICATE-----
  55598. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  55599. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  55600. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  55601. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  55602. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  55603. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  55604. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  55605. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  55606. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  55607. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  55608. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  55609. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  55610. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  55611. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  55612. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  55613. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  55614. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  55615. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  55616. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  55617. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  55618. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  55619. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  55620. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  55621. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  55622. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  55623. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  55624. -----END CERTIFICATE-----
  55625. certSIGN ROOT CA
  55626. ================
  55627. -----BEGIN CERTIFICATE-----
  55628. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  55629. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  55630. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  55631. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  55632. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  55633. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  55634. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  55635. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  55636. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  55637. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  55638. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  55639. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  55640. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  55641. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  55642. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  55643. -----END CERTIFICATE-----
  55644. GeoTrust Primary Certification Authority - G3
  55645. =============================================
  55646. -----BEGIN CERTIFICATE-----
  55647. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  55648. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  55649. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  55650. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  55651. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  55652. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  55653. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  55654. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  55655. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  55656. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  55657. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  55658. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  55659. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  55660. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  55661. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  55662. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  55663. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  55664. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  55665. -----END CERTIFICATE-----
  55666. thawte Primary Root CA - G2
  55667. ===========================
  55668. -----BEGIN CERTIFICATE-----
  55669. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  55670. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  55671. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  55672. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  55673. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  55674. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  55675. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  55676. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  55677. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  55678. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  55679. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  55680. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  55681. -----END CERTIFICATE-----
  55682. thawte Primary Root CA - G3
  55683. ===========================
  55684. -----BEGIN CERTIFICATE-----
  55685. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  55686. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  55687. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  55688. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  55689. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  55690. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  55691. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  55692. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55693. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  55694. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  55695. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  55696. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  55697. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  55698. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  55699. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  55700. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  55701. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  55702. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  55703. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  55704. -----END CERTIFICATE-----
  55705. GeoTrust Primary Certification Authority - G2
  55706. =============================================
  55707. -----BEGIN CERTIFICATE-----
  55708. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  55709. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  55710. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  55711. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  55712. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  55713. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  55714. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  55715. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  55716. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  55717. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  55718. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  55719. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  55720. npaqBA+K
  55721. -----END CERTIFICATE-----
  55722. VeriSign Universal Root Certification Authority
  55723. ===============================================
  55724. -----BEGIN CERTIFICATE-----
  55725. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  55726. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  55727. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  55728. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  55729. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  55730. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  55731. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  55732. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  55733. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  55734. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  55735. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  55736. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  55737. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  55738. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  55739. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  55740. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  55741. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  55742. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  55743. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  55744. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  55745. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  55746. mJO37M2CYfE45k+XmCpajQ==
  55747. -----END CERTIFICATE-----
  55748. VeriSign Class 3 Public Primary Certification Authority - G4
  55749. ============================================================
  55750. -----BEGIN CERTIFICATE-----
  55751. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  55752. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  55753. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  55754. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  55755. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  55756. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  55757. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  55758. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  55759. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  55760. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  55761. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  55762. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  55763. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  55764. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  55765. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  55766. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  55767. -----END CERTIFICATE-----
  55768. NetLock Arany (Class Gold) Főtanúsítvány
  55769. ========================================
  55770. -----BEGIN CERTIFICATE-----
  55771. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  55772. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  55773. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  55774. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  55775. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  55776. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  55777. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  55778. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  55779. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  55780. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  55781. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  55782. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  55783. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  55784. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  55785. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  55786. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  55787. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  55788. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  55789. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  55790. -----END CERTIFICATE-----
  55791. Hongkong Post Root CA 1
  55792. =======================
  55793. -----BEGIN CERTIFICATE-----
  55794. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  55795. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  55796. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  55797. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  55798. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  55799. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  55800. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  55801. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  55802. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  55803. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  55804. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  55805. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  55806. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  55807. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  55808. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  55809. -----END CERTIFICATE-----
  55810. SecureSign RootCA11
  55811. ===================
  55812. -----BEGIN CERTIFICATE-----
  55813. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  55814. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  55815. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  55816. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  55817. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  55818. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  55819. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  55820. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  55821. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  55822. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  55823. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  55824. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  55825. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  55826. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  55827. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  55828. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  55829. -----END CERTIFICATE-----
  55830. Microsec e-Szigno Root CA 2009
  55831. ==============================
  55832. -----BEGIN CERTIFICATE-----
  55833. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  55834. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  55835. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  55836. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  55837. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  55838. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  55839. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  55840. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  55841. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  55842. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  55843. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  55844. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  55845. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  55846. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  55847. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  55848. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  55849. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  55850. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  55851. LXpUq3DDfSJlgnCW
  55852. -----END CERTIFICATE-----
  55853. GlobalSign Root CA - R3
  55854. =======================
  55855. -----BEGIN CERTIFICATE-----
  55856. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  55857. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  55858. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  55859. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  55860. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  55861. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  55862. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  55863. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  55864. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  55865. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55866. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  55867. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  55868. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  55869. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  55870. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  55871. kpeDMdmztcpHWD9f
  55872. -----END CERTIFICATE-----
  55873. Autoridad de Certificacion Firmaprofesional CIF A62634068
  55874. =========================================================
  55875. -----BEGIN CERTIFICATE-----
  55876. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  55877. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  55878. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  55879. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  55880. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  55881. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  55882. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  55883. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  55884. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  55885. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  55886. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  55887. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  55888. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  55889. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  55890. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  55891. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  55892. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  55893. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  55894. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  55895. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  55896. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  55897. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  55898. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  55899. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  55900. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  55901. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  55902. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  55903. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  55904. -----END CERTIFICATE-----
  55905. Izenpe.com
  55906. ==========
  55907. -----BEGIN CERTIFICATE-----
  55908. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  55909. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  55910. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  55911. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  55912. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  55913. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  55914. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  55915. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  55916. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  55917. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  55918. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  55919. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  55920. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  55921. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  55922. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  55923. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  55924. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55925. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  55926. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  55927. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  55928. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  55929. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  55930. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  55931. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  55932. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  55933. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  55934. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  55935. -----END CERTIFICATE-----
  55936. Chambers of Commerce Root - 2008
  55937. ================================
  55938. -----BEGIN CERTIFICATE-----
  55939. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  55940. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55941. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55942. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  55943. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  55944. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  55945. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  55946. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  55947. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  55948. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  55949. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  55950. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  55951. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  55952. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  55953. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  55954. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  55955. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  55956. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  55957. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  55958. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  55959. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  55960. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  55961. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  55962. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  55963. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  55964. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  55965. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  55966. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  55967. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  55968. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  55969. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  55970. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  55971. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  55972. -----END CERTIFICATE-----
  55973. Global Chambersign Root - 2008
  55974. ==============================
  55975. -----BEGIN CERTIFICATE-----
  55976. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  55977. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  55978. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  55979. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  55980. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  55981. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  55982. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  55983. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  55984. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  55985. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  55986. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  55987. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  55988. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  55989. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  55990. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  55991. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  55992. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  55993. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  55994. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  55995. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  55996. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  55997. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  55998. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  55999. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  56000. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  56001. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  56002. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  56003. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  56004. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  56005. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  56006. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  56007. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  56008. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  56009. -----END CERTIFICATE-----
  56010. Go Daddy Root Certificate Authority - G2
  56011. ========================================
  56012. -----BEGIN CERTIFICATE-----
  56013. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56014. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  56015. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  56016. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  56017. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  56018. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  56019. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  56020. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  56021. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  56022. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  56023. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  56024. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  56025. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  56026. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  56027. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  56028. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  56029. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  56030. -----END CERTIFICATE-----
  56031. Starfield Root Certificate Authority - G2
  56032. =========================================
  56033. -----BEGIN CERTIFICATE-----
  56034. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56035. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56036. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  56037. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  56038. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  56039. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  56040. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  56041. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  56042. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  56043. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  56044. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  56045. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56046. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  56047. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  56048. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  56049. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  56050. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  56051. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  56052. -----END CERTIFICATE-----
  56053. Starfield Services Root Certificate Authority - G2
  56054. ==================================================
  56055. -----BEGIN CERTIFICATE-----
  56056. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  56057. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  56058. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  56059. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  56060. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  56061. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  56062. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  56063. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  56064. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  56065. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  56066. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  56067. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  56068. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  56069. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  56070. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  56071. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  56072. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  56073. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  56074. -----END CERTIFICATE-----
  56075. AffirmTrust Commercial
  56076. ======================
  56077. -----BEGIN CERTIFICATE-----
  56078. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56079. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  56080. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56081. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  56082. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  56083. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  56084. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  56085. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  56086. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  56087. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56088. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  56089. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  56090. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  56091. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  56092. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  56093. -----END CERTIFICATE-----
  56094. AffirmTrust Networking
  56095. ======================
  56096. -----BEGIN CERTIFICATE-----
  56097. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  56098. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  56099. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  56100. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  56101. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  56102. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  56103. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  56104. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  56105. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  56106. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  56107. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  56108. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  56109. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  56110. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  56111. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  56112. -----END CERTIFICATE-----
  56113. AffirmTrust Premium
  56114. ===================
  56115. -----BEGIN CERTIFICATE-----
  56116. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  56117. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  56118. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  56119. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56120. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  56121. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  56122. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  56123. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  56124. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  56125. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  56126. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  56127. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  56128. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  56129. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  56130. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  56131. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  56132. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  56133. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  56134. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  56135. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  56136. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  56137. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  56138. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  56139. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  56140. -----END CERTIFICATE-----
  56141. AffirmTrust Premium ECC
  56142. =======================
  56143. -----BEGIN CERTIFICATE-----
  56144. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  56145. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  56146. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  56147. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  56148. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  56149. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  56150. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  56151. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  56152. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  56153. eQ==
  56154. -----END CERTIFICATE-----
  56155. Certum Trusted Network CA
  56156. =========================
  56157. -----BEGIN CERTIFICATE-----
  56158. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  56159. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  56160. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  56161. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  56162. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  56163. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  56164. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  56165. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  56166. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  56167. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  56168. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  56169. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  56170. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  56171. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  56172. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  56173. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  56174. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  56175. -----END CERTIFICATE-----
  56176. TWCA Root Certification Authority
  56177. =================================
  56178. -----BEGIN CERTIFICATE-----
  56179. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  56180. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  56181. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  56182. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  56183. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  56184. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  56185. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  56186. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  56187. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  56188. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  56189. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  56190. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  56191. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  56192. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  56193. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  56194. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  56195. -----END CERTIFICATE-----
  56196. Security Communication RootCA2
  56197. ==============================
  56198. -----BEGIN CERTIFICATE-----
  56199. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  56200. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  56201. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  56202. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  56203. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56204. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  56205. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  56206. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  56207. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  56208. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  56209. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  56210. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  56211. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  56212. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  56213. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  56214. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  56215. -----END CERTIFICATE-----
  56216. EC-ACC
  56217. ======
  56218. -----BEGIN CERTIFICATE-----
  56219. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  56220. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  56221. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  56222. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  56223. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  56224. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  56225. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  56226. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  56227. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  56228. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  56229. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  56230. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  56231. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  56232. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  56233. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  56234. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  56235. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  56236. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  56237. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  56238. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  56239. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  56240. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  56241. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  56242. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  56243. 5EI=
  56244. -----END CERTIFICATE-----
  56245. Hellenic Academic and Research Institutions RootCA 2011
  56246. =======================================================
  56247. -----BEGIN CERTIFICATE-----
  56248. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  56249. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  56250. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56251. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  56252. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  56253. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  56254. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  56255. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  56256. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  56257. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  56258. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  56259. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  56260. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  56261. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  56262. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  56263. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  56264. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  56265. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  56266. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  56267. -----END CERTIFICATE-----
  56268. Actalis Authentication Root CA
  56269. ==============================
  56270. -----BEGIN CERTIFICATE-----
  56271. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  56272. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  56273. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  56274. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  56275. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  56276. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  56277. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  56278. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  56279. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  56280. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  56281. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  56282. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  56283. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  56284. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  56285. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  56286. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  56287. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  56288. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  56289. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  56290. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  56291. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  56292. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  56293. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  56294. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  56295. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  56296. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  56297. -----END CERTIFICATE-----
  56298. Trustis FPS Root CA
  56299. ===================
  56300. -----BEGIN CERTIFICATE-----
  56301. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  56302. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  56303. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  56304. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  56305. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  56306. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  56307. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  56308. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  56309. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  56310. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  56311. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  56312. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  56313. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  56314. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  56315. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  56316. iB6XzCGcKQENZetX2fNXlrtIzYE=
  56317. -----END CERTIFICATE-----
  56318. Buypass Class 2 Root CA
  56319. =======================
  56320. -----BEGIN CERTIFICATE-----
  56321. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56322. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  56323. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56324. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  56325. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  56326. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  56327. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  56328. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  56329. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  56330. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  56331. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  56332. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  56333. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  56334. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56335. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56336. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  56337. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  56338. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  56339. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  56340. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  56341. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  56342. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  56343. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  56344. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  56345. rJgWVqA=
  56346. -----END CERTIFICATE-----
  56347. Buypass Class 3 Root CA
  56348. =======================
  56349. -----BEGIN CERTIFICATE-----
  56350. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  56351. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  56352. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  56353. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  56354. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  56355. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  56356. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  56357. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  56358. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  56359. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  56360. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  56361. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  56362. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  56363. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  56364. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  56365. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  56366. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  56367. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  56368. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  56369. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  56370. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  56371. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  56372. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  56373. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  56374. Cp/HuZc=
  56375. -----END CERTIFICATE-----
  56376. T-TeleSec GlobalRoot Class 3
  56377. ============================
  56378. -----BEGIN CERTIFICATE-----
  56379. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56380. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56381. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  56382. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56383. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56384. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  56385. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  56386. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  56387. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  56388. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  56389. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  56390. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  56391. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  56392. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  56393. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  56394. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  56395. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  56396. -----END CERTIFICATE-----
  56397. EE Certification Centre Root CA
  56398. ===============================
  56399. -----BEGIN CERTIFICATE-----
  56400. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  56401. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  56402. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  56403. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  56404. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  56405. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  56406. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  56407. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  56408. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  56409. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  56410. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  56411. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  56412. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  56413. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  56414. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  56415. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  56416. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  56417. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  56418. dcGWxZ0=
  56419. -----END CERTIFICATE-----
  56420. D-TRUST Root Class 3 CA 2 2009
  56421. ==============================
  56422. -----BEGIN CERTIFICATE-----
  56423. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56424. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  56425. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  56426. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  56427. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  56428. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  56429. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  56430. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  56431. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  56432. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  56433. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  56434. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  56435. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  56436. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  56437. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  56438. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  56439. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  56440. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  56441. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  56442. -----END CERTIFICATE-----
  56443. D-TRUST Root Class 3 CA 2 EV 2009
  56444. =================================
  56445. -----BEGIN CERTIFICATE-----
  56446. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56447. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56448. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  56449. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  56450. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  56451. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  56452. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  56453. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  56454. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  56455. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  56456. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  56457. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  56458. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  56459. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  56460. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  56461. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  56462. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  56463. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  56464. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  56465. w9y4AyHqnxbxLFS1
  56466. -----END CERTIFICATE-----
  56467. CA Disig Root R2
  56468. ================
  56469. -----BEGIN CERTIFICATE-----
  56470. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  56471. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  56472. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  56473. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  56474. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  56475. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  56476. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  56477. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  56478. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  56479. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  56480. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  56481. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  56482. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  56483. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  56484. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  56485. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  56486. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  56487. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  56488. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  56489. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  56490. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  56491. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  56492. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  56493. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  56494. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  56495. -----END CERTIFICATE-----
  56496. ACCVRAIZ1
  56497. =========
  56498. -----BEGIN CERTIFICATE-----
  56499. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  56500. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  56501. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  56502. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  56503. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  56504. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  56505. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  56506. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  56507. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  56508. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  56509. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  56510. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  56511. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  56512. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  56513. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  56514. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  56515. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  56516. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  56517. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  56518. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  56519. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  56520. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  56521. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  56522. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  56523. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  56524. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  56525. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  56526. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  56527. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  56528. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  56529. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  56530. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  56531. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  56532. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  56533. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  56534. EfbRD0tVNEYqi4Y7
  56535. -----END CERTIFICATE-----
  56536. TWCA Global Root CA
  56537. ===================
  56538. -----BEGIN CERTIFICATE-----
  56539. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  56540. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  56541. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  56542. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  56543. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  56544. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  56545. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  56546. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  56547. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  56548. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  56549. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  56550. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  56551. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  56552. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  56553. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  56554. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  56555. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  56556. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  56557. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  56558. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  56559. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  56560. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  56561. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  56562. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  56563. -----END CERTIFICATE-----
  56564. TeliaSonera Root CA v1
  56565. ======================
  56566. -----BEGIN CERTIFICATE-----
  56567. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  56568. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  56569. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  56570. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  56571. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  56572. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  56573. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  56574. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  56575. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  56576. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  56577. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  56578. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  56579. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  56580. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  56581. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  56582. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  56583. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  56584. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  56585. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  56586. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  56587. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  56588. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  56589. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  56590. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  56591. -----END CERTIFICATE-----
  56592. E-Tugra Certification Authority
  56593. ===============================
  56594. -----BEGIN CERTIFICATE-----
  56595. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  56596. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  56597. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  56598. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  56599. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  56600. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  56601. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  56602. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  56603. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  56604. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  56605. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  56606. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  56607. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  56608. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  56609. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  56610. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  56611. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  56612. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  56613. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  56614. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  56615. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  56616. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  56617. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  56618. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  56619. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  56620. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  56621. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  56622. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  56623. C7TbO6Orb1wdtn7os4I07QZcJA==
  56624. -----END CERTIFICATE-----
  56625. T-TeleSec GlobalRoot Class 2
  56626. ============================
  56627. -----BEGIN CERTIFICATE-----
  56628. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  56629. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  56630. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  56631. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  56632. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  56633. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  56634. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  56635. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  56636. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  56637. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  56638. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  56639. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  56640. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  56641. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  56642. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  56643. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  56644. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  56645. -----END CERTIFICATE-----
  56646. Atos TrustedRoot 2011
  56647. =====================
  56648. -----BEGIN CERTIFICATE-----
  56649. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  56650. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  56651. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  56652. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  56653. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  56654. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  56655. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  56656. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  56657. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  56658. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  56659. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  56660. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  56661. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  56662. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  56663. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  56664. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  56665. -----END CERTIFICATE-----
  56666. QuoVadis Root CA 1 G3
  56667. =====================
  56668. -----BEGIN CERTIFICATE-----
  56669. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56670. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56671. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  56672. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  56673. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  56674. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  56675. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  56676. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  56677. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  56678. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  56679. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  56680. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  56681. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  56682. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56683. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  56684. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  56685. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  56686. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  56687. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  56688. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  56689. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  56690. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  56691. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  56692. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  56693. hMJKzRwuJIczYOXD
  56694. -----END CERTIFICATE-----
  56695. QuoVadis Root CA 2 G3
  56696. =====================
  56697. -----BEGIN CERTIFICATE-----
  56698. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  56699. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56700. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  56701. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  56702. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  56703. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  56704. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  56705. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  56706. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  56707. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  56708. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  56709. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  56710. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  56711. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56712. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  56713. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  56714. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  56715. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  56716. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  56717. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  56718. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  56719. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  56720. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  56721. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  56722. O3jtZsSOeWmD3n+M
  56723. -----END CERTIFICATE-----
  56724. QuoVadis Root CA 3 G3
  56725. =====================
  56726. -----BEGIN CERTIFICATE-----
  56727. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  56728. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  56729. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  56730. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  56731. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  56732. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  56733. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  56734. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  56735. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  56736. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  56737. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  56738. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  56739. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  56740. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  56741. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  56742. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  56743. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  56744. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  56745. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  56746. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  56747. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  56748. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  56749. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  56750. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  56751. PpxxVJkES/1Y+Zj0
  56752. -----END CERTIFICATE-----
  56753. DigiCert Assured ID Root G2
  56754. ===========================
  56755. -----BEGIN CERTIFICATE-----
  56756. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  56757. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  56758. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  56759. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  56760. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  56761. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  56762. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  56763. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  56764. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  56765. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  56766. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  56767. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  56768. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  56769. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  56770. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  56771. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  56772. IhNzbM8m9Yop5w==
  56773. -----END CERTIFICATE-----
  56774. DigiCert Assured ID Root G3
  56775. ===========================
  56776. -----BEGIN CERTIFICATE-----
  56777. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  56778. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  56779. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56780. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56781. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  56782. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  56783. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  56784. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  56785. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  56786. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  56787. 1vUhZscv6pZjamVFkpUBtA==
  56788. -----END CERTIFICATE-----
  56789. DigiCert Global Root G2
  56790. =======================
  56791. -----BEGIN CERTIFICATE-----
  56792. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  56793. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  56794. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  56795. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  56796. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  56797. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  56798. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  56799. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  56800. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  56801. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  56802. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  56803. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  56804. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  56805. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  56806. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  56807. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  56808. MrY=
  56809. -----END CERTIFICATE-----
  56810. DigiCert Global Root G3
  56811. =======================
  56812. -----BEGIN CERTIFICATE-----
  56813. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  56814. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  56815. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  56816. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  56817. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  56818. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  56819. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  56820. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  56821. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  56822. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  56823. VOKa5Vt8sycX
  56824. -----END CERTIFICATE-----
  56825. DigiCert Trusted Root G4
  56826. ========================
  56827. -----BEGIN CERTIFICATE-----
  56828. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  56829. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  56830. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  56831. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  56832. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  56833. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  56834. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  56835. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  56836. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  56837. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  56838. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  56839. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  56840. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  56841. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  56842. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  56843. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  56844. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  56845. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  56846. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  56847. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  56848. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  56849. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  56850. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  56851. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  56852. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  56853. 82Z+
  56854. -----END CERTIFICATE-----
  56855. COMODO RSA Certification Authority
  56856. ==================================
  56857. -----BEGIN CERTIFICATE-----
  56858. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  56859. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  56860. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  56861. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  56862. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  56863. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  56864. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  56865. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  56866. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  56867. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  56868. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  56869. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  56870. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  56871. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  56872. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  56873. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  56874. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  56875. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  56876. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  56877. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  56878. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  56879. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  56880. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  56881. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  56882. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  56883. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  56884. LaZRfyHBNVOFBkpdn627G190
  56885. -----END CERTIFICATE-----
  56886. USERTrust RSA Certification Authority
  56887. =====================================
  56888. -----BEGIN CERTIFICATE-----
  56889. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  56890. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56891. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56892. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  56893. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  56894. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  56895. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  56896. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  56897. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  56898. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  56899. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  56900. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  56901. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  56902. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  56903. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  56904. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  56905. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  56906. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  56907. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  56908. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  56909. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  56910. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  56911. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  56912. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  56913. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  56914. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  56915. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  56916. -----END CERTIFICATE-----
  56917. USERTrust ECC Certification Authority
  56918. =====================================
  56919. -----BEGIN CERTIFICATE-----
  56920. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  56921. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56922. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56923. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  56924. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  56925. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  56926. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  56927. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  56928. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  56929. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  56930. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  56931. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  56932. -----END CERTIFICATE-----
  56933. GlobalSign ECC Root CA - R4
  56934. ===========================
  56935. -----BEGIN CERTIFICATE-----
  56936. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  56937. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56938. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56939. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56940. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  56941. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  56942. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  56943. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  56944. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  56945. -----END CERTIFICATE-----
  56946. GlobalSign ECC Root CA - R5
  56947. ===========================
  56948. -----BEGIN CERTIFICATE-----
  56949. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  56950. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56951. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  56952. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  56953. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  56954. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  56955. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  56956. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  56957. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  56958. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  56959. -----END CERTIFICATE-----
  56960. Staat der Nederlanden Root CA - G3
  56961. ==================================
  56962. -----BEGIN CERTIFICATE-----
  56963. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56964. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56965. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  56966. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  56967. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  56968. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  56969. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  56970. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  56971. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  56972. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  56973. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  56974. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  56975. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  56976. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  56977. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  56978. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  56979. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  56980. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  56981. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  56982. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  56983. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  56984. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  56985. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  56986. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  56987. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  56988. -----END CERTIFICATE-----
  56989. Staat der Nederlanden EV Root CA
  56990. ================================
  56991. -----BEGIN CERTIFICATE-----
  56992. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  56993. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  56994. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  56995. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  56996. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  56997. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  56998. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  56999. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  57000. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  57001. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  57002. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  57003. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  57004. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  57005. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  57006. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  57007. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  57008. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  57009. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  57010. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  57011. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  57012. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  57013. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  57014. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  57015. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  57016. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  57017. -----END CERTIFICATE-----
  57018. IdenTrust Commercial Root CA 1
  57019. ==============================
  57020. -----BEGIN CERTIFICATE-----
  57021. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  57022. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  57023. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  57024. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  57025. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  57026. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  57027. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  57028. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  57029. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  57030. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  57031. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  57032. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  57033. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  57034. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  57035. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  57036. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  57037. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  57038. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  57039. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  57040. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  57041. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  57042. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  57043. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  57044. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  57045. cGzM7vRX+Bi6hG6H
  57046. -----END CERTIFICATE-----
  57047. IdenTrust Public Sector Root CA 1
  57048. =================================
  57049. -----BEGIN CERTIFICATE-----
  57050. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  57051. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  57052. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  57053. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  57054. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  57055. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  57056. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  57057. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  57058. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  57059. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  57060. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  57061. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  57062. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  57063. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  57064. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  57065. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  57066. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  57067. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  57068. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  57069. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  57070. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  57071. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  57072. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  57073. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  57074. 3Wl9af0AVqW3rLatt8o+Ae+c
  57075. -----END CERTIFICATE-----
  57076. Entrust Root Certification Authority - G2
  57077. =========================================
  57078. -----BEGIN CERTIFICATE-----
  57079. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  57080. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  57081. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  57082. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  57083. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  57084. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  57085. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  57086. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  57087. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  57088. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  57089. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  57090. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  57091. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  57092. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  57093. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  57094. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  57095. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  57096. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  57097. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  57098. e4pIb4tF9g==
  57099. -----END CERTIFICATE-----
  57100. Entrust Root Certification Authority - EC1
  57101. ==========================================
  57102. -----BEGIN CERTIFICATE-----
  57103. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  57104. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  57105. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  57106. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  57107. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  57108. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  57109. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  57110. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  57111. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  57112. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  57113. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  57114. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  57115. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  57116. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  57117. -----END CERTIFICATE-----
  57118. CFCA EV ROOT
  57119. ============
  57120. -----BEGIN CERTIFICATE-----
  57121. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  57122. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  57123. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  57124. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  57125. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  57126. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  57127. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  57128. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  57129. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  57130. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  57131. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  57132. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  57133. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  57134. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  57135. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  57136. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  57137. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  57138. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  57139. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  57140. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  57141. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  57142. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  57143. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  57144. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  57145. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  57146. -----END CERTIFICATE-----
  57147. OISTE WISeKey Global Root GB CA
  57148. ===============================
  57149. -----BEGIN CERTIFICATE-----
  57150. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  57151. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  57152. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  57153. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  57154. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  57155. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  57156. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  57157. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  57158. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  57159. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  57160. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  57161. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  57162. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  57163. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  57164. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  57165. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  57166. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  57167. -----END CERTIFICATE-----
  57168. SZAFIR ROOT CA2
  57169. ===============
  57170. -----BEGIN CERTIFICATE-----
  57171. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  57172. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  57173. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  57174. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  57175. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  57176. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  57177. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  57178. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  57179. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  57180. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  57181. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  57182. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  57183. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  57184. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  57185. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  57186. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  57187. -----END CERTIFICATE-----
  57188. Certum Trusted Network CA 2
  57189. ===========================
  57190. -----BEGIN CERTIFICATE-----
  57191. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  57192. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  57193. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  57194. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  57195. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  57196. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  57197. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  57198. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  57199. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  57200. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  57201. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  57202. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  57203. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  57204. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  57205. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  57206. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57207. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  57208. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  57209. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  57210. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  57211. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  57212. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  57213. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  57214. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  57215. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  57216. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  57217. zAYspsbiDrW5viSP
  57218. -----END CERTIFICATE-----
  57219. Hellenic Academic and Research Institutions RootCA 2015
  57220. =======================================================
  57221. -----BEGIN CERTIFICATE-----
  57222. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  57223. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  57224. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  57225. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  57226. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  57227. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  57228. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  57229. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  57230. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  57231. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  57232. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  57233. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  57234. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  57235. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  57236. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  57237. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  57238. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  57239. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  57240. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  57241. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  57242. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  57243. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  57244. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  57245. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  57246. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  57247. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  57248. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  57249. p/UsQu0yrbYhnr68
  57250. -----END CERTIFICATE-----
  57251. Hellenic Academic and Research Institutions ECC RootCA 2015
  57252. ===========================================================
  57253. -----BEGIN CERTIFICATE-----
  57254. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  57255. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  57256. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  57257. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  57258. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  57259. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  57260. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  57261. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  57262. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  57263. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  57264. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  57265. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  57266. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  57267. -----END CERTIFICATE-----
  57268. ISRG Root X1
  57269. ============
  57270. -----BEGIN CERTIFICATE-----
  57271. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  57272. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  57273. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  57274. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  57275. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  57276. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  57277. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  57278. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  57279. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  57280. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  57281. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  57282. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  57283. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  57284. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  57285. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  57286. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  57287. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  57288. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  57289. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  57290. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  57291. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  57292. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  57293. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  57294. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  57295. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  57296. -----END CERTIFICATE-----
  57297. AC RAIZ FNMT-RCM
  57298. ================
  57299. -----BEGIN CERTIFICATE-----
  57300. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  57301. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  57302. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  57303. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57304. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  57305. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  57306. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  57307. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  57308. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  57309. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  57310. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  57311. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  57312. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  57313. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  57314. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  57315. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  57316. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  57317. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  57318. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  57319. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  57320. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  57321. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  57322. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  57323. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  57324. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  57325. -----END CERTIFICATE-----
  57326. Amazon Root CA 1
  57327. ================
  57328. -----BEGIN CERTIFICATE-----
  57329. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  57330. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  57331. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57332. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  57333. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  57334. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  57335. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  57336. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  57337. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  57338. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  57339. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  57340. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  57341. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  57342. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  57343. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  57344. -----END CERTIFICATE-----
  57345. Amazon Root CA 2
  57346. ================
  57347. -----BEGIN CERTIFICATE-----
  57348. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  57349. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  57350. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  57351. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  57352. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  57353. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  57354. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  57355. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  57356. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  57357. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  57358. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  57359. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  57360. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  57361. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  57362. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  57363. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  57364. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  57365. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  57366. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  57367. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  57368. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  57369. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  57370. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  57371. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  57372. -----END CERTIFICATE-----
  57373. Amazon Root CA 3
  57374. ================
  57375. -----BEGIN CERTIFICATE-----
  57376. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  57377. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  57378. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57379. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  57380. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  57381. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  57382. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  57383. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  57384. -----END CERTIFICATE-----
  57385. Amazon Root CA 4
  57386. ================
  57387. -----BEGIN CERTIFICATE-----
  57388. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  57389. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  57390. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  57391. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  57392. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  57393. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  57394. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  57395. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  57396. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  57397. -----END CERTIFICATE-----
  57398. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  57399. =============================================
  57400. -----BEGIN CERTIFICATE-----
  57401. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  57402. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  57403. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  57404. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  57405. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  57406. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  57407. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  57408. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  57409. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  57410. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  57411. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  57412. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  57413. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  57414. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  57415. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  57416. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  57417. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  57418. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  57419. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  57420. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  57421. -----END CERTIFICATE-----
  57422. GDCA TrustAUTH R5 ROOT
  57423. ======================
  57424. -----BEGIN CERTIFICATE-----
  57425. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  57426. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  57427. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  57428. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  57429. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  57430. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  57431. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  57432. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  57433. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  57434. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  57435. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  57436. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  57437. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  57438. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  57439. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  57440. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  57441. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  57442. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  57443. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  57444. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  57445. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  57446. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  57447. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  57448. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  57449. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  57450. -----END CERTIFICATE-----
  57451. TrustCor RootCert CA-1
  57452. ======================
  57453. -----BEGIN CERTIFICATE-----
  57454. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  57455. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57456. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57457. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  57458. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  57459. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  57460. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  57461. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  57462. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  57463. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  57464. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  57465. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  57466. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  57467. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  57468. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  57469. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  57470. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  57471. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  57472. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  57473. -----END CERTIFICATE-----
  57474. TrustCor RootCert CA-2
  57475. ======================
  57476. -----BEGIN CERTIFICATE-----
  57477. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  57478. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  57479. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  57480. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  57481. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  57482. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  57483. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  57484. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  57485. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  57486. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  57487. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  57488. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  57489. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  57490. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  57491. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  57492. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  57493. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  57494. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  57495. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  57496. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  57497. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  57498. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  57499. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  57500. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  57501. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  57502. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  57503. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  57504. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  57505. -----END CERTIFICATE-----
  57506. TrustCor ECA-1
  57507. ==============
  57508. -----BEGIN CERTIFICATE-----
  57509. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  57510. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  57511. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  57512. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  57513. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  57514. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  57515. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  57516. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  57517. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  57518. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  57519. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  57520. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  57521. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  57522. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  57523. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  57524. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  57525. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  57526. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  57527. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  57528. -----END CERTIFICATE-----
  57529. SSL.com Root Certification Authority RSA
  57530. ========================================
  57531. -----BEGIN CERTIFICATE-----
  57532. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  57533. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  57534. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  57535. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57536. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  57537. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  57538. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  57539. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  57540. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  57541. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  57542. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  57543. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  57544. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  57545. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  57546. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  57547. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  57548. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  57549. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  57550. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  57551. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  57552. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  57553. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  57554. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  57555. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  57556. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  57557. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  57558. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  57559. -----END CERTIFICATE-----
  57560. SSL.com Root Certification Authority ECC
  57561. ========================================
  57562. -----BEGIN CERTIFICATE-----
  57563. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  57564. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  57565. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  57566. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  57567. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  57568. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  57569. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  57570. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  57571. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  57572. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  57573. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  57574. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  57575. -----END CERTIFICATE-----
  57576. SSL.com EV Root Certification Authority RSA R2
  57577. ==============================================
  57578. -----BEGIN CERTIFICATE-----
  57579. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  57580. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  57581. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  57582. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  57583. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  57584. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  57585. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  57586. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  57587. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  57588. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  57589. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  57590. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  57591. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  57592. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  57593. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  57594. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  57595. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  57596. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  57597. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  57598. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  57599. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  57600. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  57601. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  57602. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  57603. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  57604. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  57605. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  57606. -----END CERTIFICATE-----
  57607. SSL.com EV Root Certification Authority ECC
  57608. ===========================================
  57609. -----BEGIN CERTIFICATE-----
  57610. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  57611. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  57612. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  57613. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  57614. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  57615. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  57616. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  57617. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  57618. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  57619. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  57620. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  57621. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  57622. -----END CERTIFICATE-----
  57623. GlobalSign Root CA - R6
  57624. =======================
  57625. -----BEGIN CERTIFICATE-----
  57626. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  57627. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  57628. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  57629. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  57630. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  57631. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  57632. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  57633. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  57634. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  57635. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  57636. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  57637. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  57638. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  57639. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  57640. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  57641. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  57642. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  57643. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  57644. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  57645. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  57646. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  57647. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  57648. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  57649. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  57650. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  57651. -----END CERTIFICATE-----
  57652. OISTE WISeKey Global Root GC CA
  57653. ===============================
  57654. -----BEGIN CERTIFICATE-----
  57655. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  57656. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  57657. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  57658. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  57659. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  57660. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  57661. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  57662. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  57663. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  57664. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  57665. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  57666. -----END CERTIFICATE-----
  57667. GTS Root R1
  57668. ===========
  57669. -----BEGIN CERTIFICATE-----
  57670. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57671. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57672. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57673. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  57674. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  57675. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  57676. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  57677. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  57678. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  57679. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  57680. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  57681. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  57682. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  57683. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57684. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  57685. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  57686. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  57687. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  57688. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  57689. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  57690. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  57691. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  57692. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  57693. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  57694. CFF1pkgl
  57695. -----END CERTIFICATE-----
  57696. GTS Root R2
  57697. ===========
  57698. -----BEGIN CERTIFICATE-----
  57699. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  57700. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  57701. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  57702. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  57703. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  57704. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  57705. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  57706. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  57707. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  57708. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  57709. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  57710. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  57711. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  57712. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  57713. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  57714. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  57715. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  57716. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  57717. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  57718. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  57719. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  57720. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  57721. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  57722. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  57723. o/DUhgkC
  57724. -----END CERTIFICATE-----
  57725. GTS Root R3
  57726. ===========
  57727. -----BEGIN CERTIFICATE-----
  57728. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57729. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57730. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57731. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  57732. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  57733. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  57734. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  57735. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  57736. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  57737. KaqW04MjyaR7YbPMAuhd
  57738. -----END CERTIFICATE-----
  57739. GTS Root R4
  57740. ===========
  57741. -----BEGIN CERTIFICATE-----
  57742. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  57743. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  57744. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  57745. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  57746. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  57747. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  57748. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  57749. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  57750. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  57751. zPKwTdb+mciUqXWi4w==
  57752. -----END CERTIFICATE-----
  57753. UCA Global G2 Root
  57754. ==================
  57755. -----BEGIN CERTIFICATE-----
  57756. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  57757. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  57758. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  57759. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  57760. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  57761. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  57762. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  57763. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  57764. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  57765. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  57766. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  57767. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  57768. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  57769. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  57770. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  57771. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  57772. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  57773. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  57774. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  57775. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  57776. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  57777. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  57778. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  57779. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  57780. -----END CERTIFICATE-----
  57781. UCA Extended Validation Root
  57782. ============================
  57783. -----BEGIN CERTIFICATE-----
  57784. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  57785. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  57786. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  57787. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  57788. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  57789. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  57790. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  57791. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  57792. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  57793. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  57794. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  57795. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  57796. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  57797. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  57798. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  57799. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  57800. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  57801. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  57802. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  57803. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  57804. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  57805. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  57806. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  57807. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  57808. dhh2n1ax
  57809. -----END CERTIFICATE-----
  57810. Certigna Root CA
  57811. ================
  57812. -----BEGIN CERTIFICATE-----
  57813. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  57814. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  57815. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  57816. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  57817. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  57818. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  57819. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  57820. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  57821. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  57822. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  57823. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  57824. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  57825. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  57826. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  57827. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  57828. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  57829. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  57830. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  57831. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  57832. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  57833. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  57834. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  57835. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  57836. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  57837. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  57838. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  57839. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  57840. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  57841. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  57842. -----END CERTIFICATE-----
  57843. emSign Root CA - G1
  57844. ===================
  57845. -----BEGIN CERTIFICATE-----
  57846. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  57847. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  57848. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  57849. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  57850. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  57851. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  57852. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  57853. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  57854. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  57855. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  57856. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  57857. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  57858. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  57859. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  57860. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  57861. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  57862. iN66zB+Afko=
  57863. -----END CERTIFICATE-----
  57864. emSign ECC Root CA - G3
  57865. =======================
  57866. -----BEGIN CERTIFICATE-----
  57867. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  57868. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  57869. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  57870. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  57871. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  57872. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  57873. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  57874. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  57875. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  57876. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  57877. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  57878. -----END CERTIFICATE-----
  57879. emSign Root CA - C1
  57880. ===================
  57881. -----BEGIN CERTIFICATE-----
  57882. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  57883. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  57884. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  57885. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  57886. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  57887. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  57888. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  57889. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  57890. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  57891. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  57892. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  57893. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  57894. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  57895. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  57896. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  57897. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  57898. -----END CERTIFICATE-----
  57899. emSign ECC Root CA - C3
  57900. =======================
  57901. -----BEGIN CERTIFICATE-----
  57902. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  57903. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  57904. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  57905. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  57906. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  57907. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  57908. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  57909. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  57910. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  57911. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  57912. -----END CERTIFICATE-----
  57913. Hongkong Post Root CA 3
  57914. =======================
  57915. -----BEGIN CERTIFICATE-----
  57916. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  57917. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  57918. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  57919. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  57920. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  57921. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  57922. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  57923. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  57924. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  57925. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  57926. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  57927. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  57928. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  57929. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  57930. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  57931. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  57932. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  57933. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  57934. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  57935. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  57936. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  57937. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  57938. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  57939. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  57940. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  57941. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  57942. dBb9HxEGmpv0
  57943. -----END CERTIFICATE-----
  57944. Entrust Root Certification Authority - G4
  57945. =========================================
  57946. -----BEGIN CERTIFICATE-----
  57947. MIIGSzCCBDOgAwIBAgIRANm1Q3+vqTkPAAAAAFVlrVgwDQYJKoZIhvcNAQELBQAwgb4xCzAJBgNV
  57948. BAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3Qu
  57949. bmV0L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1
  57950. dGhvcml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1
  57951. dGhvcml0eSAtIEc0MB4XDTE1MDUyNzExMTExNloXDTM3MTIyNzExNDExNlowgb4xCzAJBgNVBAYT
  57952. AlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0
  57953. L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxNSBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhv
  57954. cml6ZWQgdXNlIG9ubHkxMjAwBgNVBAMTKUVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhv
  57955. cml0eSAtIEc0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAsewsQu7i0TD/pZJH4i3D
  57956. umSXbcr3DbVZwbPLqGgZ2K+EbTBwXX7zLtJTmeH+H17ZSK9dE43b/2MzTdMAArzE+NEGCJR5WIoV
  57957. 3imz/f3ET+iq4qA7ec2/a0My3dl0ELn39GjUu9CH1apLiipvKgS1sqbHoHrmSKvS0VnM1n4j5pds
  57958. 8ELl3FFLFUHtSUrJ3hCX1nbB76W1NhSXNdh4IjVS70O92yfbYVaCNNzLiGAMC1rlLAHGVK/XqsEQ
  57959. e9IFWrhAnoanw5CGAlZSCXqc0ieCU0plUmr1POeo8pyvi73TDtTUXm6Hnmo9RR3RXRv06QqsYJn7
  57960. ibT/mCzPfB3pAqoEmh643IhuJbNsZvc8kPNXwbMv9W3y+8qh+CmdRouzavbmZwe+LGcKKh9asj5X
  57961. xNMhIWNlUpEbsZmOeX7m640A2Vqq6nPopIICR5b+W45UYaPrL0swsIsjdXJ8ITzI9vF01Bx7owVV
  57962. 7rtNOzK+mndmnqxpkCIHH2E6lr7lmk/MBTwoWdPBDFSoWWG9yHJM6Nyfh3+9nEg2XpWjDrk4JFX8
  57963. dWbrAuMINClKxuMrLzOg2qOGpRKX/YAr2hRC45K9PvJdXmd0LhyIRyk0X+IyqJwlN4y6mACXi0mW
  57964. Hv0liqzc2thddG5msP9E36EYxr5ILzeUePiVSj9/E15dWf10hkNjc0kCAwEAAaNCMEAwDwYDVR0T
  57965. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJ84xFYjwznooHFs6FRM5Og6sb9n
  57966. MA0GCSqGSIb3DQEBCwUAA4ICAQAS5UKme4sPDORGpbZgQIeMJX6tuGguW8ZAdjwD+MlZ9POrYs4Q
  57967. jbRaZIxowLByQzTSGwv2LFPSypBLhmb8qoMi9IsabyZIrHZ3CL/FmFz0Jomee8O5ZDIBf9PD3Vht
  57968. 7LGrhFV0d4QEJ1JrhkzO3bll/9bGXp+aEJlLdWr+aumXIOTkdnrG0CSqkM0gkLpHZPt/B7NTeLUK
  57969. YvJzQ85BK4FqLoUWlFPUa19yIqtRLULVAJyZv967lDtX/Zr1hstWO1uIAeV8KEsD+UmDfLJ/fOPt
  57970. jqF/YFOOVZ1QNBIPt5d7bIdKROf1beyAN/BYGW5KaHbwH5Lk6rWS02FREAutp9lfx1/cH6NcjKF+
  57971. m7ee01ZvZl4HliDtC3T7Zk6LERXpgUl+b7DUUH8i119lAg2m9IUe2K4GS0qn0jFmwvjO5QimpAKW
  57972. RGhXxNUzzxkvFMSUHHuk2fCfDrGA4tGeEWSpiBE6doLlYsKA2KSD7ZPvfC+QsDJMlhVoSFLUmQjA
  57973. JOgc47OlIQ6SwJAfzyBfyjs4x7dtOvPmRLgOMWuIjnDrnBdSqEGULoe256YSxXXfW8AKbnuk5F6G
  57974. +TaU33fD6Q3AOfF5u0aOq0NZJ7cguyPpVkAh7DE9ZapD8j3fcEThuk0mEDuYn/PIjhs4ViFqUZPT
  57975. kcpG2om3PVODLAgfi49T3f+sHw==
  57976. -----END CERTIFICATE-----
  57977. Microsoft ECC Root Certificate Authority 2017
  57978. =============================================
  57979. -----BEGIN CERTIFICATE-----
  57980. MIICWTCCAd+gAwIBAgIQZvI9r4fei7FK6gxXMQHC7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  57981. UzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQgRUND
  57982. IFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjMwNjQ1WhcNNDIwNzE4
  57983. MjMxNjA0WjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYw
  57984. NAYDVQQDEy1NaWNyb3NvZnQgRUNDIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwdjAQ
  57985. BgcqhkjOPQIBBgUrgQQAIgNiAATUvD0CQnVBEyPNgASGAlEvaqiBYgtlzPbKnR5vSmZRogPZnZH6
  57986. thaxjG7efM3beaYvzrvOcS/lpaso7GMEZpn4+vKTEAXhgShC48Zo9OYbhGBKia/teQ87zvH2RPUB
  57987. eMCjVDBSMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTIy5lycFIM
  57988. +Oa+sgRXKSrPQhDtNTAQBgkrBgEEAYI3FQEEAwIBADAKBggqhkjOPQQDAwNoADBlAjBY8k3qDPlf
  57989. Xu5gKcs68tvWMoQZP3zVL8KxzJOuULsJMsbG7X7JNpQS5GiFBqIb0C8CMQCZ6Ra0DvpWSNSkMBaR
  57990. eNtUjGUBiudQZsIxtzm6uBoiB078a1QWIP8rtedMDE2mT3M=
  57991. -----END CERTIFICATE-----
  57992. Microsoft RSA Root Certificate Authority 2017
  57993. =============================================
  57994. -----BEGIN CERTIFICATE-----
  57995. MIIFqDCCA5CgAwIBAgIQHtOXCV/YtLNHcB6qvn9FszANBgkqhkiG9w0BAQwFADBlMQswCQYDVQQG
  57996. EwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9uMTYwNAYDVQQDEy1NaWNyb3NvZnQg
  57997. UlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcwHhcNMTkxMjE4MjI1MTIyWhcNNDIw
  57998. NzE4MjMwMDIzWjBlMQswCQYDVQQGEwJVUzEeMBwGA1UEChMVTWljcm9zb2Z0IENvcnBvcmF0aW9u
  57999. MTYwNAYDVQQDEy1NaWNyb3NvZnQgUlNBIFJvb3QgQ2VydGlmaWNhdGUgQXV0aG9yaXR5IDIwMTcw
  58000. ggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKW76UM4wplZEWCpW9R2LBifOZNt9GkMml
  58001. 7Xhqb0eRaPgnZ1AzHaGm++DlQ6OEAlcBXZxIQIJTELy/xztokLaCLeX0ZdDMbRnMlfl7rEqUrQ7e
  58002. S0MdhweSE5CAg2Q1OQT85elss7YfUJQ4ZVBcF0a5toW1HLUX6NZFndiyJrDKxHBKrmCk3bPZ7Pw7
  58003. 1VdyvD/IybLeS2v4I2wDwAW9lcfNcztmgGTjGqwu+UcF8ga2m3P1eDNbx6H7JyqhtJqRjJHTOoI+
  58004. dkC0zVJhUXAoP8XFWvLJjEm7FFtNyP9nTUwSlq31/niol4fX/V4ggNyhSyL71Imtus5Hl0dVe49F
  58005. yGcohJUcaDDv70ngNXtk55iwlNpNhTs+VcQor1fznhPbRiefHqJeRIOkpcrVE7NLP8TjwuaGYaRS
  58006. MLl6IE9vDzhTyzMMEyuP1pq9KsgtsRx9S1HKR9FIJ3Jdh+vVReZIZZ2vUpC6W6IYZVcSn2i51BVr
  58007. lMRpIpj0M+Dt+VGOQVDJNE92kKz8OMHY4Xu54+OU4UZpyw4KUGsTuqwPN1q3ErWQgR5WrlcihtnJ
  58008. 0tHXUeOrO8ZV/R4O03QK0dqq6mm4lyiPSMQH+FJDOvTKVTUssKZqwJz58oHhEmrARdlns87/I6KJ
  58009. ClTUFLkqqNfs+avNJVgyeY+QW5g5xAgGwax/Dj0ApQIDAQABo1QwUjAOBgNVHQ8BAf8EBAMCAYYw
  58010. DwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUCctZf4aycI8awznjwNnpv7tNsiMwEAYJKwYBBAGC
  58011. NxUBBAMCAQAwDQYJKoZIhvcNAQEMBQADggIBAKyvPl3CEZaJjqPnktaXFbgToqZCLgLNFgVZJ8og
  58012. 6Lq46BrsTaiXVq5lQ7GPAJtSzVXNUzltYkyLDVt8LkS/gxCP81OCgMNPOsduET/m4xaRhPtthH80
  58013. dK2Jp86519efhGSSvpWhrQlTM93uCupKUY5vVau6tZRGrox/2KJQJWVggEbbMwSubLWYdFQl3JPk
  58014. +ONVFT24bcMKpBLBaYVu32TxU5nhSnUgnZUP5NbcA/FZGOhHibJXWpS2qdgXKxdJ5XbLwVaZOjex
  58015. /2kskZGT4d9Mozd2TaGf+G0eHdP67Pv0RR0Tbc/3WeUiJ3IrhvNXuzDtJE3cfVa7o7P4NHmJweDy
  58016. AmH3pvwPuxwXC65B2Xy9J6P9LjrRk5Sxcx0ki69bIImtt2dmefU6xqaWM/5TkshGsRGRxpl/j8nW
  58017. ZjEgQRCHLQzWwa80mMpkg/sTV9HB8Dx6jKXB/ZUhoHHBk2dxEuqPiAppGWSZI1b7rCoucL5mxAyE
  58018. 7+WL85MB+GqQk2dLsmijtWKP6T+MejteD+eMuMZ87zf9dOLITzNy4ZQ5bb0Sr74MTnB8G2+NszKT
  58019. c0QWbej09+CVgI+WXTik9KveCjCHk9hNAHFiRSdLOkKEW39lt2c0Ui2cFmuqqNh7o0JMcccMyj6D
  58020. 5KbvtwEwXlGjefVwaaZBRA+GsCyRxj3qrg+E
  58021. -----END CERTIFICATE-----
  58022. e-Szigno Root CA 2017
  58023. =====================
  58024. -----BEGIN CERTIFICATE-----
  58025. MIICQDCCAeWgAwIBAgIMAVRI7yH9l1kN9QQKMAoGCCqGSM49BAMCMHExCzAJBgNVBAYTAkhVMREw
  58026. DwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UECgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUt
  58027. MjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3ppZ25vIFJvb3QgQ0EgMjAxNzAeFw0xNzA4MjIxMjA3MDZa
  58028. Fw00MjA4MjIxMjA3MDZaMHExCzAJBgNVBAYTAkhVMREwDwYDVQQHDAhCdWRhcGVzdDEWMBQGA1UE
  58029. CgwNTWljcm9zZWMgTHRkLjEXMBUGA1UEYQwOVkFUSFUtMjM1ODQ0OTcxHjAcBgNVBAMMFWUtU3pp
  58030. Z25vIFJvb3QgQ0EgMjAxNzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABJbcPYrYsHtvxie+RJCx
  58031. s1YVe45DJH0ahFnuY2iyxl6H0BVIHqiQrb1TotreOpCmYF9oMrWGQd+HWyx7xf58etqjYzBhMA8G
  58032. A1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBSHERUI0arBeAyxr87GyZDv
  58033. vzAEwDAfBgNVHSMEGDAWgBSHERUI0arBeAyxr87GyZDvvzAEwDAKBggqhkjOPQQDAgNJADBGAiEA
  58034. tVfd14pVCzbhhkT61NlojbjcI4qKDdQvfepz7L9NbKgCIQDLpbQS+ue16M9+k/zzNY9vTlp8tLxO
  58035. svxyqltZ+efcMQ==
  58036. -----END CERTIFICATE-----
  58037. certSIGN Root CA G2
  58038. ===================
  58039. -----BEGIN CERTIFICATE-----
  58040. MIIFRzCCAy+gAwIBAgIJEQA0tk7GNi02MA0GCSqGSIb3DQEBCwUAMEExCzAJBgNVBAYTAlJPMRQw
  58041. EgYDVQQKEwtDRVJUU0lHTiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjAeFw0xNzAy
  58042. MDYwOTI3MzVaFw00MjAyMDYwOTI3MzVaMEExCzAJBgNVBAYTAlJPMRQwEgYDVQQKEwtDRVJUU0lH
  58043. TiBTQTEcMBoGA1UECxMTY2VydFNJR04gUk9PVCBDQSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  58044. ADCCAgoCggIBAMDFdRmRfUR0dIf+DjuW3NgBFszuY5HnC2/OOwppGnzC46+CjobXXo9X69MhWf05
  58045. N0IwvlDqtg+piNguLWkh59E3GE59kdUWX2tbAMI5Qw02hVK5U2UPHULlj88F0+7cDBrZuIt4Imfk
  58046. abBoxTzkbFpG583H+u/E7Eu9aqSs/cwoUe+StCmrqzWaTOTECMYmzPhpn+Sc8CnTXPnGFiWeI8Mg
  58047. wT0PPzhAsP6CRDiqWhqKa2NYOLQV07YRaXseVO6MGiKscpc/I1mbySKEwQdPzH/iV8oScLumZfNp
  58048. dWO9lfsbl83kqK/20U6o2YpxJM02PbyWxPFsqa7lzw1uKA2wDrXKUXt4FMMgL3/7FFXhEZn91Qqh
  58049. ngLjYl/rNUssuHLoPj1PrCy7Lobio3aP5ZMqz6WryFyNSwb/EkaseMsUBzXgqd+L6a8VTxaJW732
  58050. jcZZroiFDsGJ6x9nxUWO/203Nit4ZoORUSs9/1F3dmKh7Gc+PoGD4FapUB8fepmrY7+EF3fxDTvf
  58051. 95xhszWYijqy7DwaNz9+j5LP2RIUZNoQAhVB/0/E6xyjyfqZ90bp4RjZsbgyLcsUDFDYg2WD7rlc
  58052. z8sFWkz6GZdr1l0T08JcVLwyc6B49fFtHsufpaafItzRUZ6CeWRgKRM+o/1Pcmqr4tTluCRVLERL
  58053. iohEnMqE0yo7AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1Ud
  58054. DgQWBBSCIS1mxteg4BXrzkwJd8RgnlRuAzANBgkqhkiG9w0BAQsFAAOCAgEAYN4auOfyYILVAzOB
  58055. ywaK8SJJ6ejqkX/GM15oGQOGO0MBzwdw5AgeZYWR5hEit/UCI46uuR59H35s5r0l1ZUa8gWmr4UC
  58056. b6741jH/JclKyMeKqdmfS0mbEVeZkkMR3rYzpMzXjWR91M08KCy0mpbqTfXERMQlqiCA2ClV9+BB
  58057. /AYm/7k29UMUA2Z44RGx2iBfRgB4ACGlHgAoYXhvqAEBj500mv/0OJD7uNGzcgbJceaBxXntC6Z5
  58058. 8hMLnPddDnskk7RI24Zf3lCGeOdA5jGokHZwYa+cNywRtYK3qq4kNFtyDGkNzVmf9nGvnAvRCjj5
  58059. BiKDUyUM/FHE5r7iOZULJK2v0ZXkltd0ZGtxTgI8qoXzIKNDOXZbbFD+mpwUHmUUihW9o4JFWklW
  58060. atKcsWMy5WHgUyIOpwpJ6st+H6jiYoD2EEVSmAYY3qXNL3+q1Ok+CHLsIwMCPKaq2LxndD0UF/tU
  58061. Sxfj03k9bWtJySgOLnRQvwzZRjoQhsmnP+mg7H/rpXdYaXHmgwo38oZJar55CJD2AhZkPuXaTH4M
  58062. NMn5X7azKFGnpyuqSfqNZSlO42sTp5SjLVFteAxEy9/eCG/Oo2Sr05WE1LlSVHJ7liXMvGnjSG4N
  58063. 0MedJ5qq+BOS3R7fY581qRY27Iy4g/Q9iY/NtBde17MXQRBdJ3NghVdJIgc=
  58064. -----END CERTIFICATE-----
  58065. <?php
  58066. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  58067. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  58068. }
  58069. setlocale(LC_ALL, 'C');
  58070. require __DIR__.'/../src/bootstrap.php';
  58071. use Composer\Console\Application;
  58072. use Composer\XdebugHandler\XdebugHandler;
  58073. error_reporting(-1);
  58074. // Restart without Xdebug
  58075. $xdebug = new XdebugHandler('Composer', '--ansi');
  58076. $xdebug->check();
  58077. unset($xdebug);
  58078. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  58079. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  58080. exit(1);
  58081. }
  58082. if (function_exists('ini_set')) {
  58083. @ini_set('display_errors', 1);
  58084. $memoryInBytes = function ($value) {
  58085. $unit = strtolower(substr($value, -1, 1));
  58086. $value = (int) $value;
  58087. switch($unit) {
  58088. case 'g':
  58089. $value *= 1024;
  58090. // no break (cumulative multiplier)
  58091. case 'm':
  58092. $value *= 1024;
  58093. // no break (cumulative multiplier)
  58094. case 'k':
  58095. $value *= 1024;
  58096. }
  58097. return $value;
  58098. };
  58099. $memoryLimit = trim(ini_get('memory_limit'));
  58100. // Increase memory_limit if it is lower than 1.5GB
  58101. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  58102. @ini_set('memory_limit', '1536M');
  58103. }
  58104. // Set user defined memory limit
  58105. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  58106. @ini_set('memory_limit', $memoryLimit);
  58107. }
  58108. unset($memoryInBytes, $memoryLimit);
  58109. }
  58110. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  58111. // run the command application
  58112. $application = new Application();
  58113. $application->run();
  58114. Copyright (c) Nils Adermann, Jordi Boggiano
  58115. Permission is hereby granted, free of charge, to any person obtaining a copy
  58116. of this software and associated documentation files (the "Software"), to deal
  58117. in the Software without restriction, including without limitation the rights
  58118. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  58119. copies of the Software, and to permit persons to whom the Software is furnished
  58120. to do so, subject to the following conditions:
  58121. The above copyright notice and this permission notice shall be included in all
  58122. copies or substantial portions of the Software.
  58123. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  58124. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  58125. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  58126. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  58127. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  58128. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  58129. THE SOFTWARE.
  58130. ôvý–ßm;(l ãøm÷‘�ª’�ÿ���GBMB