composer.phar 1.8 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572265732657426575265762657726578265792658026581265822658326584265852658626587265882658926590265912659226593265942659526596265972659826599266002660126602266032660426605266062660726608266092661026611266122661326614266152661626617266182661926620266212662226623266242662526626266272662826629266302663126632266332663426635266362663726638266392664026641266422664326644266452664626647266482664926650266512665226653266542665526656266572665826659266602666126662266632666426665266662666726668266692667026671266722667326674266752667626677266782667926680266812668226683266842668526686266872668826689266902669126692266932669426695266962669726698266992670026701267022670326704267052670626707267082670926710267112671226713267142671526716267172671826719267202672126722267232672426725267262672726728267292673026731267322673326734267352673626737267382673926740267412674226743267442674526746267472674826749267502675126752267532675426755267562675726758267592676026761267622676326764267652676626767267682676926770267712677226773267742677526776267772677826779267802678126782267832678426785267862678726788267892679026791267922679326794267952679626797267982679926800268012680226803268042680526806268072680826809268102681126812268132681426815268162681726818268192682026821268222682326824268252682626827268282682926830268312683226833268342683526836268372683826839268402684126842268432684426845268462684726848268492685026851268522685326854268552685626857268582685926860268612686226863268642686526866268672686826869268702687126872268732687426875268762687726878268792688026881268822688326884268852688626887268882688926890268912689226893268942689526896268972689826899269002690126902269032690426905269062690726908269092691026911269122691326914269152691626917269182691926920269212692226923269242692526926269272692826929269302693126932269332693426935269362693726938269392694026941269422694326944269452694626947269482694926950269512695226953269542695526956269572695826959269602696126962269632696426965269662696726968269692697026971269722697326974269752697626977269782697926980269812698226983269842698526986269872698826989269902699126992269932699426995269962699726998269992700027001270022700327004270052700627007270082700927010270112701227013270142701527016270172701827019270202702127022270232702427025270262702727028270292703027031270322703327034270352703627037270382703927040270412704227043270442704527046270472704827049270502705127052270532705427055270562705727058270592706027061270622706327064270652706627067270682706927070270712707227073270742707527076270772707827079270802708127082270832708427085270862708727088270892709027091270922709327094270952709627097270982709927100271012710227103271042710527106271072710827109271102711127112271132711427115271162711727118271192712027121271222712327124271252712627127271282712927130271312713227133271342713527136271372713827139271402714127142271432714427145271462714727148271492715027151271522715327154271552715627157271582715927160271612716227163271642716527166271672716827169271702717127172271732717427175271762717727178271792718027181271822718327184271852718627187271882718927190271912719227193271942719527196271972719827199272002720127202272032720427205272062720727208272092721027211272122721327214272152721627217272182721927220272212722227223272242722527226272272722827229272302723127232272332723427235272362723727238272392724027241272422724327244272452724627247272482724927250272512725227253272542725527256272572725827259272602726127262272632726427265272662726727268272692727027271272722727327274272752727627277272782727927280272812728227283272842728527286272872728827289272902729127292272932729427295272962729727298272992730027301273022730327304273052730627307273082730927310273112731227313273142731527316273172731827319273202732127322273232732427325273262732727328273292733027331273322733327334273352733627337273382733927340273412734227343273442734527346273472734827349273502735127352273532735427355273562735727358273592736027361273622736327364273652736627367273682736927370273712737227373273742737527376273772737827379273802738127382273832738427385273862738727388273892739027391273922739327394273952739627397273982739927400274012740227403274042740527406274072740827409274102741127412274132741427415274162741727418274192742027421274222742327424274252742627427274282742927430274312743227433274342743527436274372743827439274402744127442274432744427445274462744727448274492745027451274522745327454274552745627457274582745927460274612746227463274642746527466274672746827469274702747127472274732747427475274762747727478274792748027481274822748327484274852748627487274882748927490274912749227493274942749527496274972749827499275002750127502275032750427505275062750727508275092751027511275122751327514275152751627517275182751927520275212752227523275242752527526275272752827529275302753127532275332753427535275362753727538275392754027541275422754327544275452754627547275482754927550275512755227553275542755527556275572755827559275602756127562275632756427565275662756727568275692757027571275722757327574275752757627577275782757927580275812758227583275842758527586275872758827589275902759127592275932759427595275962759727598275992760027601276022760327604276052760627607276082760927610276112761227613276142761527616276172761827619276202762127622276232762427625276262762727628276292763027631276322763327634276352763627637276382763927640276412764227643276442764527646276472764827649276502765127652276532765427655276562765727658276592766027661276622766327664276652766627667276682766927670276712767227673276742767527676276772767827679276802768127682276832768427685276862768727688276892769027691276922769327694276952769627697276982769927700277012770227703277042770527706277072770827709277102771127712277132771427715277162771727718277192772027721277222772327724277252772627727277282772927730277312773227733277342773527736277372773827739277402774127742277432774427745277462774727748277492775027751277522775327754277552775627757277582775927760277612776227763277642776527766277672776827769277702777127772277732777427775277762777727778277792778027781277822778327784277852778627787277882778927790277912779227793277942779527796277972779827799278002780127802278032780427805278062780727808278092781027811278122781327814278152781627817278182781927820278212782227823278242782527826278272782827829278302783127832278332783427835278362783727838278392784027841278422784327844278452784627847278482784927850278512785227853278542785527856278572785827859278602786127862278632786427865278662786727868278692787027871278722787327874278752787627877278782787927880278812788227883278842788527886278872788827889278902789127892278932789427895278962789727898278992790027901279022790327904279052790627907279082790927910279112791227913279142791527916279172791827919279202792127922279232792427925279262792727928279292793027931279322793327934279352793627937279382793927940279412794227943279442794527946279472794827949279502795127952279532795427955279562795727958279592796027961279622796327964279652796627967279682796927970279712797227973279742797527976279772797827979279802798127982279832798427985279862798727988279892799027991279922799327994279952799627997279982799928000280012800228003280042800528006280072800828009280102801128012280132801428015280162801728018280192802028021280222802328024280252802628027280282802928030280312803228033280342803528036280372803828039280402804128042280432804428045280462804728048280492805028051280522805328054280552805628057280582805928060280612806228063280642806528066280672806828069280702807128072280732807428075280762807728078280792808028081280822808328084280852808628087280882808928090280912809228093280942809528096280972809828099281002810128102281032810428105281062810728108281092811028111281122811328114281152811628117281182811928120281212812228123281242812528126281272812828129281302813128132281332813428135281362813728138281392814028141281422814328144281452814628147281482814928150281512815228153281542815528156281572815828159281602816128162281632816428165281662816728168281692817028171281722817328174281752817628177281782817928180281812818228183281842818528186281872818828189281902819128192281932819428195281962819728198281992820028201282022820328204282052820628207282082820928210282112821228213282142821528216282172821828219282202822128222282232822428225282262822728228282292823028231282322823328234282352823628237282382823928240282412824228243282442824528246282472824828249282502825128252282532825428255282562825728258282592826028261282622826328264282652826628267282682826928270282712827228273282742827528276282772827828279282802828128282282832828428285282862828728288282892829028291282922829328294282952829628297282982829928300283012830228303283042830528306283072830828309283102831128312283132831428315283162831728318283192832028321283222832328324283252832628327283282832928330283312833228333283342833528336283372833828339283402834128342283432834428345283462834728348283492835028351283522835328354283552835628357283582835928360283612836228363283642836528366283672836828369283702837128372283732837428375283762837728378283792838028381283822838328384283852838628387283882838928390283912839228393283942839528396283972839828399284002840128402284032840428405284062840728408284092841028411284122841328414284152841628417284182841928420284212842228423284242842528426284272842828429284302843128432284332843428435284362843728438284392844028441284422844328444284452844628447284482844928450284512845228453284542845528456284572845828459284602846128462284632846428465284662846728468284692847028471284722847328474284752847628477284782847928480284812848228483284842848528486284872848828489284902849128492284932849428495284962849728498284992850028501285022850328504285052850628507285082850928510285112851228513285142851528516285172851828519285202852128522285232852428525285262852728528285292853028531285322853328534285352853628537285382853928540285412854228543285442854528546285472854828549285502855128552285532855428555285562855728558285592856028561285622856328564285652856628567285682856928570285712857228573285742857528576285772857828579285802858128582285832858428585285862858728588285892859028591285922859328594285952859628597285982859928600286012860228603286042860528606286072860828609286102861128612286132861428615286162861728618286192862028621286222862328624286252862628627286282862928630286312863228633286342863528636286372863828639286402864128642286432864428645286462864728648286492865028651286522865328654286552865628657286582865928660286612866228663286642866528666286672866828669286702867128672286732867428675286762867728678286792868028681286822868328684286852868628687286882868928690286912869228693286942869528696286972869828699287002870128702287032870428705287062870728708287092871028711287122871328714287152871628717287182871928720287212872228723287242872528726287272872828729287302873128732287332873428735287362873728738287392874028741287422874328744287452874628747287482874928750287512875228753287542875528756287572875828759287602876128762287632876428765287662876728768287692877028771287722877328774287752877628777287782877928780287812878228783287842878528786287872878828789287902879128792287932879428795287962879728798287992880028801288022880328804288052880628807288082880928810288112881228813288142881528816288172881828819288202882128822288232882428825288262882728828288292883028831288322883328834288352883628837288382883928840288412884228843288442884528846288472884828849288502885128852288532885428855288562885728858288592886028861288622886328864288652886628867288682886928870288712887228873288742887528876288772887828879288802888128882288832888428885288862888728888288892889028891288922889328894288952889628897288982889928900289012890228903289042890528906289072890828909289102891128912289132891428915289162891728918289192892028921289222892328924289252892628927289282892928930289312893228933289342893528936289372893828939289402894128942289432894428945289462894728948289492895028951289522895328954289552895628957289582895928960289612896228963289642896528966289672896828969289702897128972289732897428975289762897728978289792898028981289822898328984289852898628987289882898928990289912899228993289942899528996289972899828999290002900129002290032900429005290062900729008290092901029011290122901329014290152901629017290182901929020290212902229023290242902529026290272902829029290302903129032290332903429035290362903729038290392904029041290422904329044290452904629047290482904929050290512905229053290542905529056290572905829059290602906129062290632906429065290662906729068290692907029071290722907329074290752907629077290782907929080290812908229083290842908529086290872908829089290902909129092290932909429095290962909729098290992910029101291022910329104291052910629107291082910929110291112911229113291142911529116291172911829119291202912129122291232912429125291262912729128291292913029131291322913329134291352913629137291382913929140291412914229143291442914529146291472914829149291502915129152291532915429155291562915729158291592916029161291622916329164291652916629167291682916929170291712917229173291742917529176291772917829179291802918129182291832918429185291862918729188291892919029191291922919329194291952919629197291982919929200292012920229203292042920529206292072920829209292102921129212292132921429215292162921729218292192922029221292222922329224292252922629227292282922929230292312923229233292342923529236292372923829239292402924129242292432924429245292462924729248292492925029251292522925329254292552925629257292582925929260292612926229263292642926529266292672926829269292702927129272292732927429275292762927729278292792928029281292822928329284292852928629287292882928929290292912929229293292942929529296292972929829299293002930129302293032930429305293062930729308293092931029311293122931329314293152931629317293182931929320293212932229323293242932529326293272932829329293302933129332293332933429335293362933729338293392934029341293422934329344293452934629347293482934929350293512935229353293542935529356293572935829359293602936129362293632936429365293662936729368293692937029371293722937329374293752937629377293782937929380293812938229383293842938529386293872938829389293902939129392293932939429395293962939729398293992940029401294022940329404294052940629407294082940929410294112941229413294142941529416294172941829419294202942129422294232942429425294262942729428294292943029431294322943329434294352943629437294382943929440294412944229443294442944529446294472944829449294502945129452294532945429455294562945729458294592946029461294622946329464294652946629467294682946929470294712947229473294742947529476294772947829479294802948129482294832948429485294862948729488294892949029491294922949329494294952949629497294982949929500295012950229503295042950529506295072950829509295102951129512295132951429515295162951729518295192952029521295222952329524295252952629527295282952929530295312953229533295342953529536295372953829539295402954129542295432954429545295462954729548295492955029551295522955329554295552955629557295582955929560295612956229563295642956529566295672956829569295702957129572295732957429575295762957729578295792958029581295822958329584295852958629587295882958929590295912959229593295942959529596295972959829599296002960129602296032960429605296062960729608296092961029611296122961329614296152961629617296182961929620296212962229623296242962529626296272962829629296302963129632296332963429635296362963729638296392964029641296422964329644296452964629647296482964929650296512965229653296542965529656296572965829659296602966129662296632966429665296662966729668296692967029671296722967329674296752967629677296782967929680296812968229683296842968529686296872968829689296902969129692296932969429695296962969729698296992970029701297022970329704297052970629707297082970929710297112971229713297142971529716297172971829719297202972129722297232972429725297262972729728297292973029731297322973329734297352973629737297382973929740297412974229743297442974529746297472974829749297502975129752297532975429755297562975729758297592976029761297622976329764297652976629767297682976929770297712977229773297742977529776297772977829779297802978129782297832978429785297862978729788297892979029791297922979329794297952979629797297982979929800298012980229803298042980529806298072980829809298102981129812298132981429815298162981729818298192982029821298222982329824298252982629827298282982929830298312983229833298342983529836298372983829839298402984129842298432984429845298462984729848298492985029851298522985329854298552985629857298582985929860298612986229863298642986529866298672986829869298702987129872298732987429875298762987729878298792988029881298822988329884298852988629887298882988929890298912989229893298942989529896298972989829899299002990129902299032990429905299062990729908299092991029911299122991329914299152991629917299182991929920299212992229923299242992529926299272992829929299302993129932299332993429935299362993729938299392994029941299422994329944299452994629947299482994929950299512995229953299542995529956299572995829959299602996129962299632996429965299662996729968299692997029971299722997329974299752997629977299782997929980299812998229983299842998529986299872998829989299902999129992299932999429995299962999729998299993000030001300023000330004300053000630007300083000930010300113001230013300143001530016300173001830019300203002130022300233002430025300263002730028300293003030031300323003330034300353003630037300383003930040300413004230043300443004530046300473004830049300503005130052300533005430055300563005730058300593006030061300623006330064300653006630067300683006930070300713007230073300743007530076300773007830079300803008130082300833008430085300863008730088300893009030091300923009330094300953009630097300983009930100301013010230103301043010530106301073010830109301103011130112301133011430115301163011730118301193012030121301223012330124301253012630127301283012930130301313013230133301343013530136301373013830139301403014130142301433014430145301463014730148301493015030151301523015330154301553015630157301583015930160301613016230163301643016530166301673016830169301703017130172301733017430175301763017730178301793018030181301823018330184301853018630187301883018930190301913019230193301943019530196301973019830199302003020130202302033020430205302063020730208302093021030211302123021330214302153021630217302183021930220302213022230223302243022530226302273022830229302303023130232302333023430235302363023730238302393024030241302423024330244302453024630247302483024930250302513025230253302543025530256302573025830259302603026130262302633026430265302663026730268302693027030271302723027330274302753027630277302783027930280302813028230283302843028530286302873028830289302903029130292302933029430295302963029730298302993030030301303023030330304303053030630307303083030930310303113031230313303143031530316303173031830319303203032130322303233032430325303263032730328303293033030331303323033330334303353033630337303383033930340303413034230343303443034530346303473034830349303503035130352303533035430355303563035730358303593036030361303623036330364303653036630367303683036930370303713037230373303743037530376303773037830379303803038130382303833038430385303863038730388303893039030391303923039330394303953039630397303983039930400304013040230403304043040530406304073040830409304103041130412304133041430415304163041730418304193042030421304223042330424304253042630427304283042930430304313043230433304343043530436304373043830439304403044130442304433044430445304463044730448304493045030451304523045330454304553045630457304583045930460304613046230463304643046530466304673046830469304703047130472304733047430475304763047730478304793048030481304823048330484304853048630487304883048930490304913049230493304943049530496304973049830499305003050130502305033050430505305063050730508305093051030511305123051330514305153051630517305183051930520305213052230523305243052530526305273052830529305303053130532305333053430535305363053730538305393054030541305423054330544305453054630547305483054930550305513055230553305543055530556305573055830559305603056130562305633056430565305663056730568305693057030571305723057330574305753057630577305783057930580305813058230583305843058530586305873058830589305903059130592305933059430595305963059730598305993060030601306023060330604306053060630607306083060930610306113061230613306143061530616306173061830619306203062130622306233062430625306263062730628306293063030631306323063330634306353063630637306383063930640306413064230643306443064530646306473064830649306503065130652306533065430655306563065730658306593066030661306623066330664306653066630667306683066930670306713067230673306743067530676306773067830679306803068130682306833068430685306863068730688306893069030691306923069330694306953069630697306983069930700307013070230703307043070530706307073070830709307103071130712307133071430715307163071730718307193072030721307223072330724307253072630727307283072930730307313073230733307343073530736307373073830739307403074130742307433074430745307463074730748307493075030751307523075330754307553075630757307583075930760307613076230763307643076530766307673076830769307703077130772307733077430775307763077730778307793078030781307823078330784307853078630787307883078930790307913079230793307943079530796307973079830799308003080130802308033080430805308063080730808308093081030811308123081330814308153081630817308183081930820308213082230823308243082530826308273082830829308303083130832308333083430835308363083730838308393084030841308423084330844308453084630847308483084930850308513085230853308543085530856308573085830859308603086130862308633086430865308663086730868308693087030871308723087330874308753087630877308783087930880308813088230883308843088530886308873088830889308903089130892308933089430895308963089730898308993090030901309023090330904309053090630907309083090930910309113091230913309143091530916309173091830919309203092130922309233092430925309263092730928309293093030931309323093330934309353093630937309383093930940309413094230943309443094530946309473094830949309503095130952309533095430955309563095730958309593096030961309623096330964309653096630967309683096930970309713097230973309743097530976309773097830979309803098130982309833098430985309863098730988309893099030991309923099330994309953099630997309983099931000310013100231003310043100531006310073100831009310103101131012310133101431015310163101731018310193102031021310223102331024310253102631027310283102931030310313103231033310343103531036310373103831039310403104131042310433104431045310463104731048310493105031051310523105331054310553105631057310583105931060310613106231063310643106531066310673106831069310703107131072310733107431075310763107731078310793108031081310823108331084310853108631087310883108931090310913109231093310943109531096310973109831099311003110131102311033110431105311063110731108311093111031111311123111331114311153111631117311183111931120311213112231123311243112531126311273112831129311303113131132311333113431135311363113731138311393114031141311423114331144311453114631147311483114931150311513115231153311543115531156311573115831159311603116131162311633116431165311663116731168311693117031171311723117331174311753117631177311783117931180311813118231183311843118531186311873118831189311903119131192311933119431195311963119731198311993120031201312023120331204312053120631207312083120931210312113121231213312143121531216312173121831219312203122131222312233122431225312263122731228312293123031231312323123331234312353123631237312383123931240312413124231243312443124531246312473124831249312503125131252312533125431255312563125731258312593126031261312623126331264312653126631267312683126931270312713127231273312743127531276312773127831279312803128131282312833128431285312863128731288312893129031291312923129331294312953129631297312983129931300313013130231303313043130531306313073130831309313103131131312313133131431315313163131731318313193132031321313223132331324313253132631327313283132931330313313133231333313343133531336313373133831339313403134131342313433134431345313463134731348313493135031351313523135331354313553135631357313583135931360313613136231363313643136531366313673136831369313703137131372313733137431375313763137731378313793138031381313823138331384313853138631387313883138931390313913139231393313943139531396313973139831399314003140131402314033140431405314063140731408314093141031411314123141331414314153141631417314183141931420314213142231423314243142531426314273142831429314303143131432314333143431435314363143731438314393144031441314423144331444314453144631447314483144931450314513145231453314543145531456314573145831459314603146131462314633146431465314663146731468314693147031471314723147331474314753147631477314783147931480314813148231483314843148531486314873148831489314903149131492314933149431495314963149731498314993150031501315023150331504315053150631507315083150931510315113151231513315143151531516315173151831519315203152131522315233152431525315263152731528315293153031531315323153331534315353153631537315383153931540315413154231543315443154531546315473154831549315503155131552315533155431555315563155731558315593156031561315623156331564315653156631567315683156931570315713157231573315743157531576315773157831579315803158131582315833158431585315863158731588315893159031591315923159331594315953159631597315983159931600316013160231603316043160531606316073160831609316103161131612316133161431615316163161731618316193162031621316223162331624316253162631627316283162931630316313163231633316343163531636316373163831639316403164131642316433164431645316463164731648316493165031651316523165331654316553165631657316583165931660316613166231663316643166531666316673166831669316703167131672316733167431675316763167731678316793168031681316823168331684316853168631687316883168931690316913169231693316943169531696316973169831699317003170131702317033170431705317063170731708317093171031711317123171331714317153171631717317183171931720317213172231723317243172531726317273172831729317303173131732317333173431735317363173731738317393174031741317423174331744317453174631747317483174931750317513175231753317543175531756317573175831759317603176131762317633176431765317663176731768317693177031771317723177331774317753177631777317783177931780317813178231783317843178531786317873178831789317903179131792317933179431795317963179731798317993180031801318023180331804318053180631807318083180931810318113181231813318143181531816318173181831819318203182131822318233182431825318263182731828318293183031831318323183331834318353183631837318383183931840318413184231843318443184531846318473184831849318503185131852318533185431855318563185731858318593186031861318623186331864318653186631867318683186931870318713187231873318743187531876318773187831879318803188131882318833188431885318863188731888318893189031891318923189331894318953189631897318983189931900319013190231903319043190531906319073190831909319103191131912319133191431915319163191731918319193192031921319223192331924319253192631927319283192931930319313193231933319343193531936319373193831939319403194131942319433194431945319463194731948319493195031951319523195331954319553195631957319583195931960319613196231963319643196531966319673196831969319703197131972319733197431975319763197731978319793198031981319823198331984319853198631987319883198931990319913199231993319943199531996319973199831999320003200132002320033200432005320063200732008320093201032011320123201332014320153201632017320183201932020320213202232023320243202532026320273202832029320303203132032320333203432035320363203732038320393204032041320423204332044320453204632047320483204932050320513205232053320543205532056320573205832059320603206132062320633206432065320663206732068320693207032071320723207332074320753207632077320783207932080320813208232083320843208532086320873208832089320903209132092320933209432095320963209732098320993210032101321023210332104321053210632107321083210932110321113211232113321143211532116321173211832119321203212132122321233212432125321263212732128321293213032131321323213332134321353213632137321383213932140321413214232143321443214532146321473214832149321503215132152321533215432155321563215732158321593216032161321623216332164321653216632167321683216932170321713217232173321743217532176321773217832179321803218132182321833218432185321863218732188321893219032191321923219332194321953219632197321983219932200322013220232203322043220532206322073220832209322103221132212322133221432215322163221732218322193222032221322223222332224322253222632227322283222932230322313223232233322343223532236322373223832239322403224132242322433224432245322463224732248322493225032251322523225332254322553225632257322583225932260322613226232263322643226532266322673226832269322703227132272322733227432275322763227732278322793228032281322823228332284322853228632287322883228932290322913229232293322943229532296322973229832299323003230132302323033230432305323063230732308323093231032311323123231332314323153231632317323183231932320323213232232323323243232532326323273232832329323303233132332323333233432335323363233732338323393234032341323423234332344323453234632347323483234932350323513235232353323543235532356323573235832359323603236132362323633236432365323663236732368323693237032371323723237332374323753237632377323783237932380323813238232383323843238532386323873238832389323903239132392323933239432395323963239732398323993240032401324023240332404324053240632407324083240932410324113241232413324143241532416324173241832419324203242132422324233242432425324263242732428324293243032431324323243332434324353243632437324383243932440324413244232443324443244532446324473244832449324503245132452324533245432455324563245732458324593246032461324623246332464324653246632467324683246932470324713247232473324743247532476324773247832479324803248132482324833248432485324863248732488324893249032491324923249332494324953249632497324983249932500325013250232503325043250532506325073250832509325103251132512325133251432515325163251732518325193252032521325223252332524325253252632527325283252932530325313253232533325343253532536325373253832539325403254132542325433254432545325463254732548325493255032551325523255332554325553255632557325583255932560325613256232563325643256532566325673256832569325703257132572325733257432575325763257732578325793258032581325823258332584325853258632587325883258932590325913259232593325943259532596325973259832599326003260132602326033260432605326063260732608326093261032611326123261332614326153261632617326183261932620326213262232623326243262532626326273262832629326303263132632326333263432635326363263732638326393264032641326423264332644326453264632647326483264932650326513265232653326543265532656326573265832659326603266132662326633266432665326663266732668326693267032671326723267332674326753267632677326783267932680326813268232683326843268532686326873268832689326903269132692326933269432695326963269732698326993270032701327023270332704327053270632707327083270932710327113271232713327143271532716327173271832719327203272132722327233272432725327263272732728327293273032731327323273332734327353273632737327383273932740327413274232743327443274532746327473274832749327503275132752327533275432755327563275732758327593276032761327623276332764327653276632767327683276932770327713277232773327743277532776327773277832779327803278132782327833278432785327863278732788327893279032791327923279332794327953279632797327983279932800328013280232803328043280532806328073280832809328103281132812328133281432815328163281732818328193282032821328223282332824328253282632827328283282932830328313283232833328343283532836328373283832839328403284132842328433284432845328463284732848328493285032851328523285332854328553285632857328583285932860328613286232863328643286532866328673286832869328703287132872328733287432875328763287732878328793288032881328823288332884328853288632887328883288932890328913289232893328943289532896328973289832899329003290132902329033290432905329063290732908329093291032911329123291332914329153291632917329183291932920329213292232923329243292532926329273292832929329303293132932329333293432935329363293732938329393294032941329423294332944329453294632947329483294932950329513295232953329543295532956329573295832959329603296132962329633296432965329663296732968329693297032971329723297332974329753297632977329783297932980329813298232983329843298532986329873298832989329903299132992329933299432995329963299732998329993300033001330023300333004330053300633007330083300933010330113301233013330143301533016330173301833019330203302133022330233302433025330263302733028330293303033031330323303333034330353303633037330383303933040330413304233043330443304533046330473304833049330503305133052330533305433055330563305733058330593306033061330623306333064330653306633067330683306933070330713307233073330743307533076330773307833079330803308133082330833308433085330863308733088330893309033091330923309333094330953309633097330983309933100331013310233103331043310533106331073310833109331103311133112331133311433115331163311733118331193312033121331223312333124331253312633127331283312933130331313313233133331343313533136331373313833139331403314133142331433314433145331463314733148331493315033151331523315333154331553315633157331583315933160331613316233163331643316533166331673316833169331703317133172331733317433175331763317733178331793318033181331823318333184331853318633187331883318933190331913319233193331943319533196331973319833199332003320133202332033320433205332063320733208332093321033211332123321333214332153321633217332183321933220332213322233223332243322533226332273322833229332303323133232332333323433235332363323733238332393324033241332423324333244332453324633247332483324933250332513325233253332543325533256332573325833259332603326133262332633326433265332663326733268332693327033271332723327333274332753327633277332783327933280332813328233283332843328533286332873328833289332903329133292332933329433295332963329733298332993330033301333023330333304333053330633307333083330933310333113331233313333143331533316333173331833319333203332133322333233332433325333263332733328333293333033331333323333333334333353333633337333383333933340333413334233343333443334533346333473334833349333503335133352333533335433355333563335733358333593336033361333623336333364333653336633367333683336933370333713337233373333743337533376333773337833379333803338133382333833338433385333863338733388333893339033391333923339333394333953339633397333983339933400334013340233403334043340533406334073340833409334103341133412334133341433415334163341733418334193342033421334223342333424334253342633427334283342933430334313343233433334343343533436334373343833439334403344133442334433344433445334463344733448334493345033451334523345333454334553345633457334583345933460334613346233463334643346533466334673346833469334703347133472334733347433475334763347733478334793348033481334823348333484334853348633487334883348933490334913349233493334943349533496334973349833499335003350133502335033350433505335063350733508335093351033511335123351333514335153351633517335183351933520335213352233523335243352533526335273352833529335303353133532335333353433535335363353733538335393354033541335423354333544335453354633547335483354933550335513355233553335543355533556335573355833559335603356133562335633356433565335663356733568335693357033571335723357333574335753357633577335783357933580335813358233583335843358533586335873358833589335903359133592335933359433595335963359733598335993360033601336023360333604336053360633607336083360933610336113361233613336143361533616336173361833619336203362133622336233362433625336263362733628336293363033631336323363333634336353363633637336383363933640336413364233643336443364533646336473364833649336503365133652336533365433655336563365733658336593366033661336623366333664336653366633667336683366933670336713367233673336743367533676336773367833679336803368133682336833368433685336863368733688336893369033691336923369333694336953369633697336983369933700337013370233703337043370533706337073370833709337103371133712337133371433715337163371733718337193372033721337223372333724337253372633727337283372933730337313373233733337343373533736337373373833739337403374133742337433374433745337463374733748337493375033751337523375333754337553375633757337583375933760337613376233763337643376533766337673376833769337703377133772337733377433775337763377733778337793378033781337823378333784337853378633787337883378933790337913379233793337943379533796337973379833799338003380133802338033380433805338063380733808338093381033811338123381333814338153381633817338183381933820338213382233823338243382533826338273382833829338303383133832338333383433835338363383733838338393384033841338423384333844338453384633847338483384933850338513385233853338543385533856338573385833859338603386133862338633386433865338663386733868338693387033871338723387333874338753387633877338783387933880338813388233883338843388533886338873388833889338903389133892338933389433895338963389733898338993390033901339023390333904339053390633907339083390933910339113391233913339143391533916339173391833919339203392133922339233392433925339263392733928339293393033931339323393333934339353393633937339383393933940339413394233943339443394533946339473394833949339503395133952339533395433955339563395733958339593396033961339623396333964339653396633967339683396933970339713397233973339743397533976339773397833979339803398133982339833398433985339863398733988339893399033991339923399333994339953399633997339983399934000340013400234003340043400534006340073400834009340103401134012340133401434015340163401734018340193402034021340223402334024340253402634027340283402934030340313403234033340343403534036340373403834039340403404134042340433404434045340463404734048340493405034051340523405334054340553405634057340583405934060340613406234063340643406534066340673406834069340703407134072340733407434075340763407734078340793408034081340823408334084340853408634087340883408934090340913409234093340943409534096340973409834099341003410134102341033410434105341063410734108341093411034111341123411334114341153411634117341183411934120341213412234123341243412534126341273412834129341303413134132341333413434135341363413734138341393414034141341423414334144341453414634147341483414934150341513415234153341543415534156341573415834159341603416134162341633416434165341663416734168341693417034171341723417334174341753417634177341783417934180341813418234183341843418534186341873418834189341903419134192341933419434195341963419734198341993420034201342023420334204342053420634207342083420934210342113421234213342143421534216342173421834219342203422134222342233422434225342263422734228342293423034231342323423334234342353423634237342383423934240342413424234243342443424534246342473424834249342503425134252342533425434255342563425734258342593426034261342623426334264342653426634267342683426934270342713427234273342743427534276342773427834279342803428134282342833428434285342863428734288342893429034291342923429334294342953429634297342983429934300343013430234303343043430534306343073430834309343103431134312343133431434315343163431734318343193432034321343223432334324343253432634327343283432934330343313433234333343343433534336343373433834339343403434134342343433434434345343463434734348343493435034351343523435334354343553435634357343583435934360343613436234363343643436534366343673436834369343703437134372343733437434375343763437734378343793438034381343823438334384343853438634387343883438934390343913439234393343943439534396343973439834399344003440134402344033440434405344063440734408344093441034411344123441334414344153441634417344183441934420344213442234423344243442534426344273442834429344303443134432344333443434435344363443734438344393444034441344423444334444344453444634447344483444934450344513445234453344543445534456344573445834459344603446134462344633446434465344663446734468344693447034471344723447334474344753447634477344783447934480344813448234483344843448534486344873448834489344903449134492344933449434495344963449734498344993450034501345023450334504345053450634507345083450934510345113451234513345143451534516345173451834519345203452134522345233452434525345263452734528345293453034531345323453334534345353453634537345383453934540345413454234543345443454534546345473454834549345503455134552345533455434555345563455734558345593456034561345623456334564345653456634567345683456934570345713457234573345743457534576345773457834579345803458134582345833458434585345863458734588345893459034591345923459334594345953459634597345983459934600346013460234603346043460534606346073460834609346103461134612346133461434615346163461734618346193462034621346223462334624346253462634627346283462934630346313463234633346343463534636346373463834639346403464134642346433464434645346463464734648346493465034651346523465334654346553465634657346583465934660346613466234663346643466534666346673466834669346703467134672346733467434675346763467734678346793468034681346823468334684346853468634687346883468934690346913469234693346943469534696346973469834699347003470134702347033470434705347063470734708347093471034711347123471334714347153471634717347183471934720347213472234723347243472534726347273472834729347303473134732347333473434735347363473734738347393474034741347423474334744347453474634747347483474934750347513475234753347543475534756347573475834759347603476134762347633476434765347663476734768347693477034771347723477334774347753477634777347783477934780347813478234783347843478534786347873478834789347903479134792347933479434795347963479734798347993480034801348023480334804348053480634807348083480934810348113481234813348143481534816348173481834819348203482134822348233482434825348263482734828348293483034831348323483334834348353483634837348383483934840348413484234843348443484534846348473484834849348503485134852348533485434855348563485734858348593486034861348623486334864348653486634867348683486934870348713487234873348743487534876348773487834879348803488134882348833488434885348863488734888348893489034891348923489334894348953489634897348983489934900349013490234903349043490534906349073490834909349103491134912349133491434915349163491734918349193492034921349223492334924349253492634927349283492934930349313493234933349343493534936349373493834939349403494134942349433494434945349463494734948349493495034951349523495334954349553495634957349583495934960349613496234963349643496534966349673496834969349703497134972349733497434975349763497734978349793498034981349823498334984349853498634987349883498934990349913499234993349943499534996349973499834999350003500135002350033500435005350063500735008350093501035011350123501335014350153501635017350183501935020350213502235023350243502535026350273502835029350303503135032350333503435035350363503735038350393504035041350423504335044350453504635047350483504935050350513505235053350543505535056350573505835059350603506135062350633506435065350663506735068350693507035071350723507335074350753507635077350783507935080350813508235083350843508535086350873508835089350903509135092350933509435095350963509735098350993510035101351023510335104351053510635107351083510935110351113511235113351143511535116351173511835119351203512135122351233512435125351263512735128351293513035131351323513335134351353513635137351383513935140351413514235143351443514535146351473514835149351503515135152351533515435155351563515735158351593516035161351623516335164351653516635167351683516935170351713517235173351743517535176351773517835179351803518135182351833518435185351863518735188351893519035191351923519335194351953519635197351983519935200352013520235203352043520535206352073520835209352103521135212352133521435215352163521735218352193522035221352223522335224352253522635227352283522935230352313523235233352343523535236352373523835239352403524135242352433524435245352463524735248352493525035251352523525335254352553525635257352583525935260352613526235263352643526535266352673526835269352703527135272352733527435275352763527735278352793528035281352823528335284352853528635287352883528935290352913529235293352943529535296352973529835299353003530135302353033530435305353063530735308353093531035311353123531335314353153531635317353183531935320353213532235323353243532535326353273532835329353303533135332353333533435335353363533735338353393534035341353423534335344353453534635347353483534935350353513535235353353543535535356353573535835359353603536135362353633536435365353663536735368353693537035371353723537335374353753537635377353783537935380353813538235383353843538535386353873538835389353903539135392353933539435395353963539735398353993540035401354023540335404354053540635407354083540935410354113541235413354143541535416354173541835419354203542135422354233542435425354263542735428354293543035431354323543335434354353543635437354383543935440354413544235443354443544535446354473544835449354503545135452354533545435455354563545735458354593546035461354623546335464354653546635467354683546935470354713547235473354743547535476354773547835479354803548135482354833548435485354863548735488354893549035491354923549335494354953549635497354983549935500355013550235503355043550535506355073550835509355103551135512355133551435515355163551735518355193552035521355223552335524355253552635527355283552935530355313553235533355343553535536355373553835539355403554135542355433554435545355463554735548355493555035551355523555335554355553555635557355583555935560355613556235563355643556535566355673556835569355703557135572355733557435575355763557735578355793558035581355823558335584355853558635587355883558935590355913559235593355943559535596355973559835599356003560135602356033560435605356063560735608356093561035611356123561335614356153561635617356183561935620356213562235623356243562535626356273562835629356303563135632356333563435635356363563735638356393564035641356423564335644356453564635647356483564935650356513565235653356543565535656356573565835659356603566135662356633566435665356663566735668356693567035671356723567335674356753567635677356783567935680356813568235683356843568535686356873568835689356903569135692356933569435695356963569735698356993570035701357023570335704357053570635707357083570935710357113571235713357143571535716357173571835719357203572135722357233572435725357263572735728357293573035731357323573335734357353573635737357383573935740357413574235743357443574535746357473574835749357503575135752357533575435755357563575735758357593576035761357623576335764357653576635767357683576935770357713577235773357743577535776357773577835779357803578135782357833578435785357863578735788357893579035791357923579335794357953579635797357983579935800358013580235803358043580535806358073580835809358103581135812358133581435815358163581735818358193582035821358223582335824358253582635827358283582935830358313583235833358343583535836358373583835839358403584135842358433584435845358463584735848358493585035851358523585335854358553585635857358583585935860358613586235863358643586535866358673586835869358703587135872358733587435875358763587735878358793588035881358823588335884358853588635887358883588935890358913589235893358943589535896358973589835899359003590135902359033590435905359063590735908359093591035911359123591335914359153591635917359183591935920359213592235923359243592535926359273592835929359303593135932359333593435935359363593735938359393594035941359423594335944359453594635947359483594935950359513595235953359543595535956359573595835959359603596135962359633596435965359663596735968359693597035971359723597335974359753597635977359783597935980359813598235983359843598535986359873598835989359903599135992359933599435995359963599735998359993600036001360023600336004360053600636007360083600936010360113601236013360143601536016360173601836019360203602136022360233602436025360263602736028360293603036031360323603336034360353603636037360383603936040360413604236043360443604536046360473604836049360503605136052360533605436055360563605736058360593606036061360623606336064360653606636067360683606936070360713607236073360743607536076360773607836079360803608136082360833608436085360863608736088360893609036091360923609336094360953609636097360983609936100361013610236103361043610536106361073610836109361103611136112361133611436115361163611736118361193612036121361223612336124361253612636127361283612936130361313613236133361343613536136361373613836139361403614136142361433614436145361463614736148361493615036151361523615336154361553615636157361583615936160361613616236163361643616536166361673616836169361703617136172361733617436175361763617736178361793618036181361823618336184361853618636187361883618936190361913619236193361943619536196361973619836199362003620136202362033620436205362063620736208362093621036211362123621336214362153621636217362183621936220362213622236223362243622536226362273622836229362303623136232362333623436235362363623736238362393624036241362423624336244362453624636247362483624936250362513625236253362543625536256362573625836259362603626136262362633626436265362663626736268362693627036271362723627336274362753627636277362783627936280362813628236283362843628536286362873628836289362903629136292362933629436295362963629736298362993630036301363023630336304363053630636307363083630936310363113631236313363143631536316363173631836319363203632136322363233632436325363263632736328363293633036331363323633336334363353633636337363383633936340363413634236343363443634536346363473634836349363503635136352363533635436355363563635736358363593636036361363623636336364363653636636367363683636936370363713637236373363743637536376363773637836379363803638136382363833638436385363863638736388363893639036391363923639336394363953639636397363983639936400364013640236403364043640536406364073640836409364103641136412364133641436415364163641736418364193642036421364223642336424364253642636427364283642936430364313643236433364343643536436364373643836439364403644136442364433644436445364463644736448364493645036451364523645336454364553645636457364583645936460364613646236463364643646536466364673646836469364703647136472364733647436475364763647736478364793648036481364823648336484364853648636487364883648936490364913649236493364943649536496364973649836499365003650136502365033650436505365063650736508365093651036511365123651336514365153651636517365183651936520365213652236523365243652536526365273652836529365303653136532365333653436535365363653736538365393654036541365423654336544365453654636547365483654936550365513655236553365543655536556365573655836559365603656136562365633656436565365663656736568365693657036571365723657336574365753657636577365783657936580365813658236583365843658536586365873658836589365903659136592365933659436595365963659736598365993660036601366023660336604366053660636607366083660936610366113661236613366143661536616366173661836619366203662136622366233662436625366263662736628366293663036631366323663336634366353663636637366383663936640366413664236643366443664536646366473664836649366503665136652366533665436655366563665736658366593666036661366623666336664366653666636667366683666936670366713667236673366743667536676366773667836679366803668136682366833668436685366863668736688366893669036691366923669336694366953669636697366983669936700367013670236703367043670536706367073670836709367103671136712367133671436715367163671736718367193672036721367223672336724367253672636727367283672936730367313673236733367343673536736367373673836739367403674136742367433674436745367463674736748367493675036751367523675336754367553675636757367583675936760367613676236763367643676536766367673676836769367703677136772367733677436775367763677736778367793678036781367823678336784367853678636787367883678936790367913679236793367943679536796367973679836799368003680136802368033680436805368063680736808368093681036811368123681336814368153681636817368183681936820368213682236823368243682536826368273682836829368303683136832368333683436835368363683736838368393684036841368423684336844368453684636847368483684936850368513685236853368543685536856368573685836859368603686136862368633686436865368663686736868368693687036871368723687336874368753687636877368783687936880368813688236883368843688536886368873688836889368903689136892368933689436895368963689736898368993690036901369023690336904369053690636907369083690936910369113691236913369143691536916369173691836919369203692136922369233692436925369263692736928369293693036931369323693336934369353693636937369383693936940369413694236943369443694536946369473694836949369503695136952369533695436955369563695736958369593696036961369623696336964369653696636967369683696936970369713697236973369743697536976369773697836979369803698136982369833698436985369863698736988369893699036991369923699336994369953699636997369983699937000370013700237003370043700537006370073700837009370103701137012370133701437015370163701737018370193702037021370223702337024370253702637027370283702937030370313703237033370343703537036370373703837039370403704137042370433704437045370463704737048370493705037051370523705337054370553705637057370583705937060370613706237063370643706537066370673706837069370703707137072370733707437075370763707737078370793708037081370823708337084370853708637087370883708937090370913709237093370943709537096370973709837099371003710137102371033710437105371063710737108371093711037111371123711337114371153711637117371183711937120371213712237123371243712537126371273712837129371303713137132371333713437135371363713737138371393714037141371423714337144371453714637147371483714937150371513715237153371543715537156371573715837159371603716137162371633716437165371663716737168371693717037171371723717337174371753717637177371783717937180371813718237183371843718537186371873718837189371903719137192371933719437195371963719737198371993720037201372023720337204372053720637207372083720937210372113721237213372143721537216372173721837219372203722137222372233722437225372263722737228372293723037231372323723337234372353723637237372383723937240372413724237243372443724537246372473724837249372503725137252372533725437255372563725737258372593726037261372623726337264372653726637267372683726937270372713727237273372743727537276372773727837279372803728137282372833728437285372863728737288372893729037291372923729337294372953729637297372983729937300373013730237303373043730537306373073730837309373103731137312373133731437315373163731737318373193732037321373223732337324373253732637327373283732937330373313733237333373343733537336373373733837339373403734137342373433734437345373463734737348373493735037351373523735337354373553735637357373583735937360373613736237363373643736537366373673736837369373703737137372373733737437375373763737737378373793738037381373823738337384373853738637387373883738937390373913739237393373943739537396373973739837399374003740137402374033740437405374063740737408374093741037411374123741337414374153741637417374183741937420374213742237423374243742537426374273742837429374303743137432374333743437435374363743737438374393744037441374423744337444374453744637447374483744937450374513745237453374543745537456374573745837459374603746137462374633746437465374663746737468374693747037471374723747337474374753747637477374783747937480374813748237483374843748537486374873748837489374903749137492374933749437495374963749737498374993750037501375023750337504375053750637507375083750937510375113751237513375143751537516375173751837519375203752137522375233752437525375263752737528375293753037531375323753337534375353753637537375383753937540375413754237543375443754537546375473754837549375503755137552375533755437555375563755737558375593756037561375623756337564375653756637567375683756937570375713757237573375743757537576375773757837579375803758137582375833758437585375863758737588375893759037591375923759337594375953759637597375983759937600376013760237603376043760537606376073760837609376103761137612376133761437615376163761737618376193762037621376223762337624376253762637627376283762937630376313763237633376343763537636376373763837639376403764137642376433764437645376463764737648376493765037651376523765337654376553765637657376583765937660376613766237663376643766537666376673766837669376703767137672376733767437675376763767737678376793768037681376823768337684376853768637687376883768937690376913769237693376943769537696376973769837699377003770137702377033770437705377063770737708377093771037711377123771337714377153771637717377183771937720377213772237723377243772537726377273772837729377303773137732377333773437735377363773737738377393774037741377423774337744377453774637747377483774937750377513775237753377543775537756377573775837759377603776137762377633776437765377663776737768377693777037771377723777337774377753777637777377783777937780377813778237783377843778537786377873778837789377903779137792377933779437795377963779737798377993780037801378023780337804378053780637807378083780937810378113781237813378143781537816378173781837819378203782137822378233782437825378263782737828378293783037831378323783337834378353783637837378383783937840378413784237843378443784537846378473784837849378503785137852378533785437855378563785737858378593786037861378623786337864378653786637867378683786937870378713787237873378743787537876378773787837879378803788137882378833788437885378863788737888378893789037891378923789337894378953789637897378983789937900379013790237903379043790537906379073790837909379103791137912379133791437915379163791737918379193792037921379223792337924379253792637927379283792937930379313793237933379343793537936379373793837939379403794137942379433794437945379463794737948379493795037951379523795337954379553795637957379583795937960379613796237963379643796537966379673796837969379703797137972379733797437975379763797737978379793798037981379823798337984379853798637987379883798937990379913799237993379943799537996379973799837999380003800138002380033800438005380063800738008380093801038011380123801338014380153801638017380183801938020380213802238023380243802538026380273802838029380303803138032380333803438035380363803738038380393804038041380423804338044380453804638047380483804938050380513805238053380543805538056380573805838059380603806138062380633806438065380663806738068380693807038071380723807338074380753807638077380783807938080380813808238083380843808538086380873808838089380903809138092380933809438095380963809738098380993810038101381023810338104381053810638107381083810938110381113811238113381143811538116381173811838119381203812138122381233812438125381263812738128381293813038131381323813338134381353813638137381383813938140381413814238143381443814538146381473814838149381503815138152381533815438155381563815738158381593816038161381623816338164381653816638167381683816938170381713817238173381743817538176381773817838179381803818138182381833818438185381863818738188381893819038191381923819338194381953819638197381983819938200382013820238203382043820538206382073820838209382103821138212382133821438215382163821738218382193822038221382223822338224382253822638227382283822938230382313823238233382343823538236382373823838239382403824138242382433824438245382463824738248382493825038251382523825338254382553825638257382583825938260382613826238263382643826538266382673826838269382703827138272382733827438275382763827738278382793828038281382823828338284382853828638287382883828938290382913829238293382943829538296382973829838299383003830138302383033830438305383063830738308383093831038311383123831338314383153831638317383183831938320383213832238323383243832538326383273832838329383303833138332383333833438335383363833738338383393834038341383423834338344383453834638347383483834938350383513835238353383543835538356383573835838359383603836138362383633836438365383663836738368383693837038371383723837338374383753837638377383783837938380383813838238383383843838538386383873838838389383903839138392383933839438395383963839738398383993840038401384023840338404384053840638407384083840938410384113841238413384143841538416384173841838419384203842138422384233842438425384263842738428384293843038431384323843338434384353843638437384383843938440384413844238443384443844538446384473844838449384503845138452384533845438455384563845738458384593846038461384623846338464384653846638467384683846938470384713847238473384743847538476384773847838479384803848138482384833848438485384863848738488384893849038491384923849338494384953849638497384983849938500385013850238503385043850538506385073850838509385103851138512385133851438515385163851738518385193852038521385223852338524385253852638527385283852938530385313853238533385343853538536385373853838539385403854138542385433854438545385463854738548385493855038551385523855338554385553855638557385583855938560385613856238563385643856538566385673856838569385703857138572385733857438575385763857738578385793858038581385823858338584385853858638587385883858938590385913859238593385943859538596385973859838599386003860138602386033860438605386063860738608386093861038611386123861338614386153861638617386183861938620386213862238623386243862538626386273862838629386303863138632386333863438635386363863738638386393864038641386423864338644386453864638647386483864938650386513865238653386543865538656386573865838659386603866138662386633866438665386663866738668386693867038671386723867338674386753867638677386783867938680386813868238683386843868538686386873868838689386903869138692386933869438695386963869738698386993870038701387023870338704387053870638707387083870938710387113871238713387143871538716387173871838719387203872138722387233872438725387263872738728387293873038731387323873338734387353873638737387383873938740387413874238743387443874538746387473874838749387503875138752387533875438755387563875738758387593876038761387623876338764387653876638767387683876938770387713877238773387743877538776387773877838779387803878138782387833878438785387863878738788387893879038791387923879338794387953879638797387983879938800388013880238803388043880538806388073880838809388103881138812388133881438815388163881738818388193882038821388223882338824388253882638827388283882938830388313883238833388343883538836388373883838839388403884138842388433884438845388463884738848388493885038851388523885338854388553885638857388583885938860388613886238863388643886538866388673886838869388703887138872388733887438875388763887738878388793888038881388823888338884388853888638887388883888938890388913889238893388943889538896388973889838899389003890138902389033890438905389063890738908389093891038911389123891338914389153891638917389183891938920389213892238923389243892538926389273892838929389303893138932389333893438935389363893738938389393894038941389423894338944389453894638947389483894938950389513895238953389543895538956389573895838959389603896138962389633896438965389663896738968389693897038971389723897338974389753897638977389783897938980389813898238983389843898538986389873898838989389903899138992389933899438995389963899738998389993900039001390023900339004390053900639007390083900939010390113901239013390143901539016390173901839019390203902139022390233902439025390263902739028390293903039031390323903339034390353903639037390383903939040390413904239043390443904539046390473904839049390503905139052390533905439055390563905739058390593906039061390623906339064390653906639067390683906939070390713907239073390743907539076390773907839079390803908139082390833908439085390863908739088390893909039091390923909339094390953909639097390983909939100391013910239103391043910539106391073910839109391103911139112391133911439115391163911739118391193912039121391223912339124391253912639127391283912939130391313913239133391343913539136391373913839139391403914139142391433914439145391463914739148391493915039151391523915339154391553915639157391583915939160391613916239163391643916539166391673916839169391703917139172391733917439175391763917739178391793918039181391823918339184391853918639187391883918939190391913919239193391943919539196391973919839199392003920139202392033920439205392063920739208392093921039211392123921339214392153921639217392183921939220392213922239223392243922539226392273922839229392303923139232392333923439235392363923739238392393924039241392423924339244392453924639247392483924939250392513925239253392543925539256392573925839259392603926139262392633926439265392663926739268392693927039271392723927339274392753927639277392783927939280392813928239283392843928539286392873928839289392903929139292392933929439295392963929739298392993930039301393023930339304393053930639307393083930939310393113931239313393143931539316393173931839319393203932139322393233932439325393263932739328393293933039331393323933339334393353933639337393383933939340393413934239343393443934539346393473934839349393503935139352393533935439355393563935739358393593936039361393623936339364393653936639367393683936939370393713937239373393743937539376393773937839379393803938139382393833938439385393863938739388393893939039391393923939339394393953939639397393983939939400394013940239403394043940539406394073940839409394103941139412394133941439415394163941739418394193942039421394223942339424394253942639427394283942939430394313943239433394343943539436394373943839439394403944139442394433944439445394463944739448394493945039451394523945339454394553945639457394583945939460394613946239463394643946539466394673946839469394703947139472394733947439475394763947739478394793948039481394823948339484394853948639487394883948939490394913949239493394943949539496394973949839499395003950139502395033950439505395063950739508395093951039511395123951339514395153951639517395183951939520395213952239523395243952539526395273952839529395303953139532395333953439535395363953739538395393954039541395423954339544395453954639547395483954939550395513955239553395543955539556395573955839559395603956139562395633956439565395663956739568395693957039571395723957339574395753957639577395783957939580395813958239583395843958539586395873958839589395903959139592395933959439595395963959739598395993960039601396023960339604396053960639607396083960939610396113961239613396143961539616396173961839619396203962139622396233962439625396263962739628396293963039631396323963339634396353963639637396383963939640396413964239643396443964539646396473964839649396503965139652396533965439655396563965739658396593966039661396623966339664396653966639667396683966939670396713967239673396743967539676396773967839679396803968139682396833968439685396863968739688396893969039691396923969339694396953969639697396983969939700397013970239703397043970539706397073970839709397103971139712397133971439715397163971739718397193972039721397223972339724397253972639727397283972939730397313973239733397343973539736397373973839739397403974139742397433974439745397463974739748397493975039751397523975339754397553975639757397583975939760397613976239763397643976539766397673976839769397703977139772397733977439775397763977739778397793978039781397823978339784397853978639787397883978939790397913979239793397943979539796397973979839799398003980139802398033980439805398063980739808398093981039811398123981339814398153981639817398183981939820398213982239823398243982539826398273982839829398303983139832398333983439835398363983739838398393984039841398423984339844398453984639847398483984939850398513985239853398543985539856398573985839859398603986139862398633986439865398663986739868398693987039871398723987339874398753987639877398783987939880398813988239883398843988539886398873988839889398903989139892398933989439895398963989739898398993990039901399023990339904399053990639907399083990939910399113991239913399143991539916399173991839919399203992139922399233992439925399263992739928399293993039931399323993339934399353993639937399383993939940399413994239943399443994539946399473994839949399503995139952399533995439955399563995739958399593996039961399623996339964399653996639967399683996939970399713997239973399743997539976399773997839979399803998139982399833998439985399863998739988399893999039991399923999339994399953999639997399983999940000400014000240003400044000540006400074000840009400104001140012400134001440015400164001740018400194002040021400224002340024400254002640027400284002940030400314003240033400344003540036400374003840039400404004140042400434004440045400464004740048400494005040051400524005340054400554005640057400584005940060400614006240063400644006540066400674006840069400704007140072400734007440075400764007740078400794008040081400824008340084400854008640087400884008940090400914009240093400944009540096400974009840099401004010140102401034010440105401064010740108401094011040111401124011340114401154011640117401184011940120401214012240123401244012540126401274012840129401304013140132401334013440135401364013740138401394014040141401424014340144401454014640147401484014940150401514015240153401544015540156401574015840159401604016140162401634016440165401664016740168401694017040171401724017340174401754017640177401784017940180401814018240183401844018540186401874018840189401904019140192401934019440195401964019740198401994020040201402024020340204402054020640207402084020940210402114021240213402144021540216402174021840219402204022140222402234022440225402264022740228402294023040231402324023340234402354023640237402384023940240402414024240243402444024540246402474024840249402504025140252402534025440255402564025740258402594026040261402624026340264402654026640267402684026940270402714027240273402744027540276402774027840279402804028140282402834028440285402864028740288402894029040291402924029340294402954029640297402984029940300403014030240303403044030540306403074030840309403104031140312403134031440315403164031740318403194032040321403224032340324403254032640327403284032940330403314033240333403344033540336403374033840339403404034140342403434034440345403464034740348403494035040351403524035340354403554035640357403584035940360403614036240363403644036540366403674036840369403704037140372403734037440375403764037740378403794038040381403824038340384403854038640387403884038940390403914039240393403944039540396403974039840399404004040140402404034040440405404064040740408404094041040411404124041340414404154041640417404184041940420404214042240423404244042540426404274042840429404304043140432404334043440435404364043740438404394044040441404424044340444404454044640447404484044940450404514045240453404544045540456404574045840459404604046140462404634046440465404664046740468404694047040471404724047340474404754047640477404784047940480404814048240483404844048540486404874048840489404904049140492404934049440495404964049740498404994050040501405024050340504405054050640507405084050940510405114051240513405144051540516405174051840519405204052140522405234052440525405264052740528405294053040531405324053340534405354053640537405384053940540405414054240543405444054540546405474054840549405504055140552405534055440555405564055740558405594056040561405624056340564405654056640567405684056940570405714057240573405744057540576405774057840579405804058140582405834058440585405864058740588405894059040591405924059340594405954059640597405984059940600406014060240603406044060540606406074060840609406104061140612406134061440615406164061740618406194062040621406224062340624406254062640627406284062940630406314063240633406344063540636406374063840639406404064140642406434064440645406464064740648406494065040651406524065340654406554065640657406584065940660406614066240663406644066540666406674066840669406704067140672406734067440675406764067740678406794068040681406824068340684406854068640687406884068940690406914069240693406944069540696406974069840699407004070140702407034070440705407064070740708407094071040711407124071340714407154071640717407184071940720407214072240723407244072540726407274072840729407304073140732407334073440735407364073740738407394074040741407424074340744407454074640747407484074940750407514075240753407544075540756407574075840759407604076140762407634076440765407664076740768407694077040771407724077340774407754077640777407784077940780407814078240783407844078540786407874078840789407904079140792407934079440795407964079740798407994080040801408024080340804408054080640807408084080940810408114081240813408144081540816408174081840819408204082140822408234082440825408264082740828408294083040831408324083340834408354083640837408384083940840408414084240843408444084540846408474084840849408504085140852408534085440855408564085740858408594086040861408624086340864408654086640867408684086940870408714087240873408744087540876408774087840879408804088140882408834088440885408864088740888408894089040891408924089340894408954089640897408984089940900409014090240903409044090540906409074090840909409104091140912409134091440915409164091740918409194092040921409224092340924409254092640927409284092940930409314093240933409344093540936409374093840939409404094140942409434094440945409464094740948409494095040951409524095340954409554095640957409584095940960409614096240963409644096540966409674096840969409704097140972409734097440975409764097740978409794098040981409824098340984409854098640987409884098940990409914099240993409944099540996409974099840999410004100141002410034100441005410064100741008410094101041011410124101341014410154101641017410184101941020410214102241023410244102541026410274102841029410304103141032410334103441035410364103741038410394104041041410424104341044410454104641047410484104941050410514105241053410544105541056410574105841059410604106141062410634106441065410664106741068410694107041071410724107341074410754107641077410784107941080410814108241083410844108541086410874108841089410904109141092410934109441095410964109741098410994110041101411024110341104411054110641107411084110941110411114111241113411144111541116411174111841119411204112141122411234112441125411264112741128411294113041131411324113341134411354113641137411384113941140411414114241143411444114541146411474114841149411504115141152411534115441155411564115741158411594116041161411624116341164411654116641167411684116941170411714117241173411744117541176411774117841179411804118141182411834118441185411864118741188411894119041191411924119341194411954119641197411984119941200412014120241203412044120541206412074120841209412104121141212412134121441215412164121741218412194122041221412224122341224412254122641227412284122941230412314123241233412344123541236412374123841239412404124141242412434124441245412464124741248412494125041251412524125341254412554125641257412584125941260412614126241263412644126541266412674126841269412704127141272412734127441275412764127741278412794128041281412824128341284412854128641287412884128941290412914129241293412944129541296412974129841299413004130141302413034130441305413064130741308413094131041311413124131341314413154131641317413184131941320413214132241323413244132541326413274132841329413304133141332413334133441335413364133741338413394134041341413424134341344413454134641347413484134941350413514135241353413544135541356413574135841359413604136141362413634136441365413664136741368413694137041371413724137341374413754137641377413784137941380413814138241383413844138541386413874138841389413904139141392413934139441395413964139741398413994140041401414024140341404414054140641407414084140941410414114141241413414144141541416414174141841419414204142141422414234142441425414264142741428414294143041431414324143341434414354143641437414384143941440414414144241443414444144541446414474144841449414504145141452414534145441455414564145741458414594146041461414624146341464414654146641467414684146941470414714147241473414744147541476414774147841479414804148141482414834148441485414864148741488414894149041491414924149341494414954149641497414984149941500415014150241503415044150541506415074150841509415104151141512415134151441515415164151741518415194152041521415224152341524415254152641527415284152941530415314153241533415344153541536415374153841539415404154141542415434154441545415464154741548415494155041551415524155341554415554155641557415584155941560415614156241563415644156541566415674156841569415704157141572415734157441575415764157741578415794158041581415824158341584415854158641587415884158941590415914159241593415944159541596415974159841599416004160141602416034160441605416064160741608416094161041611416124161341614416154161641617416184161941620416214162241623416244162541626416274162841629416304163141632416334163441635416364163741638416394164041641416424164341644416454164641647416484164941650416514165241653416544165541656416574165841659416604166141662416634166441665416664166741668416694167041671416724167341674416754167641677416784167941680416814168241683416844168541686416874168841689416904169141692416934169441695416964169741698416994170041701417024170341704417054170641707417084170941710417114171241713417144171541716417174171841719417204172141722417234172441725417264172741728417294173041731417324173341734417354173641737417384173941740417414174241743417444174541746417474174841749417504175141752417534175441755417564175741758417594176041761417624176341764417654176641767417684176941770417714177241773417744177541776417774177841779417804178141782417834178441785417864178741788417894179041791417924179341794417954179641797417984179941800418014180241803418044180541806418074180841809418104181141812418134181441815418164181741818418194182041821418224182341824418254182641827418284182941830418314183241833418344183541836418374183841839418404184141842418434184441845418464184741848418494185041851418524185341854418554185641857418584185941860418614186241863418644186541866418674186841869418704187141872418734187441875418764187741878418794188041881418824188341884418854188641887418884188941890418914189241893418944189541896418974189841899419004190141902419034190441905419064190741908419094191041911419124191341914419154191641917419184191941920419214192241923419244192541926419274192841929419304193141932419334193441935419364193741938419394194041941419424194341944419454194641947419484194941950419514195241953419544195541956419574195841959419604196141962419634196441965419664196741968419694197041971419724197341974419754197641977419784197941980419814198241983419844198541986419874198841989419904199141992419934199441995419964199741998419994200042001420024200342004420054200642007420084200942010420114201242013420144201542016420174201842019420204202142022420234202442025420264202742028420294203042031420324203342034420354203642037420384203942040420414204242043420444204542046420474204842049420504205142052420534205442055420564205742058420594206042061420624206342064420654206642067420684206942070420714207242073420744207542076420774207842079420804208142082420834208442085420864208742088420894209042091420924209342094420954209642097420984209942100421014210242103421044210542106421074210842109421104211142112421134211442115421164211742118421194212042121421224212342124421254212642127421284212942130421314213242133421344213542136421374213842139421404214142142421434214442145421464214742148421494215042151421524215342154421554215642157421584215942160421614216242163421644216542166421674216842169421704217142172421734217442175421764217742178421794218042181421824218342184421854218642187421884218942190421914219242193421944219542196421974219842199422004220142202422034220442205422064220742208422094221042211422124221342214422154221642217422184221942220422214222242223422244222542226422274222842229422304223142232422334223442235422364223742238422394224042241422424224342244422454224642247422484224942250422514225242253422544225542256422574225842259422604226142262422634226442265422664226742268422694227042271422724227342274422754227642277422784227942280422814228242283422844228542286422874228842289422904229142292422934229442295422964229742298422994230042301423024230342304423054230642307423084230942310423114231242313423144231542316423174231842319423204232142322423234232442325423264232742328423294233042331423324233342334423354233642337423384233942340423414234242343423444234542346423474234842349423504235142352423534235442355423564235742358423594236042361423624236342364423654236642367423684236942370423714237242373423744237542376423774237842379423804238142382423834238442385423864238742388423894239042391423924239342394423954239642397423984239942400424014240242403424044240542406424074240842409424104241142412424134241442415424164241742418424194242042421424224242342424424254242642427424284242942430424314243242433424344243542436424374243842439424404244142442424434244442445424464244742448424494245042451424524245342454424554245642457424584245942460424614246242463424644246542466424674246842469424704247142472424734247442475424764247742478424794248042481424824248342484424854248642487424884248942490424914249242493424944249542496424974249842499425004250142502425034250442505425064250742508425094251042511425124251342514425154251642517425184251942520425214252242523425244252542526425274252842529425304253142532425334253442535425364253742538425394254042541425424254342544425454254642547425484254942550425514255242553425544255542556425574255842559425604256142562425634256442565425664256742568425694257042571425724257342574425754257642577425784257942580425814258242583425844258542586425874258842589425904259142592425934259442595425964259742598425994260042601426024260342604426054260642607426084260942610426114261242613426144261542616426174261842619426204262142622426234262442625426264262742628426294263042631426324263342634426354263642637426384263942640426414264242643426444264542646426474264842649426504265142652426534265442655426564265742658426594266042661426624266342664426654266642667426684266942670426714267242673426744267542676426774267842679426804268142682426834268442685426864268742688426894269042691426924269342694426954269642697426984269942700427014270242703427044270542706427074270842709427104271142712427134271442715427164271742718427194272042721427224272342724427254272642727427284272942730427314273242733427344273542736427374273842739427404274142742427434274442745427464274742748427494275042751427524275342754427554275642757427584275942760427614276242763427644276542766427674276842769427704277142772427734277442775427764277742778427794278042781427824278342784427854278642787427884278942790427914279242793427944279542796427974279842799428004280142802428034280442805428064280742808428094281042811428124281342814428154281642817428184281942820428214282242823428244282542826428274282842829428304283142832428334283442835428364283742838428394284042841428424284342844428454284642847428484284942850428514285242853428544285542856428574285842859428604286142862428634286442865428664286742868428694287042871428724287342874428754287642877428784287942880428814288242883428844288542886428874288842889428904289142892428934289442895428964289742898428994290042901429024290342904429054290642907429084290942910429114291242913429144291542916429174291842919429204292142922429234292442925429264292742928429294293042931429324293342934429354293642937429384293942940429414294242943429444294542946429474294842949429504295142952429534295442955429564295742958429594296042961429624296342964429654296642967429684296942970429714297242973429744297542976429774297842979429804298142982429834298442985429864298742988429894299042991429924299342994429954299642997429984299943000430014300243003430044300543006430074300843009430104301143012430134301443015430164301743018430194302043021430224302343024430254302643027430284302943030430314303243033430344303543036430374303843039430404304143042430434304443045430464304743048430494305043051430524305343054430554305643057430584305943060430614306243063430644306543066430674306843069430704307143072430734307443075430764307743078430794308043081430824308343084430854308643087430884308943090430914309243093430944309543096430974309843099431004310143102431034310443105431064310743108431094311043111431124311343114431154311643117431184311943120431214312243123431244312543126431274312843129431304313143132431334313443135431364313743138431394314043141431424314343144431454314643147431484314943150431514315243153431544315543156431574315843159431604316143162431634316443165431664316743168431694317043171431724317343174431754317643177431784317943180431814318243183431844318543186431874318843189431904319143192431934319443195431964319743198431994320043201432024320343204432054320643207432084320943210432114321243213432144321543216432174321843219432204322143222432234322443225432264322743228432294323043231432324323343234432354323643237432384323943240432414324243243432444324543246432474324843249432504325143252432534325443255432564325743258432594326043261432624326343264432654326643267432684326943270432714327243273432744327543276432774327843279432804328143282432834328443285432864328743288432894329043291432924329343294432954329643297432984329943300433014330243303433044330543306433074330843309433104331143312433134331443315433164331743318433194332043321433224332343324433254332643327433284332943330433314333243333433344333543336433374333843339433404334143342433434334443345433464334743348433494335043351433524335343354433554335643357433584335943360433614336243363433644336543366433674336843369433704337143372433734337443375433764337743378433794338043381433824338343384433854338643387433884338943390433914339243393433944339543396433974339843399434004340143402434034340443405434064340743408434094341043411434124341343414434154341643417434184341943420434214342243423434244342543426434274342843429434304343143432434334343443435434364343743438434394344043441434424344343444434454344643447434484344943450434514345243453434544345543456434574345843459434604346143462434634346443465434664346743468434694347043471434724347343474434754347643477434784347943480434814348243483434844348543486434874348843489434904349143492434934349443495434964349743498434994350043501435024350343504435054350643507435084350943510435114351243513435144351543516435174351843519435204352143522435234352443525435264352743528435294353043531435324353343534435354353643537435384353943540435414354243543435444354543546435474354843549435504355143552435534355443555435564355743558435594356043561435624356343564435654356643567435684356943570435714357243573435744357543576435774357843579435804358143582435834358443585435864358743588435894359043591435924359343594435954359643597435984359943600436014360243603436044360543606436074360843609436104361143612436134361443615436164361743618436194362043621436224362343624436254362643627436284362943630436314363243633436344363543636436374363843639436404364143642436434364443645436464364743648436494365043651436524365343654436554365643657436584365943660436614366243663436644366543666436674366843669436704367143672436734367443675436764367743678436794368043681436824368343684436854368643687436884368943690436914369243693436944369543696436974369843699437004370143702437034370443705437064370743708437094371043711437124371343714437154371643717437184371943720437214372243723437244372543726437274372843729437304373143732437334373443735437364373743738437394374043741437424374343744437454374643747437484374943750437514375243753437544375543756437574375843759437604376143762437634376443765437664376743768437694377043771437724377343774437754377643777437784377943780437814378243783437844378543786437874378843789437904379143792437934379443795437964379743798437994380043801438024380343804438054380643807438084380943810438114381243813438144381543816438174381843819438204382143822438234382443825438264382743828438294383043831438324383343834438354383643837438384383943840438414384243843438444384543846438474384843849438504385143852438534385443855438564385743858438594386043861438624386343864438654386643867438684386943870438714387243873438744387543876438774387843879438804388143882438834388443885438864388743888438894389043891438924389343894438954389643897438984389943900439014390243903439044390543906439074390843909439104391143912439134391443915439164391743918439194392043921439224392343924439254392643927439284392943930439314393243933439344393543936439374393843939439404394143942439434394443945439464394743948439494395043951439524395343954439554395643957439584395943960439614396243963439644396543966439674396843969439704397143972439734397443975439764397743978439794398043981439824398343984439854398643987439884398943990439914399243993439944399543996439974399843999440004400144002440034400444005440064400744008440094401044011440124401344014440154401644017440184401944020440214402244023440244402544026440274402844029440304403144032440334403444035440364403744038440394404044041440424404344044440454404644047440484404944050440514405244053440544405544056440574405844059440604406144062440634406444065440664406744068440694407044071440724407344074440754407644077440784407944080440814408244083440844408544086440874408844089440904409144092440934409444095440964409744098440994410044101441024410344104441054410644107441084410944110441114411244113441144411544116441174411844119441204412144122441234412444125441264412744128441294413044131441324413344134441354413644137441384413944140441414414244143441444414544146441474414844149441504415144152441534415444155441564415744158441594416044161441624416344164441654416644167441684416944170441714417244173441744417544176441774417844179441804418144182441834418444185441864418744188441894419044191441924419344194441954419644197441984419944200442014420244203442044420544206442074420844209442104421144212442134421444215442164421744218442194422044221442224422344224442254422644227442284422944230442314423244233442344423544236442374423844239442404424144242442434424444245442464424744248442494425044251442524425344254442554425644257442584425944260442614426244263442644426544266442674426844269442704427144272442734427444275442764427744278442794428044281442824428344284442854428644287442884428944290442914429244293442944429544296442974429844299443004430144302443034430444305443064430744308443094431044311443124431344314443154431644317443184431944320443214432244323443244432544326443274432844329443304433144332443334433444335443364433744338443394434044341443424434344344443454434644347443484434944350443514435244353443544435544356443574435844359443604436144362443634436444365443664436744368443694437044371443724437344374443754437644377443784437944380443814438244383443844438544386443874438844389443904439144392443934439444395443964439744398443994440044401444024440344404444054440644407444084440944410444114441244413444144441544416444174441844419444204442144422444234442444425444264442744428444294443044431444324443344434444354443644437444384443944440444414444244443444444444544446444474444844449444504445144452444534445444455444564445744458444594446044461444624446344464444654446644467444684446944470444714447244473444744447544476444774447844479444804448144482444834448444485444864448744488444894449044491444924449344494444954449644497444984449944500445014450244503445044450544506445074450844509445104451144512445134451444515445164451744518445194452044521445224452344524445254452644527445284452944530445314453244533445344453544536445374453844539445404454144542445434454444545445464454744548445494455044551445524455344554445554455644557445584455944560445614456244563445644456544566445674456844569445704457144572445734457444575445764457744578445794458044581445824458344584445854458644587445884458944590445914459244593445944459544596445974459844599446004460144602446034460444605446064460744608446094461044611446124461344614446154461644617446184461944620446214462244623446244462544626446274462844629446304463144632446334463444635446364463744638446394464044641446424464344644446454464644647446484464944650446514465244653446544465544656446574465844659446604466144662446634466444665446664466744668446694467044671446724467344674446754467644677446784467944680446814468244683446844468544686446874468844689446904469144692446934469444695446964469744698446994470044701447024470344704447054470644707447084470944710447114471244713447144471544716447174471844719447204472144722447234472444725447264472744728447294473044731447324473344734447354473644737447384473944740447414474244743447444474544746447474474844749447504475144752447534475444755447564475744758447594476044761447624476344764447654476644767447684476944770447714477244773447744477544776447774477844779447804478144782447834478444785447864478744788447894479044791447924479344794447954479644797447984479944800448014480244803448044480544806448074480844809448104481144812448134481444815448164481744818448194482044821448224482344824448254482644827448284482944830448314483244833448344483544836448374483844839448404484144842448434484444845448464484744848448494485044851448524485344854448554485644857448584485944860448614486244863448644486544866448674486844869448704487144872448734487444875448764487744878448794488044881448824488344884448854488644887448884488944890448914489244893448944489544896448974489844899449004490144902449034490444905449064490744908449094491044911449124491344914449154491644917449184491944920449214492244923449244492544926449274492844929449304493144932449334493444935449364493744938449394494044941449424494344944449454494644947449484494944950449514495244953449544495544956449574495844959449604496144962449634496444965449664496744968449694497044971449724497344974449754497644977449784497944980449814498244983449844498544986449874498844989449904499144992449934499444995449964499744998449994500045001450024500345004450054500645007450084500945010450114501245013450144501545016450174501845019450204502145022450234502445025450264502745028450294503045031450324503345034450354503645037450384503945040450414504245043450444504545046450474504845049450504505145052450534505445055450564505745058450594506045061450624506345064450654506645067450684506945070450714507245073450744507545076450774507845079450804508145082450834508445085450864508745088450894509045091450924509345094450954509645097450984509945100451014510245103451044510545106451074510845109451104511145112451134511445115451164511745118451194512045121451224512345124451254512645127451284512945130451314513245133451344513545136451374513845139451404514145142451434514445145451464514745148451494515045151451524515345154451554515645157451584515945160451614516245163451644516545166451674516845169451704517145172451734517445175451764517745178451794518045181451824518345184451854518645187451884518945190451914519245193451944519545196451974519845199452004520145202452034520445205452064520745208452094521045211452124521345214452154521645217452184521945220452214522245223452244522545226452274522845229452304523145232452334523445235452364523745238452394524045241452424524345244452454524645247452484524945250452514525245253452544525545256452574525845259452604526145262452634526445265452664526745268452694527045271452724527345274452754527645277452784527945280452814528245283452844528545286452874528845289452904529145292452934529445295452964529745298452994530045301453024530345304453054530645307453084530945310453114531245313453144531545316453174531845319453204532145322453234532445325453264532745328453294533045331453324533345334453354533645337453384533945340453414534245343453444534545346453474534845349453504535145352453534535445355453564535745358453594536045361453624536345364453654536645367453684536945370453714537245373453744537545376453774537845379453804538145382453834538445385453864538745388453894539045391453924539345394453954539645397453984539945400454014540245403454044540545406454074540845409454104541145412454134541445415454164541745418454194542045421454224542345424454254542645427454284542945430454314543245433454344543545436454374543845439454404544145442454434544445445454464544745448454494545045451454524545345454454554545645457454584545945460454614546245463454644546545466454674546845469454704547145472454734547445475454764547745478454794548045481454824548345484454854548645487454884548945490454914549245493454944549545496454974549845499455004550145502455034550445505455064550745508455094551045511455124551345514455154551645517455184551945520455214552245523455244552545526455274552845529455304553145532455334553445535455364553745538455394554045541455424554345544455454554645547455484554945550455514555245553455544555545556455574555845559455604556145562455634556445565455664556745568455694557045571455724557345574455754557645577455784557945580455814558245583455844558545586455874558845589455904559145592455934559445595455964559745598455994560045601456024560345604456054560645607456084560945610456114561245613456144561545616456174561845619456204562145622456234562445625456264562745628456294563045631456324563345634456354563645637456384563945640456414564245643456444564545646456474564845649456504565145652456534565445655456564565745658456594566045661456624566345664456654566645667456684566945670456714567245673456744567545676456774567845679456804568145682456834568445685456864568745688456894569045691456924569345694456954569645697456984569945700457014570245703457044570545706457074570845709457104571145712457134571445715457164571745718457194572045721457224572345724457254572645727457284572945730457314573245733457344573545736457374573845739457404574145742457434574445745457464574745748457494575045751457524575345754457554575645757457584575945760457614576245763457644576545766457674576845769457704577145772457734577445775457764577745778457794578045781457824578345784457854578645787457884578945790457914579245793457944579545796457974579845799458004580145802458034580445805458064580745808458094581045811458124581345814458154581645817458184581945820458214582245823458244582545826458274582845829458304583145832458334583445835458364583745838458394584045841458424584345844458454584645847458484584945850458514585245853458544585545856458574585845859458604586145862458634586445865458664586745868458694587045871458724587345874458754587645877458784587945880458814588245883458844588545886458874588845889458904589145892458934589445895458964589745898458994590045901459024590345904459054590645907459084590945910459114591245913459144591545916459174591845919459204592145922459234592445925459264592745928459294593045931459324593345934459354593645937459384593945940459414594245943459444594545946459474594845949459504595145952459534595445955459564595745958459594596045961459624596345964459654596645967459684596945970459714597245973459744597545976459774597845979459804598145982459834598445985459864598745988459894599045991459924599345994459954599645997459984599946000460014600246003460044600546006460074600846009460104601146012460134601446015460164601746018460194602046021460224602346024460254602646027460284602946030460314603246033460344603546036460374603846039460404604146042460434604446045460464604746048460494605046051460524605346054460554605646057460584605946060460614606246063460644606546066460674606846069460704607146072460734607446075460764607746078460794608046081460824608346084460854608646087460884608946090460914609246093460944609546096460974609846099461004610146102461034610446105461064610746108461094611046111461124611346114461154611646117461184611946120461214612246123461244612546126461274612846129461304613146132461334613446135461364613746138461394614046141461424614346144461454614646147461484614946150461514615246153461544615546156461574615846159461604616146162461634616446165461664616746168461694617046171461724617346174461754617646177461784617946180461814618246183461844618546186461874618846189461904619146192461934619446195461964619746198461994620046201462024620346204462054620646207462084620946210462114621246213462144621546216462174621846219462204622146222462234622446225462264622746228462294623046231462324623346234462354623646237462384623946240462414624246243462444624546246462474624846249462504625146252462534625446255462564625746258462594626046261462624626346264462654626646267462684626946270462714627246273462744627546276462774627846279462804628146282462834628446285462864628746288462894629046291462924629346294462954629646297462984629946300463014630246303463044630546306463074630846309463104631146312463134631446315463164631746318463194632046321463224632346324463254632646327463284632946330463314633246333463344633546336463374633846339463404634146342463434634446345463464634746348463494635046351463524635346354463554635646357463584635946360463614636246363463644636546366463674636846369463704637146372463734637446375463764637746378463794638046381463824638346384463854638646387463884638946390463914639246393463944639546396463974639846399464004640146402464034640446405464064640746408464094641046411464124641346414464154641646417464184641946420464214642246423464244642546426464274642846429464304643146432464334643446435464364643746438464394644046441464424644346444464454644646447464484644946450464514645246453464544645546456464574645846459464604646146462464634646446465464664646746468464694647046471464724647346474464754647646477464784647946480464814648246483464844648546486464874648846489464904649146492464934649446495464964649746498464994650046501465024650346504465054650646507465084650946510465114651246513465144651546516465174651846519465204652146522465234652446525465264652746528465294653046531465324653346534465354653646537465384653946540465414654246543465444654546546465474654846549465504655146552465534655446555465564655746558465594656046561465624656346564465654656646567465684656946570465714657246573465744657546576465774657846579465804658146582465834658446585465864658746588465894659046591465924659346594465954659646597465984659946600466014660246603466044660546606466074660846609466104661146612466134661446615466164661746618466194662046621466224662346624466254662646627466284662946630466314663246633466344663546636466374663846639466404664146642466434664446645466464664746648466494665046651466524665346654466554665646657466584665946660466614666246663466644666546666466674666846669466704667146672466734667446675466764667746678466794668046681466824668346684466854668646687466884668946690466914669246693466944669546696466974669846699467004670146702467034670446705467064670746708467094671046711467124671346714467154671646717467184671946720467214672246723467244672546726467274672846729467304673146732467334673446735467364673746738467394674046741467424674346744467454674646747467484674946750467514675246753467544675546756467574675846759467604676146762467634676446765467664676746768467694677046771467724677346774467754677646777467784677946780467814678246783467844678546786467874678846789467904679146792467934679446795467964679746798467994680046801468024680346804468054680646807468084680946810468114681246813468144681546816468174681846819468204682146822468234682446825468264682746828468294683046831468324683346834468354683646837468384683946840468414684246843468444684546846468474684846849468504685146852468534685446855468564685746858468594686046861468624686346864468654686646867468684686946870468714687246873468744687546876468774687846879468804688146882468834688446885468864688746888468894689046891468924689346894468954689646897468984689946900469014690246903469044690546906469074690846909469104691146912469134691446915469164691746918469194692046921469224692346924469254692646927469284692946930469314693246933469344693546936469374693846939469404694146942469434694446945469464694746948469494695046951469524695346954469554695646957469584695946960469614696246963469644696546966469674696846969469704697146972469734697446975469764697746978469794698046981469824698346984469854698646987469884698946990469914699246993469944699546996469974699846999470004700147002470034700447005470064700747008470094701047011470124701347014470154701647017470184701947020470214702247023470244702547026470274702847029470304703147032470334703447035470364703747038470394704047041470424704347044470454704647047470484704947050470514705247053470544705547056470574705847059470604706147062470634706447065470664706747068470694707047071470724707347074470754707647077470784707947080470814708247083470844708547086470874708847089470904709147092470934709447095470964709747098470994710047101471024710347104471054710647107471084710947110471114711247113471144711547116471174711847119471204712147122471234712447125471264712747128471294713047131471324713347134471354713647137471384713947140471414714247143471444714547146471474714847149471504715147152471534715447155471564715747158471594716047161471624716347164471654716647167471684716947170471714717247173471744717547176471774717847179471804718147182471834718447185471864718747188471894719047191471924719347194471954719647197471984719947200472014720247203472044720547206472074720847209472104721147212472134721447215472164721747218472194722047221472224722347224472254722647227472284722947230472314723247233472344723547236472374723847239472404724147242472434724447245472464724747248472494725047251472524725347254472554725647257472584725947260472614726247263472644726547266472674726847269472704727147272472734727447275472764727747278472794728047281472824728347284472854728647287472884728947290472914729247293472944729547296472974729847299473004730147302473034730447305473064730747308473094731047311473124731347314473154731647317473184731947320473214732247323473244732547326473274732847329473304733147332473334733447335473364733747338473394734047341473424734347344473454734647347473484734947350473514735247353473544735547356473574735847359473604736147362473634736447365473664736747368473694737047371473724737347374473754737647377473784737947380473814738247383473844738547386473874738847389473904739147392473934739447395473964739747398473994740047401474024740347404474054740647407474084740947410474114741247413474144741547416474174741847419474204742147422474234742447425474264742747428474294743047431474324743347434474354743647437474384743947440474414744247443474444744547446474474744847449474504745147452474534745447455474564745747458474594746047461474624746347464474654746647467474684746947470474714747247473474744747547476474774747847479474804748147482474834748447485474864748747488474894749047491474924749347494474954749647497474984749947500475014750247503475044750547506475074750847509475104751147512475134751447515475164751747518475194752047521475224752347524475254752647527475284752947530475314753247533475344753547536475374753847539475404754147542475434754447545475464754747548475494755047551475524755347554475554755647557475584755947560475614756247563475644756547566475674756847569475704757147572475734757447575475764757747578475794758047581475824758347584475854758647587475884758947590475914759247593475944759547596475974759847599476004760147602476034760447605476064760747608476094761047611476124761347614476154761647617476184761947620476214762247623476244762547626476274762847629476304763147632476334763447635476364763747638476394764047641476424764347644476454764647647476484764947650476514765247653476544765547656476574765847659476604766147662476634766447665476664766747668476694767047671476724767347674476754767647677476784767947680476814768247683476844768547686476874768847689476904769147692476934769447695476964769747698476994770047701477024770347704477054770647707477084770947710477114771247713477144771547716477174771847719477204772147722477234772447725477264772747728477294773047731477324773347734477354773647737477384773947740477414774247743477444774547746477474774847749477504775147752477534775447755477564775747758477594776047761477624776347764477654776647767477684776947770477714777247773477744777547776477774777847779477804778147782477834778447785477864778747788477894779047791477924779347794477954779647797477984779947800478014780247803478044780547806478074780847809478104781147812478134781447815478164781747818478194782047821478224782347824478254782647827478284782947830478314783247833478344783547836478374783847839478404784147842478434784447845478464784747848478494785047851478524785347854478554785647857478584785947860478614786247863478644786547866478674786847869478704787147872478734787447875478764787747878478794788047881478824788347884478854788647887478884788947890478914789247893478944789547896478974789847899479004790147902479034790447905479064790747908479094791047911479124791347914479154791647917479184791947920479214792247923479244792547926479274792847929479304793147932479334793447935479364793747938479394794047941479424794347944479454794647947479484794947950479514795247953479544795547956479574795847959479604796147962479634796447965479664796747968479694797047971479724797347974479754797647977479784797947980479814798247983479844798547986479874798847989479904799147992479934799447995479964799747998479994800048001480024800348004480054800648007480084800948010480114801248013480144801548016480174801848019480204802148022480234802448025480264802748028480294803048031480324803348034480354803648037480384803948040480414804248043480444804548046480474804848049480504805148052480534805448055480564805748058480594806048061480624806348064480654806648067480684806948070480714807248073480744807548076480774807848079480804808148082480834808448085480864808748088480894809048091480924809348094480954809648097480984809948100481014810248103481044810548106481074810848109481104811148112481134811448115481164811748118481194812048121481224812348124481254812648127481284812948130481314813248133481344813548136481374813848139481404814148142481434814448145481464814748148481494815048151481524815348154481554815648157481584815948160481614816248163481644816548166481674816848169481704817148172481734817448175481764817748178481794818048181481824818348184481854818648187481884818948190481914819248193481944819548196481974819848199482004820148202482034820448205482064820748208482094821048211482124821348214482154821648217482184821948220482214822248223482244822548226482274822848229482304823148232482334823448235482364823748238482394824048241482424824348244482454824648247482484824948250482514825248253482544825548256482574825848259482604826148262482634826448265482664826748268482694827048271482724827348274482754827648277482784827948280482814828248283482844828548286482874828848289482904829148292482934829448295482964829748298482994830048301483024830348304483054830648307483084830948310483114831248313483144831548316483174831848319483204832148322483234832448325483264832748328483294833048331483324833348334483354833648337483384833948340483414834248343483444834548346483474834848349483504835148352483534835448355483564835748358483594836048361483624836348364483654836648367483684836948370483714837248373483744837548376483774837848379483804838148382483834838448385483864838748388483894839048391483924839348394483954839648397483984839948400484014840248403484044840548406484074840848409484104841148412484134841448415484164841748418484194842048421484224842348424484254842648427484284842948430484314843248433484344843548436484374843848439484404844148442484434844448445484464844748448484494845048451484524845348454484554845648457484584845948460484614846248463484644846548466484674846848469484704847148472484734847448475484764847748478484794848048481484824848348484484854848648487484884848948490484914849248493484944849548496484974849848499485004850148502485034850448505485064850748508485094851048511485124851348514485154851648517485184851948520485214852248523485244852548526485274852848529485304853148532485334853448535485364853748538485394854048541485424854348544485454854648547485484854948550485514855248553485544855548556485574855848559485604856148562485634856448565485664856748568485694857048571485724857348574485754857648577485784857948580485814858248583485844858548586485874858848589485904859148592485934859448595485964859748598485994860048601486024860348604486054860648607486084860948610486114861248613486144861548616486174861848619486204862148622486234862448625486264862748628486294863048631486324863348634486354863648637486384863948640486414864248643486444864548646486474864848649486504865148652486534865448655486564865748658486594866048661486624866348664486654866648667486684866948670486714867248673486744867548676486774867848679486804868148682486834868448685486864868748688486894869048691486924869348694486954869648697486984869948700487014870248703487044870548706487074870848709487104871148712487134871448715487164871748718487194872048721487224872348724487254872648727487284872948730487314873248733487344873548736487374873848739487404874148742487434874448745487464874748748487494875048751487524875348754487554875648757487584875948760487614876248763487644876548766487674876848769487704877148772487734877448775487764877748778487794878048781487824878348784487854878648787487884878948790487914879248793487944879548796487974879848799488004880148802488034880448805488064880748808488094881048811488124881348814488154881648817488184881948820488214882248823488244882548826488274882848829488304883148832488334883448835488364883748838488394884048841488424884348844488454884648847488484884948850488514885248853488544885548856488574885848859488604886148862488634886448865488664886748868488694887048871488724887348874488754887648877488784887948880488814888248883488844888548886488874888848889488904889148892488934889448895488964889748898488994890048901489024890348904489054890648907489084890948910489114891248913489144891548916489174891848919489204892148922489234892448925489264892748928489294893048931489324893348934489354893648937489384893948940489414894248943489444894548946489474894848949489504895148952489534895448955489564895748958489594896048961489624896348964489654896648967489684896948970489714897248973489744897548976489774897848979489804898148982489834898448985489864898748988489894899048991489924899348994489954899648997489984899949000490014900249003490044900549006490074900849009490104901149012490134901449015490164901749018490194902049021490224902349024490254902649027490284902949030490314903249033490344903549036490374903849039490404904149042490434904449045490464904749048490494905049051490524905349054490554905649057490584905949060490614906249063490644906549066490674906849069490704907149072490734907449075490764907749078490794908049081490824908349084490854908649087490884908949090490914909249093490944909549096490974909849099491004910149102491034910449105491064910749108491094911049111491124911349114491154911649117491184911949120491214912249123491244912549126491274912849129491304913149132491334913449135491364913749138491394914049141491424914349144491454914649147491484914949150491514915249153491544915549156491574915849159491604916149162491634916449165491664916749168491694917049171491724917349174491754917649177491784917949180491814918249183491844918549186491874918849189491904919149192491934919449195491964919749198491994920049201492024920349204492054920649207492084920949210492114921249213492144921549216492174921849219492204922149222492234922449225492264922749228492294923049231492324923349234492354923649237492384923949240492414924249243492444924549246492474924849249492504925149252492534925449255492564925749258492594926049261492624926349264492654926649267492684926949270492714927249273492744927549276492774927849279492804928149282492834928449285492864928749288492894929049291492924929349294492954929649297492984929949300493014930249303493044930549306493074930849309493104931149312493134931449315493164931749318493194932049321493224932349324493254932649327493284932949330493314933249333493344933549336493374933849339493404934149342493434934449345493464934749348493494935049351493524935349354493554935649357493584935949360493614936249363493644936549366493674936849369493704937149372493734937449375493764937749378493794938049381493824938349384493854938649387493884938949390493914939249393493944939549396493974939849399494004940149402494034940449405494064940749408494094941049411494124941349414494154941649417494184941949420494214942249423494244942549426494274942849429494304943149432494334943449435494364943749438494394944049441494424944349444494454944649447494484944949450494514945249453494544945549456494574945849459494604946149462494634946449465494664946749468494694947049471494724947349474494754947649477494784947949480494814948249483494844948549486494874948849489494904949149492494934949449495494964949749498494994950049501495024950349504495054950649507495084950949510495114951249513495144951549516495174951849519495204952149522495234952449525495264952749528495294953049531495324953349534495354953649537495384953949540495414954249543495444954549546495474954849549495504955149552495534955449555495564955749558495594956049561495624956349564495654956649567495684956949570495714957249573495744957549576495774957849579495804958149582495834958449585495864958749588495894959049591495924959349594495954959649597495984959949600496014960249603496044960549606496074960849609496104961149612496134961449615496164961749618496194962049621496224962349624496254962649627496284962949630496314963249633496344963549636496374963849639496404964149642496434964449645496464964749648496494965049651496524965349654496554965649657496584965949660496614966249663496644966549666496674966849669496704967149672496734967449675496764967749678496794968049681496824968349684496854968649687496884968949690496914969249693496944969549696496974969849699497004970149702497034970449705497064970749708497094971049711497124971349714497154971649717497184971949720497214972249723497244972549726497274972849729497304973149732497334973449735497364973749738497394974049741497424974349744497454974649747497484974949750497514975249753497544975549756497574975849759497604976149762497634976449765497664976749768497694977049771497724977349774497754977649777497784977949780497814978249783497844978549786497874978849789497904979149792497934979449795497964979749798497994980049801498024980349804498054980649807498084980949810498114981249813498144981549816498174981849819498204982149822498234982449825498264982749828498294983049831498324983349834498354983649837498384983949840498414984249843498444984549846498474984849849498504985149852498534985449855498564985749858498594986049861498624986349864498654986649867498684986949870498714987249873498744987549876498774987849879498804988149882498834988449885498864988749888498894989049891498924989349894498954989649897498984989949900499014990249903499044990549906499074990849909499104991149912499134991449915499164991749918499194992049921499224992349924499254992649927499284992949930499314993249933499344993549936499374993849939499404994149942499434994449945499464994749948499494995049951499524995349954499554995649957499584995949960499614996249963499644996549966499674996849969499704997149972499734997449975499764997749978499794998049981499824998349984499854998649987499884998949990499914999249993499944999549996499974999849999500005000150002500035000450005500065000750008500095001050011500125001350014500155001650017500185001950020500215002250023500245002550026500275002850029500305003150032500335003450035500365003750038500395004050041500425004350044500455004650047500485004950050500515005250053500545005550056500575005850059500605006150062500635006450065500665006750068500695007050071500725007350074500755007650077500785007950080500815008250083500845008550086500875008850089500905009150092500935009450095500965009750098500995010050101501025010350104501055010650107501085010950110501115011250113501145011550116501175011850119501205012150122501235012450125501265012750128501295013050131501325013350134501355013650137501385013950140501415014250143501445014550146501475014850149501505015150152501535015450155501565015750158501595016050161501625016350164501655016650167501685016950170501715017250173501745017550176501775017850179501805018150182501835018450185501865018750188501895019050191501925019350194501955019650197501985019950200502015020250203502045020550206502075020850209502105021150212502135021450215502165021750218502195022050221502225022350224502255022650227502285022950230502315023250233502345023550236502375023850239502405024150242502435024450245502465024750248502495025050251502525025350254502555025650257502585025950260502615026250263502645026550266502675026850269502705027150272502735027450275502765027750278502795028050281502825028350284502855028650287502885028950290502915029250293502945029550296502975029850299503005030150302503035030450305503065030750308503095031050311503125031350314503155031650317503185031950320503215032250323503245032550326503275032850329503305033150332503335033450335503365033750338503395034050341503425034350344503455034650347503485034950350503515035250353503545035550356503575035850359503605036150362503635036450365503665036750368503695037050371503725037350374503755037650377503785037950380503815038250383503845038550386503875038850389503905039150392503935039450395503965039750398503995040050401504025040350404504055040650407504085040950410504115041250413504145041550416504175041850419504205042150422504235042450425504265042750428504295043050431504325043350434504355043650437504385043950440504415044250443504445044550446504475044850449504505045150452504535045450455504565045750458504595046050461504625046350464504655046650467504685046950470504715047250473504745047550476504775047850479504805048150482504835048450485504865048750488504895049050491504925049350494504955049650497504985049950500505015050250503505045050550506505075050850509505105051150512505135051450515505165051750518505195052050521505225052350524505255052650527505285052950530505315053250533505345053550536505375053850539505405054150542505435054450545505465054750548505495055050551505525055350554505555055650557505585055950560505615056250563505645056550566505675056850569505705057150572505735057450575505765057750578505795058050581505825058350584505855058650587505885058950590505915059250593505945059550596505975059850599506005060150602506035060450605506065060750608506095061050611506125061350614506155061650617506185061950620506215062250623506245062550626506275062850629506305063150632506335063450635506365063750638506395064050641506425064350644506455064650647506485064950650506515065250653506545065550656506575065850659506605066150662506635066450665506665066750668506695067050671506725067350674506755067650677506785067950680506815068250683506845068550686506875068850689506905069150692506935069450695506965069750698506995070050701507025070350704507055070650707507085070950710507115071250713507145071550716507175071850719507205072150722507235072450725507265072750728507295073050731507325073350734507355073650737507385073950740507415074250743507445074550746507475074850749507505075150752507535075450755507565075750758507595076050761507625076350764507655076650767507685076950770507715077250773507745077550776507775077850779507805078150782507835078450785507865078750788507895079050791507925079350794507955079650797507985079950800508015080250803508045080550806508075080850809508105081150812508135081450815508165081750818508195082050821508225082350824508255082650827508285082950830508315083250833508345083550836508375083850839508405084150842508435084450845508465084750848508495085050851508525085350854508555085650857508585085950860508615086250863508645086550866508675086850869508705087150872508735087450875508765087750878508795088050881508825088350884508855088650887508885088950890508915089250893508945089550896508975089850899509005090150902509035090450905509065090750908509095091050911509125091350914509155091650917509185091950920509215092250923509245092550926509275092850929509305093150932509335093450935509365093750938509395094050941509425094350944509455094650947509485094950950509515095250953509545095550956509575095850959509605096150962509635096450965509665096750968509695097050971509725097350974509755097650977509785097950980509815098250983509845098550986509875098850989509905099150992509935099450995509965099750998509995100051001510025100351004510055100651007510085100951010510115101251013510145101551016510175101851019510205102151022510235102451025510265102751028510295103051031510325103351034510355103651037510385103951040510415104251043510445104551046510475104851049510505105151052510535105451055510565105751058510595106051061510625106351064510655106651067510685106951070510715107251073510745107551076510775107851079510805108151082510835108451085510865108751088510895109051091510925109351094510955109651097510985109951100511015110251103511045110551106511075110851109511105111151112511135111451115511165111751118511195112051121511225112351124511255112651127511285112951130511315113251133511345113551136511375113851139511405114151142511435114451145511465114751148511495115051151511525115351154511555115651157511585115951160511615116251163511645116551166511675116851169511705117151172511735117451175511765117751178511795118051181511825118351184511855118651187511885118951190511915119251193511945119551196511975119851199512005120151202512035120451205512065120751208512095121051211512125121351214512155121651217512185121951220512215122251223512245122551226512275122851229512305123151232512335123451235512365123751238512395124051241512425124351244512455124651247512485124951250512515125251253512545125551256512575125851259512605126151262512635126451265512665126751268512695127051271512725127351274512755127651277512785127951280512815128251283512845128551286512875128851289512905129151292512935129451295512965129751298512995130051301513025130351304513055130651307513085130951310513115131251313513145131551316513175131851319513205132151322513235132451325513265132751328513295133051331513325133351334513355133651337513385133951340513415134251343513445134551346513475134851349513505135151352513535135451355513565135751358513595136051361513625136351364513655136651367513685136951370513715137251373513745137551376513775137851379513805138151382513835138451385513865138751388513895139051391513925139351394513955139651397513985139951400514015140251403514045140551406514075140851409514105141151412514135141451415514165141751418514195142051421514225142351424514255142651427514285142951430514315143251433514345143551436514375143851439514405144151442514435144451445514465144751448514495145051451514525145351454514555145651457514585145951460514615146251463514645146551466514675146851469514705147151472514735147451475514765147751478514795148051481514825148351484514855148651487514885148951490514915149251493514945149551496514975149851499515005150151502515035150451505515065150751508515095151051511515125151351514515155151651517515185151951520515215152251523515245152551526515275152851529515305153151532515335153451535515365153751538515395154051541515425154351544515455154651547515485154951550515515155251553515545155551556515575155851559515605156151562515635156451565515665156751568515695157051571515725157351574515755157651577515785157951580515815158251583515845158551586515875158851589515905159151592515935159451595515965159751598515995160051601516025160351604516055160651607516085160951610516115161251613516145161551616516175161851619516205162151622516235162451625516265162751628516295163051631516325163351634516355163651637516385163951640516415164251643516445164551646516475164851649516505165151652516535165451655516565165751658516595166051661516625166351664516655166651667516685166951670516715167251673516745167551676516775167851679516805168151682516835168451685516865168751688516895169051691516925169351694516955169651697516985169951700517015170251703517045170551706517075170851709517105171151712517135171451715517165171751718517195172051721517225172351724517255172651727517285172951730517315173251733517345173551736517375173851739517405174151742517435174451745517465174751748517495175051751517525175351754517555175651757517585175951760517615176251763517645176551766517675176851769517705177151772517735177451775517765177751778517795178051781517825178351784517855178651787517885178951790517915179251793517945179551796517975179851799518005180151802518035180451805518065180751808518095181051811518125181351814518155181651817518185181951820518215182251823518245182551826518275182851829518305183151832518335183451835518365183751838518395184051841518425184351844518455184651847518485184951850518515185251853518545185551856518575185851859518605186151862518635186451865518665186751868518695187051871518725187351874518755187651877518785187951880518815188251883518845188551886518875188851889518905189151892518935189451895518965189751898518995190051901519025190351904519055190651907519085190951910519115191251913519145191551916519175191851919519205192151922519235192451925519265192751928519295193051931519325193351934519355193651937519385193951940519415194251943519445194551946519475194851949519505195151952519535195451955519565195751958519595196051961519625196351964519655196651967519685196951970519715197251973519745197551976519775197851979519805198151982519835198451985519865198751988519895199051991519925199351994519955199651997519985199952000520015200252003520045200552006520075200852009520105201152012520135201452015520165201752018520195202052021520225202352024520255202652027520285202952030520315203252033520345203552036520375203852039520405204152042520435204452045520465204752048520495205052051520525205352054520555205652057520585205952060520615206252063520645206552066520675206852069520705207152072520735207452075520765207752078520795208052081520825208352084520855208652087520885208952090520915209252093520945209552096520975209852099521005210152102521035210452105521065210752108521095211052111521125211352114521155211652117521185211952120521215212252123521245212552126521275212852129521305213152132521335213452135521365213752138521395214052141521425214352144521455214652147521485214952150521515215252153521545215552156521575215852159521605216152162521635216452165521665216752168521695217052171521725217352174521755217652177521785217952180521815218252183521845218552186521875218852189521905219152192521935219452195521965219752198521995220052201522025220352204522055220652207522085220952210522115221252213522145221552216522175221852219522205222152222522235222452225522265222752228522295223052231522325223352234522355223652237522385223952240522415224252243522445224552246522475224852249522505225152252522535225452255522565225752258522595226052261522625226352264522655226652267522685226952270522715227252273522745227552276522775227852279522805228152282522835228452285522865228752288522895229052291522925229352294522955229652297522985229952300523015230252303523045230552306523075230852309523105231152312523135231452315523165231752318523195232052321523225232352324523255232652327523285232952330523315233252333523345233552336523375233852339523405234152342523435234452345523465234752348523495235052351523525235352354523555235652357523585235952360523615236252363523645236552366523675236852369523705237152372523735237452375523765237752378523795238052381523825238352384523855238652387523885238952390523915239252393523945239552396523975239852399524005240152402524035240452405524065240752408524095241052411524125241352414524155241652417524185241952420524215242252423524245242552426524275242852429524305243152432524335243452435524365243752438524395244052441524425244352444524455244652447524485244952450524515245252453524545245552456524575245852459524605246152462524635246452465524665246752468524695247052471524725247352474524755247652477524785247952480524815248252483524845248552486524875248852489524905249152492524935249452495524965249752498524995250052501525025250352504525055250652507525085250952510525115251252513525145251552516525175251852519525205252152522525235252452525525265252752528525295253052531525325253352534525355253652537525385253952540525415254252543525445254552546525475254852549525505255152552525535255452555525565255752558525595256052561525625256352564525655256652567525685256952570525715257252573525745257552576525775257852579525805258152582525835258452585525865258752588525895259052591525925259352594525955259652597525985259952600526015260252603526045260552606526075260852609526105261152612526135261452615526165261752618526195262052621526225262352624526255262652627526285262952630526315263252633526345263552636526375263852639526405264152642526435264452645526465264752648526495265052651526525265352654526555265652657526585265952660526615266252663526645266552666526675266852669526705267152672526735267452675526765267752678526795268052681526825268352684526855268652687526885268952690526915269252693526945269552696526975269852699527005270152702527035270452705527065270752708527095271052711527125271352714527155271652717527185271952720527215272252723527245272552726527275272852729527305273152732527335273452735527365273752738527395274052741527425274352744527455274652747527485274952750527515275252753527545275552756527575275852759527605276152762527635276452765527665276752768527695277052771527725277352774527755277652777527785277952780527815278252783527845278552786527875278852789527905279152792527935279452795527965279752798527995280052801528025280352804528055280652807528085280952810528115281252813528145281552816528175281852819528205282152822528235282452825528265282752828528295283052831528325283352834528355283652837528385283952840528415284252843528445284552846528475284852849528505285152852528535285452855528565285752858528595286052861528625286352864528655286652867528685286952870528715287252873528745287552876528775287852879528805288152882528835288452885528865288752888528895289052891528925289352894528955289652897528985289952900529015290252903529045290552906529075290852909529105291152912529135291452915529165291752918529195292052921529225292352924529255292652927529285292952930529315293252933529345293552936529375293852939529405294152942529435294452945529465294752948529495295052951529525295352954529555295652957529585295952960529615296252963529645296552966529675296852969529705297152972529735297452975529765297752978529795298052981529825298352984529855298652987529885298952990529915299252993529945299552996529975299852999530005300153002530035300453005530065300753008530095301053011530125301353014530155301653017530185301953020530215302253023530245302553026530275302853029530305303153032530335303453035530365303753038530395304053041530425304353044530455304653047530485304953050530515305253053530545305553056530575305853059530605306153062530635306453065530665306753068530695307053071530725307353074530755307653077530785307953080530815308253083530845308553086530875308853089530905309153092530935309453095530965309753098530995310053101531025310353104531055310653107531085310953110531115311253113531145311553116531175311853119531205312153122531235312453125531265312753128531295313053131531325313353134531355313653137531385313953140531415314253143531445314553146531475314853149531505315153152531535315453155531565315753158531595316053161531625316353164531655316653167531685316953170531715317253173531745317553176531775317853179531805318153182531835318453185531865318753188531895319053191531925319353194531955319653197531985319953200532015320253203532045320553206532075320853209532105321153212532135321453215532165321753218532195322053221532225322353224532255322653227532285322953230532315323253233532345323553236532375323853239532405324153242532435324453245532465324753248532495325053251532525325353254532555325653257532585325953260532615326253263532645326553266532675326853269532705327153272532735327453275532765327753278532795328053281532825328353284532855328653287532885328953290532915329253293532945329553296532975329853299533005330153302533035330453305533065330753308533095331053311533125331353314533155331653317533185331953320533215332253323533245332553326533275332853329533305333153332533335333453335533365333753338533395334053341533425334353344533455334653347533485334953350533515335253353533545335553356533575335853359533605336153362533635336453365533665336753368533695337053371533725337353374533755337653377533785337953380533815338253383533845338553386533875338853389533905339153392533935339453395533965339753398533995340053401534025340353404534055340653407534085340953410534115341253413534145341553416534175341853419534205342153422534235342453425534265342753428534295343053431534325343353434534355343653437534385343953440534415344253443534445344553446534475344853449534505345153452534535345453455534565345753458534595346053461534625346353464534655346653467534685346953470534715347253473534745347553476534775347853479534805348153482534835348453485534865348753488534895349053491534925349353494534955349653497534985349953500535015350253503535045350553506535075350853509535105351153512535135351453515535165351753518535195352053521535225352353524535255352653527535285352953530535315353253533535345353553536535375353853539535405354153542535435354453545535465354753548535495355053551535525355353554535555355653557535585355953560535615356253563535645356553566535675356853569535705357153572535735357453575535765357753578535795358053581535825358353584535855358653587535885358953590535915359253593535945359553596535975359853599536005360153602536035360453605536065360753608536095361053611536125361353614536155361653617536185361953620536215362253623536245362553626536275362853629536305363153632536335363453635536365363753638536395364053641536425364353644536455364653647536485364953650536515365253653536545365553656536575365853659536605366153662536635366453665536665366753668536695367053671536725367353674536755367653677536785367953680536815368253683536845368553686536875368853689536905369153692536935369453695536965369753698536995370053701537025370353704537055370653707537085370953710537115371253713537145371553716537175371853719537205372153722537235372453725537265372753728537295373053731537325373353734537355373653737537385373953740537415374253743537445374553746537475374853749537505375153752537535375453755537565375753758537595376053761537625376353764537655376653767537685376953770537715377253773537745377553776537775377853779537805378153782537835378453785537865378753788537895379053791537925379353794537955379653797537985379953800538015380253803538045380553806538075380853809538105381153812538135381453815538165381753818538195382053821538225382353824538255382653827538285382953830538315383253833538345383553836538375383853839538405384153842538435384453845538465384753848538495385053851538525385353854538555385653857538585385953860538615386253863538645386553866538675386853869538705387153872538735387453875538765387753878538795388053881538825388353884538855388653887538885388953890538915389253893538945389553896538975389853899539005390153902539035390453905539065390753908539095391053911539125391353914539155391653917539185391953920539215392253923539245392553926539275392853929539305393153932539335393453935539365393753938539395394053941539425394353944539455394653947539485394953950539515395253953539545395553956539575395853959539605396153962539635396453965539665396753968539695397053971539725397353974539755397653977539785397953980539815398253983539845398553986539875398853989539905399153992539935399453995539965399753998539995400054001540025400354004540055400654007540085400954010540115401254013540145401554016540175401854019540205402154022540235402454025540265402754028540295403054031540325403354034540355403654037540385403954040540415404254043540445404554046540475404854049540505405154052540535405454055540565405754058540595406054061540625406354064540655406654067540685406954070540715407254073540745407554076540775407854079540805408154082540835408454085540865408754088540895409054091540925409354094540955409654097540985409954100541015410254103541045410554106541075410854109541105411154112541135411454115541165411754118541195412054121541225412354124541255412654127541285412954130541315413254133541345413554136541375413854139541405414154142541435414454145541465414754148541495415054151541525415354154541555415654157541585415954160541615416254163541645416554166541675416854169541705417154172541735417454175541765417754178541795418054181541825418354184541855418654187541885418954190541915419254193541945419554196541975419854199542005420154202542035420454205542065420754208542095421054211542125421354214542155421654217542185421954220542215422254223542245422554226542275422854229542305423154232542335423454235542365423754238542395424054241542425424354244542455424654247542485424954250542515425254253542545425554256542575425854259542605426154262542635426454265542665426754268542695427054271542725427354274542755427654277542785427954280542815428254283542845428554286542875428854289542905429154292542935429454295542965429754298542995430054301543025430354304543055430654307543085430954310543115431254313543145431554316543175431854319543205432154322543235432454325543265432754328543295433054331543325433354334543355433654337543385433954340543415434254343543445434554346543475434854349543505435154352543535435454355543565435754358543595436054361543625436354364543655436654367543685436954370543715437254373543745437554376543775437854379543805438154382543835438454385543865438754388543895439054391543925439354394543955439654397543985439954400544015440254403544045440554406544075440854409544105441154412544135441454415544165441754418544195442054421544225442354424544255442654427544285442954430544315443254433544345443554436544375443854439544405444154442544435444454445544465444754448544495445054451544525445354454544555445654457544585445954460544615446254463544645446554466544675446854469544705447154472544735447454475544765447754478544795448054481544825448354484544855448654487544885448954490544915449254493544945449554496544975449854499545005450154502545035450454505545065450754508545095451054511545125451354514545155451654517545185451954520545215452254523545245452554526545275452854529545305453154532545335453454535545365453754538545395454054541545425454354544545455454654547545485454954550545515455254553545545455554556545575455854559545605456154562545635456454565545665456754568545695457054571545725457354574545755457654577545785457954580545815458254583545845458554586545875458854589545905459154592545935459454595545965459754598545995460054601546025460354604546055460654607546085460954610546115461254613546145461554616546175461854619546205462154622546235462454625546265462754628546295463054631546325463354634546355463654637546385463954640546415464254643546445464554646546475464854649546505465154652546535465454655546565465754658546595466054661546625466354664546655466654667546685466954670546715467254673546745467554676546775467854679546805468154682546835468454685546865468754688546895469054691546925469354694546955469654697546985469954700547015470254703547045470554706547075470854709547105471154712547135471454715547165471754718547195472054721547225472354724547255472654727547285472954730547315473254733547345473554736547375473854739547405474154742547435474454745547465474754748547495475054751547525475354754547555475654757547585475954760547615476254763547645476554766547675476854769547705477154772547735477454775547765477754778547795478054781547825478354784547855478654787547885478954790547915479254793547945479554796547975479854799548005480154802548035480454805548065480754808548095481054811548125481354814548155481654817548185481954820548215482254823548245482554826548275482854829548305483154832548335483454835548365483754838548395484054841548425484354844548455484654847548485484954850548515485254853548545485554856548575485854859548605486154862548635486454865548665486754868548695487054871548725487354874548755487654877548785487954880548815488254883548845488554886548875488854889548905489154892548935489454895548965489754898548995490054901549025490354904549055490654907549085490954910549115491254913549145491554916549175491854919549205492154922549235492454925549265492754928549295493054931549325493354934549355493654937549385493954940549415494254943549445494554946549475494854949549505495154952549535495454955549565495754958549595496054961549625496354964549655496654967549685496954970549715497254973549745497554976549775497854979549805498154982549835498454985549865498754988549895499054991549925499354994549955499654997549985499955000550015500255003550045500555006550075500855009550105501155012550135501455015550165501755018550195502055021550225502355024550255502655027550285502955030550315503255033550345503555036550375503855039550405504155042550435504455045550465504755048550495505055051550525505355054550555505655057550585505955060550615506255063550645506555066550675506855069550705507155072550735507455075550765507755078550795508055081550825508355084550855508655087550885508955090550915509255093550945509555096550975509855099551005510155102551035510455105551065510755108551095511055111551125511355114551155511655117551185511955120551215512255123551245512555126551275512855129551305513155132551335513455135551365513755138551395514055141551425514355144551455514655147551485514955150551515515255153551545515555156551575515855159551605516155162551635516455165551665516755168551695517055171551725517355174551755517655177551785517955180551815518255183551845518555186551875518855189551905519155192551935519455195551965519755198551995520055201552025520355204552055520655207552085520955210552115521255213552145521555216552175521855219552205522155222552235522455225552265522755228552295523055231552325523355234552355523655237552385523955240552415524255243552445524555246552475524855249552505525155252552535525455255552565525755258552595526055261552625526355264552655526655267552685526955270552715527255273552745527555276552775527855279552805528155282552835528455285552865528755288552895529055291552925529355294552955529655297552985529955300553015530255303553045530555306553075530855309553105531155312553135531455315553165531755318553195532055321553225532355324553255532655327553285532955330553315533255333553345533555336553375533855339553405534155342553435534455345553465534755348553495535055351553525535355354553555535655357553585535955360553615536255363553645536555366553675536855369553705537155372553735537455375553765537755378553795538055381553825538355384553855538655387553885538955390553915539255393553945539555396553975539855399554005540155402554035540455405554065540755408554095541055411554125541355414554155541655417554185541955420554215542255423554245542555426554275542855429554305543155432554335543455435554365543755438554395544055441554425544355444554455544655447554485544955450554515545255453554545545555456554575545855459554605546155462554635546455465554665546755468554695547055471554725547355474554755547655477554785547955480554815548255483554845548555486554875548855489554905549155492554935549455495554965549755498554995550055501555025550355504555055550655507555085550955510555115551255513555145551555516555175551855519555205552155522555235552455525555265552755528555295553055531555325553355534555355553655537555385553955540555415554255543555445554555546555475554855549555505555155552555535555455555555565555755558555595556055561555625556355564555655556655567555685556955570555715557255573555745557555576555775557855579555805558155582555835558455585555865558755588555895559055591555925559355594555955559655597555985559955600556015560255603556045560555606556075560855609556105561155612556135561455615556165561755618556195562055621556225562355624556255562655627556285562955630556315563255633556345563555636556375563855639556405564155642556435564455645556465564755648556495565055651556525565355654556555565655657556585565955660556615566255663556645566555666556675566855669556705567155672556735567455675556765567755678556795568055681556825568355684556855568655687556885568955690556915569255693556945569555696556975569855699557005570155702557035570455705557065570755708557095571055711557125571355714557155571655717557185571955720557215572255723557245572555726557275572855729557305573155732557335573455735557365573755738557395574055741557425574355744557455574655747557485574955750557515575255753557545575555756557575575855759557605576155762557635576455765557665576755768557695577055771557725577355774557755577655777557785577955780557815578255783557845578555786557875578855789557905579155792557935579455795557965579755798557995580055801558025580355804558055580655807558085580955810558115581255813558145581555816558175581855819558205582155822558235582455825558265582755828558295583055831558325583355834558355583655837558385583955840558415584255843558445584555846558475584855849558505585155852558535585455855558565585755858558595586055861558625586355864558655586655867558685586955870558715587255873558745587555876558775587855879558805588155882558835588455885558865588755888558895589055891558925589355894558955589655897558985589955900559015590255903559045590555906559075590855909559105591155912559135591455915559165591755918559195592055921559225592355924559255592655927559285592955930559315593255933559345593555936559375593855939559405594155942559435594455945559465594755948559495595055951559525595355954559555595655957559585595955960559615596255963559645596555966559675596855969559705597155972559735597455975559765597755978559795598055981559825598355984559855598655987559885598955990559915599255993559945599555996559975599855999560005600156002560035600456005560065600756008560095601056011560125601356014560155601656017560185601956020560215602256023560245602556026560275602856029560305603156032560335603456035560365603756038560395604056041560425604356044560455604656047560485604956050560515605256053560545605556056560575605856059560605606156062560635606456065560665606756068560695607056071560725607356074560755607656077560785607956080560815608256083560845608556086560875608856089560905609156092560935609456095560965609756098560995610056101561025610356104561055610656107561085610956110561115611256113561145611556116561175611856119561205612156122561235612456125561265612756128561295613056131561325613356134561355613656137561385613956140561415614256143561445614556146561475614856149561505615156152561535615456155561565615756158561595616056161561625616356164561655616656167561685616956170561715617256173561745617556176561775617856179561805618156182561835618456185561865618756188561895619056191561925619356194561955619656197561985619956200562015620256203562045620556206562075620856209562105621156212562135621456215562165621756218562195622056221562225622356224562255622656227562285622956230562315623256233562345623556236562375623856239562405624156242562435624456245562465624756248562495625056251562525625356254562555625656257562585625956260562615626256263562645626556266562675626856269562705627156272562735627456275562765627756278562795628056281562825628356284562855628656287562885628956290562915629256293562945629556296562975629856299563005630156302563035630456305563065630756308563095631056311563125631356314563155631656317563185631956320563215632256323563245632556326563275632856329563305633156332563335633456335563365633756338563395634056341563425634356344563455634656347563485634956350563515635256353563545635556356563575635856359563605636156362563635636456365563665636756368563695637056371563725637356374563755637656377563785637956380563815638256383563845638556386563875638856389563905639156392563935639456395563965639756398563995640056401564025640356404564055640656407564085640956410564115641256413564145641556416564175641856419564205642156422564235642456425564265642756428564295643056431564325643356434564355643656437564385643956440564415644256443564445644556446564475644856449564505645156452564535645456455564565645756458564595646056461564625646356464564655646656467564685646956470564715647256473564745647556476564775647856479564805648156482564835648456485564865648756488564895649056491564925649356494564955649656497564985649956500565015650256503565045650556506565075650856509565105651156512565135651456515565165651756518565195652056521565225652356524565255652656527565285652956530565315653256533565345653556536565375653856539565405654156542565435654456545565465654756548565495655056551565525655356554565555655656557565585655956560565615656256563565645656556566565675656856569565705657156572565735657456575565765657756578565795658056581565825658356584565855658656587565885658956590565915659256593565945659556596565975659856599566005660156602566035660456605566065660756608566095661056611566125661356614566155661656617566185661956620566215662256623566245662556626566275662856629566305663156632566335663456635566365663756638566395664056641566425664356644566455664656647566485664956650566515665256653566545665556656566575665856659566605666156662566635666456665566665666756668566695667056671566725667356674566755667656677566785667956680566815668256683566845668556686566875668856689566905669156692566935669456695566965669756698566995670056701567025670356704567055670656707567085670956710567115671256713567145671556716567175671856719567205672156722567235672456725567265672756728567295673056731567325673356734567355673656737567385673956740567415674256743567445674556746567475674856749567505675156752567535675456755567565675756758567595676056761567625676356764567655676656767567685676956770567715677256773567745677556776567775677856779567805678156782567835678456785567865678756788567895679056791567925679356794567955679656797567985679956800568015680256803568045680556806568075680856809568105681156812568135681456815568165681756818568195682056821568225682356824568255682656827568285682956830568315683256833568345683556836568375683856839568405684156842568435684456845568465684756848568495685056851568525685356854568555685656857568585685956860568615686256863568645686556866568675686856869568705687156872568735687456875568765687756878568795688056881568825688356884568855688656887568885688956890568915689256893568945689556896568975689856899569005690156902569035690456905569065690756908569095691056911569125691356914569155691656917569185691956920569215692256923569245692556926569275692856929569305693156932569335693456935569365693756938569395694056941569425694356944569455694656947569485694956950569515695256953569545695556956569575695856959569605696156962569635696456965569665696756968569695697056971569725697356974569755697656977569785697956980569815698256983569845698556986569875698856989569905699156992569935699456995569965699756998569995700057001570025700357004570055700657007570085700957010570115701257013570145701557016570175701857019570205702157022570235702457025570265702757028570295703057031570325703357034570355703657037570385703957040570415704257043570445704557046570475704857049570505705157052570535705457055570565705757058570595706057061570625706357064570655706657067570685706957070570715707257073570745707557076570775707857079570805708157082570835708457085570865708757088570895709057091570925709357094570955709657097570985709957100571015710257103571045710557106571075710857109571105711157112571135711457115571165711757118571195712057121571225712357124571255712657127571285712957130571315713257133571345713557136571375713857139571405714157142571435714457145571465714757148571495715057151571525715357154571555715657157571585715957160571615716257163571645716557166571675716857169571705717157172571735717457175571765717757178571795718057181571825718357184571855718657187571885718957190571915719257193571945719557196571975719857199572005720157202572035720457205572065720757208572095721057211572125721357214572155721657217572185721957220572215722257223572245722557226572275722857229572305723157232572335723457235572365723757238572395724057241572425724357244572455724657247572485724957250572515725257253572545725557256572575725857259572605726157262572635726457265572665726757268572695727057271572725727357274572755727657277572785727957280572815728257283572845728557286572875728857289572905729157292572935729457295572965729757298572995730057301573025730357304573055730657307573085730957310573115731257313573145731557316573175731857319573205732157322573235732457325573265732757328573295733057331573325733357334573355733657337573385733957340573415734257343573445734557346573475734857349573505735157352573535735457355573565735757358573595736057361573625736357364573655736657367573685736957370573715737257373573745737557376573775737857379573805738157382573835738457385573865738757388573895739057391573925739357394573955739657397573985739957400574015740257403574045740557406574075740857409574105741157412574135741457415574165741757418574195742057421574225742357424574255742657427574285742957430574315743257433574345743557436574375743857439574405744157442574435744457445574465744757448574495745057451574525745357454574555745657457574585745957460574615746257463574645746557466574675746857469574705747157472574735747457475574765747757478574795748057481574825748357484574855748657487574885748957490574915749257493574945749557496574975749857499575005750157502575035750457505575065750757508575095751057511575125751357514575155751657517575185751957520575215752257523575245752557526575275752857529575305753157532575335753457535575365753757538575395754057541575425754357544575455754657547575485754957550575515755257553575545755557556575575755857559575605756157562575635756457565575665756757568575695757057571575725757357574575755757657577575785757957580575815758257583575845758557586575875758857589575905759157592575935759457595575965759757598575995760057601576025760357604576055760657607576085760957610576115761257613576145761557616576175761857619576205762157622576235762457625576265762757628576295763057631576325763357634576355763657637576385763957640576415764257643576445764557646576475764857649576505765157652576535765457655576565765757658576595766057661576625766357664576655766657667576685766957670576715767257673576745767557676576775767857679576805768157682576835768457685576865768757688576895769057691576925769357694576955769657697576985769957700577015770257703577045770557706577075770857709577105771157712577135771457715577165771757718577195772057721577225772357724577255772657727577285772957730577315773257733577345773557736577375773857739577405774157742577435774457745577465774757748577495775057751577525775357754577555775657757577585775957760577615776257763577645776557766577675776857769577705777157772577735777457775577765777757778577795778057781577825778357784577855778657787577885778957790577915779257793577945779557796577975779857799578005780157802578035780457805578065780757808578095781057811578125781357814578155781657817578185781957820578215782257823578245782557826578275782857829578305783157832578335783457835578365783757838578395784057841578425784357844578455784657847578485784957850578515785257853578545785557856578575785857859578605786157862578635786457865578665786757868578695787057871578725787357874578755787657877578785787957880578815788257883578845788557886578875788857889578905789157892578935789457895578965789757898578995790057901579025790357904579055790657907579085790957910579115791257913579145791557916579175791857919579205792157922579235792457925579265792757928579295793057931579325793357934579355793657937579385793957940579415794257943579445794557946579475794857949579505795157952579535795457955579565795757958579595796057961579625796357964579655796657967579685796957970579715797257973579745797557976579775797857979579805798157982579835798457985579865798757988579895799057991579925799357994579955799657997579985799958000580015800258003580045800558006580075800858009580105801158012580135801458015580165801758018580195802058021580225802358024580255802658027580285802958030580315803258033580345803558036580375803858039580405804158042580435804458045580465804758048580495805058051580525805358054580555805658057580585805958060580615806258063580645806558066580675806858069580705807158072580735807458075580765807758078580795808058081580825808358084580855808658087580885808958090580915809258093580945809558096580975809858099581005810158102581035810458105581065810758108581095811058111581125811358114581155811658117581185811958120581215812258123581245812558126581275812858129581305813158132581335813458135581365813758138581395814058141581425814358144581455814658147581485814958150581515815258153581545815558156581575815858159581605816158162581635816458165581665816758168581695817058171581725817358174581755817658177581785817958180581815818258183581845818558186581875818858189581905819158192581935819458195581965819758198581995820058201582025820358204582055820658207582085820958210582115821258213582145821558216582175821858219582205822158222582235822458225582265822758228582295823058231582325823358234582355823658237582385823958240582415824258243582445824558246582475824858249582505825158252582535825458255582565825758258582595826058261582625826358264582655826658267582685826958270582715827258273582745827558276582775827858279582805828158282582835828458285582865828758288582895829058291582925829358294582955829658297582985829958300583015830258303583045830558306583075830858309583105831158312583135831458315583165831758318583195832058321583225832358324583255832658327583285832958330583315833258333583345833558336583375833858339583405834158342583435834458345583465834758348583495835058351583525835358354583555835658357583585835958360583615836258363583645836558366583675836858369583705837158372583735837458375583765837758378583795838058381583825838358384583855838658387583885838958390583915839258393583945839558396583975839858399584005840158402584035840458405584065840758408584095841058411584125841358414584155841658417584185841958420584215842258423584245842558426584275842858429584305843158432584335843458435584365843758438584395844058441584425844358444584455844658447584485844958450584515845258453584545845558456584575845858459584605846158462584635846458465584665846758468584695847058471584725847358474584755847658477584785847958480584815848258483584845848558486584875848858489584905849158492584935849458495584965849758498584995850058501585025850358504585055850658507585085850958510585115851258513585145851558516585175851858519585205852158522585235852458525585265852758528585295853058531585325853358534585355853658537585385853958540585415854258543585445854558546585475854858549585505855158552585535855458555585565855758558585595856058561585625856358564585655856658567585685856958570585715857258573585745857558576585775857858579585805858158582585835858458585585865858758588585895859058591585925859358594585955859658597585985859958600586015860258603586045860558606586075860858609586105861158612586135861458615586165861758618586195862058621586225862358624586255862658627586285862958630586315863258633586345863558636586375863858639586405864158642586435864458645586465864758648586495865058651586525865358654586555865658657586585865958660586615866258663586645866558666586675866858669586705867158672586735867458675586765867758678586795868058681586825868358684586855868658687586885868958690586915869258693586945869558696586975869858699587005870158702587035870458705587065870758708587095871058711587125871358714587155871658717587185871958720587215872258723587245872558726587275872858729587305873158732587335873458735587365873758738587395874058741587425874358744587455874658747587485874958750587515875258753587545875558756587575875858759587605876158762587635876458765587665876758768587695877058771587725877358774587755877658777587785877958780587815878258783587845878558786587875878858789587905879158792587935879458795587965879758798587995880058801588025880358804588055880658807588085880958810588115881258813588145881558816588175881858819588205882158822588235882458825588265882758828588295883058831588325883358834588355883658837588385883958840588415884258843588445884558846588475884858849588505885158852588535885458855588565885758858588595886058861588625886358864588655886658867588685886958870588715887258873588745887558876588775887858879588805888158882588835888458885588865888758888588895889058891588925889358894588955889658897588985889958900589015890258903589045890558906589075890858909589105891158912589135891458915589165891758918589195892058921589225892358924589255892658927589285892958930589315893258933589345893558936589375893858939589405894158942589435894458945589465894758948589495895058951589525895358954589555895658957589585895958960589615896258963589645896558966589675896858969589705897158972589735897458975589765897758978589795898058981589825898358984589855898658987589885898958990589915899258993589945899558996589975899858999590005900159002590035900459005590065900759008590095901059011590125901359014590155901659017590185901959020590215902259023590245902559026590275902859029590305903159032590335903459035590365903759038590395904059041590425904359044590455904659047590485904959050590515905259053590545905559056590575905859059590605906159062590635906459065590665906759068590695907059071590725907359074590755907659077590785907959080590815908259083590845908559086590875908859089590905909159092590935909459095590965909759098590995910059101591025910359104591055910659107591085910959110591115911259113591145911559116591175911859119591205912159122591235912459125591265912759128591295913059131591325913359134591355913659137591385913959140591415914259143591445914559146591475914859149591505915159152591535915459155591565915759158591595916059161591625916359164591655916659167591685916959170591715917259173591745917559176591775917859179591805918159182591835918459185591865918759188591895919059191591925919359194591955919659197591985919959200592015920259203592045920559206592075920859209592105921159212592135921459215592165921759218592195922059221592225922359224592255922659227592285922959230592315923259233592345923559236592375923859239592405924159242592435924459245592465924759248592495925059251592525925359254592555925659257592585925959260592615926259263592645926559266592675926859269592705927159272592735927459275592765927759278592795928059281592825928359284592855928659287592885928959290592915929259293592945929559296592975929859299593005930159302593035930459305593065930759308593095931059311593125931359314593155931659317593185931959320593215932259323593245932559326593275932859329593305933159332593335933459335593365933759338593395934059341593425934359344593455934659347593485934959350593515935259353593545935559356593575935859359593605936159362593635936459365593665936759368593695937059371593725937359374593755937659377593785937959380593815938259383593845938559386593875938859389593905939159392593935939459395593965939759398593995940059401594025940359404594055940659407594085940959410594115941259413594145941559416594175941859419594205942159422594235942459425594265942759428594295943059431594325943359434594355943659437594385943959440594415944259443594445944559446594475944859449594505945159452594535945459455594565945759458594595946059461594625946359464594655946659467594685946959470594715947259473594745947559476594775947859479594805948159482594835948459485594865948759488594895949059491594925949359494594955949659497594985949959500595015950259503595045950559506595075950859509595105951159512595135951459515595165951759518595195952059521595225952359524595255952659527595285952959530595315953259533595345953559536595375953859539595405954159542595435954459545595465954759548595495955059551595525955359554595555955659557595585955959560595615956259563595645956559566595675956859569595705957159572595735957459575595765957759578595795958059581595825958359584595855958659587595885958959590595915959259593595945959559596595975959859599596005960159602596035960459605596065960759608596095961059611596125961359614596155961659617596185961959620596215962259623596245962559626596275962859629596305963159632596335963459635596365963759638596395964059641596425964359644596455964659647596485964959650596515965259653596545965559656596575965859659596605966159662596635966459665596665966759668596695967059671596725967359674596755967659677596785967959680596815968259683596845968559686596875968859689596905969159692596935969459695596965969759698596995970059701597025970359704597055970659707597085970959710597115971259713597145971559716597175971859719597205972159722597235972459725597265972759728597295973059731597325973359734597355973659737597385973959740597415974259743597445974559746597475974859749597505975159752597535975459755597565975759758597595976059761597625976359764597655976659767597685976959770597715977259773597745977559776597775977859779597805978159782597835978459785597865978759788597895979059791597925979359794597955979659797597985979959800598015980259803598045980559806598075980859809598105981159812598135981459815598165981759818598195982059821598225982359824598255982659827598285982959830598315983259833598345983559836598375983859839598405984159842598435984459845598465984759848598495985059851598525985359854598555985659857598585985959860598615986259863598645986559866598675986859869598705987159872598735987459875598765987759878598795988059881598825988359884598855988659887598885988959890598915989259893598945989559896598975989859899599005990159902599035990459905599065990759908599095991059911599125991359914599155991659917599185991959920599215992259923599245992559926599275992859929599305993159932599335993459935599365993759938599395994059941599425994359944599455994659947599485994959950599515995259953599545995559956599575995859959599605996159962599635996459965599665996759968599695997059971599725997359974599755997659977599785997959980599815998259983599845998559986599875998859989599905999159992599935999459995599965999759998599996000060001600026000360004600056000660007600086000960010600116001260013600146001560016600176001860019600206002160022600236002460025600266002760028600296003060031600326003360034600356003660037600386003960040600416004260043600446004560046600476004860049600506005160052600536005460055600566005760058600596006060061600626006360064600656006660067600686006960070600716007260073600746007560076600776007860079600806008160082600836008460085600866008760088600896009060091600926009360094600956009660097600986009960100601016010260103601046010560106601076010860109601106011160112601136011460115601166011760118601196012060121601226012360124601256012660127601286012960130601316013260133601346013560136601376013860139601406014160142601436014460145601466014760148601496015060151601526015360154601556015660157601586015960160601616016260163601646016560166601676016860169601706017160172601736017460175601766017760178601796018060181601826018360184601856018660187601886018960190601916019260193601946019560196601976019860199602006020160202602036020460205602066020760208602096021060211602126021360214602156021660217602186021960220602216022260223602246022560226602276022860229602306023160232602336023460235602366023760238602396024060241602426024360244602456024660247602486024960250602516025260253602546025560256602576025860259602606026160262602636026460265602666026760268602696027060271602726027360274602756027660277602786027960280602816028260283602846028560286602876028860289602906029160292602936029460295602966029760298602996030060301603026030360304603056030660307603086030960310603116031260313603146031560316603176031860319603206032160322603236032460325603266032760328603296033060331603326033360334603356033660337603386033960340603416034260343603446034560346603476034860349603506035160352603536035460355603566035760358603596036060361603626036360364603656036660367603686036960370603716037260373603746037560376603776037860379603806038160382603836038460385603866038760388603896039060391603926039360394603956039660397603986039960400604016040260403604046040560406604076040860409604106041160412604136041460415604166041760418604196042060421604226042360424604256042660427604286042960430604316043260433604346043560436604376043860439604406044160442604436044460445604466044760448604496045060451604526045360454604556045660457604586045960460604616046260463604646046560466604676046860469604706047160472604736047460475604766047760478604796048060481604826048360484604856048660487604886048960490604916049260493604946049560496604976049860499605006050160502605036050460505605066050760508605096051060511605126051360514605156051660517605186051960520605216052260523605246052560526605276052860529605306053160532605336053460535605366053760538605396054060541605426054360544605456054660547605486054960550605516055260553605546055560556605576055860559605606056160562605636056460565605666056760568605696057060571605726057360574605756057660577605786057960580605816058260583605846058560586605876058860589605906059160592605936059460595605966059760598605996060060601606026060360604606056060660607606086060960610606116061260613606146061560616606176061860619606206062160622606236062460625606266062760628606296063060631606326063360634606356063660637606386063960640606416064260643606446064560646606476064860649606506065160652606536065460655606566065760658606596066060661606626066360664606656066660667606686066960670606716067260673606746067560676606776067860679606806068160682606836068460685606866068760688606896069060691606926069360694606956069660697606986069960700607016070260703607046070560706607076070860709607106071160712607136071460715607166071760718607196072060721607226072360724607256072660727607286072960730607316073260733607346073560736607376073860739607406074160742607436074460745607466074760748607496075060751607526075360754607556075660757607586075960760607616076260763607646076560766607676076860769607706077160772607736077460775607766077760778607796078060781607826078360784607856078660787607886078960790607916079260793607946079560796607976079860799608006080160802608036080460805608066080760808608096081060811608126081360814608156081660817608186081960820608216082260823608246082560826608276082860829608306083160832608336083460835608366083760838608396084060841608426084360844608456084660847608486084960850608516085260853608546085560856608576085860859608606086160862608636086460865608666086760868608696087060871608726087360874608756087660877608786087960880608816088260883608846088560886608876088860889608906089160892608936089460895608966089760898608996090060901609026090360904609056090660907609086090960910609116091260913609146091560916609176091860919609206092160922609236092460925609266092760928609296093060931609326093360934609356093660937609386093960940609416094260943609446094560946609476094860949609506095160952609536095460955609566095760958609596096060961609626096360964609656096660967609686096960970609716097260973609746097560976609776097860979609806098160982609836098460985609866098760988609896099060991609926099360994609956099660997609986099961000610016100261003610046100561006610076100861009610106101161012610136101461015610166101761018610196102061021610226102361024610256102661027610286102961030610316103261033610346103561036610376103861039610406104161042610436104461045610466104761048610496105061051610526105361054610556105661057610586105961060610616106261063610646106561066610676106861069610706107161072610736107461075610766107761078610796108061081610826108361084610856108661087610886108961090610916109261093610946109561096610976109861099611006110161102611036110461105611066110761108611096111061111611126111361114611156111661117611186111961120611216112261123611246112561126611276112861129611306113161132611336113461135611366113761138611396114061141611426114361144611456114661147611486114961150611516115261153611546115561156611576115861159611606116161162611636116461165611666116761168611696117061171611726117361174611756117661177611786117961180611816118261183611846118561186611876118861189611906119161192611936119461195611966119761198611996120061201612026120361204612056120661207612086120961210612116121261213612146121561216612176121861219612206122161222612236122461225612266122761228612296123061231612326123361234612356123661237612386123961240612416124261243612446124561246612476124861249612506125161252612536125461255612566125761258612596126061261612626126361264612656126661267612686126961270612716127261273612746127561276612776127861279612806128161282612836128461285612866128761288612896129061291612926129361294612956129661297612986129961300613016130261303613046130561306613076130861309613106131161312613136131461315613166131761318613196132061321613226132361324613256132661327613286132961330613316133261333613346133561336613376133861339613406134161342613436134461345613466134761348613496135061351613526135361354613556135661357613586135961360613616136261363613646136561366613676136861369613706137161372613736137461375613766137761378613796138061381613826138361384613856138661387613886138961390613916139261393613946139561396613976139861399614006140161402614036140461405614066140761408614096141061411614126141361414614156141661417614186141961420614216142261423614246142561426614276142861429614306143161432614336143461435614366143761438614396144061441614426144361444614456144661447614486144961450614516145261453614546145561456614576145861459614606146161462614636146461465614666146761468614696147061471614726147361474614756147661477614786147961480614816148261483614846148561486614876148861489614906149161492614936149461495614966149761498614996150061501615026150361504615056150661507615086150961510615116151261513615146151561516615176151861519615206152161522615236152461525615266152761528615296153061531615326153361534615356153661537615386153961540615416154261543615446154561546615476154861549615506155161552615536155461555615566155761558615596156061561615626156361564615656156661567615686156961570615716157261573615746157561576615776157861579615806158161582615836158461585615866158761588615896159061591615926159361594615956159661597615986159961600616016160261603616046160561606616076160861609616106161161612616136161461615616166161761618616196162061621616226162361624616256162661627616286162961630616316163261633616346163561636616376163861639616406164161642616436164461645616466164761648616496165061651616526165361654616556165661657616586165961660616616166261663616646166561666616676166861669616706167161672616736167461675616766167761678616796168061681616826168361684616856168661687616886168961690616916169261693616946169561696616976169861699617006170161702617036170461705617066170761708617096171061711617126171361714617156171661717617186171961720617216172261723617246172561726617276172861729617306173161732617336173461735617366173761738617396174061741617426174361744617456174661747617486174961750617516175261753617546175561756617576175861759617606176161762617636176461765617666176761768617696177061771617726177361774617756177661777617786177961780617816178261783617846178561786617876178861789617906179161792617936179461795617966179761798617996180061801618026180361804618056180661807618086180961810618116181261813618146181561816618176181861819618206182161822618236182461825618266182761828618296183061831618326183361834618356183661837618386183961840618416184261843618446184561846618476184861849618506185161852618536185461855618566185761858618596186061861618626186361864618656186661867618686186961870618716187261873618746187561876618776187861879618806188161882618836188461885618866188761888618896189061891618926189361894618956189661897618986189961900619016190261903619046190561906619076190861909619106191161912619136191461915619166191761918619196192061921619226192361924619256192661927619286192961930619316193261933619346193561936619376193861939619406194161942619436194461945619466194761948619496195061951619526195361954619556195661957619586195961960619616196261963619646196561966619676196861969619706197161972619736197461975619766197761978619796198061981619826198361984619856198661987619886198961990619916199261993619946199561996619976199861999620006200162002620036200462005620066200762008620096201062011620126201362014620156201662017620186201962020620216202262023620246202562026620276202862029620306203162032620336203462035620366203762038620396204062041620426204362044620456204662047620486204962050620516205262053620546205562056620576205862059620606206162062620636206462065620666206762068620696207062071620726207362074620756207662077620786207962080620816208262083620846208562086620876208862089620906209162092620936209462095620966209762098620996210062101621026210362104621056210662107621086210962110621116211262113621146211562116621176211862119621206212162122621236212462125621266212762128621296213062131621326213362134621356213662137621386213962140621416214262143621446214562146621476214862149621506215162152621536215462155621566215762158621596216062161621626216362164621656216662167621686216962170621716217262173621746217562176621776217862179621806218162182621836218462185621866218762188621896219062191621926219362194621956219662197621986219962200622016220262203622046220562206622076220862209622106221162212622136221462215622166221762218622196222062221622226222362224622256222662227622286222962230622316223262233622346223562236622376223862239622406224162242622436224462245622466224762248622496225062251622526225362254622556225662257622586225962260622616226262263622646226562266622676226862269622706227162272622736227462275622766227762278622796228062281622826228362284622856228662287622886228962290622916229262293622946229562296622976229862299623006230162302623036230462305623066230762308623096231062311623126231362314623156231662317623186231962320623216232262323623246232562326623276232862329623306233162332623336233462335623366233762338623396234062341623426234362344623456234662347623486234962350623516235262353623546235562356623576235862359623606236162362623636236462365623666236762368623696237062371623726237362374623756237662377623786237962380623816238262383623846238562386623876238862389623906239162392623936239462395623966239762398623996240062401624026240362404624056240662407624086240962410624116241262413624146241562416624176241862419624206242162422624236242462425624266242762428624296243062431624326243362434624356243662437624386243962440624416244262443624446244562446624476244862449624506245162452624536245462455624566245762458624596246062461624626246362464624656246662467624686246962470624716247262473624746247562476624776247862479624806248162482624836248462485624866248762488624896249062491624926249362494624956249662497624986249962500625016250262503625046250562506625076250862509625106251162512625136251462515625166251762518625196252062521625226252362524625256252662527625286252962530625316253262533625346253562536625376253862539625406254162542625436254462545625466254762548625496255062551625526255362554625556255662557625586255962560625616256262563625646256562566625676256862569625706257162572625736257462575625766257762578625796258062581625826258362584625856258662587625886258962590625916259262593625946259562596625976259862599626006260162602626036260462605626066260762608626096261062611626126261362614626156261662617626186261962620626216262262623626246262562626626276262862629626306263162632626336263462635626366263762638626396264062641626426264362644626456264662647626486264962650626516265262653626546265562656626576265862659626606266162662626636266462665626666266762668626696267062671626726267362674626756267662677626786267962680626816268262683626846268562686626876268862689626906269162692626936269462695626966269762698626996270062701627026270362704627056270662707627086270962710627116271262713627146271562716627176271862719627206272162722627236272462725627266272762728627296273062731627326273362734627356273662737627386273962740627416274262743627446274562746627476274862749627506275162752627536275462755627566275762758627596276062761627626276362764627656276662767627686276962770627716277262773627746277562776627776277862779627806278162782627836278462785627866278762788627896279062791627926279362794627956279662797627986279962800628016280262803628046280562806628076280862809628106281162812628136281462815628166281762818628196282062821628226282362824628256282662827628286282962830628316283262833628346283562836628376283862839628406284162842628436284462845628466284762848628496285062851628526285362854628556285662857628586285962860628616286262863628646286562866628676286862869628706287162872628736287462875628766287762878628796288062881628826288362884628856288662887628886288962890628916289262893628946289562896628976289862899629006290162902629036290462905629066290762908629096291062911629126291362914629156291662917629186291962920629216292262923629246292562926629276292862929629306293162932629336293462935629366293762938629396294062941629426294362944629456294662947629486294962950629516295262953629546295562956629576295862959629606296162962629636296462965629666296762968629696297062971629726297362974629756297662977629786297962980629816298262983629846298562986629876298862989629906299162992629936299462995629966299762998629996300063001630026300363004630056300663007630086300963010630116301263013630146301563016630176301863019630206302163022630236302463025630266302763028630296303063031630326303363034630356303663037630386303963040630416304263043630446304563046630476304863049630506305163052630536305463055630566305763058630596306063061630626306363064630656306663067630686306963070630716307263073630746307563076630776307863079630806308163082630836308463085630866308763088630896309063091630926309363094630956309663097630986309963100631016310263103631046310563106631076310863109631106311163112631136311463115631166311763118631196312063121631226312363124631256312663127631286312963130631316313263133631346313563136631376313863139631406314163142631436314463145631466314763148631496315063151631526315363154631556315663157631586315963160631616316263163631646316563166631676316863169631706317163172631736317463175631766317763178631796318063181631826318363184631856318663187631886318963190631916319263193631946319563196631976319863199632006320163202632036320463205632066320763208632096321063211632126321363214632156321663217632186321963220632216322263223632246322563226632276322863229632306323163232632336323463235632366323763238632396324063241632426324363244632456324663247632486324963250632516325263253632546325563256632576325863259632606326163262632636326463265632666326763268632696327063271632726327363274632756327663277632786327963280632816328263283632846328563286632876328863289632906329163292632936329463295632966329763298632996330063301633026330363304633056330663307633086330963310633116331263313633146331563316633176331863319633206332163322633236332463325633266332763328633296333063331633326333363334633356333663337633386333963340633416334263343633446334563346633476334863349633506335163352633536335463355633566335763358633596336063361633626336363364633656336663367633686336963370633716337263373633746337563376633776337863379633806338163382633836338463385633866338763388633896339063391633926339363394633956339663397633986339963400634016340263403634046340563406634076340863409634106341163412634136341463415634166341763418634196342063421634226342363424634256342663427634286342963430634316343263433634346343563436634376343863439634406344163442634436344463445634466344763448634496345063451634526345363454634556345663457634586345963460634616346263463634646346563466634676346863469634706347163472634736347463475634766347763478634796348063481634826348363484634856348663487634886348963490634916349263493634946349563496634976349863499635006350163502635036350463505635066350763508635096351063511635126351363514635156351663517635186351963520635216352263523635246352563526635276352863529635306353163532635336353463535635366353763538635396354063541635426354363544635456354663547635486354963550635516355263553635546355563556635576355863559635606356163562635636356463565635666356763568635696357063571635726357363574635756357663577635786357963580635816358263583635846358563586635876358863589635906359163592635936359463595635966359763598635996360063601636026360363604636056360663607636086360963610636116361263613636146361563616636176361863619636206362163622636236362463625636266362763628636296363063631636326363363634636356363663637636386363963640636416364263643636446364563646636476364863649636506365163652636536365463655636566365763658636596366063661636626366363664636656366663667636686366963670636716367263673636746367563676636776367863679636806368163682636836368463685636866368763688636896369063691636926369363694636956369663697636986369963700637016370263703637046370563706637076370863709637106371163712637136371463715637166371763718637196372063721637226372363724637256372663727637286372963730637316373263733637346373563736637376373863739637406374163742637436374463745637466374763748637496375063751637526375363754637556375663757637586375963760637616376263763637646376563766637676376863769637706377163772637736377463775637766377763778637796378063781637826378363784637856378663787637886378963790637916379263793637946379563796637976379863799638006380163802638036380463805638066380763808638096381063811638126381363814638156381663817638186381963820638216382263823638246382563826638276382863829638306383163832638336383463835638366383763838638396384063841638426384363844638456384663847638486384963850638516385263853638546385563856638576385863859638606386163862638636386463865638666386763868638696387063871638726387363874638756387663877638786387963880638816388263883638846388563886638876388863889638906389163892638936389463895638966389763898638996390063901639026390363904639056390663907639086390963910639116391263913639146391563916639176391863919639206392163922639236392463925639266392763928639296393063931639326393363934639356393663937639386393963940639416394263943639446394563946639476394863949639506395163952639536395463955639566395763958639596396063961639626396363964639656396663967639686396963970639716397263973639746397563976639776397863979639806398163982639836398463985639866398763988639896399063991639926399363994639956399663997639986399964000640016400264003640046400564006640076400864009640106401164012640136401464015640166401764018640196402064021640226402364024640256402664027640286402964030640316403264033640346403564036640376403864039640406404164042640436404464045640466404764048640496405064051640526405364054640556405664057640586405964060640616406264063640646406564066640676406864069640706407164072640736407464075640766407764078640796408064081640826408364084640856408664087640886408964090640916409264093640946409564096640976409864099641006410164102641036410464105641066410764108641096411064111641126411364114641156411664117641186411964120641216412264123641246412564126641276412864129641306413164132641336413464135641366413764138641396414064141641426414364144641456414664147641486414964150641516415264153641546415564156641576415864159641606416164162641636416464165641666416764168641696417064171641726417364174641756417664177641786417964180641816418264183641846418564186641876418864189641906419164192641936419464195641966419764198641996420064201642026420364204642056420664207642086420964210642116421264213642146421564216642176421864219642206422164222642236422464225642266422764228642296423064231642326423364234642356423664237642386423964240642416424264243642446424564246642476424864249642506425164252642536425464255642566425764258642596426064261642626426364264642656426664267642686426964270642716427264273642746427564276642776427864279642806428164282642836428464285642866428764288642896429064291642926429364294642956429664297642986429964300643016430264303643046430564306643076430864309643106431164312643136431464315643166431764318643196432064321643226432364324643256432664327643286432964330643316433264333643346433564336643376433864339643406434164342643436434464345643466434764348643496435064351643526435364354643556435664357643586435964360643616436264363643646436564366643676436864369643706437164372643736437464375643766437764378643796438064381643826438364384643856438664387643886438964390643916439264393643946439564396643976439864399644006440164402644036440464405644066440764408644096441064411644126441364414644156441664417644186441964420644216442264423644246442564426644276442864429644306443164432644336443464435644366443764438644396444064441644426444364444644456444664447644486444964450644516445264453644546445564456644576445864459644606446164462644636446464465644666446764468644696447064471644726447364474644756447664477644786447964480644816448264483644846448564486644876448864489644906449164492644936449464495644966449764498644996450064501645026450364504645056450664507645086450964510645116451264513645146451564516645176451864519645206452164522645236452464525645266452764528645296453064531645326453364534645356453664537645386453964540645416454264543645446454564546645476454864549645506455164552645536455464555645566455764558645596456064561645626456364564645656456664567645686456964570645716457264573645746457564576645776457864579645806458164582645836458464585645866458764588645896459064591645926459364594645956459664597645986459964600646016460264603646046460564606646076460864609646106461164612646136461464615646166461764618646196462064621646226462364624646256462664627646286462964630646316463264633646346463564636646376463864639646406464164642646436464464645646466464764648646496465064651646526465364654646556465664657646586465964660646616466264663646646466564666646676466864669646706467164672646736467464675646766467764678646796468064681646826468364684646856468664687646886468964690646916469264693646946469564696646976469864699647006470164702647036470464705647066470764708647096471064711647126471364714647156471664717647186471964720647216472264723647246472564726647276472864729647306473164732647336473464735647366473764738647396474064741647426474364744647456474664747647486474964750647516475264753647546475564756647576475864759647606476164762647636476464765647666476764768647696477064771647726477364774647756477664777647786477964780647816478264783647846478564786647876478864789647906479164792647936479464795647966479764798647996480064801648026480364804648056480664807648086480964810648116481264813648146481564816648176481864819648206482164822648236482464825648266482764828648296483064831648326483364834648356483664837648386483964840648416484264843648446484564846648476484864849648506485164852648536485464855648566485764858648596486064861648626486364864648656486664867648686486964870648716487264873648746487564876648776487864879648806488164882648836488464885648866488764888648896489064891648926489364894648956489664897648986489964900649016490264903649046490564906649076490864909649106491164912649136491464915649166491764918649196492064921649226492364924649256492664927649286492964930649316493264933649346493564936649376493864939649406494164942649436494464945649466494764948649496495064951649526495364954649556495664957649586495964960649616496264963649646496564966649676496864969649706497164972649736497464975649766497764978649796498064981649826498364984649856498664987649886498964990649916499264993649946499564996649976499864999650006500165002650036500465005650066500765008650096501065011650126501365014650156501665017650186501965020650216502265023650246502565026650276502865029650306503165032650336503465035650366503765038650396504065041650426504365044650456504665047650486504965050650516505265053650546505565056650576505865059650606506165062650636506465065650666506765068650696507065071650726507365074650756507665077650786507965080650816508265083650846508565086650876508865089650906509165092650936509465095650966509765098650996510065101651026510365104651056510665107651086510965110651116511265113651146511565116651176511865119651206512165122651236512465125651266512765128651296513065131651326513365134651356513665137651386513965140651416514265143651446514565146651476514865149651506515165152651536515465155651566515765158651596516065161651626516365164651656516665167651686516965170651716517265173651746517565176651776517865179651806518165182651836518465185651866518765188651896519065191651926519365194651956519665197651986519965200652016520265203652046520565206652076520865209652106521165212652136521465215652166521765218652196522065221652226522365224652256522665227652286522965230652316523265233652346523565236652376523865239652406524165242652436524465245652466524765248652496525065251652526525365254652556525665257652586525965260652616526265263652646526565266652676526865269652706527165272652736527465275652766527765278652796528065281652826528365284652856528665287652886528965290652916529265293652946529565296652976529865299653006530165302653036530465305653066530765308653096531065311653126531365314653156531665317653186531965320653216532265323653246532565326653276532865329653306533165332653336533465335653366533765338653396534065341653426534365344653456534665347653486534965350653516535265353653546535565356653576535865359653606536165362653636536465365653666536765368653696537065371653726537365374653756537665377653786537965380653816538265383653846538565386653876538865389653906539165392653936539465395653966539765398653996540065401654026540365404654056540665407654086540965410654116541265413654146541565416654176541865419654206542165422654236542465425654266542765428654296543065431654326543365434654356543665437654386543965440654416544265443654446544565446654476544865449654506545165452654536545465455654566545765458654596546065461654626546365464654656546665467654686546965470654716547265473654746547565476654776547865479654806548165482654836548465485654866548765488654896549065491654926549365494654956549665497654986549965500655016550265503655046550565506655076550865509655106551165512655136551465515655166551765518655196552065521655226552365524655256552665527655286552965530655316553265533655346553565536655376553865539655406554165542655436554465545655466554765548655496555065551655526555365554655556555665557655586555965560655616556265563655646556565566655676556865569655706557165572655736557465575655766557765578655796558065581655826558365584655856558665587655886558965590655916559265593655946559565596655976559865599656006560165602656036560465605656066560765608656096561065611656126561365614656156561665617656186561965620656216562265623656246562565626656276562865629656306563165632656336563465635656366563765638656396564065641656426564365644656456564665647656486564965650656516565265653656546565565656656576565865659656606566165662656636566465665656666566765668656696567065671656726567365674656756567665677656786567965680656816568265683656846568565686656876568865689656906569165692656936569465695656966569765698656996570065701657026570365704657056570665707657086570965710657116571265713657146571565716657176571865719657206572165722657236572465725657266572765728657296573065731657326573365734657356573665737657386573965740657416574265743657446574565746657476574865749657506575165752657536575465755657566575765758657596576065761657626576365764657656576665767657686576965770657716577265773657746577565776657776577865779657806578165782657836578465785657866578765788657896579065791657926579365794657956579665797657986579965800658016580265803658046580565806658076580865809658106581165812658136581465815658166581765818658196582065821658226582365824658256582665827658286582965830658316583265833658346583565836658376583865839658406584165842658436584465845658466584765848658496585065851658526585365854658556585665857658586585965860658616586265863658646586565866658676586865869658706587165872658736587465875658766587765878658796588065881658826588365884658856588665887658886588965890658916589265893658946589565896658976589865899659006590165902659036590465905659066590765908659096591065911659126591365914659156591665917659186591965920659216592265923659246592565926659276592865929659306593165932659336593465935659366593765938659396594065941659426594365944659456594665947659486594965950659516595265953659546595565956659576595865959659606596165962659636596465965659666596765968659696597065971659726597365974659756597665977659786597965980659816598265983659846598565986659876598865989659906599165992659936599465995659966599765998659996600066001660026600366004660056600666007660086600966010660116601266013660146601566016660176601866019660206602166022660236602466025660266602766028660296603066031660326603366034660356603666037660386603966040660416604266043660446604566046660476604866049660506605166052660536605466055660566605766058660596606066061660626606366064660656606666067660686606966070660716607266073660746607566076660776607866079660806608166082660836608466085660866608766088660896609066091660926609366094660956609666097660986609966100661016610266103661046610566106661076610866109661106611166112661136611466115661166611766118661196612066121661226612366124661256612666127661286612966130661316613266133661346613566136661376613866139661406614166142661436614466145661466614766148661496615066151661526615366154661556615666157661586615966160661616616266163661646616566166661676616866169661706617166172661736617466175661766617766178661796618066181661826618366184661856618666187661886618966190661916619266193661946619566196661976619866199662006620166202662036620466205662066620766208662096621066211662126621366214662156621666217662186621966220662216622266223662246622566226662276622866229662306623166232662336623466235662366623766238662396624066241662426624366244662456624666247662486624966250662516625266253662546625566256662576625866259662606626166262662636626466265662666626766268662696627066271662726627366274662756627666277662786627966280662816628266283662846628566286662876628866289662906629166292662936629466295662966629766298662996630066301663026630366304663056630666307663086630966310663116631266313663146631566316663176631866319663206632166322663236632466325663266632766328663296633066331663326633366334663356633666337663386633966340663416634266343663446634566346663476634866349663506635166352663536635466355663566635766358663596636066361663626636366364663656636666367663686636966370663716637266373663746637566376663776637866379663806638166382663836638466385663866638766388663896639066391663926639366394663956639666397663986639966400664016640266403664046640566406664076640866409664106641166412664136641466415664166641766418664196642066421664226642366424664256642666427664286642966430664316643266433664346643566436664376643866439664406644166442664436644466445664466644766448664496645066451664526645366454664556645666457664586645966460664616646266463664646646566466664676646866469664706647166472664736647466475664766647766478664796648066481664826648366484664856648666487664886648966490664916649266493664946649566496664976649866499665006650166502665036650466505665066650766508665096651066511665126651366514665156651666517665186651966520665216652266523665246652566526665276652866529665306653166532665336653466535665366653766538665396654066541665426654366544665456654666547665486654966550665516655266553665546655566556665576655866559665606656166562665636656466565665666656766568665696657066571665726657366574665756657666577665786657966580665816658266583665846658566586665876658866589665906659166592665936659466595665966659766598665996660066601666026660366604666056660666607666086660966610666116661266613666146661566616666176661866619666206662166622666236662466625666266662766628666296663066631666326663366634666356663666637666386663966640666416664266643666446664566646666476664866649666506665166652666536665466655666566665766658666596666066661666626666366664666656666666667666686666966670666716667266673666746667566676666776667866679666806668166682666836668466685666866668766688666896669066691666926669366694666956669666697666986669966700667016670266703667046670566706667076670866709667106671166712667136671466715667166671766718667196672066721667226672366724667256672666727667286672966730667316673266733667346673566736667376673866739667406674166742667436674466745667466674766748667496675066751667526675366754667556675666757667586675966760667616676266763667646676566766667676676866769667706677166772667736677466775667766677766778667796678066781667826678366784667856678666787667886678966790667916679266793667946679566796667976679866799668006680166802668036680466805668066680766808668096681066811668126681366814668156681666817668186681966820668216682266823668246682566826668276682866829668306683166832668336683466835668366683766838668396684066841668426684366844668456684666847668486684966850668516685266853668546685566856668576685866859668606686166862668636686466865668666686766868668696687066871668726687366874668756687666877668786687966880668816688266883668846688566886668876688866889668906689166892668936689466895668966689766898668996690066901669026690366904669056690666907669086690966910669116691266913669146691566916669176691866919669206692166922669236692466925669266692766928669296693066931669326693366934669356693666937669386693966940669416694266943669446694566946669476694866949669506695166952669536695466955669566695766958669596696066961669626696366964669656696666967669686696966970669716697266973669746697566976669776697866979669806698166982669836698466985669866698766988669896699066991669926699366994669956699666997669986699967000670016700267003670046700567006670076700867009670106701167012670136701467015670166701767018670196702067021670226702367024670256702667027670286702967030670316703267033670346703567036670376703867039670406704167042670436704467045670466704767048670496705067051670526705367054670556705667057670586705967060670616706267063670646706567066670676706867069670706707167072670736707467075670766707767078670796708067081670826708367084670856708667087670886708967090670916709267093670946709567096670976709867099671006710167102671036710467105671066710767108671096711067111671126711367114671156711667117671186711967120671216712267123671246712567126671276712867129671306713167132671336713467135671366713767138671396714067141671426714367144671456714667147671486714967150671516715267153671546715567156671576715867159671606716167162671636716467165671666716767168671696717067171671726717367174671756717667177671786717967180671816718267183671846718567186671876718867189671906719167192671936719467195671966719767198671996720067201672026720367204672056720667207672086720967210672116721267213672146721567216672176721867219672206722167222672236722467225672266722767228672296723067231672326723367234672356723667237672386723967240672416724267243672446724567246672476724867249672506725167252672536725467255672566725767258672596726067261672626726367264672656726667267672686726967270672716727267273672746727567276672776727867279672806728167282672836728467285672866728767288672896729067291672926729367294672956729667297672986729967300673016730267303673046730567306673076730867309673106731167312673136731467315673166731767318673196732067321673226732367324673256732667327673286732967330673316733267333673346733567336673376733867339673406734167342673436734467345673466734767348673496735067351673526735367354673556735667357673586735967360673616736267363673646736567366673676736867369673706737167372673736737467375673766737767378673796738067381673826738367384673856738667387673886738967390673916739267393673946739567396673976739867399674006740167402674036740467405674066740767408674096741067411674126741367414674156741667417674186741967420674216742267423674246742567426674276742867429674306743167432674336743467435674366743767438674396744067441674426744367444674456744667447674486744967450674516745267453674546745567456674576745867459674606746167462674636746467465674666746767468674696747067471674726747367474674756747667477674786747967480674816748267483674846748567486674876748867489674906749167492674936749467495674966749767498674996750067501675026750367504675056750667507675086750967510675116751267513675146751567516675176751867519675206752167522675236752467525675266752767528675296753067531675326753367534675356753667537675386753967540675416754267543675446754567546675476754867549675506755167552675536755467555675566755767558675596756067561675626756367564675656756667567675686756967570675716757267573675746757567576675776757867579675806758167582675836758467585675866758767588675896759067591675926759367594675956759667597675986759967600676016760267603676046760567606676076760867609676106761167612676136761467615676166761767618676196762067621676226762367624676256762667627676286762967630676316763267633676346763567636676376763867639676406764167642676436764467645676466764767648676496765067651676526765367654676556765667657676586765967660676616766267663676646766567666676676766867669676706767167672676736767467675676766767767678676796768067681676826768367684676856768667687676886768967690676916769267693676946769567696676976769867699677006770167702677036770467705677066770767708677096771067711677126771367714677156771667717677186771967720677216772267723677246772567726677276772867729677306773167732677336773467735677366773767738677396774067741677426774367744677456774667747677486774967750677516775267753677546775567756677576775867759677606776167762677636776467765677666776767768677696777067771677726777367774677756777667777677786777967780677816778267783677846778567786677876778867789677906779167792677936779467795677966779767798677996780067801678026780367804678056780667807678086780967810678116781267813678146781567816678176781867819678206782167822678236782467825678266782767828678296783067831678326783367834678356783667837678386783967840678416784267843678446784567846678476784867849678506785167852678536785467855678566785767858678596786067861678626786367864678656786667867678686786967870678716787267873678746787567876678776787867879678806788167882678836788467885678866788767888678896789067891678926789367894678956789667897678986789967900679016790267903679046790567906679076790867909679106791167912679136791467915679166791767918679196792067921679226792367924679256792667927679286792967930679316793267933679346793567936679376793867939679406794167942679436794467945679466794767948679496795067951679526795367954679556795667957679586795967960679616796267963679646796567966679676796867969679706797167972679736797467975679766797767978679796798067981679826798367984679856798667987679886798967990679916799267993679946799567996679976799867999680006800168002680036800468005680066800768008680096801068011680126801368014680156801668017680186801968020680216802268023680246802568026680276802868029680306803168032680336803468035680366803768038680396804068041680426804368044680456804668047680486804968050680516805268053680546805568056680576805868059680606806168062680636806468065680666806768068680696807068071680726807368074680756807668077680786807968080680816808268083680846808568086680876808868089680906809168092680936809468095680966809768098680996810068101681026810368104681056810668107681086810968110681116811268113681146811568116681176811868119681206812168122681236812468125681266812768128681296813068131681326813368134681356813668137681386813968140681416814268143681446814568146681476814868149681506815168152681536815468155681566815768158681596816068161681626816368164681656816668167681686816968170681716817268173681746817568176681776817868179681806818168182681836818468185681866818768188681896819068191681926819368194681956819668197681986819968200682016820268203682046820568206682076820868209682106821168212682136821468215682166821768218682196822068221682226822368224682256822668227682286822968230682316823268233682346823568236682376823868239682406824168242682436824468245682466824768248682496825068251682526825368254682556825668257682586825968260682616826268263682646826568266682676826868269682706827168272682736827468275682766827768278682796828068281682826828368284682856828668287682886828968290682916829268293682946829568296682976829868299683006830168302683036830468305683066830768308683096831068311683126831368314683156831668317683186831968320683216832268323683246832568326683276832868329683306833168332683336833468335683366833768338683396834068341683426834368344683456834668347683486834968350683516835268353683546835568356683576835868359683606836168362683636836468365683666836768368683696837068371683726837368374683756837668377683786837968380683816838268383683846838568386683876838868389683906839168392683936839468395683966839768398683996840068401684026840368404684056840668407684086840968410684116841268413684146841568416684176841868419684206842168422684236842468425684266842768428684296843068431684326843368434684356843668437684386843968440684416844268443684446844568446684476844868449684506845168452684536845468455684566845768458684596846068461684626846368464684656846668467684686846968470684716847268473684746847568476684776847868479684806848168482684836848468485684866848768488684896849068491684926849368494684956849668497684986849968500685016850268503685046850568506685076850868509685106851168512685136851468515685166851768518685196852068521685226852368524685256852668527685286852968530685316853268533685346853568536685376853868539685406854168542685436854468545685466854768548685496855068551685526855368554685556855668557685586855968560685616856268563685646856568566685676856868569685706857168572685736857468575685766857768578685796858068581685826858368584685856858668587685886858968590685916859268593685946859568596685976859868599686006860168602686036860468605686066860768608686096861068611686126861368614686156861668617686186861968620686216862268623686246862568626686276862868629686306863168632686336863468635686366863768638686396864068641686426864368644686456864668647686486864968650686516865268653686546865568656686576865868659686606866168662686636866468665686666866768668686696867068671686726867368674686756867668677686786867968680686816868268683686846868568686686876868868689686906869168692686936869468695686966869768698686996870068701687026870368704687056870668707687086870968710687116871268713687146871568716687176871868719687206872168722687236872468725687266872768728687296873068731687326873368734687356873668737687386873968740687416874268743687446874568746687476874868749687506875168752687536875468755687566875768758687596876068761687626876368764687656876668767687686876968770687716877268773687746877568776687776877868779687806878168782687836878468785687866878768788687896879068791687926879368794687956879668797687986879968800688016880268803688046880568806688076880868809688106881168812688136881468815688166881768818688196882068821688226882368824688256882668827688286882968830688316883268833688346883568836688376883868839688406884168842688436884468845688466884768848688496885068851688526885368854688556885668857688586885968860688616886268863688646886568866688676886868869688706887168872688736887468875688766887768878688796888068881688826888368884688856888668887688886888968890688916889268893688946889568896688976889868899689006890168902689036890468905689066890768908689096891068911689126891368914689156891668917689186891968920689216892268923689246892568926689276892868929689306893168932689336893468935689366893768938689396894068941689426894368944689456894668947689486894968950689516895268953689546895568956689576895868959689606896168962689636896468965689666896768968689696897068971689726897368974689756897668977689786897968980689816898268983689846898568986689876898868989689906899168992689936899468995689966899768998689996900069001690026900369004690056900669007690086900969010690116901269013690146901569016690176901869019690206902169022690236902469025690266902769028690296903069031690326903369034690356903669037690386903969040690416904269043690446904569046690476904869049690506905169052690536905469055690566905769058690596906069061690626906369064690656906669067690686906969070690716907269073690746907569076690776907869079690806908169082690836908469085690866908769088690896909069091690926909369094690956909669097690986909969100691016910269103691046910569106691076910869109691106911169112691136911469115691166911769118691196912069121691226912369124691256912669127691286912969130691316913269133691346913569136691376913869139691406914169142691436914469145691466914769148691496915069151691526915369154691556915669157691586915969160691616916269163691646916569166691676916869169691706917169172691736917469175691766917769178691796918069181691826918369184691856918669187691886918969190691916919269193691946919569196691976919869199692006920169202692036920469205692066920769208692096921069211692126921369214692156921669217692186921969220692216922269223692246922569226692276922869229692306923169232692336923469235692366923769238692396924069241692426924369244692456924669247692486924969250692516925269253692546925569256692576925869259692606926169262692636926469265692666926769268692696927069271692726927369274692756927669277692786927969280692816928269283692846928569286692876928869289692906929169292692936929469295692966929769298692996930069301693026930369304693056930669307693086930969310693116931269313693146931569316693176931869319693206932169322693236932469325693266932769328693296933069331693326933369334693356933669337693386933969340693416934269343693446934569346693476934869349693506935169352693536935469355693566935769358693596936069361693626936369364693656936669367693686936969370693716937269373693746937569376693776937869379693806938169382693836938469385693866938769388693896939069391693926939369394693956939669397693986939969400694016940269403694046940569406694076940869409694106941169412694136941469415694166941769418694196942069421694226942369424694256942669427694286942969430694316943269433694346943569436694376943869439694406944169442694436944469445694466944769448694496945069451694526945369454694556945669457694586945969460694616946269463694646946569466694676946869469694706947169472694736947469475694766947769478694796948069481694826948369484694856948669487694886948969490694916949269493694946949569496694976949869499695006950169502695036950469505695066950769508695096951069511695126951369514695156951669517695186951969520695216952269523695246952569526695276952869529695306953169532695336953469535695366953769538695396954069541695426954369544695456954669547695486954969550695516955269553695546955569556695576955869559695606956169562695636956469565695666956769568695696957069571695726957369574695756957669577695786957969580695816958269583695846958569586695876958869589695906959169592695936959469595695966959769598695996960069601696026960369604696056960669607696086960969610696116961269613696146961569616696176961869619696206962169622696236962469625696266962769628696296963069631696326963369634696356963669637696386963969640696416964269643696446964569646696476964869649696506965169652696536965469655696566965769658696596966069661696626966369664696656966669667696686966969670696716967269673696746967569676696776967869679696806968169682696836968469685696866968769688696896969069691696926969369694696956969669697696986969969700697016970269703697046970569706697076970869709697106971169712697136971469715697166971769718697196972069721697226972369724697256972669727697286972969730697316973269733697346973569736697376973869739697406974169742697436974469745697466974769748697496975069751697526975369754697556975669757697586975969760697616976269763697646976569766697676976869769697706977169772697736977469775697766977769778697796978069781697826978369784697856978669787697886978969790697916979269793697946979569796697976979869799698006980169802698036980469805698066980769808698096981069811698126981369814698156981669817698186981969820698216982269823698246982569826698276982869829698306983169832698336983469835698366983769838698396984069841698426984369844698456984669847698486984969850698516985269853698546985569856698576985869859698606986169862698636986469865698666986769868698696987069871698726987369874698756987669877698786987969880698816988269883698846988569886698876988869889698906989169892698936989469895698966989769898698996990069901699026990369904699056990669907699086990969910699116991269913699146991569916699176991869919699206992169922699236992469925699266992769928699296993069931699326993369934699356993669937699386993969940699416994269943699446994569946699476994869949699506995169952699536995469955699566995769958699596996069961699626996369964699656996669967699686996969970699716997269973699746997569976699776997869979699806998169982699836998469985699866998769988699896999069991699926999369994699956999669997699986999970000700017000270003700047000570006700077000870009700107001170012700137001470015700167001770018700197002070021700227002370024700257002670027700287002970030700317003270033700347003570036700377003870039700407004170042700437004470045700467004770048700497005070051700527005370054700557005670057700587005970060700617006270063700647006570066700677006870069700707007170072700737007470075700767007770078700797008070081700827008370084700857008670087700887008970090700917009270093700947009570096700977009870099701007010170102701037010470105701067010770108701097011070111701127011370114701157011670117701187011970120701217012270123701247012570126701277012870129701307013170132701337013470135701367013770138701397014070141701427014370144701457014670147701487014970150701517015270153701547015570156701577015870159701607016170162701637016470165701667016770168701697017070171701727017370174701757017670177701787017970180701817018270183701847018570186701877018870189701907019170192701937019470195701967019770198701997020070201702027020370204702057020670207702087020970210702117021270213702147021570216702177021870219702207022170222702237022470225702267022770228702297023070231702327023370234702357023670237702387023970240702417024270243702447024570246702477024870249702507025170252702537025470255702567025770258702597026070261702627026370264702657026670267702687026970270702717027270273702747027570276702777027870279702807028170282702837028470285702867028770288702897029070291702927029370294702957029670297702987029970300703017030270303703047030570306703077030870309703107031170312703137031470315703167031770318703197032070321703227032370324703257032670327703287032970330703317033270333703347033570336703377033870339703407034170342703437034470345703467034770348703497035070351703527035370354703557035670357703587035970360703617036270363703647036570366703677036870369703707037170372703737037470375703767037770378703797038070381703827038370384703857038670387703887038970390703917039270393703947039570396703977039870399704007040170402704037040470405704067040770408704097041070411704127041370414704157041670417704187041970420704217042270423704247042570426704277042870429704307043170432704337043470435704367043770438704397044070441704427044370444704457044670447704487044970450704517045270453704547045570456704577045870459704607046170462704637046470465704667046770468704697047070471704727047370474704757047670477704787047970480704817048270483704847048570486704877048870489704907049170492704937049470495704967049770498704997050070501705027050370504705057050670507705087050970510705117051270513705147051570516705177051870519705207052170522705237052470525705267052770528705297053070531705327053370534705357053670537705387053970540705417054270543705447054570546705477054870549705507055170552705537055470555705567055770558705597056070561705627056370564705657056670567705687056970570705717057270573705747057570576705777057870579705807058170582705837058470585705867058770588705897059070591705927059370594705957059670597705987059970600706017060270603706047060570606706077060870609706107061170612706137061470615706167061770618706197062070621706227062370624706257062670627706287062970630706317063270633706347063570636706377063870639706407064170642706437064470645706467064770648706497065070651706527065370654706557065670657706587065970660706617066270663706647066570666706677066870669706707067170672706737067470675706767067770678706797068070681706827068370684706857068670687706887068970690706917069270693706947069570696706977069870699707007070170702707037070470705707067070770708707097071070711707127071370714707157071670717707187071970720707217072270723707247072570726707277072870729707307073170732707337073470735707367073770738707397074070741707427074370744707457074670747707487074970750707517075270753707547075570756707577075870759707607076170762707637076470765707667076770768707697077070771707727077370774707757077670777707787077970780707817078270783707847078570786707877078870789707907079170792707937079470795707967079770798707997080070801708027080370804708057080670807708087080970810708117081270813708147081570816708177081870819708207082170822708237082470825708267082770828708297083070831708327083370834708357083670837708387083970840708417084270843708447084570846708477084870849708507085170852708537085470855708567085770858708597086070861708627086370864708657086670867708687086970870708717087270873708747087570876708777087870879708807088170882708837088470885708867088770888708897089070891708927089370894708957089670897708987089970900709017090270903709047090570906709077090870909709107091170912709137091470915709167091770918709197092070921709227092370924709257092670927709287092970930709317093270933709347093570936709377093870939709407094170942709437094470945709467094770948709497095070951709527095370954709557095670957709587095970960709617096270963709647096570966709677096870969709707097170972709737097470975709767097770978709797098070981709827098370984709857098670987709887098970990709917099270993709947099570996709977099870999710007100171002710037100471005710067100771008710097101071011710127101371014710157101671017710187101971020710217102271023710247102571026710277102871029710307103171032710337103471035710367103771038710397104071041710427104371044710457104671047710487104971050710517105271053710547105571056710577105871059710607106171062710637106471065710667106771068710697107071071710727107371074710757107671077710787107971080710817108271083710847108571086710877108871089710907109171092710937109471095710967109771098710997110071101711027110371104711057110671107711087110971110711117111271113711147111571116711177111871119711207112171122711237112471125711267112771128711297113071131711327113371134711357113671137711387113971140711417114271143711447114571146711477114871149711507115171152711537115471155711567115771158711597116071161711627116371164711657116671167711687116971170711717117271173711747117571176711777117871179711807118171182711837118471185711867118771188711897119071191711927119371194711957119671197711987119971200712017120271203712047120571206712077120871209712107121171212712137121471215712167121771218712197122071221712227122371224712257122671227712287122971230712317123271233712347123571236712377123871239712407124171242712437124471245712467124771248712497125071251712527125371254712557125671257712587125971260712617126271263712647126571266712677126871269712707127171272712737127471275712767127771278712797128071281712827128371284712857128671287712887128971290712917129271293712947129571296712977129871299713007130171302713037130471305713067130771308713097131071311713127131371314713157131671317713187131971320713217132271323713247132571326713277132871329713307133171332713337133471335713367133771338713397134071341713427134371344713457134671347713487134971350713517135271353713547135571356713577135871359713607136171362713637136471365713667136771368713697137071371713727137371374713757137671377713787137971380713817138271383713847138571386713877138871389713907139171392713937139471395713967139771398713997140071401714027140371404714057140671407714087140971410714117141271413714147141571416714177141871419714207142171422714237142471425714267142771428714297143071431714327143371434714357143671437714387143971440714417144271443714447144571446714477144871449714507145171452714537145471455714567145771458714597146071461714627146371464714657146671467714687146971470714717147271473714747147571476714777147871479714807148171482714837148471485714867148771488714897149071491714927149371494714957149671497714987149971500715017150271503715047150571506715077150871509715107151171512715137151471515715167151771518715197152071521715227152371524715257152671527715287152971530715317153271533715347153571536715377153871539715407154171542715437154471545715467154771548715497155071551715527155371554715557155671557715587155971560715617156271563715647156571566715677156871569715707157171572715737157471575715767157771578715797158071581715827158371584715857158671587715887158971590715917159271593715947159571596715977159871599716007160171602716037160471605716067160771608716097161071611716127161371614716157161671617716187161971620716217162271623716247162571626716277162871629716307163171632716337163471635716367163771638716397164071641716427164371644716457164671647716487164971650716517165271653716547165571656716577165871659716607166171662716637166471665716667166771668716697167071671716727167371674716757167671677716787167971680716817168271683716847168571686716877168871689716907169171692716937169471695716967169771698716997170071701717027170371704717057170671707717087170971710717117171271713717147171571716717177171871719717207172171722717237172471725717267172771728717297173071731717327173371734717357173671737717387173971740717417174271743717447174571746717477174871749717507175171752717537175471755717567175771758717597176071761717627176371764717657176671767717687176971770717717177271773717747177571776717777177871779717807178171782717837178471785717867178771788717897179071791717927179371794717957179671797717987179971800718017180271803718047180571806718077180871809718107181171812718137181471815718167181771818718197182071821718227182371824718257182671827718287182971830718317183271833718347183571836718377183871839718407184171842718437184471845718467184771848718497185071851718527185371854718557185671857718587185971860718617186271863718647186571866718677186871869718707187171872718737187471875718767187771878718797188071881718827188371884718857188671887718887188971890718917189271893718947189571896718977189871899719007190171902719037190471905719067190771908719097191071911719127191371914719157191671917719187191971920719217192271923719247192571926719277192871929719307193171932719337193471935719367193771938719397194071941719427194371944719457194671947719487194971950719517195271953719547195571956719577195871959719607196171962719637196471965719667196771968719697197071971719727197371974719757197671977719787197971980719817198271983719847198571986719877198871989719907199171992719937199471995719967199771998719997200072001720027200372004720057200672007720087200972010720117201272013720147201572016720177201872019720207202172022720237202472025720267202772028720297203072031720327203372034720357203672037720387203972040720417204272043720447204572046720477204872049720507205172052720537205472055720567205772058720597206072061720627206372064720657206672067720687206972070720717207272073720747207572076720777207872079720807208172082720837208472085720867208772088720897209072091720927209372094720957209672097720987209972100721017210272103721047210572106721077210872109721107211172112721137211472115721167211772118721197212072121721227212372124721257212672127721287212972130721317213272133721347213572136721377213872139721407214172142721437214472145721467214772148721497215072151721527215372154721557215672157721587215972160721617216272163721647216572166721677216872169721707217172172721737217472175721767217772178721797218072181721827218372184721857218672187721887218972190721917219272193721947219572196721977219872199722007220172202722037220472205722067220772208722097221072211722127221372214722157221672217722187221972220722217222272223722247222572226722277222872229722307223172232722337223472235722367223772238722397224072241722427224372244722457224672247722487224972250722517225272253722547225572256722577225872259722607226172262722637226472265722667226772268722697227072271722727227372274722757227672277722787227972280722817228272283722847228572286722877228872289722907229172292722937229472295722967229772298722997230072301723027230372304723057230672307723087230972310723117231272313723147231572316723177231872319723207232172322723237232472325723267232772328723297233072331723327233372334723357233672337723387233972340723417234272343723447234572346723477234872349723507235172352723537235472355723567235772358723597236072361723627236372364723657236672367723687236972370723717237272373723747237572376723777237872379723807238172382723837238472385723867238772388723897239072391723927239372394723957239672397723987239972400724017240272403724047240572406724077240872409724107241172412724137241472415724167241772418724197242072421724227242372424724257242672427724287242972430724317243272433724347243572436724377243872439724407244172442724437244472445724467244772448724497245072451724527245372454724557245672457724587245972460724617246272463724647246572466724677246872469724707247172472724737247472475724767247772478724797248072481724827248372484724857248672487724887248972490724917249272493724947249572496724977249872499725007250172502725037250472505725067250772508725097251072511725127251372514725157251672517725187251972520725217252272523725247252572526725277252872529725307253172532725337253472535725367253772538725397254072541725427254372544725457254672547725487254972550725517255272553725547255572556725577255872559725607256172562725637256472565725667256772568725697257072571725727257372574725757257672577725787257972580725817258272583725847258572586725877258872589725907259172592725937259472595725967259772598725997260072601726027260372604726057260672607726087260972610726117261272613726147261572616726177261872619726207262172622726237262472625726267262772628726297263072631726327263372634726357263672637726387263972640726417264272643726447264572646726477264872649726507265172652726537265472655726567265772658726597266072661726627266372664726657266672667726687266972670726717267272673726747267572676726777267872679726807268172682726837268472685726867268772688726897269072691726927269372694726957269672697726987269972700727017270272703727047270572706727077270872709727107271172712727137271472715727167271772718727197272072721727227272372724727257272672727727287272972730727317273272733727347273572736727377273872739727407274172742727437274472745727467274772748727497275072751727527275372754727557275672757727587275972760727617276272763727647276572766727677276872769727707277172772727737277472775727767277772778727797278072781727827278372784727857278672787727887278972790727917279272793727947279572796727977279872799728007280172802728037280472805728067280772808728097281072811728127281372814728157281672817728187281972820728217282272823728247282572826728277282872829728307283172832728337283472835728367283772838728397284072841728427284372844728457284672847728487284972850728517285272853728547285572856728577285872859728607286172862728637286472865728667286772868728697287072871728727287372874728757287672877728787287972880728817288272883728847288572886728877288872889728907289172892728937289472895728967289772898728997290072901729027290372904729057290672907729087290972910729117291272913729147291572916729177291872919729207292172922729237292472925729267292772928729297293072931729327293372934729357293672937729387293972940729417294272943729447294572946729477294872949729507295172952729537295472955729567295772958729597296072961729627296372964729657296672967729687296972970729717297272973729747297572976729777297872979729807298172982729837298472985729867298772988729897299072991729927299372994729957299672997729987299973000730017300273003730047300573006730077300873009730107301173012730137301473015730167301773018730197302073021730227302373024730257302673027730287302973030730317303273033730347303573036730377303873039730407304173042730437304473045730467304773048730497305073051730527305373054730557305673057730587305973060730617306273063730647306573066730677306873069730707307173072730737307473075730767307773078730797308073081730827308373084730857308673087730887308973090730917309273093730947309573096730977309873099731007310173102731037310473105731067310773108731097311073111731127311373114731157311673117731187311973120731217312273123731247312573126731277312873129731307313173132731337313473135731367313773138731397314073141731427314373144731457314673147731487314973150731517315273153731547315573156731577315873159731607316173162731637316473165731667316773168731697317073171731727317373174731757317673177731787317973180731817318273183731847318573186731877318873189731907319173192731937319473195731967319773198731997320073201732027320373204732057320673207732087320973210732117321273213732147321573216732177321873219732207322173222732237322473225732267322773228732297323073231732327323373234732357323673237732387323973240732417324273243732447324573246732477324873249732507325173252732537325473255732567325773258732597326073261732627326373264732657326673267732687326973270732717327273273732747327573276732777327873279732807328173282732837328473285732867328773288732897329073291732927329373294732957329673297732987329973300733017330273303733047330573306733077330873309733107331173312733137331473315733167331773318733197332073321733227332373324733257332673327733287332973330733317333273333733347333573336733377333873339733407334173342733437334473345733467334773348733497335073351733527335373354733557335673357733587335973360733617336273363733647336573366733677336873369733707337173372733737337473375733767337773378733797338073381733827338373384733857338673387733887338973390733917339273393733947339573396733977339873399734007340173402734037340473405734067340773408734097341073411734127341373414734157341673417734187341973420734217342273423734247342573426734277342873429734307343173432734337343473435734367343773438734397344073441734427344373444734457344673447734487344973450734517345273453734547345573456734577345873459734607346173462734637346473465734667346773468734697347073471734727347373474734757347673477734787347973480734817348273483734847348573486734877348873489734907349173492734937349473495734967349773498734997350073501735027350373504735057350673507735087350973510735117351273513735147351573516735177351873519735207352173522735237352473525735267352773528735297353073531735327353373534735357353673537735387353973540735417354273543735447354573546735477354873549735507355173552735537355473555735567355773558735597356073561735627356373564735657356673567735687356973570735717357273573735747357573576735777357873579735807358173582735837358473585735867358773588735897359073591735927359373594735957359673597735987359973600736017360273603736047360573606736077360873609736107361173612736137361473615736167361773618736197362073621736227362373624736257362673627736287362973630736317363273633736347363573636736377363873639736407364173642736437364473645736467364773648736497365073651736527365373654736557365673657736587365973660736617366273663736647366573666736677366873669736707367173672736737367473675736767367773678736797368073681736827368373684736857368673687736887368973690736917369273693736947369573696736977369873699737007370173702737037370473705737067370773708737097371073711737127371373714737157371673717737187371973720737217372273723737247372573726737277372873729737307373173732737337373473735737367373773738737397374073741737427374373744737457374673747737487374973750737517375273753737547375573756737577375873759737607376173762737637376473765737667376773768737697377073771737727377373774737757377673777737787377973780737817378273783737847378573786737877378873789737907379173792737937379473795737967379773798737997380073801738027380373804738057380673807738087380973810738117381273813738147381573816738177381873819738207382173822738237382473825738267382773828738297383073831738327383373834738357383673837738387383973840738417384273843738447384573846738477384873849738507385173852738537385473855738567385773858738597386073861738627386373864738657386673867738687386973870738717387273873738747387573876738777387873879738807388173882738837388473885738867388773888738897389073891738927389373894738957389673897738987389973900739017390273903739047390573906739077390873909739107391173912739137391473915739167391773918739197392073921739227392373924739257392673927739287392973930739317393273933739347393573936739377393873939739407394173942739437394473945739467394773948739497395073951739527395373954739557395673957739587395973960739617396273963739647396573966739677396873969739707397173972739737397473975739767397773978739797398073981739827398373984739857398673987739887398973990739917399273993739947399573996739977399873999740007400174002740037400474005740067400774008740097401074011740127401374014740157401674017740187401974020740217402274023740247402574026740277402874029740307403174032740337403474035740367403774038740397404074041740427404374044740457404674047740487404974050740517405274053740547405574056740577405874059740607406174062740637406474065740667406774068740697407074071740727407374074740757407674077740787407974080740817408274083740847408574086740877408874089740907409174092740937409474095740967409774098740997410074101741027410374104741057410674107741087410974110741117411274113741147411574116741177411874119741207412174122741237412474125741267412774128741297413074131741327413374134741357413674137741387413974140741417414274143741447414574146741477414874149741507415174152741537415474155741567415774158741597416074161741627416374164741657416674167741687416974170741717417274173741747417574176741777417874179741807418174182741837418474185741867418774188741897419074191741927419374194741957419674197741987419974200742017420274203742047420574206742077420874209742107421174212742137421474215742167421774218742197422074221742227422374224742257422674227742287422974230742317423274233742347423574236742377423874239742407424174242742437424474245742467424774248742497425074251742527425374254742557425674257742587425974260742617426274263742647426574266742677426874269742707427174272742737427474275742767427774278742797428074281742827428374284742857428674287742887428974290742917429274293742947429574296742977429874299743007430174302743037430474305743067430774308743097431074311743127431374314743157431674317743187431974320743217432274323743247432574326743277432874329743307433174332743337433474335743367433774338743397434074341743427434374344743457434674347743487434974350743517435274353743547435574356743577435874359743607436174362743637436474365743667436774368743697437074371743727437374374743757437674377743787437974380743817438274383743847438574386743877438874389743907439174392743937439474395743967439774398743997440074401744027440374404744057440674407744087440974410744117441274413744147441574416744177441874419744207442174422744237442474425744267442774428744297443074431744327443374434744357443674437744387443974440744417444274443744447444574446744477444874449744507445174452744537445474455744567445774458744597446074461744627446374464744657446674467744687446974470744717447274473744747447574476744777447874479744807448174482744837448474485744867448774488744897449074491744927449374494744957449674497744987449974500745017450274503745047450574506745077450874509745107451174512745137451474515745167451774518745197452074521745227452374524745257452674527745287452974530745317453274533745347453574536745377453874539745407454174542745437454474545745467454774548745497455074551745527455374554745557455674557745587455974560745617456274563745647456574566745677456874569745707457174572745737457474575745767457774578745797458074581745827458374584745857458674587745887458974590745917459274593745947459574596745977459874599746007460174602746037460474605746067460774608746097461074611746127461374614746157461674617746187461974620746217462274623746247462574626746277462874629746307463174632746337463474635746367463774638746397464074641746427464374644746457464674647746487464974650746517465274653746547465574656746577465874659746607466174662746637466474665746667466774668746697467074671746727467374674746757467674677746787467974680746817468274683746847468574686746877468874689746907469174692746937469474695746967469774698746997470074701747027470374704747057470674707747087470974710747117471274713747147471574716747177471874719747207472174722747237472474725747267472774728747297473074731747327473374734747357473674737747387473974740747417474274743747447474574746747477474874749747507475174752747537475474755747567475774758747597476074761747627476374764747657476674767747687476974770747717477274773747747477574776747777477874779747807478174782747837478474785747867478774788747897479074791747927479374794747957479674797747987479974800748017480274803748047480574806748077480874809748107481174812748137481474815748167481774818748197482074821748227482374824748257482674827748287482974830748317483274833748347483574836748377483874839748407484174842748437484474845748467484774848748497485074851748527485374854748557485674857748587485974860748617486274863748647486574866748677486874869748707487174872748737487474875748767487774878748797488074881748827488374884748857488674887748887488974890748917489274893748947489574896748977489874899749007490174902749037490474905749067490774908749097491074911749127491374914749157491674917749187491974920749217492274923749247492574926749277492874929749307493174932749337493474935749367493774938749397494074941749427494374944749457494674947749487494974950749517495274953749547495574956749577495874959749607496174962749637496474965749667496774968749697497074971749727497374974749757497674977749787497974980749817498274983749847498574986749877498874989749907499174992749937499474995749967499774998749997500075001750027500375004750057500675007750087500975010750117501275013750147501575016750177501875019750207502175022750237502475025750267502775028750297503075031750327503375034750357503675037750387503975040750417504275043750447504575046750477504875049750507505175052750537505475055750567505775058750597506075061750627506375064750657506675067750687506975070750717507275073750747507575076750777507875079750807508175082750837508475085750867508775088750897509075091750927509375094750957509675097750987509975100751017510275103751047510575106751077510875109751107511175112751137511475115751167511775118751197512075121751227512375124751257512675127751287512975130751317513275133751347513575136751377513875139751407514175142751437514475145751467514775148751497515075151751527515375154751557515675157751587515975160751617516275163751647516575166751677516875169751707517175172751737517475175751767517775178751797518075181751827518375184751857518675187751887518975190751917519275193751947519575196751977519875199752007520175202752037520475205752067520775208752097521075211752127521375214752157521675217752187521975220752217522275223752247522575226752277522875229752307523175232752337523475235752367523775238752397524075241752427524375244752457524675247752487524975250752517525275253752547525575256752577525875259752607526175262752637526475265752667526775268752697527075271752727527375274752757527675277752787527975280752817528275283752847528575286752877528875289752907529175292752937529475295752967529775298752997530075301753027530375304753057530675307753087530975310753117531275313753147531575316753177531875319753207532175322753237532475325753267532775328753297533075331753327533375334753357533675337753387533975340753417534275343753447534575346753477534875349753507535175352753537535475355753567535775358753597536075361753627536375364753657536675367753687536975370753717537275373753747537575376753777537875379753807538175382753837538475385753867538775388753897539075391753927539375394753957539675397753987539975400754017540275403754047540575406754077540875409754107541175412754137541475415754167541775418754197542075421754227542375424754257542675427754287542975430754317543275433754347543575436754377543875439754407544175442754437544475445754467544775448754497545075451754527545375454754557545675457754587545975460754617546275463754647546575466754677546875469754707547175472754737547475475754767547775478754797548075481754827548375484754857548675487754887548975490754917549275493754947549575496754977549875499755007550175502755037550475505755067550775508755097551075511755127551375514755157551675517755187551975520755217552275523755247552575526755277552875529755307553175532755337553475535755367553775538755397554075541755427554375544755457554675547755487554975550755517555275553755547555575556755577555875559755607556175562755637556475565755667556775568755697557075571755727557375574755757557675577755787557975580755817558275583755847558575586755877558875589755907559175592755937559475595755967559775598755997560075601756027560375604756057560675607756087560975610756117561275613756147561575616756177561875619756207562175622756237562475625756267562775628756297563075631756327563375634756357563675637756387563975640756417564275643756447564575646756477564875649756507565175652756537565475655756567565775658756597566075661756627566375664756657566675667756687566975670756717567275673756747567575676756777567875679756807568175682756837568475685756867568775688756897569075691756927569375694756957569675697756987569975700757017570275703757047570575706757077570875709757107571175712757137571475715757167571775718757197572075721757227572375724757257572675727757287572975730757317573275733757347573575736757377573875739757407574175742757437574475745757467574775748757497575075751757527575375754757557575675757757587575975760757617576275763757647576575766757677576875769757707577175772757737577475775757767577775778757797578075781757827578375784757857578675787757887578975790757917579275793757947579575796757977579875799758007580175802758037580475805758067580775808758097581075811758127581375814758157581675817758187581975820758217582275823758247582575826758277582875829758307583175832758337583475835758367583775838758397584075841758427584375844758457584675847758487584975850758517585275853758547585575856758577585875859758607586175862758637586475865758667586775868758697587075871758727587375874758757587675877758787587975880758817588275883758847588575886758877588875889758907589175892758937589475895758967589775898758997590075901759027590375904759057590675907759087590975910759117591275913759147591575916759177591875919759207592175922759237592475925759267592775928759297593075931759327593375934759357593675937759387593975940759417594275943759447594575946759477594875949759507595175952759537595475955759567595775958759597596075961759627596375964759657596675967759687596975970759717597275973759747597575976759777597875979759807598175982759837598475985759867598775988759897599075991759927599375994759957599675997759987599976000760017600276003760047600576006760077600876009760107601176012760137601476015760167601776018760197602076021760227602376024760257602676027760287602976030760317603276033760347603576036760377603876039760407604176042760437604476045760467604776048760497605076051760527605376054760557605676057760587605976060760617606276063760647606576066760677606876069760707607176072760737607476075760767607776078760797608076081760827608376084760857608676087760887608976090760917609276093760947609576096760977609876099761007610176102761037610476105761067610776108761097611076111761127611376114761157611676117761187611976120761217612276123761247612576126761277612876129761307613176132761337613476135761367613776138761397614076141761427614376144761457614676147761487614976150761517615276153761547615576156761577615876159761607616176162761637616476165761667616776168761697617076171761727617376174761757617676177761787617976180761817618276183761847618576186761877618876189761907619176192761937619476195761967619776198761997620076201762027620376204762057620676207762087620976210762117621276213762147621576216762177621876219762207622176222762237622476225762267622776228762297623076231762327623376234762357623676237762387623976240762417624276243762447624576246762477624876249762507625176252762537625476255762567625776258762597626076261762627626376264762657626676267762687626976270762717627276273762747627576276762777627876279762807628176282762837628476285762867628776288762897629076291762927629376294762957629676297762987629976300763017630276303763047630576306763077630876309763107631176312763137631476315763167631776318763197632076321763227632376324763257632676327763287632976330763317633276333763347633576336763377633876339763407634176342763437634476345763467634776348763497635076351763527635376354763557635676357763587635976360763617636276363763647636576366763677636876369763707637176372763737637476375763767637776378763797638076381763827638376384763857638676387763887638976390763917639276393763947639576396763977639876399764007640176402764037640476405764067640776408764097641076411764127641376414764157641676417764187641976420764217642276423764247642576426764277642876429764307643176432764337643476435764367643776438764397644076441764427644376444764457644676447764487644976450764517645276453764547645576456764577645876459764607646176462764637646476465764667646776468764697647076471764727647376474764757647676477764787647976480764817648276483764847648576486764877648876489764907649176492764937649476495764967649776498764997650076501765027650376504765057650676507765087650976510765117651276513765147651576516765177651876519765207652176522765237652476525765267652776528765297653076531765327653376534765357653676537765387653976540765417654276543765447654576546765477654876549765507655176552765537655476555765567655776558765597656076561765627656376564765657656676567765687656976570765717657276573765747657576576765777657876579765807658176582765837658476585765867658776588765897659076591765927659376594765957659676597765987659976600766017660276603766047660576606766077660876609766107661176612766137661476615766167661776618766197662076621766227662376624766257662676627766287662976630766317663276633766347663576636766377663876639766407664176642766437664476645766467664776648766497665076651766527665376654766557665676657766587665976660766617666276663766647666576666766677666876669766707667176672766737667476675766767667776678766797668076681766827668376684766857668676687766887668976690766917669276693766947669576696766977669876699767007670176702767037670476705767067670776708767097671076711767127671376714767157671676717767187671976720767217672276723767247672576726767277672876729767307673176732767337673476735767367673776738767397674076741767427674376744767457674676747767487674976750767517675276753767547675576756767577675876759767607676176762767637676476765767667676776768767697677076771767727677376774767757677676777767787677976780767817678276783767847678576786767877678876789767907679176792767937679476795767967679776798767997680076801768027680376804768057680676807768087680976810768117681276813768147681576816768177681876819768207682176822768237682476825768267682776828768297683076831768327683376834768357683676837768387683976840768417684276843768447684576846768477684876849768507685176852768537685476855768567685776858768597686076861768627686376864768657686676867768687686976870768717687276873768747687576876768777687876879768807688176882768837688476885768867688776888768897689076891768927689376894768957689676897768987689976900769017690276903769047690576906769077690876909769107691176912769137691476915769167691776918769197692076921769227692376924769257692676927769287692976930769317693276933769347693576936769377693876939769407694176942769437694476945769467694776948769497695076951769527695376954769557695676957769587695976960769617696276963769647696576966769677696876969769707697176972769737697476975769767697776978769797698076981769827698376984769857698676987769887698976990769917699276993769947699576996769977699876999770007700177002770037700477005770067700777008770097701077011770127701377014770157701677017770187701977020770217702277023770247702577026770277702877029770307703177032770337703477035770367703777038770397704077041770427704377044770457704677047770487704977050770517705277053770547705577056770577705877059770607706177062770637706477065770667706777068770697707077071770727707377074770757707677077770787707977080770817708277083770847708577086770877708877089770907709177092770937709477095770967709777098770997710077101771027710377104771057710677107771087710977110771117711277113771147711577116771177711877119771207712177122771237712477125771267712777128771297713077131771327713377134771357713677137771387713977140771417714277143771447714577146771477714877149771507715177152771537715477155771567715777158771597716077161771627716377164771657716677167771687716977170771717717277173771747717577176771777717877179771807718177182771837718477185771867718777188771897719077191771927719377194771957719677197771987719977200772017720277203772047720577206772077720877209772107721177212772137721477215772167721777218772197722077221772227722377224772257722677227772287722977230772317723277233772347723577236772377723877239772407724177242772437724477245772467724777248772497725077251772527725377254772557725677257772587725977260772617726277263772647726577266772677726877269772707727177272772737727477275772767727777278772797728077281772827728377284772857728677287772887728977290772917729277293772947729577296772977729877299773007730177302773037730477305773067730777308773097731077311773127731377314773157731677317773187731977320773217732277323773247732577326773277732877329773307733177332773337733477335773367733777338773397734077341773427734377344773457734677347773487734977350773517735277353773547735577356773577735877359773607736177362773637736477365773667736777368773697737077371773727737377374773757737677377773787737977380773817738277383773847738577386773877738877389773907739177392773937739477395773967739777398773997740077401774027740377404774057740677407774087740977410774117741277413774147741577416774177741877419774207742177422774237742477425774267742777428774297743077431774327743377434774357743677437774387743977440774417744277443774447744577446774477744877449774507745177452774537745477455774567745777458774597746077461774627746377464774657746677467774687746977470774717747277473774747747577476774777747877479774807748177482774837748477485774867748777488774897749077491774927749377494774957749677497774987749977500775017750277503775047750577506775077750877509775107751177512775137751477515775167751777518775197752077521775227752377524775257752677527775287752977530775317753277533775347753577536775377753877539775407754177542775437754477545775467754777548775497755077551775527755377554775557755677557775587755977560775617756277563775647756577566775677756877569775707757177572775737757477575775767757777578775797758077581775827758377584775857758677587775887758977590775917759277593775947759577596775977759877599776007760177602776037760477605776067760777608776097761077611776127761377614776157761677617776187761977620776217762277623776247762577626776277762877629776307763177632776337763477635776367763777638776397764077641776427764377644776457764677647776487764977650776517765277653776547765577656776577765877659776607766177662776637766477665776667766777668776697767077671776727767377674776757767677677776787767977680776817768277683776847768577686776877768877689776907769177692776937769477695776967769777698776997770077701777027770377704777057770677707777087770977710777117771277713777147771577716777177771877719777207772177722777237772477725777267772777728777297773077731777327773377734777357773677737777387773977740777417774277743777447774577746777477774877749777507775177752777537775477755777567775777758777597776077761777627776377764777657776677767777687776977770777717777277773777747777577776777777777877779777807778177782777837778477785777867778777788777897779077791777927779377794777957779677797777987779977800778017780277803778047780577806778077780877809778107781177812778137781477815778167781777818778197782077821778227782377824778257782677827778287782977830778317783277833778347783577836778377783877839778407784177842778437784477845778467784777848778497785077851778527785377854778557785677857778587785977860778617786277863778647786577866778677786877869778707787177872778737787477875778767787777878778797788077881778827788377884778857788677887778887788977890778917789277893778947789577896778977789877899779007790177902779037790477905779067790777908779097791077911779127791377914779157791677917779187791977920779217792277923779247792577926779277792877929779307793177932779337793477935779367793777938779397794077941779427794377944779457794677947779487794977950779517795277953779547795577956779577795877959779607796177962779637796477965779667796777968779697797077971779727797377974779757797677977779787797977980779817798277983779847798577986779877798877989779907799177992779937799477995779967799777998779997800078001780027800378004780057800678007780087800978010780117801278013780147801578016780177801878019780207802178022780237802478025780267802778028780297803078031780327803378034780357803678037780387803978040780417804278043780447804578046780477804878049780507805178052780537805478055780567805778058780597806078061780627806378064780657806678067780687806978070780717807278073780747807578076780777807878079780807808178082780837808478085780867808778088780897809078091780927809378094780957809678097780987809978100781017810278103781047810578106781077810878109781107811178112781137811478115781167811778118781197812078121781227812378124781257812678127781287812978130781317813278133781347813578136781377813878139781407814178142781437814478145781467814778148781497815078151781527815378154781557815678157781587815978160781617816278163781647816578166781677816878169781707817178172781737817478175781767817778178781797818078181781827818378184781857818678187781887818978190781917819278193781947819578196781977819878199782007820178202782037820478205782067820778208782097821078211782127821378214782157821678217782187821978220782217822278223782247822578226782277822878229782307823178232782337823478235782367823778238782397824078241782427824378244782457824678247782487824978250782517825278253782547825578256782577825878259782607826178262782637826478265782667826778268782697827078271782727827378274782757827678277782787827978280782817828278283782847828578286782877828878289782907829178292782937829478295782967829778298782997830078301783027830378304783057830678307783087830978310783117831278313783147831578316783177831878319783207832178322783237832478325783267832778328783297833078331783327833378334783357833678337783387833978340783417834278343783447834578346783477834878349783507835178352783537835478355783567835778358783597836078361783627836378364783657836678367783687836978370783717837278373783747837578376783777837878379783807838178382783837838478385783867838778388783897839078391783927839378394783957839678397783987839978400784017840278403784047840578406784077840878409784107841178412784137841478415784167841778418784197842078421784227842378424784257842678427784287842978430784317843278433784347843578436784377843878439784407844178442784437844478445784467844778448784497845078451784527845378454784557845678457784587845978460784617846278463784647846578466784677846878469784707847178472784737847478475784767847778478784797848078481784827848378484784857848678487784887848978490784917849278493784947849578496784977849878499785007850178502785037850478505785067850778508785097851078511785127851378514785157851678517785187851978520785217852278523785247852578526785277852878529785307853178532785337853478535785367853778538785397854078541785427854378544785457854678547785487854978550785517855278553785547855578556785577855878559785607856178562785637856478565785667856778568785697857078571785727857378574785757857678577785787857978580785817858278583785847858578586785877858878589785907859178592785937859478595785967859778598785997860078601786027860378604786057860678607786087860978610786117861278613786147861578616786177861878619786207862178622786237862478625786267862778628786297863078631786327863378634786357863678637786387863978640786417864278643786447864578646786477864878649786507865178652786537865478655786567865778658786597866078661786627866378664786657866678667786687866978670786717867278673786747867578676786777867878679786807868178682786837868478685786867868778688786897869078691786927869378694786957869678697786987869978700787017870278703787047870578706787077870878709787107871178712787137871478715787167871778718787197872078721787227872378724787257872678727787287872978730787317873278733787347873578736787377873878739787407874178742787437874478745787467874778748787497875078751787527875378754787557875678757787587875978760787617876278763787647876578766787677876878769787707877178772787737877478775787767877778778787797878078781787827878378784787857878678787787887878978790787917879278793787947879578796787977879878799788007880178802788037880478805788067880778808788097881078811788127881378814788157881678817788187881978820788217882278823788247882578826788277882878829788307883178832788337883478835788367883778838788397884078841788427884378844788457884678847788487884978850788517885278853788547885578856788577885878859788607886178862788637886478865788667886778868788697887078871788727887378874788757887678877788787887978880788817888278883788847888578886788877888878889788907889178892788937889478895788967889778898788997890078901789027890378904789057890678907789087890978910789117891278913789147891578916789177891878919789207892178922789237892478925789267892778928789297893078931789327893378934789357893678937789387893978940789417894278943789447894578946789477894878949789507895178952789537895478955789567895778958789597896078961789627896378964789657896678967789687896978970789717897278973789747897578976789777897878979789807898178982789837898478985789867898778988789897899078991789927899378994789957899678997789987899979000790017900279003790047900579006790077900879009790107901179012790137901479015790167901779018790197902079021790227902379024790257902679027790287902979030790317903279033790347903579036790377903879039790407904179042790437904479045790467904779048790497905079051790527905379054790557905679057790587905979060790617906279063790647906579066790677906879069790707907179072790737907479075790767907779078790797908079081790827908379084790857908679087790887908979090790917909279093790947909579096790977909879099791007910179102791037910479105791067910779108791097911079111791127911379114791157911679117791187911979120791217912279123791247912579126791277912879129791307913179132791337913479135791367913779138791397914079141791427914379144791457914679147791487914979150791517915279153791547915579156791577915879159791607916179162791637916479165791667916779168791697917079171791727917379174791757917679177791787917979180791817918279183791847918579186791877918879189791907919179192791937919479195791967919779198791997920079201792027920379204792057920679207792087920979210792117921279213792147921579216792177921879219792207922179222792237922479225792267922779228792297923079231792327923379234792357923679237792387923979240792417924279243792447924579246792477924879249792507925179252792537925479255792567925779258792597926079261792627926379264792657926679267792687926979270792717927279273792747927579276792777927879279792807928179282792837928479285792867928779288792897929079291792927929379294792957929679297792987929979300793017930279303793047930579306793077930879309793107931179312793137931479315793167931779318793197932079321793227932379324793257932679327793287932979330793317933279333793347933579336793377933879339793407934179342793437934479345793467934779348793497935079351793527935379354793557935679357793587935979360793617936279363793647936579366793677936879369793707937179372793737937479375793767937779378793797938079381793827938379384793857938679387793887938979390793917939279393793947939579396793977939879399794007940179402794037940479405794067940779408794097941079411794127941379414794157941679417794187941979420794217942279423794247942579426794277942879429794307943179432794337943479435794367943779438794397944079441794427944379444794457944679447794487944979450794517945279453794547945579456794577945879459794607946179462794637946479465794667946779468794697947079471794727947379474794757947679477794787947979480794817948279483794847948579486794877948879489794907949179492794937949479495794967949779498794997950079501795027950379504795057950679507795087950979510795117951279513795147951579516795177951879519795207952179522795237952479525795267952779528795297953079531795327953379534795357953679537795387953979540795417954279543795447954579546795477954879549795507955179552795537955479555795567955779558795597956079561795627956379564795657956679567795687956979570795717957279573795747957579576795777957879579795807958179582795837958479585795867958779588795897959079591795927959379594795957959679597795987959979600796017960279603796047960579606796077960879609796107961179612796137961479615796167961779618796197962079621796227962379624796257962679627796287962979630796317963279633796347963579636796377963879639796407964179642796437964479645796467964779648796497965079651796527965379654796557965679657796587965979660796617966279663796647966579666796677966879669796707967179672796737967479675796767967779678796797968079681796827968379684796857968679687796887968979690796917969279693796947969579696796977969879699797007970179702797037970479705797067970779708797097971079711797127971379714797157971679717797187971979720797217972279723797247972579726797277972879729797307973179732797337973479735797367973779738797397974079741797427974379744797457974679747797487974979750797517975279753797547975579756797577975879759797607976179762797637976479765797667976779768797697977079771797727977379774797757977679777797787977979780797817978279783797847978579786797877978879789797907979179792797937979479795797967979779798797997980079801798027980379804798057980679807798087980979810798117981279813798147981579816798177981879819798207982179822798237982479825798267982779828798297983079831798327983379834798357983679837798387983979840798417984279843798447984579846798477984879849798507985179852798537985479855798567985779858798597986079861798627986379864798657986679867798687986979870798717987279873798747987579876798777987879879798807988179882798837988479885798867988779888798897989079891798927989379894798957989679897798987989979900799017990279903799047990579906799077990879909799107991179912799137991479915799167991779918799197992079921799227992379924799257992679927799287992979930799317993279933799347993579936799377993879939799407994179942799437994479945799467994779948799497995079951799527995379954799557995679957799587995979960799617996279963799647996579966799677996879969799707997179972799737997479975799767997779978799797998079981799827998379984799857998679987799887998979990799917999279993799947999579996799977999879999800008000180002800038000480005800068000780008800098001080011800128001380014800158001680017800188001980020800218002280023800248002580026800278002880029800308003180032800338003480035800368003780038800398004080041800428004380044800458004680047800488004980050800518005280053800548005580056800578005880059800608006180062800638006480065800668006780068800698007080071800728007380074800758007680077800788007980080800818008280083800848008580086800878008880089800908009180092800938009480095800968009780098800998010080101801028010380104801058010680107801088010980110801118011280113801148011580116801178011880119801208012180122801238012480125801268012780128801298013080131801328013380134801358013680137801388013980140801418014280143801448014580146801478014880149801508015180152801538015480155801568015780158801598016080161801628016380164801658016680167801688016980170801718017280173801748017580176801778017880179801808018180182801838018480185801868018780188801898019080191801928019380194801958019680197801988019980200802018020280203802048020580206802078020880209802108021180212802138021480215802168021780218802198022080221802228022380224802258022680227802288022980230802318023280233802348023580236802378023880239802408024180242802438024480245802468024780248802498025080251802528025380254802558025680257802588025980260802618026280263802648026580266802678026880269802708027180272802738027480275802768027780278802798028080281802828028380284802858028680287802888028980290802918029280293802948029580296802978029880299803008030180302803038030480305803068030780308803098031080311803128031380314803158031680317803188031980320803218032280323803248032580326803278032880329803308033180332803338033480335803368033780338803398034080341803428034380344803458034680347803488034980350803518035280353803548035580356803578035880359803608036180362803638036480365803668036780368803698037080371803728037380374803758037680377803788037980380803818038280383803848038580386803878038880389803908039180392803938039480395803968039780398803998040080401804028040380404804058040680407804088040980410804118041280413804148041580416804178041880419804208042180422804238042480425804268042780428804298043080431804328043380434804358043680437804388043980440804418044280443804448044580446804478044880449804508045180452804538045480455804568045780458804598046080461804628046380464804658046680467804688046980470804718047280473804748047580476804778047880479804808048180482804838048480485804868048780488804898049080491804928049380494804958049680497804988049980500805018050280503805048050580506805078050880509805108051180512805138051480515805168051780518805198052080521805228052380524805258052680527805288052980530805318053280533805348053580536805378053880539805408054180542805438054480545805468054780548805498055080551805528055380554805558055680557805588055980560805618056280563805648056580566805678056880569805708057180572805738057480575805768057780578805798058080581805828058380584805858058680587805888058980590805918059280593805948059580596805978059880599806008060180602806038060480605806068060780608806098061080611806128061380614806158061680617806188061980620806218062280623806248062580626806278062880629806308063180632806338063480635806368063780638806398064080641806428064380644806458064680647806488064980650806518065280653806548065580656806578065880659806608066180662806638066480665806668066780668806698067080671806728067380674806758067680677806788067980680806818068280683806848068580686806878068880689806908069180692806938069480695806968069780698806998070080701807028070380704807058070680707807088070980710807118071280713807148071580716807178071880719807208072180722807238072480725807268072780728807298073080731807328073380734807358073680737807388073980740807418074280743807448074580746807478074880749807508075180752807538075480755807568075780758807598076080761807628076380764807658076680767807688076980770807718077280773807748077580776807778077880779807808078180782807838078480785807868078780788807898079080791807928079380794807958079680797807988079980800808018080280803808048080580806808078080880809808108081180812808138081480815808168081780818808198082080821808228082380824808258082680827808288082980830808318083280833808348083580836808378083880839808408084180842808438084480845808468084780848808498085080851808528085380854808558085680857808588085980860808618086280863808648086580866808678086880869808708087180872808738087480875808768087780878808798088080881808828088380884808858088680887808888088980890808918089280893808948089580896808978089880899809008090180902809038090480905809068090780908809098091080911809128091380914809158091680917809188091980920809218092280923809248092580926809278092880929809308093180932809338093480935809368093780938809398094080941809428094380944809458094680947809488094980950809518095280953809548095580956809578095880959809608096180962809638096480965809668096780968809698097080971809728097380974809758097680977809788097980980809818098280983809848098580986809878098880989809908099180992809938099480995809968099780998809998100081001810028100381004810058100681007810088100981010810118101281013810148101581016810178101881019810208102181022810238102481025810268102781028810298103081031810328103381034810358103681037810388103981040810418104281043810448104581046810478104881049810508105181052810538105481055810568105781058810598106081061810628106381064810658106681067810688106981070810718107281073810748107581076810778107881079810808108181082810838108481085810868108781088810898109081091810928109381094810958109681097810988109981100811018110281103811048110581106811078110881109811108111181112811138111481115811168111781118811198112081121811228112381124811258112681127811288112981130811318113281133811348113581136811378113881139811408114181142811438114481145811468114781148811498115081151811528115381154811558115681157811588115981160811618116281163811648116581166811678116881169811708117181172811738117481175811768117781178811798118081181811828118381184811858118681187811888118981190811918119281193811948119581196811978119881199812008120181202812038120481205812068120781208812098121081211812128121381214812158121681217812188121981220812218122281223812248122581226812278122881229812308123181232812338123481235812368123781238812398124081241812428124381244812458124681247812488124981250812518125281253812548125581256812578125881259812608126181262812638126481265812668126781268812698127081271812728127381274812758127681277812788127981280812818128281283812848128581286812878128881289812908129181292812938129481295812968129781298812998130081301813028130381304813058130681307813088130981310813118131281313813148131581316813178131881319813208132181322813238132481325813268132781328813298133081331813328133381334813358133681337813388133981340813418134281343813448134581346813478134881349813508135181352813538135481355813568135781358813598136081361813628136381364813658136681367813688136981370813718137281373813748137581376813778137881379813808138181382813838138481385813868138781388813898139081391813928139381394813958139681397813988139981400814018140281403814048140581406814078140881409814108141181412814138141481415814168141781418814198142081421814228142381424814258142681427814288142981430814318143281433814348143581436814378143881439814408144181442814438144481445814468144781448814498145081451814528145381454814558145681457814588145981460814618146281463814648146581466814678146881469814708147181472814738147481475814768147781478814798148081481814828148381484814858148681487814888148981490814918149281493814948149581496814978149881499815008150181502815038150481505815068150781508815098151081511815128151381514815158151681517815188151981520815218152281523815248152581526815278152881529815308153181532815338153481535815368153781538815398154081541815428154381544815458154681547815488154981550815518155281553815548155581556815578155881559815608156181562815638156481565815668156781568815698157081571815728157381574815758157681577815788157981580815818158281583815848158581586815878158881589815908159181592815938159481595815968159781598815998160081601816028160381604816058160681607816088160981610816118161281613816148161581616816178161881619816208162181622816238162481625816268162781628816298163081631816328163381634816358163681637816388163981640816418164281643816448164581646816478164881649816508165181652816538165481655816568165781658816598166081661816628166381664816658166681667816688166981670816718167281673816748167581676816778167881679816808168181682816838168481685816868168781688816898169081691816928169381694816958169681697816988169981700817018170281703817048170581706817078170881709817108171181712817138171481715817168171781718817198172081721817228172381724817258172681727817288172981730817318173281733817348173581736817378173881739817408174181742817438174481745817468174781748817498175081751817528175381754817558175681757817588175981760817618176281763817648176581766817678176881769817708177181772817738177481775817768177781778817798178081781817828178381784817858178681787817888178981790817918179281793817948179581796817978179881799818008180181802818038180481805818068180781808818098181081811818128181381814818158181681817818188181981820818218182281823818248182581826818278182881829818308183181832818338183481835818368183781838818398184081841818428184381844818458184681847818488184981850818518185281853818548185581856818578185881859818608186181862818638186481865818668186781868818698187081871818728187381874818758187681877818788187981880818818188281883818848188581886818878188881889818908189181892818938189481895818968189781898818998190081901819028190381904819058190681907819088190981910819118191281913819148191581916819178191881919819208192181922819238192481925819268192781928819298193081931819328193381934819358193681937819388193981940819418194281943819448194581946819478194881949819508195181952819538195481955819568195781958819598196081961819628196381964819658196681967819688196981970819718197281973819748197581976819778197881979819808198181982819838198481985819868198781988819898199081991819928199381994819958199681997819988199982000820018200282003820048200582006820078200882009820108201182012820138201482015820168201782018820198202082021820228202382024820258202682027820288202982030820318203282033820348203582036820378203882039820408204182042820438204482045820468204782048820498205082051820528205382054820558205682057820588205982060820618206282063820648206582066820678206882069820708207182072820738207482075820768207782078820798208082081820828208382084820858208682087820888208982090820918209282093820948209582096820978209882099821008210182102821038210482105821068210782108821098211082111821128211382114821158211682117821188211982120821218212282123821248212582126821278212882129821308213182132821338213482135821368213782138821398214082141821428214382144821458214682147821488214982150821518215282153821548215582156821578215882159821608216182162821638216482165821668216782168821698217082171821728217382174821758217682177821788217982180821818218282183821848218582186821878218882189821908219182192821938219482195821968219782198821998220082201822028220382204822058220682207822088220982210822118221282213822148221582216822178221882219822208222182222822238222482225822268222782228822298223082231822328223382234822358223682237822388223982240822418224282243822448224582246822478224882249822508225182252822538225482255822568225782258822598226082261822628226382264822658226682267822688226982270822718227282273822748227582276822778227882279822808228182282822838228482285822868228782288822898229082291822928229382294822958229682297822988229982300823018230282303823048230582306823078230882309823108231182312823138231482315823168231782318823198232082321823228232382324823258232682327823288232982330823318233282333823348233582336823378233882339823408234182342823438234482345823468234782348823498235082351823528235382354823558235682357823588235982360823618236282363823648236582366823678236882369823708237182372823738237482375823768237782378823798238082381823828238382384823858238682387823888238982390823918239282393823948239582396823978239882399824008240182402824038240482405824068240782408824098241082411824128241382414824158241682417824188241982420824218242282423824248242582426824278242882429824308243182432824338243482435824368243782438824398244082441824428244382444824458244682447824488244982450824518245282453824548245582456824578245882459824608246182462824638246482465824668246782468824698247082471824728247382474824758247682477824788247982480824818248282483824848248582486824878248882489824908249182492824938249482495824968249782498824998250082501825028250382504825058250682507825088250982510825118251282513825148251582516825178251882519825208252182522825238252482525825268252782528825298253082531825328253382534825358253682537825388253982540825418254282543825448254582546825478254882549825508255182552825538255482555825568255782558825598256082561825628256382564825658256682567825688256982570825718257282573825748257582576825778257882579825808258182582825838258482585825868258782588825898259082591825928259382594825958259682597825988259982600826018260282603826048260582606826078260882609826108261182612826138261482615826168261782618826198262082621826228262382624826258262682627826288262982630826318263282633826348263582636826378263882639826408264182642826438264482645826468264782648826498265082651826528265382654826558265682657826588265982660826618266282663826648266582666826678266882669826708267182672826738267482675826768267782678826798268082681826828268382684826858268682687826888268982690826918269282693826948269582696826978269882699827008270182702827038270482705827068270782708827098271082711827128271382714827158271682717827188271982720827218272282723827248272582726827278272882729827308273182732827338273482735827368273782738827398274082741827428274382744827458274682747827488274982750827518275282753827548275582756827578275882759827608276182762827638276482765827668276782768827698277082771827728277382774827758277682777827788277982780827818278282783827848278582786827878278882789827908279182792827938279482795827968279782798827998280082801828028280382804828058280682807828088280982810828118281282813828148281582816828178281882819828208282182822828238282482825828268282782828828298283082831828328283382834828358283682837828388283982840828418284282843828448284582846828478284882849828508285182852828538285482855828568285782858828598286082861828628286382864828658286682867828688286982870828718287282873828748287582876828778287882879828808288182882828838288482885828868288782888828898289082891828928289382894828958289682897828988289982900829018290282903829048290582906829078290882909829108291182912829138291482915829168291782918829198292082921829228292382924829258292682927829288292982930829318293282933829348293582936829378293882939829408294182942829438294482945829468294782948829498295082951829528295382954829558295682957829588295982960829618296282963829648296582966829678296882969829708297182972829738297482975829768297782978829798298082981829828298382984829858298682987829888298982990829918299282993829948299582996829978299882999830008300183002830038300483005830068300783008830098301083011830128301383014830158301683017830188301983020830218302283023830248302583026830278302883029830308303183032830338303483035830368303783038830398304083041830428304383044830458304683047830488304983050830518305283053830548305583056830578305883059830608306183062830638306483065830668306783068830698307083071830728307383074830758307683077830788307983080830818308283083830848308583086830878308883089830908309183092830938309483095830968309783098830998310083101831028310383104831058310683107831088310983110831118311283113831148311583116831178311883119831208312183122831238312483125831268312783128831298313083131831328313383134831358313683137831388313983140831418314283143831448314583146831478314883149831508315183152831538315483155831568315783158831598316083161831628316383164831658316683167831688316983170831718317283173831748317583176831778317883179831808318183182831838318483185831868318783188831898319083191831928319383194831958319683197831988319983200832018320283203832048320583206832078320883209832108321183212832138321483215832168321783218832198322083221832228322383224832258322683227832288322983230832318323283233832348323583236832378323883239832408324183242832438324483245832468324783248832498325083251832528325383254832558325683257832588325983260832618326283263832648326583266832678326883269832708327183272832738327483275832768327783278832798328083281832828328383284832858328683287832888328983290832918329283293832948329583296832978329883299833008330183302833038330483305833068330783308833098331083311833128331383314833158331683317833188331983320833218332283323833248332583326833278332883329833308333183332833338333483335833368333783338833398334083341833428334383344833458334683347833488334983350833518335283353833548335583356833578335883359833608336183362833638336483365833668336783368833698337083371833728337383374833758337683377833788337983380833818338283383833848338583386833878338883389833908339183392833938339483395833968339783398833998340083401834028340383404834058340683407834088340983410834118341283413834148341583416834178341883419834208342183422834238342483425834268342783428834298343083431834328343383434834358343683437834388343983440834418344283443834448344583446834478344883449834508345183452834538345483455834568345783458834598346083461834628346383464834658346683467834688346983470834718347283473834748347583476834778347883479834808348183482834838348483485834868348783488834898349083491834928349383494834958349683497834988349983500835018350283503835048350583506835078350883509835108351183512835138351483515835168351783518835198352083521835228352383524835258352683527835288352983530835318353283533835348353583536835378353883539835408354183542835438354483545835468354783548835498355083551835528355383554835558355683557835588355983560835618356283563835648356583566835678356883569835708357183572835738357483575835768357783578835798358083581835828358383584835858358683587835888358983590835918359283593835948359583596835978359883599836008360183602836038360483605836068360783608836098361083611836128361383614836158361683617836188361983620836218362283623836248362583626836278362883629836308363183632836338363483635836368363783638836398364083641836428364383644836458364683647836488364983650836518365283653836548365583656836578365883659836608366183662836638366483665836668366783668836698367083671836728367383674836758367683677836788367983680836818368283683836848368583686836878368883689836908369183692836938369483695836968369783698836998370083701837028370383704837058370683707837088370983710837118371283713837148371583716837178371883719837208372183722837238372483725837268372783728837298373083731837328373383734837358373683737837388373983740837418374283743837448374583746837478374883749837508375183752837538375483755837568375783758837598376083761837628376383764837658376683767837688376983770837718377283773837748377583776837778377883779837808378183782837838378483785837868378783788837898379083791837928379383794837958379683797837988379983800838018380283803838048380583806838078380883809838108381183812838138381483815838168381783818838198382083821838228382383824838258382683827838288382983830838318383283833838348383583836838378383883839838408384183842838438384483845838468384783848838498385083851838528385383854838558385683857838588385983860838618386283863838648386583866838678386883869838708387183872838738387483875838768387783878838798388083881838828388383884838858388683887838888388983890838918389283893838948389583896838978389883899839008390183902839038390483905839068390783908839098391083911839128391383914839158391683917839188391983920839218392283923839248392583926839278392883929839308393183932839338393483935839368393783938839398394083941839428394383944839458394683947839488394983950839518395283953839548395583956839578395883959839608396183962839638396483965839668396783968839698397083971839728397383974839758397683977839788397983980839818398283983839848398583986839878398883989839908399183992839938399483995839968399783998839998400084001840028400384004840058400684007840088400984010840118401284013840148401584016840178401884019840208402184022840238402484025840268402784028840298403084031840328403384034840358403684037840388403984040840418404284043840448404584046840478404884049840508405184052840538405484055840568405784058840598406084061840628406384064840658406684067840688406984070840718407284073840748407584076840778407884079840808408184082840838408484085840868408784088840898409084091840928409384094840958409684097840988409984100841018410284103841048410584106841078410884109841108411184112841138411484115841168411784118841198412084121841228412384124841258412684127841288412984130841318413284133841348413584136841378413884139841408414184142841438414484145841468414784148841498415084151841528415384154841558415684157841588415984160841618416284163841648416584166841678416884169841708417184172841738417484175841768417784178841798418084181841828418384184841858418684187841888418984190841918419284193841948419584196841978419884199842008420184202842038420484205842068420784208842098421084211842128421384214842158421684217842188421984220842218422284223842248422584226842278422884229842308423184232842338423484235842368423784238842398424084241842428424384244842458424684247842488424984250842518425284253842548425584256842578425884259842608426184262842638426484265842668426784268842698427084271842728427384274842758427684277842788427984280842818428284283842848428584286842878428884289842908429184292842938429484295842968429784298842998430084301843028430384304843058430684307843088430984310843118431284313843148431584316843178431884319843208432184322843238432484325843268432784328843298433084331843328433384334843358433684337843388433984340843418434284343843448434584346843478434884349843508435184352843538435484355843568435784358843598436084361843628436384364843658436684367843688436984370843718437284373843748437584376843778437884379843808438184382843838438484385843868438784388843898439084391843928439384394843958439684397843988439984400844018440284403844048440584406844078440884409844108441184412844138441484415844168441784418844198442084421844228442384424844258442684427844288442984430844318443284433844348443584436844378443884439844408444184442844438444484445844468444784448844498445084451844528445384454844558445684457844588445984460844618446284463844648446584466844678446884469844708447184472844738447484475844768447784478844798448084481844828448384484844858448684487844888448984490844918449284493844948449584496844978449884499845008450184502845038450484505845068450784508845098451084511845128451384514845158451684517845188451984520845218452284523845248452584526845278452884529845308453184532845338453484535845368453784538845398454084541845428454384544845458454684547845488454984550845518455284553845548455584556845578455884559845608456184562845638456484565845668456784568845698457084571845728457384574845758457684577845788457984580845818458284583845848458584586845878458884589845908459184592845938459484595845968459784598845998460084601846028460384604846058460684607846088460984610846118461284613846148461584616846178461884619846208462184622846238462484625846268462784628846298463084631846328463384634846358463684637846388463984640846418464284643846448464584646846478464884649846508465184652846538465484655846568465784658846598466084661846628466384664846658466684667846688466984670846718467284673846748467584676846778467884679846808468184682846838468484685846868468784688846898469084691846928469384694846958469684697846988469984700847018470284703847048470584706847078470884709847108471184712847138471484715847168471784718847198472084721847228472384724847258472684727847288472984730847318473284733847348473584736847378473884739847408474184742847438474484745847468474784748847498475084751847528475384754847558475684757847588475984760847618476284763847648476584766847678476884769847708477184772847738477484775847768477784778847798478084781847828478384784847858478684787847888478984790847918479284793847948479584796847978479884799848008480184802848038480484805848068480784808848098481084811848128481384814848158481684817848188481984820848218482284823848248482584826848278482884829848308483184832848338483484835848368483784838848398484084841848428484384844848458484684847848488484984850848518485284853848548485584856848578485884859848608486184862848638486484865848668486784868848698487084871848728487384874848758487684877848788487984880848818488284883848848488584886848878488884889848908489184892848938489484895848968489784898848998490084901849028490384904849058490684907849088490984910849118491284913849148491584916849178491884919849208492184922849238492484925849268492784928849298493084931849328493384934849358493684937849388493984940849418494284943849448494584946849478494884949849508495184952849538495484955849568495784958849598496084961849628496384964849658496684967849688496984970849718497284973849748497584976849778497884979849808498184982849838498484985849868498784988849898499084991849928499384994849958499684997849988499985000850018500285003850048500585006850078500885009850108501185012850138501485015850168501785018850198502085021850228502385024850258502685027850288502985030850318503285033850348503585036850378503885039850408504185042850438504485045850468504785048850498505085051850528505385054850558505685057850588505985060850618506285063850648506585066850678506885069850708507185072850738507485075850768507785078850798508085081850828508385084850858508685087850888508985090850918509285093850948509585096850978509885099851008510185102851038510485105851068510785108851098511085111851128511385114851158511685117851188511985120851218512285123851248512585126851278512885129851308513185132851338513485135851368513785138851398514085141851428514385144851458514685147851488514985150851518515285153851548515585156851578515885159851608516185162851638516485165851668516785168851698517085171851728517385174851758517685177851788517985180851818518285183851848518585186851878518885189851908519185192851938519485195851968519785198851998520085201852028520385204852058520685207852088520985210852118521285213852148521585216852178521885219852208522185222852238522485225852268522785228852298523085231852328523385234852358523685237852388523985240852418524285243852448524585246852478524885249852508525185252852538525485255852568525785258852598526085261852628526385264852658526685267852688526985270852718527285273852748527585276852778527885279852808528185282852838528485285852868528785288852898529085291852928529385294852958529685297852988529985300853018530285303853048530585306853078530885309853108531185312853138531485315853168531785318853198532085321853228532385324853258532685327853288532985330853318533285333853348533585336853378533885339853408534185342853438534485345853468534785348853498535085351853528535385354853558535685357853588535985360853618536285363853648536585366853678536885369853708537185372853738537485375853768537785378853798538085381853828538385384853858538685387853888538985390853918539285393853948539585396853978539885399854008540185402854038540485405854068540785408854098541085411854128541385414854158541685417854188541985420854218542285423854248542585426854278542885429854308543185432854338543485435854368543785438854398544085441854428544385444854458544685447854488544985450854518545285453854548545585456854578545885459854608546185462854638546485465854668546785468854698547085471854728547385474854758547685477854788547985480854818548285483854848548585486854878548885489854908549185492854938549485495854968549785498854998550085501855028550385504855058550685507855088550985510855118551285513855148551585516855178551885519855208552185522855238552485525855268552785528855298553085531855328553385534855358553685537855388553985540855418554285543855448554585546855478554885549855508555185552855538555485555855568555785558855598556085561855628556385564855658556685567855688556985570855718557285573855748557585576855778557885579855808558185582855838558485585855868558785588855898559085591855928559385594855958559685597855988559985600856018560285603856048560585606856078560885609856108561185612856138561485615856168561785618856198562085621856228562385624856258562685627856288562985630856318563285633856348563585636856378563885639856408564185642856438564485645856468564785648856498565085651856528565385654856558565685657856588565985660856618566285663856648566585666856678566885669856708567185672856738567485675856768567785678856798568085681856828568385684856858568685687856888568985690856918569285693856948569585696856978569885699857008570185702857038570485705857068570785708857098571085711857128571385714857158571685717857188571985720857218572285723857248572585726857278572885729857308573185732857338573485735857368573785738857398574085741857428574385744857458574685747857488574985750857518575285753857548575585756857578575885759857608576185762857638576485765857668576785768857698577085771857728577385774857758577685777857788577985780857818578285783857848578585786857878578885789857908579185792857938579485795857968579785798857998580085801858028580385804858058580685807858088580985810858118581285813858148581585816858178581885819858208582185822858238582485825858268582785828858298583085831858328583385834858358583685837858388583985840858418584285843858448584585846858478584885849858508585185852858538585485855858568585785858858598586085861858628586385864858658586685867858688586985870858718587285873858748587585876858778587885879858808588185882858838588485885858868588785888858898589085891858928589385894858958589685897858988589985900859018590285903859048590585906859078590885909859108591185912859138591485915859168591785918859198592085921859228592385924859258592685927859288592985930859318593285933859348593585936859378593885939859408594185942859438594485945859468594785948859498595085951859528595385954859558595685957859588595985960859618596285963859648596585966859678596885969859708597185972859738597485975859768597785978859798598085981859828598385984859858598685987859888598985990859918599285993859948599585996859978599885999860008600186002860038600486005860068600786008860098601086011860128601386014860158601686017860188601986020860218602286023860248602586026860278602886029860308603186032860338603486035860368603786038860398604086041860428604386044860458604686047860488604986050860518605286053860548605586056860578605886059860608606186062860638606486065860668606786068860698607086071860728607386074860758607686077860788607986080860818608286083860848608586086860878608886089860908609186092860938609486095860968609786098860998610086101861028610386104861058610686107861088610986110861118611286113861148611586116861178611886119861208612186122861238612486125861268612786128861298613086131861328613386134861358613686137861388613986140861418614286143861448614586146861478614886149861508615186152861538615486155861568615786158861598616086161861628616386164861658616686167861688616986170861718617286173861748617586176861778617886179861808618186182861838618486185861868618786188861898619086191861928619386194861958619686197861988619986200862018620286203862048620586206862078620886209862108621186212862138621486215862168621786218862198622086221862228622386224862258622686227862288622986230862318623286233862348623586236862378623886239862408624186242862438624486245862468624786248862498625086251862528625386254862558625686257862588625986260862618626286263862648626586266862678626886269862708627186272862738627486275862768627786278862798628086281862828628386284862858628686287862888628986290862918629286293862948629586296862978629886299863008630186302863038630486305863068630786308863098631086311863128631386314863158631686317863188631986320863218632286323863248632586326863278632886329863308633186332863338633486335863368633786338863398634086341863428634386344863458634686347863488634986350863518635286353863548635586356863578635886359863608636186362863638636486365863668636786368863698637086371863728637386374863758637686377863788637986380863818638286383863848638586386863878638886389863908639186392863938639486395863968639786398863998640086401864028640386404864058640686407864088640986410864118641286413864148641586416864178641886419864208642186422864238642486425864268642786428864298643086431864328643386434864358643686437864388643986440864418644286443864448644586446864478644886449864508645186452864538645486455864568645786458864598646086461864628646386464864658646686467864688646986470864718647286473864748647586476864778647886479864808648186482864838648486485864868648786488864898649086491864928649386494864958649686497864988649986500865018650286503865048650586506865078650886509865108651186512865138651486515865168651786518865198652086521865228652386524865258652686527865288652986530865318653286533865348653586536865378653886539865408654186542865438654486545865468654786548865498655086551865528655386554865558655686557865588655986560865618656286563865648656586566865678656886569865708657186572865738657486575865768657786578865798658086581865828658386584865858658686587865888658986590865918659286593865948659586596865978659886599866008660186602866038660486605866068660786608866098661086611866128661386614866158661686617866188661986620866218662286623866248662586626866278662886629866308663186632866338663486635866368663786638866398664086641866428664386644866458664686647866488664986650866518665286653866548665586656866578665886659866608666186662866638666486665866668666786668866698667086671866728667386674866758667686677866788667986680866818668286683866848668586686866878668886689866908669186692866938669486695866968669786698866998670086701867028670386704867058670686707867088670986710867118671286713867148671586716867178671886719867208672186722867238672486725867268672786728867298673086731867328673386734867358673686737867388673986740867418674286743867448674586746867478674886749867508675186752867538675486755867568675786758867598676086761867628676386764867658676686767867688676986770867718677286773867748677586776867778677886779867808678186782867838678486785867868678786788867898679086791867928679386794867958679686797867988679986800868018680286803868048680586806868078680886809868108681186812868138681486815868168681786818868198682086821868228682386824868258682686827868288682986830868318683286833868348683586836868378683886839868408684186842868438684486845868468684786848868498685086851868528685386854868558685686857868588685986860868618686286863868648686586866868678686886869868708687186872868738687486875868768687786878868798688086881868828688386884868858688686887868888688986890868918689286893868948689586896868978689886899869008690186902869038690486905869068690786908869098691086911869128691386914869158691686917869188691986920869218692286923869248692586926869278692886929869308693186932869338693486935869368693786938869398694086941869428694386944869458694686947869488694986950869518695286953869548695586956869578695886959869608696186962869638696486965869668696786968869698697086971869728697386974869758697686977869788697986980869818698286983869848698586986869878698886989869908699186992869938699486995869968699786998869998700087001870028700387004870058700687007870088700987010870118701287013870148701587016870178701887019870208702187022870238702487025870268702787028870298703087031870328703387034870358703687037870388703987040870418704287043870448704587046870478704887049870508705187052870538705487055870568705787058870598706087061870628706387064870658706687067870688706987070870718707287073870748707587076870778707887079870808708187082870838708487085870868708787088870898709087091870928709387094870958709687097870988709987100871018710287103871048710587106871078710887109871108711187112871138711487115871168711787118871198712087121871228712387124871258712687127871288712987130871318713287133871348713587136871378713887139871408714187142871438714487145871468714787148871498715087151871528715387154871558715687157871588715987160871618716287163871648716587166871678716887169871708717187172871738717487175871768717787178871798718087181871828718387184871858718687187871888718987190871918719287193871948719587196871978719887199872008720187202872038720487205872068720787208872098721087211872128721387214872158721687217872188721987220872218722287223872248722587226872278722887229872308723187232872338723487235872368723787238872398724087241872428724387244872458724687247872488724987250872518725287253872548725587256872578725887259872608726187262872638726487265872668726787268872698727087271872728727387274872758727687277872788727987280872818728287283872848728587286872878728887289872908729187292872938729487295872968729787298872998730087301873028730387304873058730687307873088730987310873118731287313873148731587316873178731887319873208732187322873238732487325873268732787328873298733087331873328733387334873358733687337873388733987340873418734287343873448734587346873478734887349873508735187352873538735487355873568735787358873598736087361873628736387364873658736687367873688736987370873718737287373873748737587376873778737887379873808738187382873838738487385873868738787388873898739087391873928739387394873958739687397873988739987400874018740287403874048740587406874078740887409874108741187412874138741487415874168741787418874198742087421874228742387424874258742687427874288742987430874318743287433874348743587436874378743887439874408744187442874438744487445874468744787448874498745087451874528745387454874558745687457874588745987460874618746287463874648746587466874678746887469874708747187472874738747487475874768747787478874798748087481874828748387484874858748687487874888748987490874918749287493874948749587496874978749887499875008750187502875038750487505875068750787508875098751087511875128751387514875158751687517875188751987520875218752287523875248752587526875278752887529875308753187532875338753487535875368753787538875398754087541875428754387544875458754687547875488754987550875518755287553875548755587556875578755887559875608756187562875638756487565875668756787568875698757087571875728757387574875758757687577875788757987580875818758287583875848758587586875878758887589875908759187592875938759487595875968759787598875998760087601876028760387604876058760687607876088760987610876118761287613876148761587616876178761887619876208762187622876238762487625876268762787628876298763087631876328763387634876358763687637876388763987640876418764287643876448764587646876478764887649876508765187652876538765487655876568765787658876598766087661876628766387664876658766687667876688766987670876718767287673876748767587676876778767887679876808768187682876838768487685876868768787688876898769087691876928769387694876958769687697876988769987700877018770287703877048770587706877078770887709877108771187712877138771487715877168771787718877198772087721877228772387724877258772687727877288772987730877318773287733877348773587736877378773887739877408774187742877438774487745877468774787748877498775087751877528775387754877558775687757877588775987760877618776287763877648776587766877678776887769877708777187772877738777487775877768777787778877798778087781877828778387784877858778687787877888778987790877918779287793877948779587796877978779887799878008780187802878038780487805878068780787808878098781087811878128781387814878158781687817878188781987820878218782287823878248782587826878278782887829878308783187832878338783487835878368783787838878398784087841878428784387844878458784687847878488784987850878518785287853878548785587856878578785887859878608786187862878638786487865878668786787868878698787087871878728787387874878758787687877878788787987880878818788287883878848788587886878878788887889878908789187892878938789487895878968789787898878998790087901879028790387904879058790687907879088790987910879118791287913879148791587916879178791887919879208792187922879238792487925879268792787928879298793087931879328793387934879358793687937879388793987940879418794287943879448794587946879478794887949879508795187952879538795487955879568795787958879598796087961879628796387964879658796687967879688796987970879718797287973879748797587976879778797887979879808798187982879838798487985879868798787988879898799087991879928799387994879958799687997879988799988000880018800288003880048800588006880078800888009880108801188012880138801488015880168801788018880198802088021880228802388024880258802688027880288802988030880318803288033880348803588036880378803888039880408804188042880438804488045880468804788048880498805088051880528805388054880558805688057880588805988060880618806288063880648806588066880678806888069880708807188072880738807488075880768807788078880798808088081880828808388084880858808688087880888808988090880918809288093880948809588096880978809888099881008810188102881038810488105881068810788108881098811088111881128811388114881158811688117881188811988120881218812288123881248812588126881278812888129881308813188132881338813488135881368813788138881398814088141881428814388144881458814688147881488814988150881518815288153881548815588156881578815888159881608816188162881638816488165881668816788168881698817088171881728817388174881758817688177881788817988180881818818288183881848818588186881878818888189881908819188192881938819488195881968819788198881998820088201882028820388204882058820688207882088820988210882118821288213882148821588216882178821888219882208822188222882238822488225882268822788228882298823088231882328823388234882358823688237882388823988240882418824288243882448824588246882478824888249882508825188252882538825488255882568825788258882598826088261882628826388264882658826688267882688826988270882718827288273882748827588276882778827888279882808828188282882838828488285882868828788288882898829088291882928829388294882958829688297882988829988300883018830288303883048830588306883078830888309883108831188312883138831488315883168831788318883198832088321883228832388324883258832688327883288832988330883318833288333883348833588336883378833888339883408834188342883438834488345883468834788348883498835088351883528835388354883558835688357883588835988360883618836288363883648836588366883678836888369883708837188372883738837488375883768837788378883798838088381883828838388384883858838688387883888838988390883918839288393883948839588396883978839888399884008840188402884038840488405884068840788408884098841088411884128841388414884158841688417884188841988420884218842288423884248842588426884278842888429884308843188432884338843488435884368843788438884398844088441884428844388444884458844688447884488844988450884518845288453884548845588456884578845888459884608846188462884638846488465884668846788468884698847088471884728847388474884758847688477884788847988480884818848288483884848848588486884878848888489884908849188492884938849488495884968849788498884998850088501885028850388504885058850688507885088850988510885118851288513885148851588516885178851888519885208852188522885238852488525885268852788528885298853088531885328853388534885358853688537885388853988540885418854288543885448854588546885478854888549885508855188552885538855488555885568855788558885598856088561885628856388564885658856688567885688856988570885718857288573885748857588576885778857888579885808858188582885838858488585885868858788588885898859088591885928859388594885958859688597885988859988600886018860288603886048860588606886078860888609886108861188612886138861488615886168861788618886198862088621886228862388624886258862688627886288862988630886318863288633886348863588636886378863888639886408864188642886438864488645886468864788648886498865088651886528865388654886558865688657886588865988660886618866288663886648866588666886678866888669886708867188672886738867488675886768867788678886798868088681886828868388684886858868688687886888868988690886918869288693886948869588696886978869888699887008870188702887038870488705887068870788708887098871088711887128871388714887158871688717887188871988720887218872288723887248872588726887278872888729887308873188732887338873488735887368873788738887398874088741887428874388744887458874688747887488874988750887518875288753887548875588756887578875888759887608876188762887638876488765887668876788768887698877088771887728877388774887758877688777887788877988780887818878288783887848878588786887878878888789887908879188792887938879488795887968879788798887998880088801888028880388804888058880688807888088880988810888118881288813888148881588816888178881888819888208882188822888238882488825888268882788828888298883088831888328883388834888358883688837888388883988840888418884288843888448884588846888478884888849888508885188852888538885488855888568885788858888598886088861888628886388864888658886688867888688886988870888718887288873888748887588876888778887888879888808888188882888838888488885888868888788888888898889088891888928889388894888958889688897888988889988900889018890288903889048890588906889078890888909889108891188912889138891488915889168891788918889198892088921889228892388924889258892688927889288892988930889318893288933889348893588936889378893888939889408894188942889438894488945889468894788948889498895088951889528895388954889558895688957889588895988960889618896288963889648896588966889678896888969889708897188972889738897488975889768897788978889798898088981889828898388984889858898688987889888898988990889918899288993889948899588996889978899888999890008900189002890038900489005890068900789008890098901089011890128901389014890158901689017890188901989020890218902289023890248902589026890278902889029890308903189032890338903489035890368903789038890398904089041890428904389044890458904689047890488904989050890518905289053890548905589056890578905889059890608906189062890638906489065890668906789068890698907089071890728907389074890758907689077890788907989080890818908289083890848908589086890878908889089890908909189092890938909489095890968909789098890998910089101891028910389104891058910689107891088910989110891118911289113891148911589116891178911889119891208912189122891238912489125891268912789128891298913089131891328913389134891358913689137891388913989140891418914289143891448914589146891478914889149891508915189152891538915489155891568915789158891598916089161891628916389164891658916689167891688916989170891718917289173891748917589176891778917889179891808918189182891838918489185891868918789188891898919089191891928919389194891958919689197891988919989200892018920289203892048920589206892078920889209892108921189212892138921489215892168921789218892198922089221892228922389224892258922689227892288922989230892318923289233892348923589236892378923889239892408924189242892438924489245892468924789248892498925089251892528925389254892558925689257892588925989260892618926289263892648926589266892678926889269892708927189272892738927489275892768927789278892798928089281892828928389284892858928689287892888928989290892918929289293892948929589296892978929889299893008930189302893038930489305893068930789308893098931089311893128931389314893158931689317893188931989320893218932289323893248932589326893278932889329893308933189332893338933489335893368933789338893398934089341893428934389344893458934689347893488934989350893518935289353893548935589356893578935889359893608936189362893638936489365893668936789368893698937089371893728937389374893758937689377893788937989380893818938289383893848938589386893878938889389893908939189392893938939489395893968939789398893998940089401894028940389404894058940689407894088940989410894118941289413894148941589416894178941889419894208942189422894238942489425894268942789428894298943089431894328943389434894358943689437894388943989440894418944289443894448944589446894478944889449894508945189452894538945489455894568945789458894598946089461894628946389464894658946689467894688946989470894718947289473894748947589476894778947889479894808948189482894838948489485894868948789488894898949089491894928949389494894958949689497894988949989500895018950289503895048950589506895078950889509895108951189512895138951489515895168951789518895198952089521895228952389524895258952689527895288952989530895318953289533895348953589536895378953889539895408954189542895438954489545895468954789548895498955089551895528955389554895558955689557895588955989560895618956289563895648956589566895678956889569895708957189572895738957489575895768957789578895798958089581895828958389584895858958689587895888958989590895918959289593895948959589596895978959889599896008960189602896038960489605896068960789608896098961089611896128961389614896158961689617896188961989620896218962289623896248962589626896278962889629896308963189632896338963489635896368963789638896398964089641896428964389644896458964689647896488964989650896518965289653896548965589656896578965889659896608966189662896638966489665896668966789668896698967089671896728967389674896758967689677896788967989680896818968289683896848968589686896878968889689896908969189692896938969489695896968969789698896998970089701897028970389704897058970689707897088970989710897118971289713897148971589716897178971889719897208972189722897238972489725897268972789728897298973089731897328973389734897358973689737897388973989740897418974289743897448974589746897478974889749897508975189752897538975489755897568975789758897598976089761897628976389764897658976689767897688976989770897718977289773897748977589776897778977889779897808978189782897838978489785897868978789788897898979089791897928979389794897958979689797897988979989800898018980289803898048980589806898078980889809898108981189812898138981489815898168981789818898198982089821898228982389824898258982689827898288982989830898318983289833898348983589836898378983889839898408984189842898438984489845898468984789848898498985089851898528985389854898558985689857898588985989860898618986289863898648986589866898678986889869898708987189872898738987489875898768987789878898798988089881898828988389884898858988689887898888988989890898918989289893898948989589896898978989889899899008990189902899038990489905899068990789908899098991089911899128991389914899158991689917899188991989920899218992289923899248992589926899278992889929899308993189932899338993489935899368993789938899398994089941899428994389944899458994689947899488994989950899518995289953899548995589956899578995889959899608996189962899638996489965899668996789968899698997089971899728997389974899758997689977899788997989980899818998289983899848998589986899878998889989899908999189992899938999489995899968999789998899999000090001900029000390004900059000690007900089000990010900119001290013900149001590016900179001890019900209002190022900239002490025900269002790028900299003090031900329003390034900359003690037900389003990040900419004290043900449004590046900479004890049900509005190052900539005490055900569005790058900599006090061900629006390064900659006690067900689006990070900719007290073900749007590076900779007890079900809008190082900839008490085900869008790088900899009090091900929009390094900959009690097900989009990100901019010290103901049010590106901079010890109901109011190112901139011490115901169011790118901199012090121901229012390124901259012690127901289012990130901319013290133901349013590136901379013890139901409014190142901439014490145901469014790148901499015090151901529015390154901559015690157901589015990160901619016290163901649016590166901679016890169901709017190172901739017490175901769017790178901799018090181901829018390184901859018690187901889018990190901919019290193901949019590196901979019890199902009020190202902039020490205902069020790208902099021090211902129021390214902159021690217902189021990220902219022290223902249022590226902279022890229902309023190232902339023490235902369023790238902399024090241902429024390244902459024690247902489024990250902519025290253902549025590256902579025890259902609026190262902639026490265902669026790268902699027090271902729027390274902759027690277902789027990280902819028290283902849028590286902879028890289902909029190292902939029490295902969029790298902999030090301903029030390304903059030690307903089030990310903119031290313903149031590316903179031890319903209032190322903239032490325903269032790328903299033090331903329033390334903359033690337903389033990340903419034290343903449034590346903479034890349903509035190352903539035490355903569035790358903599036090361903629036390364903659036690367903689036990370903719037290373903749037590376903779037890379903809038190382903839038490385903869038790388903899039090391903929039390394903959039690397903989039990400904019040290403904049040590406904079040890409904109041190412904139041490415904169041790418904199042090421904229042390424904259042690427904289042990430904319043290433904349043590436904379043890439904409044190442904439044490445904469044790448904499045090451904529045390454904559045690457904589045990460904619046290463904649046590466904679046890469904709047190472904739047490475904769047790478904799048090481904829048390484904859048690487904889048990490904919049290493904949049590496904979049890499905009050190502905039050490505905069050790508905099051090511905129051390514905159051690517905189051990520905219052290523905249052590526905279052890529905309053190532905339053490535905369053790538905399054090541905429054390544905459054690547905489054990550905519055290553905549055590556905579055890559905609056190562905639056490565905669056790568905699057090571905729057390574905759057690577905789057990580905819058290583905849058590586905879058890589905909059190592905939059490595905969059790598905999060090601906029060390604906059060690607906089060990610906119061290613906149061590616906179061890619906209062190622906239062490625906269062790628906299063090631906329063390634906359063690637906389063990640906419064290643906449064590646906479064890649906509065190652906539065490655906569065790658906599066090661906629066390664906659066690667906689066990670906719067290673906749067590676906779067890679906809068190682906839068490685906869068790688906899069090691906929069390694906959069690697906989069990700907019070290703907049070590706907079070890709907109071190712907139071490715907169071790718907199072090721
  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üc��A[¼]üc��ÊÇv`¶������+���src/Composer/Autoload/ClassMapGenerator.php¨��A[¼]¨�� ™f¶���������src/Composer/Cache.phpç��A[¼]ç��³›î¶������%���src/Composer/Command/AboutCommand.phpØ��A[¼]Ø��ö÷;‡¶������'���src/Composer/Command/ArchiveCommand.phpž��A[¼]ž��lG¶������$���src/Composer/Command/BaseCommand.phpÜ ��A[¼]Ü ��gô1¶������.���src/Composer/Command/BaseDependencyCommand.phpñ��A[¼]ñ��XgFð¶������1���src/Composer/Command/CheckPlatformReqsCommand.php ��A[¼] ��*Þ¯T¶������*���src/Composer/Command/ClearCacheCommand.phpµ��A[¼]µ��vÿyƒ¶������&���src/Composer/Command/ConfigCommand.phpM��A[¼]M��Û=y¶������-���src/Composer/Command/CreateProjectCommand.phpß5��A[¼]ß5��ü�_÷¶������'���src/Composer/Command/DependsCommand.phpø��A[¼]ø��ªeá¶������(���src/Composer/Command/DiagnoseCommand.phpåM��A[¼]åM��hÇÔ¶������,���src/Composer/Command/DumpAutoloadCommand.phpL ��A[¼]L ��°E²ù¶������$���src/Composer/Command/ExecCommand.phpï��A[¼]ï��Xrœ¾¶������&���src/Composer/Command/GlobalCommand.phpz ��A[¼]z ��³çå?¶������$���src/Composer/Command/HomeCommand.php��A[¼]��qLBŽ¶������$���src/Composer/Command/InitCommand.php¯Q��A[¼]¯Q��œÁ ´¶������'���src/Composer/Command/InstallCommand.phpT��A[¼]T��Þùõ›¶������(���src/Composer/Command/LicensesCommand.php‚��A[¼]‚��±s'¶������(���src/Composer/Command/OutdatedCommand.php ��A[¼] ��اc¶������)���src/Composer/Command/ProhibitsCommand.php��A[¼]��_¤éS¶������&���src/Composer/Command/RemoveCommand.phpá��A[¼]á��½í�)¶������'���src/Composer/Command/RequireCommand.php"'��A[¼]"'��ü¤Ø²¶������)���src/Composer/Command/RunScriptCommand.php=��A[¼]=��rºmܶ������+���src/Composer/Command/ScriptAliasCommand.php¯��A[¼]¯��?=Ѷ������&���src/Composer/Command/SearchCommand.phpU ��A[¼]U ��…߶������*���src/Composer/Command/SelfUpdateCommand.php;3��A[¼];3��kð˜m¶������$���src/Composer/Command/ShowCommand.phphq��A[¼]hq��+a_¶������&���src/Composer/Command/StatusCommand.php–��A[¼]–��ùjض������(���src/Composer/Command/SuggestsCommand.phpò ��A[¼]ò ��íA�Ƕ������&���src/Composer/Command/UpdateCommand.phpñ#��A[¼]ñ#��p\F¶������(���src/Composer/Command/ValidateCommand.php€��A[¼]€��ÍÃ�î¶���������src/Composer/Composer.phpN ��A[¼]N ��!Çç¶���������src/Composer/Config.phph$��A[¼]h$��»‰Á¶������-���src/Composer/Config/ConfigSourceInterface.php��A[¼]��³ [/¶������(���src/Composer/Config/JsonConfigSource.php²��A[¼]²��QiÃb¶������$���src/Composer/Console/Application.phpý6��A[¼]ý6��ò|-¶������,���src/Composer/Console/HtmlOutputFormatter.php3��A[¼]3��Ú�Eu¶������-���src/Composer/DependencyResolver/Decisions.php'��A[¼]'��¹ÔŽ¼¶������1���src/Composer/DependencyResolver/DefaultPolicy.php��A[¼]��õÝv¶������/���src/Composer/DependencyResolver/GenericRule.phpµ��A[¼]µ��᫤¶������>���src/Composer/DependencyResolver/Operation/InstallOperation.phpC��A[¼]C��´\õ*¶������I���src/Composer/DependencyResolver/Operation/MarkAliasInstalledOperation.php÷��A[¼]÷��ïÎà÷¶������K���src/Composer/DependencyResolver/Operation/MarkAliasUninstalledOperation.phpý��A[¼]ý��3#†¶������@���src/Composer/DependencyResolver/Operation/OperationInterface.phpÓ���A[¼]Ó���Ùâ&ä¶������=���src/Composer/DependencyResolver/Operation/SolverOperation.php¹��A[¼]¹��&¢e
  25. ¶������@���src/Composer/DependencyResolver/Operation/UninstallOperation.phpI��A[¼]I��FûÂɶ������=���src/Composer/DependencyResolver/Operation/UpdateOperation.phph��A[¼]h��öSÕ]¶������3���src/Composer/DependencyResolver/PolicyInterface.php­��A[¼]­��Ÿ‹R¶������(���src/Composer/DependencyResolver/Pool.php¯"��A[¼]¯"��m½ ¶������+���src/Composer/DependencyResolver/Problem.phpú��A[¼]ú��]D5¶������+���src/Composer/DependencyResolver/Request.phpƒ��A[¼]ƒ��åVP„¶������(���src/Composer/DependencyResolver/Rule.php?��A[¼]?��¬‘œü¶������1���src/Composer/DependencyResolver/Rule2Literals.php��A[¼]��tZÅɶ������+���src/Composer/DependencyResolver/RuleSet.phpª
  26. ��A[¼]ª
  27. ��_΂¶������4���src/Composer/DependencyResolver/RuleSetGenerator.phpÊ��A[¼]Ê��D¦õZ¶������3���src/Composer/DependencyResolver/RuleSetIterator.php��A[¼]��›Cü$¶������2���src/Composer/DependencyResolver/RuleWatchChain.phpi��A[¼]i��hïš,¶������2���src/Composer/DependencyResolver/RuleWatchGraph.phpá��A[¼]á��‰rôv¶������1���src/Composer/DependencyResolver/RuleWatchNode.php��A[¼]���Gd7¶������*���src/Composer/DependencyResolver/Solver.php�:��A[¼]�:��æ¯Ép¶������6���src/Composer/DependencyResolver/SolverBugException.php™��A[¼]™��Xg6¶������;���src/Composer/DependencyResolver/SolverProblemsException.phpô��A[¼]ô��×|Ŧ¶������/���src/Composer/DependencyResolver/Transaction.php×��A[¼]×��Vm쟶������-���src/Composer/Downloader/ArchiveDownloader.phpÆ ��A[¼]Æ ��G s0¶������1���src/Composer/Downloader/ChangeReportInterface.phpÌ���A[¼]Ì���¯à¨¿¶������+���src/Composer/Downloader/DownloadManager.php`��A[¼]`��#ÏX¶������/���src/Composer/Downloader/DownloaderInterface.phpÊ��A[¼]Ê��gs!l¶������3���src/Composer/Downloader/DvcsDownloaderInterface.phpÑ���A[¼]Ñ���&Áœ¿¶������*���src/Composer/Downloader/FileDownloader.phpG��A[¼]G��äOж������/���src/Composer/Downloader/FilesystemException.php
  28. ��A[¼]
  29. ��.-‹¶������,���src/Composer/Downloader/FossilDownloader.php‚ ��A[¼]‚ ��Ü�Ii¶������)���src/Composer/Downloader/GitDownloader.php³6��A[¼]³6��¦Ü(9¶������*���src/Composer/Downloader/GzipDownloader.phpó��A[¼]ó��}Úo¶������(���src/Composer/Downloader/HgDownloader.php”��A[¼]”��ßis̶������*���src/Composer/Downloader/PathDownloader.phpé��A[¼]é��$²FQ¶������0���src/Composer/Downloader/PearPackageExtractor.phpu��A[¼]u��z„‡¶������.���src/Composer/Downloader/PerforceDownloader.phpž��A[¼]ž��Öüñ9¶������*���src/Composer/Downloader/PharDownloader.phpå���A[¼]å���ÞÉç¶������)���src/Composer/Downloader/RarDownloader.phpž��A[¼]ž��6 3U¶������)���src/Composer/Downloader/SvnDownloader.phpG��A[¼]G��M#j¶������)���src/Composer/Downloader/TarDownloader.phpã���A[¼]ã���Í’X?¶������.���src/Composer/Downloader/TransportException.php=��A[¼]=��ZÎÈÞ¶������9���src/Composer/Downloader/VcsCapableDownloaderInterface.phpÔ���A[¼]Ô���`§ôö¶������)���src/Composer/Downloader/VcsDownloader.php¡��A[¼]¡��( à>¶������(���src/Composer/Downloader/XzDownloader.php§��A[¼]§��W$;á¶������)���src/Composer/Downloader/ZipDownloader.phpk��A[¼]k��Òo”ζ������&���src/Composer/EventDispatcher/Event.php ��A[¼] ��±™jï¶������0���src/Composer/EventDispatcher/EventDispatcher.php$4��A[¼]$4��x‹@¶������9���src/Composer/EventDispatcher/EventSubscriberInterface.php©���A[¼]©���h·0¶������9���src/Composer/EventDispatcher/ScriptExecutionException.phpv���A[¼]v���wZ8S¶������)���src/Composer/Exception/NoSslException.phpf���A[¼]f���ËíM�¶���������src/Composer/Factory.php_=��A[¼]_=��x"Ŷ���������src/Composer/IO/BaseIO.phpÝ��A[¼]Ý��¢âº¶���������src/Composer/IO/BufferIO.php¾��A[¼]¾��X~d¶���������src/Composer/IO/ConsoleIO.php7��A[¼]7��¥<ȶ���������src/Composer/IO/IOInterface.phpì��A[¼]ì���Õ�¶���������src/Composer/IO/NullIO.phpÀ��A[¼]À��F`sʶ���������src/Composer/Installer.phpÚž��A[¼]Úž��¾g«‰¶������*���src/Composer/Installer/BinaryInstaller.php
  30. ��A[¼]
  31. ��t¤{ø¶������2���src/Composer/Installer/BinaryPresenceInterface.phpË���A[¼]Ë���À5š¨¶������.���src/Composer/Installer/InstallationManager.php-��A[¼]-��¾}Œ7¶������)���src/Composer/Installer/InstallerEvent.php��A[¼]��lÔzi¶������*���src/Composer/Installer/InstallerEvents.phpÞ���A[¼]Þ���ìŸ@G¶������-���src/Composer/Installer/InstallerInterface.phpã��A[¼]ã��^ƒ“ʶ������+���src/Composer/Installer/LibraryInstaller.php%��A[¼]%�� »�̶������/���src/Composer/Installer/MetapackageInstaller.phpÊ��A[¼]Ê��Ùti·¶������(���src/Composer/Installer/NoopInstaller.php+��A[¼]+��À·M}¶������'���src/Composer/Installer/PackageEvent.phpe��A[¼]e��;° ¶������(���src/Composer/Installer/PackageEvents.php¸��A[¼]¸��dbØs¶������.���src/Composer/Installer/PearBinaryInstaller.phpø ��A[¼]ø ��*ë•k¶������(���src/Composer/Installer/PearInstaller.php¢��A[¼]¢��È‚¶Ñ¶������*���src/Composer/Installer/PluginInstaller.php‹��A[¼]‹��ÒX8¶������+���src/Composer/Installer/ProjectInstaller.php��A[¼]��*0@P¶������4���src/Composer/Installer/SuggestedPackagesReporter.php:��A[¼]:��‚´UV¶���������src/Composer/Json/JsonFile.php[��A[¼][��°�Ë™¶������#���src/Composer/Json/JsonFormatter.phpb��A[¼]b��ÝNš¶������%���src/Composer/Json/JsonManipulator.phpÀ3��A[¼]À3���™ ¶������-���src/Composer/Json/JsonValidationException.php\��A[¼]\��.Xóܶ������%���src/Composer/Package/AliasPackage.php§��A[¼]§��Õ”R™¶������7���src/Composer/Package/Archiver/ArchivableFilesFilter.php ��A[¼] ��yY+¦¶������7���src/Composer/Package/Archiver/ArchivableFilesFinder.phpÞ��A[¼]Þ�� ²²¹¶������0���src/Composer/Package/Archiver/ArchiveManager.phpÝ ��A[¼]Ý ��í<´B¶������3���src/Composer/Package/Archiver/ArchiverInterface.php��A[¼]��ñ´> ¶������3���src/Composer/Package/Archiver/BaseExcludeFilter.php–��A[¼]–��y¶=ƶ������7���src/Composer/Package/Archiver/ComposerExcludeFilter.php��A[¼]��‹SZ0¶������2���src/Composer/Package/Archiver/GitExcludeFilter.phpr��A[¼]r��3‘Mh¶������1���src/Composer/Package/Archiver/HgExcludeFilter.php ��A[¼] �� •¦S¶������.���src/Composer/Package/Archiver/PharArchiver.php?��A[¼]?��®— u¶������-���src/Composer/Package/Archiver/ZipArchiver.php½��A[¼]½��VÀ‚¨¶������$���src/Composer/Package/BasePackage.php��A[¼]��D|ŸÈ¶������*���src/Composer/Package/Comparer/Comparer.phpR��A[¼]R��Ïسî¶������(���src/Composer/Package/CompletePackage.phpü��A[¼]ü��þM˶¶������1���src/Composer/Package/CompletePackageInterface.phpõ��A[¼]õ��¦Ê�ò¶������+���src/Composer/Package/Dumper/ArrayDumper.phpW ��A[¼]W ��¿éÁ¦¶���������src/Composer/Package/Link.phpˆ��A[¼]ˆ��å¶Y«¶������7���src/Composer/Package/LinkConstraint/EmptyConstraint.php‚��A[¼]‚��é~‹¶������?���src/Composer/Package/LinkConstraint/LinkConstraintInterface.phpd��A[¼]d��¤ôLn¶������7���src/Composer/Package/LinkConstraint/MultiConstraint.php‚��A[¼]‚��ób`ý¶������:���src/Composer/Package/LinkConstraint/SpecificConstraint.phpi��A[¼]i��Þ”š%¶������9���src/Composer/Package/LinkConstraint/VersionConstraint.phpX��A[¼]X��}`y¶������+���src/Composer/Package/Loader/ArrayLoader.phpN��A[¼]N��âQ¬¶������7���src/Composer/Package/Loader/InvalidPackageException.phpE��A[¼]E��xb¾¶������*���src/Composer/Package/Loader/JsonLoader.phpù��A[¼]ù��!~ˆ{¶������/���src/Composer/Package/Loader/LoaderInterface.php²���A[¼]²���¦}úζ������1���src/Composer/Package/Loader/RootPackageLoader.phpó��A[¼]ó��l”.ض������5���src/Composer/Package/Loader/ValidatingArrayLoader.php(>��A[¼](>��„´P¶���������src/Composer/Package/Locker.php¥!��A[¼]¥!��/=xö¶������ ���src/Composer/Package/Package.phpÉ��A[¼]É��cÃ�h¶������)���src/Composer/Package/PackageInterface.php\��A[¼]\��xåp¨¶������)���src/Composer/Package/RootAliasPackage.php ��A[¼] �� _€ø¶������$���src/Composer/Package/RootPackage.php��A[¼]��ŽÎ_¶������-���src/Composer/Package/RootPackageInterface.php¹��A[¼]¹��"maV¶������/���src/Composer/Package/Version/VersionGuesser.phpÏ��A[¼]Ï��ÌÂ߶������.���src/Composer/Package/Version/VersionParser.php¥��A[¼]¥��ô´à¶������0���src/Composer/Package/Version/VersionSelector.phpK ��A[¼]K ��²<ȶ������-���src/Composer/Plugin/Capability/Capability.phpW���A[¼]W���æ_¨1¶������2���src/Composer/Plugin/Capability/CommandProvider.php—���A[¼]—���ûOâ>¶���������src/Composer/Plugin/Capable.php���A[¼]���Æq+¶������$���src/Composer/Plugin/CommandEvent.phpâ��A[¼]â��³ÆÇW¶������$���src/Composer/Plugin/PluginEvents.phpö���A[¼]ö���á1=z¶������'���src/Composer/Plugin/PluginInterface.phpô���A[¼]ô���)'*ض������%���src/Composer/Plugin/PluginManager.phpª$��A[¼]ª$��m‰ƒä¶������*���src/Composer/Plugin/PreCommandRunEvent.phpõ��A[¼]õ��:ðd¶������,���src/Composer/Plugin/PreFileDownloadEvent.php`��A[¼]`���9-ζ������4���src/Composer/Question/StrictConfirmationQuestion.php��A[¼]��'.³è¶������+���src/Composer/Repository/ArrayRepository.php��A[¼]��éÌt�¶������.���src/Composer/Repository/ArtifactRepository.phpí��A[¼]í��q9OS¶������*���src/Composer/Repository/BaseRepository.phpŠ��A[¼]Š��äÝ÷¶������.���src/Composer/Repository/ComposerRepository.php‡T��A[¼]‡T��Ž÷ƶ������/���src/Composer/Repository/CompositeRepository.php;��A[¼];��¤¯S¶������;���src/Composer/Repository/ConfigurableRepositoryInterface.php…���A[¼]…���±Ÿ_¶������0���src/Composer/Repository/FilesystemRepository.phpp��A[¼]p��#ù¶������4���src/Composer/Repository/InstalledArrayRepository.php£���A[¼]£���/ö~>¶������9���src/Composer/Repository/InstalledFilesystemRepository.php£���A[¼]£���V
  32. •_¶������8���src/Composer/Repository/InstalledRepositoryInterface.php‡���A[¼]‡���£9p¶������6���src/Composer/Repository/InvalidRepositoryException.phpn���A[¼]n���à“똶������-���src/Composer/Repository/PackageRepository.phpj��A[¼]j��¥ôò̶������*���src/Composer/Repository/PathRepository.phpõ ��A[¼]õ ��ì[r=¶������2���src/Composer/Repository/Pear/BaseChannelReader.phpI��A[¼]I��c6³¶������,���src/Composer/Repository/Pear/ChannelInfo.phpÄ��A[¼]Ä��:T*ɶ������.���src/Composer/Repository/Pear/ChannelReader.phpí��A[¼]í��?ÈYT¶������4���src/Composer/Repository/Pear/ChannelRest10Reader.php® ��A[¼]® ��™ÖÛú¶������4���src/Composer/Repository/Pear/ChannelRest11Reader.php& ��A[¼]& ��òUb¶������5���src/Composer/Repository/Pear/DependencyConstraint.phpq��A[¼]q��9=¶������/���src/Composer/Repository/Pear/DependencyInfo.phpq��A[¼]q��fºTò¶������8���src/Composer/Repository/Pear/PackageDependencyParser.php…��A[¼]…��÷$Li¶������,���src/Composer/Repository/Pear/PackageInfo.php°��A[¼]°��Ÿ ¸ ¶������,���src/Composer/Repository/Pear/ReleaseInfo.php’��A[¼]’��o“ŠÃ¶������*���src/Composer/Repository/PearRepository.phpª��A[¼]ª��)Ÿƒ}¶������.���src/Composer/Repository/PlatformRepository.phpå��A[¼]å��»G÷å¶������-���src/Composer/Repository/RepositoryFactory.php`��A[¼]`��K¾du¶������/���src/Composer/Repository/RepositoryInterface.phpÛ��A[¼]Û��’âÁ¶������-���src/Composer/Repository/RepositoryManager.php2
  33. ��A[¼]2
  34. ��á…5#¶������7���src/Composer/Repository/RepositorySecurityException.phpo���A[¼]o���pÕ«ª¶������/���src/Composer/Repository/Vcs/BitbucketDriver.php• ��A[¼]• ��$©Rç¶������,���src/Composer/Repository/Vcs/FossilDriver.php³��A[¼]³��ÐCk¶������2���src/Composer/Repository/Vcs/GitBitbucketDriver.phpë��A[¼]ë��œ´½X¶������)���src/Composer/Repository/Vcs/GitDriver.phpu��A[¼]u��}Ýs!¶������,���src/Composer/Repository/Vcs/GitHubDriver.php})��A[¼]})��ê¦x®¶������,���src/Composer/Repository/Vcs/GitLabDriver.php]%��A[¼]]%��sÇø ¶������1���src/Composer/Repository/Vcs/HgBitbucketDriver.phpå��A[¼]å��@)‰L¶������(���src/Composer/Repository/Vcs/HgDriver.phpB��A[¼]B��»ƒî¶������.���src/Composer/Repository/Vcs/PerforceDriver.phpù ��A[¼]ù ��&½tÙ¶������)���src/Composer/Repository/Vcs/SvnDriver.php¤��A[¼]¤�� ¶������)���src/Composer/Repository/Vcs/VcsDriver.phpæ
  35. ��A[¼]æ
  36. ��eׯ-¶������2���src/Composer/Repository/Vcs/VcsDriverInterface.php÷��A[¼]÷��ÇX[‰¶������)���src/Composer/Repository/VcsRepository.phpÙ*��A[¼]Ù*��~Á£f¶������1���src/Composer/Repository/VersionCacheInterface.php”���A[¼]”���A?Rï¶������3���src/Composer/Repository/WritableArrayRepository.php��A[¼]��¾G*¶������7���src/Composer/Repository/WritableRepositoryInterface.php‰��A[¼]‰��‘/sï¶������$���src/Composer/Script/CommandEvent.phpW���A[¼]W���£VZt¶���������src/Composer/Script/Event.phpº��A[¼]º��ò�»¤¶������$���src/Composer/Script/PackageEvent.phpœ���A[¼]œ���§ÿÉ ¶������$���src/Composer/Script/ScriptEvents.phpP��A[¼]P��‡�¶¶������ ���src/Composer/SelfUpdate/Keys.php���A[¼]��� îÊN¶������$���src/Composer/SelfUpdate/Versions.phpì��A[¼]ì��͵‘ƒ¶������ ���src/Composer/Util/AuthHelper.phpË��A[¼]Ë��>zx–¶���������src/Composer/Util/Bitbucket.php*��A[¼]*��,Lšk¶������$���src/Composer/Util/ComposerMirror.php±��A[¼]±��­½øض������%���src/Composer/Util/ConfigValidator.php÷��A[¼]÷��v•Í¶������"���src/Composer/Util/ErrorHandler.php»��A[¼]»��O›rk¶������ ���src/Composer/Util/Filesystem.phpr/��A[¼]r/��Ò^j¶���������src/Composer/Util/Git.phpí-��A[¼]í-��Pë.¶���������src/Composer/Util/GitHub.php| ��A[¼]| ��`0tü¶���������src/Composer/Util/GitLab.php¬ ��A[¼]¬ ��B3 ë¶���������src/Composer/Util/Hg.php¾��A[¼]¾��LÓ �¶���������src/Composer/Util/IniHelper.phph��A[¼]h��;FP¶������$���src/Composer/Util/NoProxyPattern.php¾��A[¼]¾��Z+°m¶������#���src/Composer/Util/PackageSorter.phpÞ��A[¼]Þ��ê×ìY¶���������src/Composer/Util/Perforce.php¸2��A[¼]¸2��Ás&}¶���������src/Composer/Util/Platform.phpü��A[¼]ü��s­fç¶������%���src/Composer/Util/ProcessExecutor.phpl ��A[¼]l ��m7_š¶������&���src/Composer/Util/RemoteFilesystem.phpøn��A[¼]øn��?›{¶���������src/Composer/Util/Silencer.phpé��A[¼]é��“Vjf¶������!���src/Composer/Util/SpdxLicense.php��A[¼]��¾7
  37. ñ¶������*���src/Composer/Util/StreamContextFactory.php��A[¼]��CÉ…ù¶���������src/Composer/Util/Svn.php,��A[¼],��Ì žÄ¶���������src/Composer/Util/TlsHelper.phpL
  38. ��A[¼]L
  39. ��" i¶���������src/Composer/Util/Url.php£��A[¼]£��3œÉܶ���������src/Composer/Util/Zip.php´��A[¼]´��°³¶¶���������src/Composer/XdebugHandler.phpð��A[¼]ð��zÓf~¶���������src/bootstrap.php¹��A[¼]¹��I}œ¶������%���src/Composer/Autoload/ClassLoader.php“4��A[¼]“4��²z�–¶������#���res/composer-repository-schema.jsonð��A[¼]ð���GÐà¶���������res/composer-schema.json˜��A[¼]˜��Öý ¶������6���vendor/composer/spdx-licenses/res/spdx-exceptions.json%
  40. ��A[¼]%
  41. ��ïBð¶������4���vendor/composer/spdx-licenses/res/spdx-licenses.jsonÓ˜��A[¼]Ó˜��Id¤÷¶������4���vendor/symfony/console/Resources/bin/hiddeninput.exe�$��A[¼]�$��•�¥v¶������&���vendor/symfony/console/Application.php=X��A[¼]=X��� S’¶������*���vendor/symfony/console/Command/Command.phpî"��A[¼]î"��x°jÕ¶������.���vendor/symfony/console/Command/HelpCommand.phpØ��A[¼]Ø��¦Ú-:¶������.���vendor/symfony/console/Command/ListCommand.phpZ��A[¼]Z��»w`¶������(���vendor/symfony/console/ConsoleEvents.phpé���A[¼]é���RÛÔe¶������<���vendor/symfony/console/Descriptor/ApplicationDescription.phpÐ��A[¼]Ð��™Ž5°¶������0���vendor/symfony/console/Descriptor/Descriptor.php���A[¼]���¿N•¶������9���vendor/symfony/console/Descriptor/DescriptorInterface.phpü���A[¼]ü���±Qµ¶������4���vendor/symfony/console/Descriptor/JsonDescriptor.phpÜ ��A[¼]Ü ��*û�ɶ������8���vendor/symfony/console/Descriptor/MarkdownDescriptor.php¶��A[¼]¶��·Ô;ݶ������4���vendor/symfony/console/Descriptor/TextDescriptor.php¼��A[¼]¼��òç$¶������3���vendor/symfony/console/Descriptor/XmlDescriptor.php��A[¼]��b{<¶������4���vendor/symfony/console/Event/ConsoleCommandEvent.php°��A[¼]°��!�ȶ������-���vendor/symfony/console/Event/ConsoleEvent.phpÅ��A[¼]Å��ÒxÛ\¶������6���vendor/symfony/console/Event/ConsoleExceptionEvent.php��A[¼]��á2é¶������6���vendor/symfony/console/Event/ConsoleTerminateEvent.phpz��A[¼]z��³,îL¶������=���vendor/symfony/console/Exception/CommandNotFoundException.phpÔ��A[¼]Ô��È÷ L¶������7���vendor/symfony/console/Exception/ExceptionInterface.phpf���A[¼]f���¡ABª¶������=���vendor/symfony/console/Exception/InvalidArgumentException.php¦���A[¼]¦���Ö̽Z¶������;���vendor/symfony/console/Exception/InvalidOptionException.php¦���A[¼]¦���Ë×H¶������3���vendor/symfony/console/Exception/LogicException.php’���A[¼]’���ÍO\e¶������5���vendor/symfony/console/Exception/RuntimeException.php–���A[¼]–���Ùí,6¶������4���vendor/symfony/console/Formatter/OutputFormatter.php6��A[¼]6��?=¨¶������=���vendor/symfony/console/Formatter/OutputFormatterInterface.phpŒ��A[¼]Œ��òññÀ¶������9���vendor/symfony/console/Formatter/OutputFormatterStyle.phpF��A[¼]F��𦴶������B���vendor/symfony/console/Formatter/OutputFormatterStyleInterface.php„��A[¼]„��÷½G¶������>���vendor/symfony/console/Formatter/OutputFormatterStyleStack.php@��A[¼]@��G¨ýU¶������6���vendor/symfony/console/Helper/DebugFormatterHelper.phpy��A[¼]y��Ì8Æж������2���vendor/symfony/console/Helper/DescriptorHelper.phpw��A[¼]w��|¦C¶������.���vendor/symfony/console/Helper/DialogHelper.php��A[¼]��¹ÜÃ_¶������1���vendor/symfony/console/Helper/FormatterHelper.phpd��A[¼]d��§×,¸¶������(���vendor/symfony/console/Helper/Helper.php«��A[¼]«��!�§—¶������1���vendor/symfony/console/Helper/HelperInterface.phpå���A[¼]å���Š ¶������+���vendor/symfony/console/Helper/HelperSet.phpÊ��A[¼]Ê��áÏW"¶������2���vendor/symfony/console/Helper/InputAwareHelper.phpc��A[¼]c��Ìøƒ¶������/���vendor/symfony/console/Helper/ProcessHelper.phpÓ ��A[¼]Ó ��©w‚R¶������-���vendor/symfony/console/Helper/ProgressBar.phpl%��A[¼]l%�� díÛ¶������0���vendor/symfony/console/Helper/ProgressHelper.php]��A[¼]]��ù»‰X¶������3���vendor/symfony/console/Helper/ProgressIndicator.phpN��A[¼]N��ÿ§³l¶������0���vendor/symfony/console/Helper/QuestionHelper.phpl��A[¼]l��Ntó¶������7���vendor/symfony/console/Helper/SymfonyQuestionHelper.php–
  42. ��A[¼]–
  43. ��- ض������'���vendor/symfony/console/Helper/Table.phpÄ*��A[¼]Ä*��¾™ØT¶������+���vendor/symfony/console/Helper/TableCell.php���A[¼]���åV^¶������-���vendor/symfony/console/Helper/TableHelper.php ��A[¼] ��›uô™¶������0���vendor/symfony/console/Helper/TableSeparator.phpÊ���A[¼]Ê���az¶������,���vendor/symfony/console/Helper/TableStyle.php
  44. ��A[¼]
  45. ��_ÍI"¶������*���vendor/symfony/console/Input/ArgvInput.php��A[¼]��×ö†›¶������+���vendor/symfony/console/Input/ArrayInput.php) ��A[¼]) ��¥ÑC¶������&���vendor/symfony/console/Input/Input.php£ ��A[¼]£ ��f¡?¶������.���vendor/symfony/console/Input/InputArgument.php��A[¼]��D £¶������4���vendor/symfony/console/Input/InputAwareInterface.php˜���A[¼]˜���­O°¶������0���vendor/symfony/console/Input/InputDefinition.php†��A[¼]†��¤U)¤¶������/���vendor/symfony/console/Input/InputInterface.php£��A[¼]£��ÆBŒ'¶������,���vendor/symfony/console/Input/InputOption.php ��A[¼] ��\¢Ü=¶������,���vendor/symfony/console/Input/StringInput.phpš��A[¼]š��žµ è¶���������vendor/symfony/console/LICENSE)��A[¼])��NUN½¶������/���vendor/symfony/console/Logger/ConsoleLogger.php0 ��A[¼]0 ��…� ¸¶������0���vendor/symfony/console/Output/BufferedOutput.php_��A[¼]_��‹ >P¶������/���vendor/symfony/console/Output/ConsoleOutput.php±��A[¼]±��nì!f¶������8���vendor/symfony/console/Output/ConsoleOutputInterface.phpà���A[¼]à���‡†Æʶ������,���vendor/symfony/console/Output/NullOutput.phpÏ��A[¼]Ï��®˜‹Z¶������(���vendor/symfony/console/Output/Output.php˜ ��A[¼]˜ ��0p¶������1���vendor/symfony/console/Output/OutputInterface.php��A[¼]���ì&¶������.���vendor/symfony/console/Output/StreamOutput.php���A[¼]���Ä’Oç¶������2���vendor/symfony/console/Question/ChoiceQuestion.phpx
  46. ��A[¼]x
  47. ��W€!¶������8���vendor/symfony/console/Question/ConfirmationQuestion.phpè��A[¼]è��/Ô�¶������,���vendor/symfony/console/Question/Question.phpÎ ��A[¼]Î ��lF¶������ ���vendor/symfony/console/Shell.phpæ��A[¼]æ��¼XÒA¶������,���vendor/symfony/console/Style/OutputStyle.php\��A[¼]\��wפ¶������/���vendor/symfony/console/Style/StyleInterface.phpÏ��A[¼]Ï��&nÅѶ������-���vendor/symfony/console/Style/SymfonyStyle.phpä��A[¼]ä��­å (¶������3���vendor/symfony/console/Tester/ApplicationTester.phpÏ��A[¼]Ï��sž9i¶������/���vendor/symfony/console/Tester/CommandTester.phpª��A[¼]ª��¬K z¶������(���vendor/symfony/debug/BufferingLogger.phpt��A[¼]t��=�hܶ���������vendor/symfony/debug/Debug.php,��A[¼],��Ë~Ž.¶������)���vendor/symfony/debug/DebugClassLoader.phpµ��A[¼]µ��1rEÓ¶������%���vendor/symfony/debug/ErrorHandler.phpH��A[¼]H��¹:D#¶������9���vendor/symfony/debug/Exception/ClassNotFoundException.php–��A[¼]–��i‰æô¶������8���vendor/symfony/debug/Exception/ContextErrorException.php˜��A[¼]˜��-
  48. d2¶������1���vendor/symfony/debug/Exception/DummyException.php��A[¼]��®+Ãê¶������6���vendor/symfony/debug/Exception/FatalErrorException.php��A[¼]��™Ä¶������6���vendor/symfony/debug/Exception/FatalThrowableError.phpW��A[¼]W��?àèK¶������3���vendor/symfony/debug/Exception/FlattenException.php¼��A[¼]¼�� ׶������7���vendor/symfony/debug/Exception/OutOfMemoryException.php~���A[¼]~���ë¨oâ¶������=���vendor/symfony/debug/Exception/UndefinedFunctionException.phpš��A[¼]š���ñJÀ¶������;���vendor/symfony/debug/Exception/UndefinedMethodException.php˜��A[¼]˜��nöêض������)���vendor/symfony/debug/ExceptionHandler.php)3��A[¼])3���h5=¶������I���vendor/symfony/debug/FatalErrorHandler/ClassNotFoundFatalErrorHandler.phpA��A[¼]A��Ϥ¹l¶������E���vendor/symfony/debug/FatalErrorHandler/FatalErrorHandlerInterface.php��A[¼]��ĹBV¶������M���vendor/symfony/debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.phpx��A[¼]x��~ò"¶������K���vendor/symfony/debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.phpO��A[¼]O���ž¦*¶���������vendor/symfony/debug/LICENSE)��A[¼])��NUN½¶������:���vendor/symfony/filesystem/Exception/ExceptionInterface.phpi���A[¼]i���$ ÿ›¶������=���vendor/symfony/filesystem/Exception/FileNotFoundException.php¼��A[¼]¼��pí\¶¶������3���vendor/symfony/filesystem/Exception/IOException.php‡��A[¼]‡��€ü#Ѷ������<���vendor/symfony/filesystem/Exception/IOExceptionInterface.php¦���A[¼]¦���jÙwM¶������(���vendor/symfony/filesystem/Filesystem.phpc4��A[¼]c4��‹×@þ¶������!���vendor/symfony/filesystem/LICENSE)��A[¼])��NUN½¶������)���vendor/symfony/filesystem/LockHandler.phpö��A[¼]ö��ŸZµ1¶������1���vendor/symfony/finder/Adapter/AbstractAdapter.php\ ��A[¼]\ ��hˆB¶������5���vendor/symfony/finder/Adapter/AbstractFindAdapter.php���A[¼]���HC€/¶������2���vendor/symfony/finder/Adapter/AdapterInterface.php›��A[¼]›��Mþ¶������0���vendor/symfony/finder/Adapter/BsdFindAdapter.php3��A[¼]3��75$·¶������0���vendor/symfony/finder/Adapter/GnuFindAdapter.php��A[¼]��Ÿ`]¶������,���vendor/symfony/finder/Adapter/PhpAdapter.phpô��A[¼]ô��Þdè;¶������/���vendor/symfony/finder/Comparator/Comparator.php���A[¼]���¾üœµ¶������3���vendor/symfony/finder/Comparator/DateComparator.php#��A[¼]#��°ζ������5���vendor/symfony/finder/Comparator/NumberComparator.php|��A[¼]|��ITÇͶ������9���vendor/symfony/finder/Exception/AccessDeniedException.php„���A[¼]„���½¾sœ¶������;���vendor/symfony/finder/Exception/AdapterFailureException.php¬��A[¼]¬��wR¶������6���vendor/symfony/finder/Exception/ExceptionInterface.php„���A[¼]„���Gz-¶������A���vendor/symfony/finder/Exception/OperationNotPermitedException.php)��A[¼])��x§e¶������@���vendor/symfony/finder/Exception/ShellCommandFailureException.phpº��A[¼]º��˜þ˜¶������/���vendor/symfony/finder/Expression/Expression.php��A[¼]��i¥:Ŷ������)���vendor/symfony/finder/Expression/Glob.phpf��A[¼]f��DÞcj¶������*���vendor/symfony/finder/Expression/Regex.php��A[¼]��ü(Ã϶������3���vendor/symfony/finder/Expression/ValueInterface.phpÍ��A[¼]Í��\p4†¶������ ���vendor/symfony/finder/Finder.phpc.��A[¼]c.��:ˆ5g¶���������vendor/symfony/finder/Glob.phpL��A[¼]L��jÍ9׶������7���vendor/symfony/finder/Iterator/CustomFilterIterator.php]��A[¼]]��ÎoÅƶ������:���vendor/symfony/finder/Iterator/DateRangeFilterIterator.phpx��A[¼]x��ôP¶������;���vendor/symfony/finder/Iterator/DepthRangeFilterIterator.phpî��A[¼]î��üÍ�q¶������A���vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.phpí��A[¼]í��nõH¶������4���vendor/symfony/finder/Iterator/FilePathsIterator.php#��A[¼]#��G?T½¶������9���vendor/symfony/finder/Iterator/FileTypeFilterIterator.phpZ��A[¼]Z��(&ø¶������<���vendor/symfony/finder/Iterator/FilecontentFilterIterator.php5��A[¼]5��ší¶������9���vendor/symfony/finder/Iterator/FilenameFilterIterator.phpr��A[¼]r��tu¶������1���vendor/symfony/finder/Iterator/FilterIterator.phpÃ��A[¼]Ã��š+µÞ¶������=���vendor/symfony/finder/Iterator/MultiplePcreFilterIterator.php-��A[¼]-��ºÎÒ_¶������5���vendor/symfony/finder/Iterator/PathFilterIterator.phpÐ��A[¼]Ð��‚c¶������=���vendor/symfony/finder/Iterator/RecursiveDirectoryIterator.php ��A[¼] ��ë]í»¶������:���vendor/symfony/finder/Iterator/SizeRangeFilterIterator.phpe��A[¼]e��Ÿ’áé¶������3���vendor/symfony/finder/Iterator/SortableIterator.php+��A[¼]+��õÝË ¶���������vendor/symfony/finder/LICENSE)��A[¼])��NUN½¶������'���vendor/symfony/finder/Shell/Command.php> ��A[¼]> ��_~u ¶������%���vendor/symfony/finder/Shell/Shell.phpr��A[¼]r��þpN¶������%���vendor/symfony/finder/SplFileInfo.php��A[¼]��þ�íù¶������'���vendor/symfony/polyfill-ctype/Ctype.phpH ��A[¼]H ��³�Õݶ������%���vendor/symfony/polyfill-ctype/LICENSE)��A[¼])��´`e0¶������+���vendor/symfony/polyfill-ctype/bootstrap.phpI��A[¼]I���D!e¶������(���vendor/symfony/polyfill-mbstring/LICENSE)��A[¼])��“\ª¶������-���vendor/symfony/polyfill-mbstring/Mbstring.phpõE��A[¼]õE��K"ܶ������@���vendor/symfony/polyfill-mbstring/Resources/unidata/lowerCase.php÷@��A[¼]÷@��õžØ¶������F���vendor/symfony/polyfill-mbstring/Resources/unidata/titleCaseRegexp.phpã��A[¼]ã��öy_•¶������@���vendor/symfony/polyfill-mbstring/Resources/unidata/upperCase.phpfA��A[¼]fA��Úf”߶������.���vendor/symfony/polyfill-mbstring/bootstrap.php‚��A[¼]‚��À‘ Š¶������7���vendor/symfony/process/Exception/ExceptionInterface.phpf���A[¼]f���]ö>T¶������=���vendor/symfony/process/Exception/InvalidArgumentException.php¨���A[¼]¨���ÐÀ+_¶������3���vendor/symfony/process/Exception/LogicException.php”���A[¼]”��� ³ãñ¶������;���vendor/symfony/process/Exception/ProcessFailedException.phpx��A[¼]x��¨Ìzy¶������=���vendor/symfony/process/Exception/ProcessTimedOutException.php��A[¼]��﫶������5���vendor/symfony/process/Exception/RuntimeException.php˜���A[¼]˜���¢Ø:¶������+���vendor/symfony/process/ExecutableFinder.php���A[¼]���ûus€¶���������vendor/symfony/process/LICENSE)��A[¼])��NUN½¶������.���vendor/symfony/process/PhpExecutableFinder.phpÏ��A[¼]Ï��Î%h¶������%���vendor/symfony/process/PhpProcess.phpü��A[¼]ü��‡jûü¶������.���vendor/symfony/process/Pipes/AbstractPipes.php½��A[¼]½��憶������/���vendor/symfony/process/Pipes/PipesInterface.phpD��A[¼]D��vØ������*���vendor/symfony/process/Pipes/UnixPipes.php>��A[¼]>��ª•ir¶������-���vendor/symfony/process/Pipes/WindowsPipes.phpp ��A[¼]p ��âU~ɶ������"���vendor/symfony/process/Process.php·R��A[¼]·R��Š`Õ¶������)���vendor/symfony/process/ProcessBuilder.phpâ
  49. ��A[¼]â
  50. ��†M¶¶������'���vendor/symfony/process/ProcessUtils.phpQ��A[¼]Q��b-$m¶���������vendor/seld/jsonlint/LICENSE"��A[¼]"��aƒsy¶������@���vendor/seld/jsonlint/src/Seld/JsonLint/DuplicateKeyException.php*��A[¼]*��•pñ¶������5���vendor/seld/jsonlint/src/Seld/JsonLint/JsonParser.php82��A[¼]82��ªÃZt¶������0���vendor/seld/jsonlint/src/Seld/JsonLint/Lexer.php��A[¼]��%ÿ3N¶������;���vendor/seld/jsonlint/src/Seld/JsonLint/ParsingException.php��A[¼]��‰²ñ¶������4���vendor/seld/jsonlint/src/Seld/JsonLint/Undefined.php>���A[¼]>���ÿqŸŸ¶������(���vendor/justinrainbow/json-schema/LICENSE ��A[¼] ��ºç©¶������.���vendor/justinrainbow/json-schema/demo/demo.phpñ��A[¼]ñ��fC¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/BaseConstraint.php¡ ��A[¼]¡ ��†wÌl¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/CollectionConstraint.php�
  51. ��A[¼]�
  52. ��ÍèÓ¯¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php§ ��A[¼]§ ��›Vض������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ConstraintInterface.php¼��A[¼]¼��ÿ Qœ¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/EnumConstraint.php]��A[¼]]��VŽU<¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Factory.phpã ��A[¼]ã ��á0;¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/FormatConstraint.php…��A[¼]…��“TœÚ¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/NumberConstraint.php‡ ��A[¼]‡ ��ï›(¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/ObjectConstraint.phpÃ��A[¼]Ã��©Å¼x¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/SchemaConstraint.php0 ��A[¼]0 ��×j´˜¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/StringConstraint.php��A[¼]��¥wš‡¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/LooseTypeCheck.phpa��A[¼]a�� qö������Y���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/StrictTypeCheck.php—��A[¼]—��4~¾ ¶������\���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeCheck/TypeCheckInterface.php‰��A[¼]‰��“µ+j¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/TypeConstraint.php&��A[¼]&��4˜©T¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/UndefinedConstraint.phpa"��A[¼]a"���MÙë¶������F���vendor/justinrainbow/json-schema/src/JsonSchema/Entity/JsonPointer.phpè��A[¼]è��{N–¶������P���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ExceptionInterface.phpI���A[¼]I���%|°¶������V���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidArgumentException.php•���A[¼]•���‹àG¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidConfigException.phpl���A[¼]l���A!L׶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaException.phpl���A[¼]l���è2÷þ¶������]���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSchemaMediaTypeException.phpu���A[¼]u���=hç¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/InvalidSourceUriException.phpw���A[¼]w���N-ò[¶������S���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/JsonDecodingException.phpÞ��A[¼]Þ��\¸
  53. ¶������W���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ResourceNotFoundException.phpo���A[¼]o���píÛù¶������N���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/RuntimeException.php…���A[¼]…���%…—¶������^���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UnresolvableJsonPointerException.php€���A[¼]€���u-#1¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/UriResolverException.phpj���A[¼]j���å>�¶������Q���vendor/justinrainbow/json-schema/src/JsonSchema/Exception/ValidationException.phpf���A[¼]f���¬¤„þ¶������K���vendor/justinrainbow/json-schema/src/JsonSchema/Iterator/ObjectIterator.phpþ��A[¼]þ��M�„õ¶������;���vendor/justinrainbow/json-schema/src/JsonSchema/Rfc3339.php ��A[¼] ��f4÷³¶������A���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorage.phpœ ��A[¼]œ ��åfO¶������J���vendor/justinrainbow/json-schema/src/JsonSchema/SchemaStorageInterface.php��A[¼]��oŠ+}¶������T���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/AbstractRetriever.phpá���A[¼]á���[þA�¶������G���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/Curl.php¥��A[¼]¥��Ô§Lb¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/FileGetContents.php%��A[¼]%��5" ¶������R���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/PredefinedArray.php,��A[¼],��1•5þ¶������X���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/Retrievers/UriRetrieverInterface.php®���A[¼]®���ÿ‹Áå¶������C���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriResolver.php ��A[¼] ��£Ÿ)à¶������D���vendor/justinrainbow/json-schema/src/JsonSchema/Uri/UriRetriever.phpF��A[¼]F��¨IaD¶������H���vendor/justinrainbow/json-schema/src/JsonSchema/UriResolverInterface.phpƒ���A[¼]ƒ���J€¶������I���vendor/justinrainbow/json-schema/src/JsonSchema/UriRetrieverInterface.php…���A[¼]…���íæe¶������=���vendor/justinrainbow/json-schema/src/JsonSchema/Validator.phpv��A[¼]v��õÍg¶������%���vendor/composer/spdx-licenses/LICENSE��A[¼]��Bhí¶������2���vendor/composer/spdx-licenses/src/SpdxLicenses.phpH��A[¼]H��͉T¶���������vendor/composer/semver/LICENSE��A[¼]��Bhí¶������)���vendor/composer/semver/src/Comparator.php��A[¼]��wlƒï¶������<���vendor/composer/semver/src/Constraint/AbstractConstraint.phpî��A[¼]î��Õ­w-¶������4���vendor/composer/semver/src/Constraint/Constraint.phpª ��A[¼]ª ��ÇO7²¶������=���vendor/composer/semver/src/Constraint/ConstraintInterface.phpß���A[¼]ß���0C,‡¶������9���vendor/composer/semver/src/Constraint/EmptyConstraint.phpé��A[¼]é��!-Ø™¶������9���vendor/composer/semver/src/Constraint/MultiConstraint.php1��A[¼]1��í xU¶������%���vendor/composer/semver/src/Semver.phpv��A[¼]v��‹×È›¶������,���vendor/composer/semver/src/VersionParser.php¯*��A[¼]¯*��ZÒ“¶������!���vendor/composer/ca-bundle/LICENSE��A[¼]��*!^`¶������*���vendor/composer/ca-bundle/src/CaBundle.php±��A[¼]±��à “¶������&���vendor/composer/xdebug-handler/LICENSE)��A[¼])��#Ô;^¶������0���vendor/composer/xdebug-handler/src/PhpConfig.php´��A[¼]´��*D’�¶������.���vendor/composer/xdebug-handler/src/Process.php ��A[¼] ��`çîȶ������-���vendor/composer/xdebug-handler/src/Status.php
  54. ��A[¼]
  55. ��²‚²¶������4���vendor/composer/xdebug-handler/src/XdebugHandler.php!��A[¼]!��2|¿C¶���������vendor/psr/log/LICENSE=��A[¼]=��p±ŽO¶������)���vendor/psr/log/Psr/Log/AbstractLogger.php;��A[¼];��ñ>3[¶������3���vendor/psr/log/Psr/Log/InvalidArgumentException.php`���A[¼]`��� ˆX1¶������#���vendor/psr/log/Psr/Log/LogLevel.phpû���A[¼]û���jðñ8¶������/���vendor/psr/log/Psr/Log/LoggerAwareInterface.php|���A[¼]|���$£ˆ¶������+���vendor/psr/log/Psr/Log/LoggerAwareTrait.php§���A[¼]§���T½úB¶������*���vendor/psr/log/Psr/Log/LoggerInterface.phpÈ��A[¼]È��šx¶������&���vendor/psr/log/Psr/Log/LoggerTrait.phpk��A[¼]k��£}‰’¶������%���vendor/psr/log/Psr/Log/NullLogger.php ���A[¼] ���ÆDi¯¶������3���vendor/psr/log/Psr/Log/Test/LoggerInterfaceTest.phpj ��A[¼]j ��Nÿt¶������*���vendor/psr/log/Psr/Log/Test/TestLogger.php<��A[¼]<��þ(åI¶���������vendor/autoload.php‚���A[¼]‚���Ä-ë%¶������'���vendor/composer/autoload_namespaces.phpd���A[¼]d���Z¡¦H¶������!���vendor/composer/autoload_psr4.php÷��A[¼]÷��Å*š¶������%���vendor/composer/autoload_classmap.phpd���A[¼]d���Z¡¦H¶������"���vendor/composer/autoload_files.php��A[¼]��¥� ®¶������!���vendor/composer/autoload_real.phpI��A[¼]I��È)üƒ¶������#���vendor/composer/autoload_static.php§
  56. ��A[¼]§
  57. ��q–Ù¶���������vendor/composer/ClassLoader.php¨��A[¼]¨��xää`¶������(���vendor/composer/ca-bundle/res/cacert.pemUk�A[¼]Uk�”J̸¶������ ���bin/composerÊ��A[¼]Ê��ÿêP¶���������LICENSE.��A[¼].�� Õ¶������<?php
  58. namespace Composer\Autoload;
  59. use Composer\Config;
  60. use Composer\EventDispatcher\EventDispatcher;
  61. use Composer\Installer\InstallationManager;
  62. use Composer\IO\IOInterface;
  63. use Composer\Package\AliasPackage;
  64. use Composer\Package\PackageInterface;
  65. use Composer\Repository\InstalledRepositoryInterface;
  66. use Composer\Util\Filesystem;
  67. use Composer\Script\ScriptEvents;
  68. use Composer\Util\PackageSorter;
  69. class AutoloadGenerator
  70. {
  71. private $eventDispatcher;
  72. private $io;
  73. private $devMode = false;
  74. private $classMapAuthoritative = false;
  75. private $apcu = false;
  76. private $runScripts = false;
  77. public function __construct(EventDispatcher $eventDispatcher, IOInterface $io = null)
  78. {
  79. $this->eventDispatcher = $eventDispatcher;
  80. $this->io = $io;
  81. }
  82. public function setDevMode($devMode = true)
  83. {
  84. $this->devMode = (bool) $devMode;
  85. }
  86. public function setClassMapAuthoritative($classMapAuthoritative)
  87. {
  88. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  89. }
  90. public function setApcu($apcu)
  91. {
  92. $this->apcu = (bool) $apcu;
  93. }
  94. public function setRunScripts($runScripts = true)
  95. {
  96. $this->runScripts = (bool) $runScripts;
  97. }
  98. public function dump(Config $config, InstalledRepositoryInterface $localRepo, PackageInterface $mainPackage, InstallationManager $installationManager, $targetDir, $scanPsr0Packages = false, $suffix = '')
  99. {
  100. if ($this->classMapAuthoritative) {
  101. $scanPsr0Packages = true;
  102. }
  103. if ($this->runScripts) {
  104. $this->eventDispatcher->dispatchScript(ScriptEvents::PRE_AUTOLOAD_DUMP, $this->devMode, array(), array(
  105. 'optimize' => (bool) $scanPsr0Packages,
  106. ));
  107. }
  108. $filesystem = new Filesystem();
  109. $filesystem->ensureDirectoryExists($config->get('vendor-dir'));
  110. $basePath = $filesystem->normalizePath(realpath(realpath(getcwd())));
  111. $vendorPath = $filesystem->normalizePath(realpath(realpath($config->get('vendor-dir'))));
  112. $useGlobalIncludePath = (bool) $config->get('use-include-path');
  113. $prependAutoloader = $config->get('prepend-autoloader') === false ? 'false' : 'true';
  114. $targetDir = $vendorPath.'/'.$targetDir;
  115. $filesystem->ensureDirectoryExists($targetDir);
  116. $vendorPathCode = $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true);
  117. $vendorPathCode52 = str_replace('__DIR__', 'dirname(__FILE__)', $vendorPathCode);
  118. $vendorPathToTargetDirCode = $filesystem->findShortestPathCode($vendorPath, realpath($targetDir), true);
  119. $appBaseDirCode = $filesystem->findShortestPathCode($vendorPath, $basePath, true);
  120. $appBaseDirCode = str_replace('__DIR__', '$vendorDir', $appBaseDirCode);
  121. $namespacesFile = <<<EOF
  122. <?php
  123. // autoload_namespaces.php @generated by Composer
  124. \$vendorDir = $vendorPathCode52;
  125. \$baseDir = $appBaseDirCode;
  126. return array(
  127. EOF;
  128. $psr4File = <<<EOF
  129. <?php
  130. // autoload_psr4.php @generated by Composer
  131. \$vendorDir = $vendorPathCode52;
  132. \$baseDir = $appBaseDirCode;
  133. return array(
  134. EOF;
  135. $packageMap = $this->buildPackageMap($installationManager, $mainPackage, $localRepo->getCanonicalPackages());
  136. $autoloads = $this->parseAutoloads($packageMap, $mainPackage, $this->devMode === false);
  137. foreach ($autoloads['psr-0'] as $namespace => $paths) {
  138. $exportedPaths = array();
  139. foreach ($paths as $path) {
  140. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  141. }
  142. $exportedPrefix = var_export($namespace, true);
  143. $namespacesFile .= " $exportedPrefix => ";
  144. $namespacesFile .= "array(".implode(', ', $exportedPaths)."),\n";
  145. }
  146. $namespacesFile .= ");\n";
  147. foreach ($autoloads['psr-4'] as $namespace => $paths) {
  148. $exportedPaths = array();
  149. foreach ($paths as $path) {
  150. $exportedPaths[] = $this->getPathCode($filesystem, $basePath, $vendorPath, $path);
  151. }
  152. $exportedPrefix = var_export($namespace, true);
  153. $psr4File .= " $exportedPrefix => ";
  154. $psr4File .= "array(".implode(', ', $exportedPaths)."),\n";
  155. }
  156. $psr4File .= ");\n";
  157. $classmapFile = <<<EOF
  158. <?php
  159. // autoload_classmap.php @generated by Composer
  160. \$vendorDir = $vendorPathCode52;
  161. \$baseDir = $appBaseDirCode;
  162. return array(
  163. EOF;
  164. $targetDirLoader = null;
  165. $mainAutoload = $mainPackage->getAutoload();
  166. if ($mainPackage->getTargetDir() && !empty($mainAutoload['psr-0'])) {
  167. $levels = substr_count($filesystem->normalizePath($mainPackage->getTargetDir()), '/') + 1;
  168. $prefixes = implode(', ', array_map(function ($prefix) {
  169. return var_export($prefix, true);
  170. }, array_keys($mainAutoload['psr-0'])));
  171. $baseDirFromTargetDirCode = $filesystem->findShortestPathCode($targetDir, $basePath, true);
  172. $targetDirLoader = <<<EOF
  173. public static function autoload(\$class)
  174. {
  175. \$dir = $baseDirFromTargetDirCode . '/';
  176. \$prefixes = array($prefixes);
  177. foreach (\$prefixes as \$prefix) {
  178. if (0 !== strpos(\$class, \$prefix)) {
  179. continue;
  180. }
  181. \$path = \$dir . implode('/', array_slice(explode('\\\\', \$class), $levels)).'.php';
  182. if (!\$path = stream_resolve_include_path(\$path)) {
  183. return false;
  184. }
  185. require \$path;
  186. return true;
  187. }
  188. }
  189. EOF;
  190. }
  191. $blacklist = null;
  192. if (!empty($autoloads['exclude-from-classmap'])) {
  193. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  194. }
  195. $classMap = array();
  196. if ($scanPsr0Packages) {
  197. $namespacesToScan = array();
  198. foreach (array('psr-0', 'psr-4') as $psrType) {
  199. foreach ($autoloads[$psrType] as $namespace => $paths) {
  200. $namespacesToScan[$namespace][] = array('paths' => $paths, 'type' => $psrType);
  201. }
  202. }
  203. krsort($namespacesToScan);
  204. foreach ($namespacesToScan as $namespace => $groups) {
  205. foreach ($groups as $group) {
  206. foreach ($group['paths'] as $dir) {
  207. $dir = $filesystem->normalizePath($filesystem->isAbsolutePath($dir) ? $dir : $basePath.'/'.$dir);
  208. if (!is_dir($dir)) {
  209. continue;
  210. }
  211. $namespaceFilter = $namespace === '' ? null : $namespace;
  212. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, $namespaceFilter, $classMap);
  213. }
  214. }
  215. }
  216. }
  217. foreach ($autoloads['classmap'] as $dir) {
  218. $classMap = $this->addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist, null, $classMap);
  219. }
  220. ksort($classMap);
  221. foreach ($classMap as $class => $code) {
  222. $classmapFile .= ' '.var_export($class, true).' => '.$code;
  223. }
  224. $classmapFile .= ");\n";
  225. if (!$suffix) {
  226. if (!$config->get('autoloader-suffix') && is_readable($vendorPath.'/autoload.php')) {
  227. $content = file_get_contents($vendorPath.'/autoload.php');
  228. if (preg_match('{ComposerAutoloaderInit([^:\s]+)::}', $content, $match)) {
  229. $suffix = $match[1];
  230. }
  231. }
  232. if (!$suffix) {
  233. $suffix = $config->get('autoloader-suffix') ?: md5(uniqid('', true));
  234. }
  235. }
  236. file_put_contents($targetDir.'/autoload_namespaces.php', $namespacesFile);
  237. file_put_contents($targetDir.'/autoload_psr4.php', $psr4File);
  238. file_put_contents($targetDir.'/autoload_classmap.php', $classmapFile);
  239. $includePathFilePath = $targetDir.'/include_paths.php';
  240. if ($includePathFileContents = $this->getIncludePathsFile($packageMap, $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  241. file_put_contents($includePathFilePath, $includePathFileContents);
  242. } elseif (file_exists($includePathFilePath)) {
  243. unlink($includePathFilePath);
  244. }
  245. $includeFilesFilePath = $targetDir.'/autoload_files.php';
  246. if ($includeFilesFileContents = $this->getIncludeFilesFile($autoloads['files'], $filesystem, $basePath, $vendorPath, $vendorPathCode52, $appBaseDirCode)) {
  247. file_put_contents($includeFilesFilePath, $includeFilesFileContents);
  248. } elseif (file_exists($includeFilesFilePath)) {
  249. unlink($includeFilesFilePath);
  250. }
  251. file_put_contents($targetDir.'/autoload_static.php', $this->getStaticFile($suffix, $targetDir, $vendorPath, $basePath, $staticPhpVersion));
  252. file_put_contents($vendorPath.'/autoload.php', $this->getAutoloadFile($vendorPathToTargetDirCode, $suffix));
  253. file_put_contents($targetDir.'/autoload_real.php', $this->getAutoloadRealFile(true, (bool) $includePathFileContents, $targetDirLoader, (bool) $includeFilesFileContents, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion));
  254. $this->safeCopy(__DIR__.'/ClassLoader.php', $targetDir.'/ClassLoader.php');
  255. $this->safeCopy(__DIR__.'/../../../LICENSE', $targetDir.'/LICENSE');
  256. if ($this->runScripts) {
  257. $this->eventDispatcher->dispatchScript(ScriptEvents::POST_AUTOLOAD_DUMP, $this->devMode, array(), array(
  258. 'optimize' => (bool) $scanPsr0Packages,
  259. ));
  260. }
  261. return count($classMap);
  262. }
  263. private function addClassMapCode($filesystem, $basePath, $vendorPath, $dir, $blacklist = null, $namespaceFilter = null, array $classMap = array())
  264. {
  265. foreach ($this->generateClassMap($dir, $blacklist, $namespaceFilter) as $class => $path) {
  266. $pathCode = $this->getPathCode($filesystem, $basePath, $vendorPath, $path).",\n";
  267. if (!isset($classMap[$class])) {
  268. $classMap[$class] = $pathCode;
  269. } elseif ($this->io && $classMap[$class] !== $pathCode && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($classMap[$class].' '.$path, '\\', '/'))) {
  270. $this->io->writeError(
  271. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  272. ' was found in both "'.str_replace(array('$vendorDir . \'', "',\n"), array($vendorPath, ''), $classMap[$class]).'" and "'.$path.'", the first will be used.</warning>'
  273. );
  274. }
  275. }
  276. return $classMap;
  277. }
  278. private function generateClassMap($dir, $blacklist = null, $namespaceFilter = null, $showAmbiguousWarning = true)
  279. {
  280. return ClassMapGenerator::createMap($dir, $blacklist, $showAmbiguousWarning ? $this->io : null, $namespaceFilter);
  281. }
  282. public function buildPackageMap(InstallationManager $installationManager, PackageInterface $mainPackage, array $packages)
  283. {
  284. $packageMap = array(array($mainPackage, ''));
  285. foreach ($packages as $package) {
  286. if ($package instanceof AliasPackage) {
  287. continue;
  288. }
  289. $this->validatePackage($package);
  290. $packageMap[] = array(
  291. $package,
  292. $installationManager->getInstallPath($package),
  293. );
  294. }
  295. return $packageMap;
  296. }
  297. protected function validatePackage(PackageInterface $package)
  298. {
  299. $autoload = $package->getAutoload();
  300. if (!empty($autoload['psr-4']) && null !== $package->getTargetDir()) {
  301. $name = $package->getName();
  302. $package->getTargetDir();
  303. throw new \InvalidArgumentException("PSR-4 autoloading is incompatible with the target-dir property, remove the target-dir in package '$name'.");
  304. }
  305. if (!empty($autoload['psr-4'])) {
  306. foreach ($autoload['psr-4'] as $namespace => $dirs) {
  307. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  308. throw new \InvalidArgumentException("psr-4 namespaces must end with a namespace separator, '$namespace' does not, use '$namespace\\'.");
  309. }
  310. }
  311. }
  312. }
  313. public function parseAutoloads(array $packageMap, PackageInterface $mainPackage, $filterOutRequireDevPackages = false)
  314. {
  315. $mainPackageMap = array_shift($packageMap);
  316. if ($filterOutRequireDevPackages) {
  317. $packageMap = $this->filterPackageMap($packageMap, $mainPackage);
  318. }
  319. $sortedPackageMap = $this->sortPackageMap($packageMap);
  320. $sortedPackageMap[] = $mainPackageMap;
  321. array_unshift($packageMap, $mainPackageMap);
  322. $psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $mainPackage);
  323. $psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $mainPackage);
  324. $classmap = $this->parseAutoloadsType(array_reverse($sortedPackageMap), 'classmap', $mainPackage);
  325. $files = $this->parseAutoloadsType($sortedPackageMap, 'files', $mainPackage);
  326. $exclude = $this->parseAutoloadsType($sortedPackageMap, 'exclude-from-classmap', $mainPackage);
  327. krsort($psr0);
  328. krsort($psr4);
  329. return array(
  330. 'psr-0' => $psr0,
  331. 'psr-4' => $psr4,
  332. 'classmap' => $classmap,
  333. 'files' => $files,
  334. 'exclude-from-classmap' => $exclude,
  335. );
  336. }
  337. public function createLoader(array $autoloads)
  338. {
  339. $loader = new ClassLoader();
  340. if (isset($autoloads['psr-0'])) {
  341. foreach ($autoloads['psr-0'] as $namespace => $path) {
  342. $loader->add($namespace, $path);
  343. }
  344. }
  345. if (isset($autoloads['psr-4'])) {
  346. foreach ($autoloads['psr-4'] as $namespace => $path) {
  347. $loader->addPsr4($namespace, $path);
  348. }
  349. }
  350. if (isset($autoloads['classmap'])) {
  351. $blacklist = null;
  352. if (!empty($autoloads['exclude-from-classmap'])) {
  353. $blacklist = '{(' . implode('|', $autoloads['exclude-from-classmap']) . ')}';
  354. }
  355. foreach ($autoloads['classmap'] as $dir) {
  356. try {
  357. $loader->addClassMap($this->generateClassMap($dir, $blacklist, null, false));
  358. } catch (\RuntimeException $e) {
  359. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  360. }
  361. }
  362. }
  363. return $loader;
  364. }
  365. protected function getIncludePathsFile(array $packageMap, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  366. {
  367. $includePaths = array();
  368. foreach ($packageMap as $item) {
  369. list($package, $installPath) = $item;
  370. if (null !== $package->getTargetDir() && strlen($package->getTargetDir()) > 0) {
  371. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  372. }
  373. foreach ($package->getIncludePaths() as $includePath) {
  374. $includePath = trim($includePath, '/');
  375. $includePaths[] = empty($installPath) ? $includePath : $installPath.'/'.$includePath;
  376. }
  377. }
  378. if (!$includePaths) {
  379. return;
  380. }
  381. $includePathsCode = '';
  382. foreach ($includePaths as $path) {
  383. $includePathsCode .= " " . $this->getPathCode($filesystem, $basePath, $vendorPath, $path) . ",\n";
  384. }
  385. return <<<EOF
  386. <?php
  387. // include_paths.php @generated by Composer
  388. \$vendorDir = $vendorPathCode;
  389. \$baseDir = $appBaseDirCode;
  390. return array(
  391. $includePathsCode);
  392. EOF;
  393. }
  394. protected function getIncludeFilesFile(array $files, Filesystem $filesystem, $basePath, $vendorPath, $vendorPathCode, $appBaseDirCode)
  395. {
  396. $filesCode = '';
  397. foreach ($files as $fileIdentifier => $functionFile) {
  398. $filesCode .= ' ' . var_export($fileIdentifier, true) . ' => '
  399. . $this->getPathCode($filesystem, $basePath, $vendorPath, $functionFile) . ",\n";
  400. }
  401. if (!$filesCode) {
  402. return false;
  403. }
  404. return <<<EOF
  405. <?php
  406. // autoload_files.php @generated by Composer
  407. \$vendorDir = $vendorPathCode;
  408. \$baseDir = $appBaseDirCode;
  409. return array(
  410. $filesCode);
  411. EOF;
  412. }
  413. protected function getPathCode(Filesystem $filesystem, $basePath, $vendorPath, $path)
  414. {
  415. if (!$filesystem->isAbsolutePath($path)) {
  416. $path = $basePath . '/' . $path;
  417. }
  418. $path = $filesystem->normalizePath($path);
  419. $baseDir = '';
  420. if (strpos($path.'/', $vendorPath.'/') === 0) {
  421. $path = substr($path, strlen($vendorPath));
  422. $baseDir = '$vendorDir';
  423. if ($path !== false) {
  424. $baseDir .= " . ";
  425. }
  426. } else {
  427. $path = $filesystem->normalizePath($filesystem->findShortestPath($basePath, $path, true));
  428. if (!$filesystem->isAbsolutePath($path)) {
  429. $baseDir = '$baseDir . ';
  430. $path = '/' . $path;
  431. }
  432. }
  433. if (strpos($path, '.phar') !== false) {
  434. $baseDir = "'phar://' . " . $baseDir;
  435. }
  436. return $baseDir . (($path !== false) ? var_export($path, true) : "");
  437. }
  438. protected function getAutoloadFile($vendorPathToTargetDirCode, $suffix)
  439. {
  440. $lastChar = $vendorPathToTargetDirCode[strlen($vendorPathToTargetDirCode) - 1];
  441. if ("'" === $lastChar || '"' === $lastChar) {
  442. $vendorPathToTargetDirCode = substr($vendorPathToTargetDirCode, 0, -1).'/autoload_real.php'.$lastChar;
  443. } else {
  444. $vendorPathToTargetDirCode .= " . '/autoload_real.php'";
  445. }
  446. return <<<AUTOLOAD
  447. <?php
  448. // autoload.php @generated by Composer
  449. require_once $vendorPathToTargetDirCode;
  450. return ComposerAutoloaderInit$suffix::getLoader();
  451. AUTOLOAD;
  452. }
  453. protected function getAutoloadRealFile($useClassMap, $useIncludePath, $targetDirLoader, $useIncludeFiles, $vendorPathCode, $appBaseDirCode, $suffix, $useGlobalIncludePath, $prependAutoloader, $staticPhpVersion = 70000)
  454. {
  455. $file = <<<HEADER
  456. <?php
  457. // autoload_real.php @generated by Composer
  458. class ComposerAutoloaderInit$suffix
  459. {
  460. private static \$loader;
  461. public static function loadClassLoader(\$class)
  462. {
  463. if ('Composer\\Autoload\\ClassLoader' === \$class) {
  464. require __DIR__ . '/ClassLoader.php';
  465. }
  466. }
  467. public static function getLoader()
  468. {
  469. if (null !== self::\$loader) {
  470. return self::\$loader;
  471. }
  472. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'), true, $prependAutoloader);
  473. self::\$loader = \$loader = new \\Composer\\Autoload\\ClassLoader();
  474. spl_autoload_unregister(array('ComposerAutoloaderInit$suffix', 'loadClassLoader'));
  475. HEADER;
  476. if ($useIncludePath) {
  477. $file .= <<<'INCLUDE_PATH'
  478. $includePaths = require __DIR__ . '/include_paths.php';
  479. $includePaths[] = get_include_path();
  480. set_include_path(implode(PATH_SEPARATOR, $includePaths));
  481. INCLUDE_PATH;
  482. }
  483. $file .= <<<STATIC_INIT
  484. \$useStaticLoader = PHP_VERSION_ID >= $staticPhpVersion && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  485. if (\$useStaticLoader) {
  486. require_once __DIR__ . '/autoload_static.php';
  487. call_user_func(\Composer\Autoload\ComposerStaticInit$suffix::getInitializer(\$loader));
  488. } else {
  489. STATIC_INIT;
  490. if (!$this->classMapAuthoritative) {
  491. $file .= <<<'PSR04'
  492. $map = require __DIR__ . '/autoload_namespaces.php';
  493. foreach ($map as $namespace => $path) {
  494. $loader->set($namespace, $path);
  495. }
  496. $map = require __DIR__ . '/autoload_psr4.php';
  497. foreach ($map as $namespace => $path) {
  498. $loader->setPsr4($namespace, $path);
  499. }
  500. PSR04;
  501. }
  502. if ($useClassMap) {
  503. $file .= <<<'CLASSMAP'
  504. $classMap = require __DIR__ . '/autoload_classmap.php';
  505. if ($classMap) {
  506. $loader->addClassMap($classMap);
  507. }
  508. CLASSMAP;
  509. }
  510. $file .= " }\n\n";
  511. if ($this->classMapAuthoritative) {
  512. $file .= <<<'CLASSMAPAUTHORITATIVE'
  513. $loader->setClassMapAuthoritative(true);
  514. CLASSMAPAUTHORITATIVE;
  515. }
  516. if ($this->apcu) {
  517. $apcuPrefix = substr(base64_encode(md5(uniqid('', true), true)), 0, -3);
  518. $file .= <<<APCU
  519. \$loader->setApcuPrefix('$apcuPrefix');
  520. APCU;
  521. }
  522. if ($useGlobalIncludePath) {
  523. $file .= <<<'INCLUDEPATH'
  524. $loader->setUseIncludePath(true);
  525. INCLUDEPATH;
  526. }
  527. if ($targetDirLoader) {
  528. $file .= <<<REGISTER_TARGET_DIR_AUTOLOAD
  529. spl_autoload_register(array('ComposerAutoloaderInit$suffix', 'autoload'), true, true);
  530. REGISTER_TARGET_DIR_AUTOLOAD;
  531. }
  532. $file .= <<<REGISTER_LOADER
  533. \$loader->register($prependAutoloader);
  534. REGISTER_LOADER;
  535. if ($useIncludeFiles) {
  536. $file .= <<<INCLUDE_FILES
  537. if (\$useStaticLoader) {
  538. \$includeFiles = Composer\Autoload\ComposerStaticInit$suffix::\$files;
  539. } else {
  540. \$includeFiles = require __DIR__ . '/autoload_files.php';
  541. }
  542. foreach (\$includeFiles as \$fileIdentifier => \$file) {
  543. composerRequire$suffix(\$fileIdentifier, \$file);
  544. }
  545. INCLUDE_FILES;
  546. }
  547. $file .= <<<METHOD_FOOTER
  548. return \$loader;
  549. }
  550. METHOD_FOOTER;
  551. $file .= $targetDirLoader;
  552. if ($useIncludeFiles) {
  553. return $file . <<<FOOTER
  554. }
  555. function composerRequire$suffix(\$fileIdentifier, \$file)
  556. {
  557. if (empty(\$GLOBALS['__composer_autoload_files'][\$fileIdentifier])) {
  558. require \$file;
  559. \$GLOBALS['__composer_autoload_files'][\$fileIdentifier] = true;
  560. }
  561. }
  562. FOOTER;
  563. }
  564. return $file . <<<FOOTER
  565. }
  566. FOOTER;
  567. }
  568. protected function getStaticFile($suffix, $targetDir, $vendorPath, $basePath, &$staticPhpVersion)
  569. {
  570. $staticPhpVersion = 50600;
  571. $file = <<<HEADER
  572. <?php
  573. // autoload_static.php @generated by Composer
  574. namespace Composer\Autoload;
  575. class ComposerStaticInit$suffix
  576. {
  577. HEADER;
  578. $loader = new ClassLoader();
  579. $map = require $targetDir . '/autoload_namespaces.php';
  580. foreach ($map as $namespace => $path) {
  581. $loader->set($namespace, $path);
  582. }
  583. $map = require $targetDir . '/autoload_psr4.php';
  584. foreach ($map as $namespace => $path) {
  585. $loader->setPsr4($namespace, $path);
  586. }
  587. $classMap = require $targetDir . '/autoload_classmap.php';
  588. if ($classMap) {
  589. $loader->addClassMap($classMap);
  590. }
  591. $filesystem = new Filesystem();
  592. $vendorPathCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  593. $vendorPharPathCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $vendorPath, true, true) . " . '/";
  594. $appBaseDirCode = ' => ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  595. $appBaseDirPharCode = ' => \'phar://\' . ' . $filesystem->findShortestPathCode(realpath($targetDir), $basePath, true, true) . " . '/";
  596. $absoluteVendorPathCode = ' => ' . substr(var_export(rtrim($vendorDir, '\\/') . '/', true), 0, -1);
  597. $absoluteVendorPharPathCode = ' => ' . substr(var_export(rtrim('phar://' . $vendorDir, '\\/') . '/', true), 0, -1);
  598. $absoluteAppBaseDirCode = ' => ' . substr(var_export(rtrim($baseDir, '\\/') . '/', true), 0, -1);
  599. $absoluteAppBaseDirPharCode = ' => ' . substr(var_export(rtrim('phar://' . $baseDir, '\\/') . '/', true), 0, -1);
  600. $initializer = '';
  601. $prefix = "\0Composer\Autoload\ClassLoader\0";
  602. $prefixLen = strlen($prefix);
  603. if (file_exists($targetDir . '/autoload_files.php')) {
  604. $maps = array('files' => require $targetDir . '/autoload_files.php');
  605. } else {
  606. $maps = array();
  607. }
  608. foreach ((array) $loader as $prop => $value) {
  609. if ($value && 0 === strpos($prop, $prefix)) {
  610. $maps[substr($prop, $prefixLen)] = $value;
  611. }
  612. }
  613. foreach ($maps as $prop => $value) {
  614. if (count($value) > 32767) {
  615. $staticPhpVersion = 70000;
  616. }
  617. $value = strtr(
  618. var_export($value, true),
  619. array(
  620. $absoluteVendorPathCode => $vendorPathCode,
  621. $absoluteVendorPharPathCode => $vendorPharPathCode,
  622. $absoluteAppBaseDirCode => $appBaseDirCode,
  623. $absoluteAppBaseDirPharCode => $appBaseDirPharCode,
  624. )
  625. );
  626. $value = ltrim(preg_replace('/^ */m', ' $0$0', $value));
  627. $file .= sprintf(" public static $%s = %s;\n\n", $prop, $value);
  628. if ('files' !== $prop) {
  629. $initializer .= " \$loader->$prop = ComposerStaticInit$suffix::\$$prop;\n";
  630. }
  631. }
  632. return $file . <<<INITIALIZER
  633. public static function getInitializer(ClassLoader \$loader)
  634. {
  635. return \Closure::bind(function () use (\$loader) {
  636. $initializer
  637. }, null, ClassLoader::class);
  638. }
  639. }
  640. INITIALIZER;
  641. }
  642. protected function parseAutoloadsType(array $packageMap, $type, PackageInterface $mainPackage)
  643. {
  644. $autoloads = array();
  645. foreach ($packageMap as $item) {
  646. list($package, $installPath) = $item;
  647. $autoload = $package->getAutoload();
  648. if ($this->devMode && $package === $mainPackage) {
  649. $autoload = array_merge_recursive($autoload, $package->getDevAutoload());
  650. }
  651. if (!isset($autoload[$type]) || !is_array($autoload[$type])) {
  652. continue;
  653. }
  654. if (null !== $package->getTargetDir() && $package !== $mainPackage) {
  655. $installPath = substr($installPath, 0, -strlen('/'.$package->getTargetDir()));
  656. }
  657. foreach ($autoload[$type] as $namespace => $paths) {
  658. foreach ((array) $paths as $path) {
  659. if (($type === 'files' || $type === 'classmap' || $type === 'exclude-from-classmap') && $package->getTargetDir() && !is_readable($installPath.'/'.$path)) {
  660. if ($package === $mainPackage) {
  661. $targetDir = str_replace('\\<dirsep\\>', '[\\\\/]', preg_quote(str_replace(array('/', '\\'), '<dirsep>', $package->getTargetDir())));
  662. $path = ltrim(preg_replace('{^'.$targetDir.'}', '', ltrim($path, '\\/')), '\\/');
  663. } else {
  664. $path = $package->getTargetDir() . '/' . $path;
  665. }
  666. }
  667. if ($type === 'exclude-from-classmap') {
  668. $path = preg_replace('{/+}', '/', preg_quote(trim(strtr($path, '\\', '/'), '/')));
  669. $path = str_replace('\\*\\*', '.+?', $path);
  670. $path = str_replace('\\*', '[^/]+?', $path);
  671. $updir = null;
  672. $path = preg_replace_callback(
  673. '{^((?:(?:\\\\\\.){1,2}+/)+)}',
  674. function ($matches) use (&$updir) {
  675. if (isset($matches[1])) {
  676. $updir = str_replace('\\.', '.', $matches[1]);
  677. }
  678. return '';
  679. },
  680. $path
  681. );
  682. if (empty($installPath)) {
  683. $installPath = strtr(getcwd(), '\\', '/');
  684. }
  685. $resolvedPath = realpath($installPath . '/' . $updir);
  686. $autoloads[] = preg_quote(strtr($resolvedPath, '\\', '/')) . '/' . $path;
  687. continue;
  688. }
  689. $relativePath = empty($installPath) ? (empty($path) ? '.' : $path) : $installPath.'/'.$path;
  690. if ($type === 'files') {
  691. $autoloads[$this->getFileIdentifier($package, $path)] = $relativePath;
  692. continue;
  693. } elseif ($type === 'classmap') {
  694. $autoloads[] = $relativePath;
  695. continue;
  696. }
  697. $autoloads[$namespace][] = $relativePath;
  698. }
  699. }
  700. }
  701. return $autoloads;
  702. }
  703. protected function getFileIdentifier(PackageInterface $package, $path)
  704. {
  705. return md5($package->getName() . ':' . $path);
  706. }
  707. protected function filterPackageMap(array $packageMap, PackageInterface $mainPackage)
  708. {
  709. $packages = array();
  710. $include = array();
  711. foreach ($packageMap as $item) {
  712. $package = $item[0];
  713. $name = $package->getName();
  714. $packages[$name] = $package;
  715. }
  716. $add = function (PackageInterface $package) use (&$add, $packages, &$include) {
  717. foreach ($package->getRequires() as $link) {
  718. $target = $link->getTarget();
  719. if (!isset($include[$target])) {
  720. $include[$target] = true;
  721. if (isset($packages[$target])) {
  722. $add($packages[$target]);
  723. }
  724. }
  725. }
  726. };
  727. $add($mainPackage);
  728. return array_filter(
  729. $packageMap,
  730. function ($item) use ($include) {
  731. $package = $item[0];
  732. foreach ($package->getNames() as $name) {
  733. if (isset($include[$name])) {
  734. return true;
  735. }
  736. }
  737. return false;
  738. }
  739. );
  740. }
  741. protected function sortPackageMap(array $packageMap)
  742. {
  743. $packages = array();
  744. $paths = array();
  745. foreach ($packageMap as $item) {
  746. list($package, $path) = $item;
  747. $name = $package->getName();
  748. $packages[$name] = $package;
  749. $paths[$name] = $path;
  750. }
  751. $sortedPackages = PackageSorter::sortPackages($packages);
  752. $sortedPackageMap = array();
  753. foreach ($sortedPackages as $package) {
  754. $name = $package->getName();
  755. $sortedPackageMap[] = array($packages[$name], $paths[$name]);
  756. }
  757. return $sortedPackageMap;
  758. }
  759. protected function safeCopy($source, $target)
  760. {
  761. $source = fopen($source, 'r');
  762. $target = fopen($target, 'w+');
  763. stream_copy_to_stream($source, $target);
  764. fclose($source);
  765. fclose($target);
  766. }
  767. }
  768. <?php
  769. namespace Composer\Autoload;
  770. use Symfony\Component\Finder\Finder;
  771. use Composer\IO\IOInterface;
  772. use Composer\Util\Filesystem;
  773. class ClassMapGenerator
  774. {
  775. public static function dump($dirs, $file)
  776. {
  777. $maps = array();
  778. foreach ($dirs as $dir) {
  779. $maps = array_merge($maps, static::createMap($dir));
  780. }
  781. file_put_contents($file, sprintf('<?php return %s;', var_export($maps, true)));
  782. }
  783. public static function createMap($path, $blacklist = null, IOInterface $io = null, $namespace = null)
  784. {
  785. if (is_string($path)) {
  786. if (is_file($path)) {
  787. $path = array(new \SplFileInfo($path));
  788. } elseif (is_dir($path)) {
  789. $path = Finder::create()->files()->followLinks()->name('/\.(php|inc|hh)$/')->in($path);
  790. } else {
  791. throw new \RuntimeException(
  792. 'Could not scan for classes inside "'.$path.
  793. '" which does not appear to be a file nor a folder'
  794. );
  795. }
  796. }
  797. $map = array();
  798. $filesystem = new Filesystem();
  799. $cwd = realpath(getcwd());
  800. foreach ($path as $file) {
  801. $filePath = $file->getPathname();
  802. if (!in_array(pathinfo($filePath, PATHINFO_EXTENSION), array('php', 'inc', 'hh'))) {
  803. continue;
  804. }
  805. if (!$filesystem->isAbsolutePath($filePath)) {
  806. $filePath = $cwd . '/' . $filePath;
  807. $filePath = $filesystem->normalizePath($filePath);
  808. } else {
  809. $filePath = preg_replace('{[\\\\/]{2,}}', '/', $filePath);
  810. }
  811. if ($blacklist && preg_match($blacklist, strtr(realpath($filePath), '\\', '/'))) {
  812. continue;
  813. }
  814. if ($blacklist && preg_match($blacklist, strtr($filePath, '\\', '/'))) {
  815. continue;
  816. }
  817. $classes = self::findClasses($filePath);
  818. foreach ($classes as $class) {
  819. if (null !== $namespace && 0 !== strpos($class, $namespace)) {
  820. continue;
  821. }
  822. if (!isset($map[$class])) {
  823. $map[$class] = $filePath;
  824. } elseif ($io && $map[$class] !== $filePath && !preg_match('{/(test|fixture|example|stub)s?/}i', strtr($map[$class].' '.$filePath, '\\', '/'))) {
  825. $io->writeError(
  826. '<warning>Warning: Ambiguous class resolution, "'.$class.'"'.
  827. ' was found in both "'.$map[$class].'" and "'.$filePath.'", the first will be used.</warning>'
  828. );
  829. }
  830. }
  831. }
  832. return $map;
  833. }
  834. private static function findClasses($path)
  835. {
  836. $extraTypes = PHP_VERSION_ID < 50400 ? '' : '|trait';
  837. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '3.3', '>=')) {
  838. $extraTypes .= '|enum';
  839. }
  840. $contents = @php_strip_whitespace($path);
  841. if (!$contents) {
  842. if (!file_exists($path)) {
  843. $message = 'File at "%s" does not exist, check your classmap definitions';
  844. } elseif (!is_readable($path)) {
  845. $message = 'File at "%s" is not readable, check its permissions';
  846. } elseif ('' === trim(file_get_contents($path))) {
  847. return array();
  848. } else {
  849. $message = 'File at "%s" could not be parsed as PHP, it may be binary or corrupted';
  850. }
  851. $error = error_get_last();
  852. if (isset($error['message'])) {
  853. $message .= PHP_EOL . 'The following message may be helpful:' . PHP_EOL . $error['message'];
  854. }
  855. throw new \RuntimeException(sprintf($message, $path));
  856. }
  857. if (!preg_match('{\b(?:class|interface'.$extraTypes.')\s}i', $contents)) {
  858. return array();
  859. }
  860. $contents = preg_replace('{<<<[ \t]*([\'"]?)(\w+)\\1(?:\r\n|\n|\r)(?:.*?)(?:\r\n|\n|\r)(?:\s*)\\2(?=\s+|[;,.)])}s', 'null', $contents);
  861. $contents = preg_replace('{"[^"\\\\]*+(\\\\.[^"\\\\]*+)*+"|\'[^\'\\\\]*+(\\\\.[^\'\\\\]*+)*+\'}s', 'null', $contents);
  862. if (substr($contents, 0, 2) !== '<?') {
  863. $contents = preg_replace('{^.+?<\?}s', '<?', $contents, 1, $replacements);
  864. if ($replacements === 0) {
  865. return array();
  866. }
  867. }
  868. $contents = preg_replace('{\?>(?:[^<]++|<(?!\?))*+<\?}s', '?><?', $contents);
  869. $pos = strrpos($contents, '?>');
  870. if (false !== $pos && false === strpos(substr($contents, $pos), '<?')) {
  871. $contents = substr($contents, 0, $pos);
  872. }
  873. if (preg_match('{(<\?)(?!(php|hh))}i', $contents)) {
  874. $contents = preg_replace('{//.* | /\*(?:[^*]++|\*(?!/))*\*/}x', '', $contents);
  875. }
  876. preg_match_all('{
  877. (?:
  878. \b(?<![\$:>])(?P<type>class|interface'.$extraTypes.') \s++ (?P<name>[a-zA-Z_\x7f-\xff:][a-zA-Z0-9_\x7f-\xff:\-]*+)
  879. | \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*+ [\{;]
  880. )
  881. }ix', $contents, $matches);
  882. $classes = array();
  883. $namespace = '';
  884. for ($i = 0, $len = count($matches['type']); $i < $len; $i++) {
  885. if (!empty($matches['ns'][$i])) {
  886. $namespace = str_replace(array(' ', "\t", "\r", "\n"), '', $matches['nsname'][$i]) . '\\';
  887. } else {
  888. $name = $matches['name'][$i];
  889. if ($name === 'extends' || $name === 'implements') {
  890. continue;
  891. }
  892. if ($name[0] === ':') {
  893. $name = 'xhp'.substr(str_replace(array('-', ':'), array('_', '__'), $name), 1);
  894. } elseif ($matches['type'][$i] === 'enum') {
  895. $name = rtrim($name, ':');
  896. }
  897. $classes[] = ltrim($namespace . $name, '\\');
  898. }
  899. }
  900. return $classes;
  901. }
  902. }
  903. <?php
  904. namespace Composer;
  905. use Composer\IO\IOInterface;
  906. use Composer\Util\Filesystem;
  907. use Composer\Util\Silencer;
  908. use Symfony\Component\Finder\Finder;
  909. class Cache
  910. {
  911. private static $cacheCollected = false;
  912. private $io;
  913. private $root;
  914. private $enabled = true;
  915. private $whitelist;
  916. private $filesystem;
  917. public function __construct(IOInterface $io, $cacheDir, $whitelist = 'a-z0-9.', Filesystem $filesystem = null)
  918. {
  919. $this->io = $io;
  920. $this->root = rtrim($cacheDir, '/\\') . '/';
  921. $this->whitelist = $whitelist;
  922. $this->filesystem = $filesystem ?: new Filesystem();
  923. if (!self::isUsable($cacheDir)) {
  924. $this->enabled = false;
  925. return;
  926. }
  927. if (
  928. (!is_dir($this->root) && !Silencer::call('mkdir', $this->root, 0777, true))
  929. || !is_writable($this->root)
  930. ) {
  931. $this->io->writeError('<warning>Cannot create cache directory ' . $this->root . ', or directory is not writable. Proceeding without cache</warning>');
  932. $this->enabled = false;
  933. }
  934. }
  935. public static function isUsable($path)
  936. {
  937. return !preg_match('{(^|[\\\\/])(\$null|nul|NUL|/dev/null)([\\\\/]|$)}', $path);
  938. }
  939. public function isEnabled()
  940. {
  941. return $this->enabled;
  942. }
  943. public function getRoot()
  944. {
  945. return $this->root;
  946. }
  947. public function read($file)
  948. {
  949. if ($this->enabled) {
  950. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  951. if (file_exists($this->root . $file)) {
  952. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  953. return file_get_contents($this->root . $file);
  954. }
  955. }
  956. return false;
  957. }
  958. public function write($file, $contents)
  959. {
  960. if ($this->enabled) {
  961. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  962. $this->io->writeError('Writing '.$this->root . $file.' into cache', true, IOInterface::DEBUG);
  963. try {
  964. return file_put_contents($this->root . $file, $contents);
  965. } catch (\ErrorException $e) {
  966. $this->io->writeError('<warning>Failed to write into cache: '.$e->getMessage().'</warning>', true, IOInterface::DEBUG);
  967. if (preg_match('{^file_put_contents\(\): Only ([0-9]+) of ([0-9]+) bytes written}', $e->getMessage(), $m)) {
  968. unlink($this->root . $file);
  969. $message = sprintf(
  970. '<warning>Writing %1$s into cache failed after %2$u of %3$u bytes written, only %4$u bytes of free space available</warning>',
  971. $this->root . $file,
  972. $m[1],
  973. $m[2],
  974. @disk_free_space($this->root . dirname($file))
  975. );
  976. $this->io->writeError($message);
  977. return false;
  978. }
  979. throw $e;
  980. }
  981. }
  982. return false;
  983. }
  984. public function copyFrom($file, $source)
  985. {
  986. if ($this->enabled) {
  987. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  988. $this->filesystem->ensureDirectoryExists(dirname($this->root . $file));
  989. if (!file_exists($source)) {
  990. $this->io->writeError('<error>'.$source.' does not exist, can not write into cache</error>');
  991. } elseif ($this->io->isDebug()) {
  992. $this->io->writeError('Writing '.$this->root . $file.' into cache from '.$source);
  993. }
  994. return copy($source, $this->root . $file);
  995. }
  996. return false;
  997. }
  998. public function copyTo($file, $target)
  999. {
  1000. if ($this->enabled) {
  1001. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1002. if (file_exists($this->root . $file)) {
  1003. try {
  1004. touch($this->root . $file, filemtime($this->root . $file), time());
  1005. } catch (\ErrorException $e) {
  1006. Silencer::call('touch', $this->root . $file);
  1007. }
  1008. $this->io->writeError('Reading '.$this->root . $file.' from cache', true, IOInterface::DEBUG);
  1009. return copy($this->root . $file, $target);
  1010. }
  1011. }
  1012. return false;
  1013. }
  1014. public function gcIsNecessary()
  1015. {
  1016. return (!self::$cacheCollected && !mt_rand(0, 50));
  1017. }
  1018. public function remove($file)
  1019. {
  1020. if ($this->enabled) {
  1021. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1022. if (file_exists($this->root . $file)) {
  1023. return $this->filesystem->unlink($this->root . $file);
  1024. }
  1025. }
  1026. return false;
  1027. }
  1028. public function clear()
  1029. {
  1030. if ($this->enabled) {
  1031. $this->filesystem->emptyDirectory($this->root);
  1032. return true;
  1033. }
  1034. return false;
  1035. }
  1036. public function gc($ttl, $maxSize)
  1037. {
  1038. if ($this->enabled) {
  1039. $expire = new \DateTime();
  1040. $expire->modify('-'.$ttl.' seconds');
  1041. $finder = $this->getFinder()->date('until '.$expire->format('Y-m-d H:i:s'));
  1042. foreach ($finder as $file) {
  1043. $this->filesystem->unlink($file->getPathname());
  1044. }
  1045. $totalSize = $this->filesystem->size($this->root);
  1046. if ($totalSize > $maxSize) {
  1047. $iterator = $this->getFinder()->sortByAccessedTime()->getIterator();
  1048. while ($totalSize > $maxSize && $iterator->valid()) {
  1049. $filepath = $iterator->current()->getPathname();
  1050. $totalSize -= $this->filesystem->size($filepath);
  1051. $this->filesystem->unlink($filepath);
  1052. $iterator->next();
  1053. }
  1054. }
  1055. self::$cacheCollected = true;
  1056. return true;
  1057. }
  1058. return false;
  1059. }
  1060. public function sha1($file)
  1061. {
  1062. if ($this->enabled) {
  1063. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1064. if (file_exists($this->root . $file)) {
  1065. return sha1_file($this->root . $file);
  1066. }
  1067. }
  1068. return false;
  1069. }
  1070. public function sha256($file)
  1071. {
  1072. if ($this->enabled) {
  1073. $file = preg_replace('{[^'.$this->whitelist.']}i', '-', $file);
  1074. if (file_exists($this->root . $file)) {
  1075. return hash_file('sha256', $this->root . $file);
  1076. }
  1077. }
  1078. return false;
  1079. }
  1080. protected function getFinder()
  1081. {
  1082. return Finder::create()->in($this->root)->files();
  1083. }
  1084. }
  1085. <?php
  1086. namespace Composer\Command;
  1087. use Symfony\Component\Console\Input\InputInterface;
  1088. use Symfony\Component\Console\Output\OutputInterface;
  1089. class AboutCommand extends BaseCommand
  1090. {
  1091. protected function configure()
  1092. {
  1093. $this
  1094. ->setName('about')
  1095. ->setDescription('Shows the short information about Composer.')
  1096. ->setHelp(
  1097. <<<EOT
  1098. <info>php composer.phar about</info>
  1099. EOT
  1100. )
  1101. ;
  1102. }
  1103. protected function execute(InputInterface $input, OutputInterface $output)
  1104. {
  1105. $this->getIO()->write(
  1106. <<<EOT
  1107. <info>Composer - Dependency Manager for PHP</info>
  1108. <comment>Composer is a dependency manager tracking local dependencies of your projects and libraries.
  1109. See https://getcomposer.org/ for more information.</comment>
  1110. EOT
  1111. );
  1112. return 0;
  1113. }
  1114. }
  1115. <?php
  1116. namespace Composer\Command;
  1117. use Composer\Factory;
  1118. use Composer\IO\IOInterface;
  1119. use Composer\Config;
  1120. use Composer\Composer;
  1121. use Composer\Repository\CompositeRepository;
  1122. use Composer\Repository\RepositoryFactory;
  1123. use Composer\Script\ScriptEvents;
  1124. use Composer\Plugin\CommandEvent;
  1125. use Composer\Plugin\PluginEvents;
  1126. use Composer\Util\Filesystem;
  1127. use Symfony\Component\Console\Input\InputArgument;
  1128. use Symfony\Component\Console\Input\InputInterface;
  1129. use Symfony\Component\Console\Input\InputOption;
  1130. use Symfony\Component\Console\Output\OutputInterface;
  1131. class ArchiveCommand extends BaseCommand
  1132. {
  1133. protected function configure()
  1134. {
  1135. $this
  1136. ->setName('archive')
  1137. ->setDescription('Creates an archive of this composer package.')
  1138. ->setDefinition(array(
  1139. new InputArgument('package', InputArgument::OPTIONAL, 'The package to archive instead of the current project'),
  1140. new InputArgument('version', InputArgument::OPTIONAL, 'A version constraint to find the package to archive'),
  1141. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the resulting archive: tar or zip'),
  1142. new InputOption('dir', null, InputOption::VALUE_REQUIRED, 'Write the archive to this directory'),
  1143. new InputOption('file', null, InputOption::VALUE_REQUIRED, 'Write the archive with the given file name.'
  1144. .' Note that the format will be appended.'),
  1145. new InputOption('ignore-filters', false, InputOption::VALUE_NONE, 'Ignore filters when saving package'),
  1146. ))
  1147. ->setHelp(
  1148. <<<EOT
  1149. The <info>archive</info> command creates an archive of the specified format
  1150. containing the files and directories of the Composer project or the specified
  1151. package in the specified version and writes it to the specified directory.
  1152. <info>php composer.phar archive [--format=zip] [--dir=/foo] [package [version]]</info>
  1153. Read more at https://getcomposer.org/doc/03-cli.md#archive
  1154. EOT
  1155. )
  1156. ;
  1157. }
  1158. protected function execute(InputInterface $input, OutputInterface $output)
  1159. {
  1160. $config = Factory::createConfig();
  1161. $composer = $this->getComposer(false);
  1162. if ($composer) {
  1163. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'archive', $input, $output);
  1164. $eventDispatcher = $composer->getEventDispatcher();
  1165. $eventDispatcher->dispatch($commandEvent->getName(), $commandEvent);
  1166. $eventDispatcher->dispatchScript(ScriptEvents::PRE_ARCHIVE_CMD);
  1167. }
  1168. if (null === $input->getOption('format')) {
  1169. $input->setOption('format', $config->get('archive-format'));
  1170. }
  1171. if (null === $input->getOption('dir')) {
  1172. $input->setOption('dir', $config->get('archive-dir'));
  1173. }
  1174. $returnCode = $this->archive(
  1175. $this->getIO(),
  1176. $config,
  1177. $input->getArgument('package'),
  1178. $input->getArgument('version'),
  1179. $input->getOption('format'),
  1180. $input->getOption('dir'),
  1181. $input->getOption('file'),
  1182. $input->getOption('ignore-filters'),
  1183. $composer
  1184. );
  1185. if (0 === $returnCode && $composer) {
  1186. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ARCHIVE_CMD);
  1187. }
  1188. return $returnCode;
  1189. }
  1190. protected function archive(IOInterface $io, Config $config, $packageName = null, $version = null, $format = 'tar', $dest = '.', $fileName = null, $ignoreFilters = false, Composer $composer = null)
  1191. {
  1192. if ($composer) {
  1193. $archiveManager = $composer->getArchiveManager();
  1194. } else {
  1195. $factory = new Factory;
  1196. $downloadManager = $factory->createDownloadManager($io, $config);
  1197. $archiveManager = $factory->createArchiveManager($config, $downloadManager);
  1198. }
  1199. if ($packageName) {
  1200. $package = $this->selectPackage($io, $packageName, $version);
  1201. if (!$package) {
  1202. return 1;
  1203. }
  1204. } else {
  1205. $package = $this->getComposer()->getPackage();
  1206. }
  1207. $io->writeError('<info>Creating the archive into "'.$dest.'".</info>');
  1208. $packagePath = $archiveManager->archive($package, $format, $dest, $fileName, $ignoreFilters);
  1209. $fs = new Filesystem;
  1210. $shortPath = $fs->findShortestPath(getcwd(), $packagePath, true);
  1211. $io->writeError('Created: ', false);
  1212. $io->write(strlen($shortPath) < strlen($packagePath) ? $shortPath : $packagePath);
  1213. return 0;
  1214. }
  1215. protected function selectPackage(IOInterface $io, $packageName, $version = null)
  1216. {
  1217. $io->writeError('<info>Searching for the specified package.</info>');
  1218. if ($composer = $this->getComposer(false)) {
  1219. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  1220. $repo = new CompositeRepository(array_merge(array($localRepo), $composer->getRepositoryManager()->getRepositories()));
  1221. } else {
  1222. $defaultRepos = RepositoryFactory::defaultRepos($this->getIO());
  1223. $io->writeError('No composer.json found in the current directory, searching packages from ' . implode(', ', array_keys($defaultRepos)));
  1224. $repo = new CompositeRepository($defaultRepos);
  1225. }
  1226. $packages = $repo->findPackages($packageName, $version);
  1227. if (count($packages) > 1) {
  1228. $package = reset($packages);
  1229. $io->writeError('<info>Found multiple matches, selected '.$package->getPrettyString().'.</info>');
  1230. $io->writeError('Alternatives were '.implode(', ', array_map(function ($p) {
  1231. return $p->getPrettyString();
  1232. }, $packages)).'.');
  1233. $io->writeError('<comment>Please use a more specific constraint to pick a different package.</comment>');
  1234. } elseif ($packages) {
  1235. $package = reset($packages);
  1236. $io->writeError('<info>Found an exact match '.$package->getPrettyString().'.</info>');
  1237. } else {
  1238. $io->writeError('<error>Could not find a package matching '.$packageName.'.</error>');
  1239. return false;
  1240. }
  1241. return $package;
  1242. }
  1243. }
  1244. <?php
  1245. namespace Composer\Command;
  1246. use Composer\Composer;
  1247. use Composer\Config;
  1248. use Composer\Console\Application;
  1249. use Composer\Factory;
  1250. use Composer\IO\IOInterface;
  1251. use Composer\IO\NullIO;
  1252. use Composer\Plugin\PreCommandRunEvent;
  1253. use Composer\Plugin\PluginEvents;
  1254. use Symfony\Component\Console\Input\InputInterface;
  1255. use Symfony\Component\Console\Output\OutputInterface;
  1256. use Symfony\Component\Console\Command\Command;
  1257. abstract class BaseCommand extends Command
  1258. {
  1259. private $composer;
  1260. private $io;
  1261. public function getComposer($required = true, $disablePlugins = null)
  1262. {
  1263. if (null === $this->composer) {
  1264. $application = $this->getApplication();
  1265. if ($application instanceof Application) {
  1266. $this->composer = $application->getComposer($required, $disablePlugins);
  1267. } elseif ($required) {
  1268. throw new \RuntimeException(
  1269. 'Could not create a Composer\Composer instance, you must inject '.
  1270. 'one if this command is not used with a Composer\Console\Application instance'
  1271. );
  1272. }
  1273. }
  1274. return $this->composer;
  1275. }
  1276. public function setComposer(Composer $composer)
  1277. {
  1278. $this->composer = $composer;
  1279. }
  1280. public function resetComposer()
  1281. {
  1282. $this->composer = null;
  1283. $this->getApplication()->resetComposer();
  1284. }
  1285. public function isProxyCommand()
  1286. {
  1287. return false;
  1288. }
  1289. public function getIO()
  1290. {
  1291. if (null === $this->io) {
  1292. $application = $this->getApplication();
  1293. if ($application instanceof Application) {
  1294. $this->io = $application->getIO();
  1295. } else {
  1296. $this->io = new NullIO();
  1297. }
  1298. }
  1299. return $this->io;
  1300. }
  1301. public function setIO(IOInterface $io)
  1302. {
  1303. $this->io = $io;
  1304. }
  1305. protected function initialize(InputInterface $input, OutputInterface $output)
  1306. {
  1307. $disablePlugins = $input->hasParameterOption('--no-plugins');
  1308. $composer = $this->getComposer(false, $disablePlugins);
  1309. if (null === $composer) {
  1310. $composer = Factory::createGlobal($this->getIO(), $disablePlugins);
  1311. }
  1312. if ($composer) {
  1313. $preCommandRunEvent = new PreCommandRunEvent(PluginEvents::PRE_COMMAND_RUN, $input, $this->getName());
  1314. $composer->getEventDispatcher()->dispatch($preCommandRunEvent->getName(), $preCommandRunEvent);
  1315. }
  1316. if (true === $input->hasParameterOption(array('--no-ansi')) && $input->hasOption('no-progress')) {
  1317. $input->setOption('no-progress', true);
  1318. }
  1319. parent::initialize($input, $output);
  1320. }
  1321. protected function getPreferredInstallOptions(Config $config, InputInterface $input, $keepVcsRequiresPreferSource = false)
  1322. {
  1323. $preferSource = false;
  1324. $preferDist = false;
  1325. switch ($config->get('preferred-install')) {
  1326. case 'source':
  1327. $preferSource = true;
  1328. break;
  1329. case 'dist':
  1330. $preferDist = true;
  1331. break;
  1332. case 'auto':
  1333. default:
  1334. break;
  1335. }
  1336. if ($input->getOption('prefer-source') || $input->getOption('prefer-dist') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'))) {
  1337. $preferSource = $input->getOption('prefer-source') || ($keepVcsRequiresPreferSource && $input->hasOption('keep-vcs') && $input->getOption('keep-vcs'));
  1338. $preferDist = $input->getOption('prefer-dist');
  1339. }
  1340. return array($preferSource, $preferDist);
  1341. }
  1342. }
  1343. <?php
  1344. namespace Composer\Command;
  1345. use Composer\DependencyResolver\Pool;
  1346. use Composer\Package\Link;
  1347. use Composer\Package\PackageInterface;
  1348. use Composer\Repository\ArrayRepository;
  1349. use Composer\Repository\CompositeRepository;
  1350. use Composer\Repository\PlatformRepository;
  1351. use Composer\Repository\RepositoryFactory;
  1352. use Composer\Plugin\CommandEvent;
  1353. use Composer\Plugin\PluginEvents;
  1354. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  1355. use Composer\Package\Version\VersionParser;
  1356. use Symfony\Component\Console\Helper\Table;
  1357. use Symfony\Component\Console\Input\InputArgument;
  1358. use Symfony\Component\Console\Input\InputInterface;
  1359. use Symfony\Component\Console\Input\InputOption;
  1360. use Symfony\Component\Console\Output\OutputInterface;
  1361. class BaseDependencyCommand extends BaseCommand
  1362. {
  1363. const ARGUMENT_PACKAGE = 'package';
  1364. const ARGUMENT_CONSTRAINT = 'constraint';
  1365. const OPTION_RECURSIVE = 'recursive';
  1366. const OPTION_TREE = 'tree';
  1367. protected $colors;
  1368. protected function configure()
  1369. {
  1370. $this->setDefinition(array(
  1371. new InputArgument(self::ARGUMENT_PACKAGE, InputArgument::REQUIRED, 'Package to inspect'),
  1372. new InputArgument(self::ARGUMENT_CONSTRAINT, InputArgument::OPTIONAL, 'Optional version constraint', '*'),
  1373. new InputOption(self::OPTION_RECURSIVE, 'r', InputOption::VALUE_NONE, 'Recursively resolves up to the root package'),
  1374. new InputOption(self::OPTION_TREE, 't', InputOption::VALUE_NONE, 'Prints the results as a nested tree'),
  1375. ));
  1376. }
  1377. protected function doExecute(InputInterface $input, OutputInterface $output, $inverted = false)
  1378. {
  1379. $composer = $this->getComposer();
  1380. $commandEvent = new CommandEvent(PluginEvents::COMMAND, $this->getName(), $input, $output);
  1381. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  1382. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  1383. $repository = new CompositeRepository(array(
  1384. new ArrayRepository(array($composer->getPackage())),
  1385. $composer->getRepositoryManager()->getLocalRepository(),
  1386. new PlatformRepository(array(), $platformOverrides),
  1387. ));
  1388. $pool = new Pool();
  1389. $pool->addRepository($repository);
  1390. list($needle, $textConstraint) = array_pad(
  1391. explode(':', $input->getArgument(self::ARGUMENT_PACKAGE)),
  1392. 2,
  1393. $input->getArgument(self::ARGUMENT_CONSTRAINT)
  1394. );
  1395. $packages = $pool->whatProvides(strtolower($needle));
  1396. if (empty($packages)) {
  1397. throw new \InvalidArgumentException(sprintf('Could not find package "%s" in your project', $needle));
  1398. }
  1399. if (!$repository->findPackage($needle, $textConstraint)) {
  1400. $defaultRepos = new CompositeRepository(RepositoryFactory::defaultRepos($this->getIO()));
  1401. if ($match = $defaultRepos->findPackage($needle, $textConstraint)) {
  1402. $repository->addRepository(new ArrayRepository(array(clone $match)));
  1403. }
  1404. }
  1405. $needles = array($needle);
  1406. if ($inverted) {
  1407. foreach ($packages as $package) {
  1408. $needles = array_merge($needles, array_map(function (Link $link) {
  1409. return $link->getTarget();
  1410. }, $package->getReplaces()));
  1411. }
  1412. }
  1413. if ('*' !== $textConstraint) {
  1414. $versionParser = new VersionParser();
  1415. $constraint = $versionParser->parseConstraints($textConstraint);
  1416. } else {
  1417. $constraint = null;
  1418. }
  1419. $renderTree = $input->getOption(self::OPTION_TREE);
  1420. $recursive = $renderTree || $input->getOption(self::OPTION_RECURSIVE);
  1421. $results = $repository->getDependents($needles, $constraint, $inverted, $recursive);
  1422. if (empty($results)) {
  1423. $extra = (null !== $constraint) ? sprintf(' in versions %smatching %s', $inverted ? 'not ' : '', $textConstraint) : '';
  1424. $this->getIO()->writeError(sprintf(
  1425. '<info>There is no installed package depending on "%s"%s</info>',
  1426. $needle,
  1427. $extra
  1428. ));
  1429. } elseif ($renderTree) {
  1430. $this->initStyles($output);
  1431. $root = $packages[0];
  1432. $this->getIO()->write(sprintf('<info>%s</info> %s %s', $root->getPrettyName(), $root->getPrettyVersion(), $root->getDescription()));
  1433. $this->printTree($results);
  1434. } else {
  1435. $this->printTable($output, $results);
  1436. }
  1437. return 0;
  1438. }
  1439. protected function printTable(OutputInterface $output, $results)
  1440. {
  1441. $table = array();
  1442. $doubles = array();
  1443. do {
  1444. $queue = array();
  1445. $rows = array();
  1446. foreach ($results as $result) {
  1447. list($package, $link, $children) = $result;
  1448. $unique = (string) $link;
  1449. if (isset($doubles[$unique])) {
  1450. continue;
  1451. }
  1452. $doubles[$unique] = true;
  1453. $version = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '-' : $package->getPrettyVersion();
  1454. $rows[] = array($package->getPrettyName(), $version, $link->getDescription(), sprintf('%s (%s)', $link->getTarget(), $link->getPrettyConstraint()));
  1455. if ($children) {
  1456. $queue = array_merge($queue, $children);
  1457. }
  1458. }
  1459. $results = $queue;
  1460. $table = array_merge($rows, $table);
  1461. } while (!empty($results));
  1462. $renderer = new Table($output);
  1463. $renderer->setStyle('compact');
  1464. $rendererStyle = $renderer->getStyle();
  1465. $rendererStyle->setVerticalBorderChar('');
  1466. $rendererStyle->setCellRowContentFormat('%s ');
  1467. $renderer->setRows($table)->render();
  1468. }
  1469. protected function initStyles(OutputInterface $output)
  1470. {
  1471. $this->colors = array(
  1472. 'green',
  1473. 'yellow',
  1474. 'cyan',
  1475. 'magenta',
  1476. 'blue',
  1477. );
  1478. foreach ($this->colors as $color) {
  1479. $style = new OutputFormatterStyle($color);
  1480. $output->getFormatter()->setStyle($color, $style);
  1481. }
  1482. }
  1483. protected function printTree($results, $prefix = '', $level = 1)
  1484. {
  1485. $count = count($results);
  1486. $idx = 0;
  1487. foreach ($results as $result) {
  1488. list($package, $link, $children) = $result;
  1489. $color = $this->colors[$level % count($this->colors)];
  1490. $prevColor = $this->colors[($level - 1) % count($this->colors)];
  1491. $isLast = (++$idx == $count);
  1492. $versionText = (strpos($package->getPrettyVersion(), 'No version set') === 0) ? '' : $package->getPrettyVersion();
  1493. $packageText = rtrim(sprintf('<%s>%s</%1$s> %s', $color, $package->getPrettyName(), $versionText));
  1494. $linkText = sprintf('%s <%s>%s</%2$s> %s', $link->getDescription(), $prevColor, $link->getTarget(), $link->getPrettyConstraint());
  1495. $circularWarn = $children === false ? '(circular dependency aborted here)' : '';
  1496. $this->writeTreeLine(rtrim(sprintf("%s%s%s (%s) %s", $prefix, $isLast ? '└──' : '├──', $packageText, $linkText, $circularWarn)));
  1497. if ($children) {
  1498. $this->printTree($children, $prefix . ($isLast ? ' ' : '│ '), $level + 1);
  1499. }
  1500. }
  1501. }
  1502. private function writeTreeLine($line)
  1503. {
  1504. $io = $this->getIO();
  1505. if (!$io->isDecorated()) {
  1506. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  1507. }
  1508. $io->write($line);
  1509. }
  1510. }
  1511. <?php
  1512. namespace Composer\Command;
  1513. use Composer\Package\Link;
  1514. use Composer\Package\PackageInterface;
  1515. use Composer\Semver\Constraint\Constraint;
  1516. use Symfony\Component\Console\Helper\Table;
  1517. use Symfony\Component\Console\Input\InputInterface;
  1518. use Symfony\Component\Console\Input\InputOption;
  1519. use Symfony\Component\Console\Output\OutputInterface;
  1520. use Composer\Repository\PlatformRepository;
  1521. class CheckPlatformReqsCommand extends BaseCommand
  1522. {
  1523. protected function configure()
  1524. {
  1525. $this->setName('check-platform-reqs')
  1526. ->setDescription('Check that platform requirements are satisfied.')
  1527. ->setDefinition(array(
  1528. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables checking of require-dev packages requirements.'),
  1529. ))
  1530. ->setHelp(
  1531. <<<EOT
  1532. Checks that your PHP and extensions versions match the platform requirements of the installed packages.
  1533. 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.
  1534. <info>php composer.phar check-platform-reqs</info>
  1535. EOT
  1536. );
  1537. }
  1538. protected function execute(InputInterface $input, OutputInterface $output)
  1539. {
  1540. $composer = $this->getComposer();
  1541. $requires = $composer->getPackage()->getRequires();
  1542. if ($input->getOption('no-dev')) {
  1543. $dependencies = $composer->getLocker()->getLockedRepository(!$input->getOption('no-dev'))->getPackages();
  1544. } else {
  1545. $dependencies = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  1546. if (!$dependencies) {
  1547. $dependencies = $composer->getLocker()->getLockedRepository(true)->getPackages();
  1548. }
  1549. $requires += $composer->getPackage()->getDevRequires();
  1550. }
  1551. foreach ($requires as $require => $link) {
  1552. $requires[$require] = array($link);
  1553. }
  1554. foreach ($dependencies as $package) {
  1555. foreach ($package->getRequires() as $require => $link) {
  1556. $requires[$require][] = $link;
  1557. }
  1558. }
  1559. ksort($requires);
  1560. $platformRepo = new PlatformRepository(array(), array());
  1561. $currentPlatformPackages = $platformRepo->getPackages();
  1562. $currentPlatformPackageMap = array();
  1563. foreach ($currentPlatformPackages as $currentPlatformPackage) {
  1564. $currentPlatformPackageMap[$currentPlatformPackage->getName()] = $currentPlatformPackage;
  1565. }
  1566. $results = array();
  1567. $exitCode = 0;
  1568. foreach ($requires as $require => $links) {
  1569. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $require)) {
  1570. if (isset($currentPlatformPackageMap[$require])) {
  1571. $pass = true;
  1572. $version = $currentPlatformPackageMap[$require]->getVersion();
  1573. foreach ($links as $link) {
  1574. if (!$link->getConstraint()->matches(new Constraint('=', $version))) {
  1575. $results[] = array(
  1576. $currentPlatformPackageMap[$require]->getPrettyName(),
  1577. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1578. $link,
  1579. '<error>failed</error>',
  1580. );
  1581. $pass = false;
  1582. $exitCode = max($exitCode, 1);
  1583. }
  1584. }
  1585. if ($pass) {
  1586. $results[] = array(
  1587. $currentPlatformPackageMap[$require]->getPrettyName(),
  1588. $currentPlatformPackageMap[$require]->getPrettyVersion(),
  1589. null,
  1590. '<info>success</info>',
  1591. );
  1592. }
  1593. } else {
  1594. $results[] = array(
  1595. $require,
  1596. 'n/a',
  1597. $links[0],
  1598. '<error>missing</error>',
  1599. );
  1600. $exitCode = max($exitCode, 2);
  1601. }
  1602. }
  1603. }
  1604. $this->printTable($output, $results);
  1605. return $exitCode;
  1606. }
  1607. protected function printTable(OutputInterface $output, $results)
  1608. {
  1609. $table = array();
  1610. $rows = array();
  1611. foreach ($results as $result) {
  1612. list($platformPackage, $version, $link, $status) = $result;
  1613. $rows[] = array(
  1614. $platformPackage,
  1615. $version,
  1616. $link ? sprintf('%s %s %s (%s)', $link->getSource(), $link->getDescription(), $link->getTarget(), $link->getPrettyConstraint()) : '',
  1617. $status,
  1618. );
  1619. }
  1620. $table = array_merge($rows, $table);
  1621. $renderer = new Table($output);
  1622. $renderer->setStyle('compact');
  1623. $rendererStyle = $renderer->getStyle();
  1624. $rendererStyle->setVerticalBorderChar('');
  1625. $rendererStyle->setCellRowContentFormat('%s ');
  1626. $renderer->setRows($table)->render();
  1627. }
  1628. }
  1629. <?php
  1630. namespace Composer\Command;
  1631. use Composer\Cache;
  1632. use Composer\Factory;
  1633. use Symfony\Component\Console\Input\InputInterface;
  1634. use Symfony\Component\Console\Output\OutputInterface;
  1635. class ClearCacheCommand extends BaseCommand
  1636. {
  1637. protected function configure()
  1638. {
  1639. $this
  1640. ->setName('clear-cache')
  1641. ->setAliases(array('clearcache'))
  1642. ->setDescription('Clears composer\'s internal package cache.')
  1643. ->setHelp(
  1644. <<<EOT
  1645. The <info>clear-cache</info> deletes all cached packages from composer's
  1646. cache directory.
  1647. Read more at https://getcomposer.org/doc/03-cli.md#clear-cache-clearcache-
  1648. EOT
  1649. )
  1650. ;
  1651. }
  1652. protected function execute(InputInterface $input, OutputInterface $output)
  1653. {
  1654. $config = Factory::createConfig();
  1655. $io = $this->getIO();
  1656. $cachePaths = array(
  1657. 'cache-vcs-dir' => $config->get('cache-vcs-dir'),
  1658. 'cache-repo-dir' => $config->get('cache-repo-dir'),
  1659. 'cache-files-dir' => $config->get('cache-files-dir'),
  1660. 'cache-dir' => $config->get('cache-dir'),
  1661. );
  1662. foreach ($cachePaths as $key => $cachePath) {
  1663. $cachePath = realpath($cachePath);
  1664. if (!$cachePath) {
  1665. $io->writeError("<info>Cache directory does not exist ($key): $cachePath</info>");
  1666. continue;
  1667. }
  1668. $cache = new Cache($io, $cachePath);
  1669. if (!$cache->isEnabled()) {
  1670. $io->writeError("<info>Cache is not enabled ($key): $cachePath</info>");
  1671. continue;
  1672. }
  1673. $io->writeError("<info>Clearing cache ($key): $cachePath</info>");
  1674. $cache->clear();
  1675. }
  1676. $io->writeError('<info>All caches cleared.</info>');
  1677. return 0;
  1678. }
  1679. }
  1680. <?php
  1681. namespace Composer\Command;
  1682. use Composer\Util\Platform;
  1683. use Composer\Util\Silencer;
  1684. use Symfony\Component\Console\Input\InputInterface;
  1685. use Symfony\Component\Console\Input\InputArgument;
  1686. use Symfony\Component\Console\Input\InputOption;
  1687. use Symfony\Component\Console\Output\OutputInterface;
  1688. use Composer\Config;
  1689. use Composer\Config\JsonConfigSource;
  1690. use Composer\Factory;
  1691. use Composer\IO\IOInterface;
  1692. use Composer\Json\JsonFile;
  1693. use Composer\Semver\VersionParser;
  1694. use Composer\Package\BasePackage;
  1695. class ConfigCommand extends BaseCommand
  1696. {
  1697. protected $config;
  1698. protected $configFile;
  1699. protected $configSource;
  1700. protected $authConfigFile;
  1701. protected $authConfigSource;
  1702. protected function configure()
  1703. {
  1704. $this
  1705. ->setName('config')
  1706. ->setDescription('Sets config options.')
  1707. ->setDefinition(array(
  1708. new InputOption('global', 'g', InputOption::VALUE_NONE, 'Apply command to the global config file'),
  1709. new InputOption('editor', 'e', InputOption::VALUE_NONE, 'Open editor'),
  1710. new InputOption('auth', 'a', InputOption::VALUE_NONE, 'Affect auth config file (only used for --editor)'),
  1711. new InputOption('unset', null, InputOption::VALUE_NONE, 'Unset the given setting-key'),
  1712. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List configuration settings'),
  1713. new InputOption('file', 'f', InputOption::VALUE_REQUIRED, 'If you want to choose a different composer.json or config.json'),
  1714. new InputOption('absolute', null, InputOption::VALUE_NONE, 'Returns absolute paths when fetching *-dir config values instead of relative'),
  1715. new InputArgument('setting-key', null, 'Setting key'),
  1716. new InputArgument('setting-value', InputArgument::IS_ARRAY, 'Setting value'),
  1717. ))
  1718. ->setHelp(
  1719. <<<EOT
  1720. This command allows you to edit composer config settings and repositories
  1721. in either the local composer.json file or the global config.json file.
  1722. Additionally it lets you edit most properties in the local composer.json.
  1723. To set a config setting:
  1724. <comment>%command.full_name% bin-dir bin/</comment>
  1725. To read a config setting:
  1726. <comment>%command.full_name% bin-dir</comment>
  1727. Outputs: <info>bin</info>
  1728. To edit the global config.json file:
  1729. <comment>%command.full_name% --global</comment>
  1730. To add a repository:
  1731. <comment>%command.full_name% repositories.foo vcs https://bar.com</comment>
  1732. To remove a repository (repo is a short alias for repositories):
  1733. <comment>%command.full_name% --unset repo.foo</comment>
  1734. To disable packagist:
  1735. <comment>%command.full_name% repo.packagist false</comment>
  1736. You can alter repositories in the global config.json file by passing in the
  1737. <info>--global</info> option.
  1738. To edit the file in an external editor:
  1739. <comment>%command.full_name% --editor</comment>
  1740. To choose your editor you can set the "EDITOR" env variable.
  1741. To get a list of configuration values in the file:
  1742. <comment>%command.full_name% --list</comment>
  1743. You can always pass more than one option. As an example, if you want to edit the
  1744. global config.json file.
  1745. <comment>%command.full_name% --editor --global</comment>
  1746. Read more at https://getcomposer.org/doc/03-cli.md#config
  1747. EOT
  1748. )
  1749. ;
  1750. }
  1751. protected function initialize(InputInterface $input, OutputInterface $output)
  1752. {
  1753. parent::initialize($input, $output);
  1754. if ($input->getOption('global') && null !== $input->getOption('file')) {
  1755. throw new \RuntimeException('--file and --global can not be combined');
  1756. }
  1757. $io = $this->getIO();
  1758. $this->config = Factory::createConfig($io);
  1759. $configFile = $input->getOption('global')
  1760. ? ($this->config->get('home') . '/config.json')
  1761. : ($input->getOption('file') ?: Factory::getComposerFile());
  1762. if (
  1763. ($configFile === 'composer.json' || $configFile === './composer.json')
  1764. && !file_exists($configFile)
  1765. && realpath(getcwd()) === realpath($this->config->get('home'))
  1766. ) {
  1767. file_put_contents($configFile, "{\n}\n");
  1768. }
  1769. $this->configFile = new JsonFile($configFile, null, $io);
  1770. $this->configSource = new JsonConfigSource($this->configFile);
  1771. $authConfigFile = $input->getOption('global')
  1772. ? ($this->config->get('home') . '/auth.json')
  1773. : dirname(realpath($configFile)) . '/auth.json';
  1774. $this->authConfigFile = new JsonFile($authConfigFile, null, $io);
  1775. $this->authConfigSource = new JsonConfigSource($this->authConfigFile, true);
  1776. if ($input->getOption('global') && !$this->configFile->exists()) {
  1777. touch($this->configFile->getPath());
  1778. $this->configFile->write(array('config' => new \ArrayObject));
  1779. Silencer::call('chmod', $this->configFile->getPath(), 0600);
  1780. }
  1781. if ($input->getOption('global') && !$this->authConfigFile->exists()) {
  1782. touch($this->authConfigFile->getPath());
  1783. $this->authConfigFile->write(array('bitbucket-oauth' => new \ArrayObject, 'github-oauth' => new \ArrayObject, 'gitlab-oauth' => new \ArrayObject, 'gitlab-token' => new \ArrayObject, 'http-basic' => new \ArrayObject));
  1784. Silencer::call('chmod', $this->authConfigFile->getPath(), 0600);
  1785. }
  1786. if (!$this->configFile->exists()) {
  1787. throw new \RuntimeException(sprintf('File "%s" cannot be found in the current directory', $configFile));
  1788. }
  1789. }
  1790. protected function execute(InputInterface $input, OutputInterface $output)
  1791. {
  1792. if ($input->getOption('editor')) {
  1793. $editor = escapeshellcmd(getenv('EDITOR'));
  1794. if (!$editor) {
  1795. if (Platform::isWindows()) {
  1796. $editor = 'notepad';
  1797. } else {
  1798. foreach (array('editor', 'vim', 'vi', 'nano', 'pico', 'ed') as $candidate) {
  1799. if (exec('which '.$candidate)) {
  1800. $editor = $candidate;
  1801. break;
  1802. }
  1803. }
  1804. }
  1805. }
  1806. $file = $input->getOption('auth') ? $this->authConfigFile->getPath() : $this->configFile->getPath();
  1807. system($editor . ' ' . $file . (Platform::isWindows() ? '' : ' > `tty`'));
  1808. return 0;
  1809. }
  1810. if (!$input->getOption('global')) {
  1811. $this->config->merge($this->configFile->read());
  1812. $this->config->merge(array('config' => $this->authConfigFile->exists() ? $this->authConfigFile->read() : array()));
  1813. }
  1814. if ($input->getOption('list')) {
  1815. $this->listConfiguration($this->config->all(), $this->config->raw(), $output);
  1816. return 0;
  1817. }
  1818. $settingKey = $input->getArgument('setting-key');
  1819. if (!$settingKey) {
  1820. return 0;
  1821. }
  1822. if (array() !== $input->getArgument('setting-value') && $input->getOption('unset')) {
  1823. throw new \RuntimeException('You can not combine a setting value with --unset');
  1824. }
  1825. if (array() === $input->getArgument('setting-value') && !$input->getOption('unset')) {
  1826. $properties = array('name', 'type', 'description', 'homepage', 'version', 'minimum-stability', 'prefer-stable', 'keywords', 'license', 'extra');
  1827. $rawData = $this->configFile->read();
  1828. $data = $this->config->all();
  1829. if (preg_match('/^repos?(?:itories)?(?:\.(.+))?/', $settingKey, $matches)) {
  1830. if (!isset($matches[1]) || $matches[1] === '') {
  1831. $value = isset($data['repositories']) ? $data['repositories'] : array();
  1832. } else {
  1833. if (!isset($data['repositories'][$matches[1]])) {
  1834. throw new \InvalidArgumentException('There is no '.$matches[1].' repository defined');
  1835. }
  1836. $value = $data['repositories'][$matches[1]];
  1837. }
  1838. } elseif (strpos($settingKey, '.')) {
  1839. $bits = explode('.', $settingKey);
  1840. if ($bits[0] === 'extra') {
  1841. $data = $rawData;
  1842. } else {
  1843. $data = $data['config'];
  1844. }
  1845. $match = false;
  1846. foreach ($bits as $bit) {
  1847. $key = isset($key) ? $key.'.'.$bit : $bit;
  1848. $match = false;
  1849. if (isset($data[$key])) {
  1850. $match = true;
  1851. $data = $data[$key];
  1852. unset($key);
  1853. }
  1854. }
  1855. if (!$match) {
  1856. throw new \RuntimeException($settingKey.' is not defined.');
  1857. }
  1858. $value = $data;
  1859. } elseif (isset($data['config'][$settingKey])) {
  1860. $value = $this->config->get($settingKey, $input->getOption('absolute') ? 0 : Config::RELATIVE_PATHS);
  1861. } elseif (in_array($settingKey, $properties, true) && isset($rawData[$settingKey])) {
  1862. $value = $rawData[$settingKey];
  1863. } else {
  1864. throw new \RuntimeException($settingKey.' is not defined');
  1865. }
  1866. if (is_array($value)) {
  1867. $value = json_encode($value);
  1868. }
  1869. $this->getIO()->write($value, true, IOInterface::QUIET);
  1870. return 0;
  1871. }
  1872. $values = $input->getArgument('setting-value');
  1873. $booleanValidator = function ($val) {
  1874. return in_array($val, array('true', 'false', '1', '0'), true);
  1875. };
  1876. $booleanNormalizer = function ($val) {
  1877. return $val !== 'false' && (bool) $val;
  1878. };
  1879. $uniqueConfigValues = array(
  1880. 'process-timeout' => array('is_numeric', 'intval'),
  1881. 'use-include-path' => array($booleanValidator, $booleanNormalizer),
  1882. 'use-github-api' => array($booleanValidator, $booleanNormalizer),
  1883. 'preferred-install' => array(
  1884. function ($val) {
  1885. return in_array($val, array('auto', 'source', 'dist'), true);
  1886. },
  1887. function ($val) {
  1888. return $val;
  1889. },
  1890. ),
  1891. 'store-auths' => array(
  1892. function ($val) {
  1893. return in_array($val, array('true', 'false', 'prompt'), true);
  1894. },
  1895. function ($val) {
  1896. if ('prompt' === $val) {
  1897. return 'prompt';
  1898. }
  1899. return $val !== 'false' && (bool) $val;
  1900. },
  1901. ),
  1902. 'notify-on-install' => array($booleanValidator, $booleanNormalizer),
  1903. 'vendor-dir' => array('is_string', function ($val) {
  1904. return $val;
  1905. }),
  1906. 'bin-dir' => array('is_string', function ($val) {
  1907. return $val;
  1908. }),
  1909. 'archive-dir' => array('is_string', function ($val) {
  1910. return $val;
  1911. }),
  1912. 'archive-format' => array('is_string', function ($val) {
  1913. return $val;
  1914. }),
  1915. 'data-dir' => array('is_string', function ($val) {
  1916. return $val;
  1917. }),
  1918. 'cache-dir' => array('is_string', function ($val) {
  1919. return $val;
  1920. }),
  1921. 'cache-files-dir' => array('is_string', function ($val) {
  1922. return $val;
  1923. }),
  1924. 'cache-repo-dir' => array('is_string', function ($val) {
  1925. return $val;
  1926. }),
  1927. 'cache-vcs-dir' => array('is_string', function ($val) {
  1928. return $val;
  1929. }),
  1930. 'cache-ttl' => array('is_numeric', 'intval'),
  1931. 'cache-files-ttl' => array('is_numeric', 'intval'),
  1932. 'cache-files-maxsize' => array(
  1933. function ($val) {
  1934. return preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $val) > 0;
  1935. },
  1936. function ($val) {
  1937. return $val;
  1938. },
  1939. ),
  1940. 'bin-compat' => array(
  1941. function ($val) {
  1942. return in_array($val, array('auto', 'full'));
  1943. },
  1944. function ($val) {
  1945. return $val;
  1946. },
  1947. ),
  1948. 'discard-changes' => array(
  1949. function ($val) {
  1950. return in_array($val, array('stash', 'true', 'false', '1', '0'), true);
  1951. },
  1952. function ($val) {
  1953. if ('stash' === $val) {
  1954. return 'stash';
  1955. }
  1956. return $val !== 'false' && (bool) $val;
  1957. },
  1958. ),
  1959. 'autoloader-suffix' => array('is_string', function ($val) {
  1960. return $val === 'null' ? null : $val;
  1961. }),
  1962. 'sort-packages' => array($booleanValidator, $booleanNormalizer),
  1963. 'optimize-autoloader' => array($booleanValidator, $booleanNormalizer),
  1964. 'classmap-authoritative' => array($booleanValidator, $booleanNormalizer),
  1965. 'apcu-autoloader' => array($booleanValidator, $booleanNormalizer),
  1966. 'prepend-autoloader' => array($booleanValidator, $booleanNormalizer),
  1967. 'disable-tls' => array($booleanValidator, $booleanNormalizer),
  1968. 'secure-http' => array($booleanValidator, $booleanNormalizer),
  1969. 'cafile' => array(
  1970. function ($val) {
  1971. return file_exists($val) && is_readable($val);
  1972. },
  1973. function ($val) {
  1974. return $val === 'null' ? null : $val;
  1975. },
  1976. ),
  1977. 'capath' => array(
  1978. function ($val) {
  1979. return is_dir($val) && is_readable($val);
  1980. },
  1981. function ($val) {
  1982. return $val === 'null' ? null : $val;
  1983. },
  1984. ),
  1985. 'github-expose-hostname' => array($booleanValidator, $booleanNormalizer),
  1986. 'htaccess-protect' => array($booleanValidator, $booleanNormalizer),
  1987. );
  1988. $multiConfigValues = array(
  1989. 'github-protocols' => array(
  1990. function ($vals) {
  1991. if (!is_array($vals)) {
  1992. return 'array expected';
  1993. }
  1994. foreach ($vals as $val) {
  1995. if (!in_array($val, array('git', 'https', 'ssh'))) {
  1996. return 'valid protocols include: git, https, ssh';
  1997. }
  1998. }
  1999. return true;
  2000. },
  2001. function ($vals) {
  2002. return $vals;
  2003. },
  2004. ),
  2005. 'github-domains' => array(
  2006. function ($vals) {
  2007. if (!is_array($vals)) {
  2008. return 'array expected';
  2009. }
  2010. return true;
  2011. },
  2012. function ($vals) {
  2013. return $vals;
  2014. },
  2015. ),
  2016. 'gitlab-domains' => array(
  2017. function ($vals) {
  2018. if (!is_array($vals)) {
  2019. return 'array expected';
  2020. }
  2021. return true;
  2022. },
  2023. function ($vals) {
  2024. return $vals;
  2025. },
  2026. ),
  2027. );
  2028. if ($input->getOption('unset') && (isset($uniqueConfigValues[$settingKey]) || isset($multiConfigValues[$settingKey]))) {
  2029. if ($settingKey === 'disable-tls' && $this->config->get('disable-tls')) {
  2030. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2031. }
  2032. $this->configSource->removeConfigSetting($settingKey);
  2033. return 0;
  2034. }
  2035. if (isset($uniqueConfigValues[$settingKey])) {
  2036. $this->handleSingleValue($settingKey, $uniqueConfigValues[$settingKey], $values, 'addConfigSetting');
  2037. return 0;
  2038. }
  2039. if (isset($multiConfigValues[$settingKey])) {
  2040. $this->handleMultiValue($settingKey, $multiConfigValues[$settingKey], $values, 'addConfigSetting');
  2041. return 0;
  2042. }
  2043. $uniqueProps = array(
  2044. 'name' => array('is_string', function ($val) {
  2045. return $val;
  2046. }),
  2047. 'type' => array('is_string', function ($val) {
  2048. return $val;
  2049. }),
  2050. 'description' => array('is_string', function ($val) {
  2051. return $val;
  2052. }),
  2053. 'homepage' => array('is_string', function ($val) {
  2054. return $val;
  2055. }),
  2056. 'version' => array('is_string', function ($val) {
  2057. return $val;
  2058. }),
  2059. 'minimum-stability' => array(
  2060. function ($val) {
  2061. return isset(BasePackage::$stabilities[VersionParser::normalizeStability($val)]);
  2062. },
  2063. function ($val) {
  2064. return VersionParser::normalizeStability($val);
  2065. },
  2066. ),
  2067. 'prefer-stable' => array($booleanValidator, $booleanNormalizer),
  2068. );
  2069. $multiProps = array(
  2070. 'keywords' => array(
  2071. function ($vals) {
  2072. if (!is_array($vals)) {
  2073. return 'array expected';
  2074. }
  2075. return true;
  2076. },
  2077. function ($vals) {
  2078. return $vals;
  2079. },
  2080. ),
  2081. 'license' => array(
  2082. function ($vals) {
  2083. if (!is_array($vals)) {
  2084. return 'array expected';
  2085. }
  2086. return true;
  2087. },
  2088. function ($vals) {
  2089. return $vals;
  2090. },
  2091. ),
  2092. );
  2093. if ($input->getOption('global') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]) || substr($settingKey, 0, 6) === 'extra.')) {
  2094. 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');
  2095. }
  2096. if ($input->getOption('unset') && (isset($uniqueProps[$settingKey]) || isset($multiProps[$settingKey]))) {
  2097. $this->configSource->removeProperty($settingKey);
  2098. return 0;
  2099. }
  2100. if (isset($uniqueProps[$settingKey])) {
  2101. $this->handleSingleValue($settingKey, $uniqueProps[$settingKey], $values, 'addProperty');
  2102. return 0;
  2103. }
  2104. if (isset($multiProps[$settingKey])) {
  2105. $this->handleMultiValue($settingKey, $multiProps[$settingKey], $values, 'addProperty');
  2106. return 0;
  2107. }
  2108. if (preg_match('/^repos?(?:itories)?\.(.+)/', $settingKey, $matches)) {
  2109. if ($input->getOption('unset')) {
  2110. $this->configSource->removeRepository($matches[1]);
  2111. return 0;
  2112. }
  2113. if (2 === count($values)) {
  2114. $this->configSource->addRepository($matches[1], array(
  2115. 'type' => $values[0],
  2116. 'url' => $values[1],
  2117. ));
  2118. return 0;
  2119. }
  2120. if (1 === count($values)) {
  2121. $value = strtolower($values[0]);
  2122. if (true === $booleanValidator($value)) {
  2123. if (false === $booleanNormalizer($value)) {
  2124. $this->configSource->addRepository($matches[1], false);
  2125. return 0;
  2126. }
  2127. } else {
  2128. $value = JsonFile::parseJson($values[0]);
  2129. $this->configSource->addRepository($matches[1], $value);
  2130. return 0;
  2131. }
  2132. }
  2133. throw new \RuntimeException('You must pass the type and a url. Example: php composer.phar config repositories.foo vcs https://bar.com');
  2134. }
  2135. if (preg_match('/^extra\.(.+)/', $settingKey, $matches)) {
  2136. if ($input->getOption('unset')) {
  2137. $this->configSource->removeProperty($settingKey);
  2138. return 0;
  2139. }
  2140. $this->configSource->addProperty($settingKey, $values[0]);
  2141. return 0;
  2142. }
  2143. if (preg_match('/^platform\.(.+)/', $settingKey, $matches)) {
  2144. if ($input->getOption('unset')) {
  2145. $this->configSource->removeConfigSetting($settingKey);
  2146. return 0;
  2147. }
  2148. $this->configSource->addConfigSetting($settingKey, $values[0]);
  2149. return 0;
  2150. }
  2151. if ($settingKey === 'platform' && $input->getOption('unset')) {
  2152. $this->configSource->removeConfigSetting($settingKey);
  2153. return 0;
  2154. }
  2155. if (preg_match('/^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic)\.(.+)/', $settingKey, $matches)) {
  2156. if ($input->getOption('unset')) {
  2157. $this->authConfigSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2158. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2159. return 0;
  2160. }
  2161. if ($matches[1] === 'bitbucket-oauth') {
  2162. if (2 !== count($values)) {
  2163. throw new \RuntimeException('Expected two arguments (consumer-key, consumer-secret), got '.count($values));
  2164. }
  2165. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2166. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('consumer-key' => $values[0], 'consumer-secret' => $values[1]));
  2167. } elseif (in_array($matches[1], array('github-oauth', 'gitlab-oauth', 'gitlab-token'), true)) {
  2168. if (1 !== count($values)) {
  2169. throw new \RuntimeException('Too many arguments, expected only one token');
  2170. }
  2171. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2172. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], $values[0]);
  2173. } elseif ($matches[1] === 'http-basic') {
  2174. if (2 !== count($values)) {
  2175. throw new \RuntimeException('Expected two arguments (username, password), got '.count($values));
  2176. }
  2177. $this->configSource->removeConfigSetting($matches[1].'.'.$matches[2]);
  2178. $this->authConfigSource->addConfigSetting($matches[1].'.'.$matches[2], array('username' => $values[0], 'password' => $values[1]));
  2179. }
  2180. return 0;
  2181. }
  2182. if (preg_match('/^scripts\.(.+)/', $settingKey, $matches)) {
  2183. if ($input->getOption('unset')) {
  2184. $this->configSource->removeProperty($settingKey);
  2185. return 0;
  2186. }
  2187. $this->configSource->addProperty($settingKey, count($values) > 1 ? $values : $values[0]);
  2188. return 0;
  2189. }
  2190. throw new \InvalidArgumentException('Setting '.$settingKey.' does not exist or is not supported by this command');
  2191. }
  2192. protected function handleSingleValue($key, array $callbacks, array $values, $method)
  2193. {
  2194. list($validator, $normalizer) = $callbacks;
  2195. if (1 !== count($values)) {
  2196. throw new \RuntimeException('You can only pass one value. Example: php composer.phar config process-timeout 300');
  2197. }
  2198. if (true !== $validation = $validator($values[0])) {
  2199. throw new \RuntimeException(sprintf(
  2200. '"%s" is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2201. $values[0]
  2202. ));
  2203. }
  2204. $normalizedValue = $normalizer($values[0]);
  2205. if ($key === 'disable-tls') {
  2206. if (!$normalizedValue && $this->config->get('disable-tls')) {
  2207. $this->getIO()->writeError('<info>You are now running Composer with SSL/TLS protection enabled.</info>');
  2208. } elseif ($normalizedValue && !$this->config->get('disable-tls')) {
  2209. $this->getIO()->writeError('<warning>You are now running Composer with SSL/TLS protection disabled.</warning>');
  2210. }
  2211. }
  2212. return call_user_func(array($this->configSource, $method), $key, $normalizedValue);
  2213. }
  2214. protected function handleMultiValue($key, array $callbacks, array $values, $method)
  2215. {
  2216. list($validator, $normalizer) = $callbacks;
  2217. if (true !== $validation = $validator($values)) {
  2218. throw new \RuntimeException(sprintf(
  2219. '%s is an invalid value'.($validation ? ' ('.$validation.')' : ''),
  2220. json_encode($values)
  2221. ));
  2222. }
  2223. return call_user_func(array($this->configSource, $method), $key, $normalizer($values));
  2224. }
  2225. protected function listConfiguration(array $contents, array $rawContents, OutputInterface $output, $k = null)
  2226. {
  2227. $origK = $k;
  2228. $io = $this->getIO();
  2229. foreach ($contents as $key => $value) {
  2230. if ($k === null && !in_array($key, array('config', 'repositories'))) {
  2231. continue;
  2232. }
  2233. $rawVal = isset($rawContents[$key]) ? $rawContents[$key] : null;
  2234. if (is_array($value) && (!is_numeric(key($value)) || ($key === 'repositories' && null === $k))) {
  2235. $k .= preg_replace('{^config\.}', '', $key . '.');
  2236. $this->listConfiguration($value, $rawVal, $output, $k);
  2237. $k = $origK;
  2238. continue;
  2239. }
  2240. if (is_array($value)) {
  2241. $value = array_map(function ($val) {
  2242. return is_array($val) ? json_encode($val) : $val;
  2243. }, $value);
  2244. $value = '['.implode(', ', $value).']';
  2245. }
  2246. if (is_bool($value)) {
  2247. $value = var_export($value, true);
  2248. }
  2249. if (is_string($rawVal) && $rawVal != $value) {
  2250. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $rawVal . ' (' . $value . ')</info>', true, IOInterface::QUIET);
  2251. } else {
  2252. $io->write('[<comment>' . $k . $key . '</comment>] <info>' . $value . '</info>', true, IOInterface::QUIET);
  2253. }
  2254. }
  2255. }
  2256. }
  2257. <?php
  2258. namespace Composer\Command;
  2259. use Composer\Config;
  2260. use Composer\Factory;
  2261. use Composer\Installer;
  2262. use Composer\Installer\ProjectInstaller;
  2263. use Composer\Installer\InstallationManager;
  2264. use Composer\Installer\SuggestedPackagesReporter;
  2265. use Composer\IO\IOInterface;
  2266. use Composer\Package\BasePackage;
  2267. use Composer\DependencyResolver\Pool;
  2268. use Composer\DependencyResolver\Operation\InstallOperation;
  2269. use Composer\Package\Version\VersionSelector;
  2270. use Composer\Package\AliasPackage;
  2271. use Composer\Repository\RepositoryFactory;
  2272. use Composer\Repository\CompositeRepository;
  2273. use Composer\Repository\PlatformRepository;
  2274. use Composer\Repository\InstalledFilesystemRepository;
  2275. use Composer\Script\ScriptEvents;
  2276. use Composer\Util\Silencer;
  2277. use Symfony\Component\Console\Input\InputArgument;
  2278. use Symfony\Component\Console\Input\InputInterface;
  2279. use Symfony\Component\Console\Input\InputOption;
  2280. use Symfony\Component\Console\Output\OutputInterface;
  2281. use Symfony\Component\Finder\Finder;
  2282. use Composer\Json\JsonFile;
  2283. use Composer\Config\JsonConfigSource;
  2284. use Composer\Util\Filesystem;
  2285. use Composer\Package\Version\VersionParser;
  2286. class CreateProjectCommand extends BaseCommand
  2287. {
  2288. protected $suggestedPackagesReporter;
  2289. protected function configure()
  2290. {
  2291. $this
  2292. ->setName('create-project')
  2293. ->setDescription('Creates new project from a package into given directory.')
  2294. ->setDefinition(array(
  2295. new InputArgument('package', InputArgument::OPTIONAL, 'Package name to be installed'),
  2296. new InputArgument('directory', InputArgument::OPTIONAL, 'Directory where the files should be created'),
  2297. new InputArgument('version', InputArgument::OPTIONAL, 'Version, will default to latest'),
  2298. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum-stability allowed (unless a version is specified).'),
  2299. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  2300. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  2301. new InputOption('repository', null, InputOption::VALUE_REQUIRED, 'Pick a different repository (as url or json config) to look for the package.'),
  2302. new InputOption('repository-url', null, InputOption::VALUE_REQUIRED, 'DEPRECATED: Use --repository instead.'),
  2303. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  2304. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  2305. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  2306. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Whether to prevent execution of all defined scripts in the root package.'),
  2307. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  2308. 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.'),
  2309. new InputOption('keep-vcs', null, InputOption::VALUE_NONE, 'Whether to prevent deleting the vcs folder.'),
  2310. new InputOption('remove-vcs', null, InputOption::VALUE_NONE, 'Whether to force deletion of the vcs folder without prompting.'),
  2311. new InputOption('no-install', null, InputOption::VALUE_NONE, 'Whether to skip installation of the package dependencies.'),
  2312. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  2313. ))
  2314. ->setHelp(
  2315. <<<EOT
  2316. The <info>create-project</info> command creates a new project from a given
  2317. package into a new directory. If executed without params and in a directory
  2318. with a composer.json file it installs the packages for the current project.
  2319. You can use this command to bootstrap new projects or setup a clean
  2320. version-controlled installation for developers of your project.
  2321. <info>php composer.phar create-project vendor/project target-directory [version]</info>
  2322. You can also specify the version with the package name using = or : as separator.
  2323. <info>php composer.phar create-project vendor/project:version target-directory</info>
  2324. To install unstable packages, either specify the version you want, or use the
  2325. --stability=dev (where dev can be one of RC, beta, alpha or dev).
  2326. To setup a developer workable version you should create the project using the source
  2327. controlled code by appending the <info>'--prefer-source'</info> flag.
  2328. To install a package from another repository than the default one you
  2329. can pass the <info>'--repository=https://myrepository.org'</info> flag.
  2330. Read more at https://getcomposer.org/doc/03-cli.md#create-project
  2331. EOT
  2332. )
  2333. ;
  2334. }
  2335. protected function execute(InputInterface $input, OutputInterface $output)
  2336. {
  2337. $config = Factory::createConfig();
  2338. $io = $this->getIO();
  2339. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input, true);
  2340. if ($input->getOption('dev')) {
  2341. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  2342. }
  2343. if ($input->getOption('no-custom-installers')) {
  2344. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  2345. $input->setOption('no-plugins', true);
  2346. }
  2347. return $this->installProject(
  2348. $io,
  2349. $config,
  2350. $input,
  2351. $input->getArgument('package'),
  2352. $input->getArgument('directory'),
  2353. $input->getArgument('version'),
  2354. $input->getOption('stability'),
  2355. $preferSource,
  2356. $preferDist,
  2357. !$input->getOption('no-dev'),
  2358. $input->getOption('repository') ?: $input->getOption('repository-url'),
  2359. $input->getOption('no-plugins'),
  2360. $input->getOption('no-scripts'),
  2361. $input->getOption('no-progress'),
  2362. $input->getOption('no-install'),
  2363. $input->getOption('ignore-platform-reqs'),
  2364. !$input->getOption('no-secure-http')
  2365. );
  2366. }
  2367. 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)
  2368. {
  2369. $oldCwd = getcwd();
  2370. $io->loadConfiguration($config);
  2371. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($io);
  2372. if ($packageName !== null) {
  2373. $installedFromVcs = $this->installRootPackage($io, $config, $packageName, $directory, $packageVersion, $stability, $preferSource, $preferDist, $installDevPackages, $repository, $disablePlugins, $noScripts, $noProgress, $ignorePlatformReqs, $secureHttp);
  2374. } else {
  2375. $installedFromVcs = false;
  2376. }
  2377. $composer = Factory::create($io, null, $disablePlugins);
  2378. $composer->getDownloadManager()->setOutputProgress(!$noProgress);
  2379. $fs = new Filesystem();
  2380. if ($noScripts === false) {
  2381. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_ROOT_PACKAGE_INSTALL, $installDevPackages);
  2382. }
  2383. $config = $composer->getConfig();
  2384. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  2385. if ($noInstall === false) {
  2386. $installer = Installer::create($io, $composer);
  2387. $installer->setPreferSource($preferSource)
  2388. ->setPreferDist($preferDist)
  2389. ->setDevMode($installDevPackages)
  2390. ->setRunScripts(!$noScripts)
  2391. ->setIgnorePlatformRequirements($ignorePlatformReqs)
  2392. ->setSuggestedPackagesReporter($this->suggestedPackagesReporter)
  2393. ->setOptimizeAutoloader($config->get('optimize-autoloader'))
  2394. ->setClassMapAuthoritative($config->get('classmap-authoritative'))
  2395. ->setApcuAutoloader($config->get('apcu-autoloader'));
  2396. if ($disablePlugins) {
  2397. $installer->disablePlugins();
  2398. }
  2399. $status = $installer->run();
  2400. if (0 !== $status) {
  2401. return $status;
  2402. }
  2403. }
  2404. $hasVcs = $installedFromVcs;
  2405. if (
  2406. !$input->getOption('keep-vcs')
  2407. && $installedFromVcs
  2408. && (
  2409. $input->getOption('remove-vcs')
  2410. || !$io->isInteractive()
  2411. || $io->askConfirmation('<info>Do you want to remove the existing VCS (.git, .svn..) history?</info> [<comment>Y,n</comment>]? ', true)
  2412. )
  2413. ) {
  2414. $finder = new Finder();
  2415. $finder->depth(0)->directories()->in(getcwd())->ignoreVCS(false)->ignoreDotFiles(false);
  2416. foreach (array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg', '.fslckout', '_FOSSIL_') as $vcsName) {
  2417. $finder->name($vcsName);
  2418. }
  2419. try {
  2420. $dirs = iterator_to_array($finder);
  2421. unset($finder);
  2422. foreach ($dirs as $dir) {
  2423. if (!$fs->removeDirectory($dir)) {
  2424. throw new \RuntimeException('Could not remove '.$dir);
  2425. }
  2426. }
  2427. } catch (\Exception $e) {
  2428. $io->writeError('<error>An error occurred while removing the VCS metadata: '.$e->getMessage().'</error>');
  2429. }
  2430. $hasVcs = false;
  2431. }
  2432. if (!$hasVcs) {
  2433. $package = $composer->getPackage();
  2434. $configSource = new JsonConfigSource(new JsonFile('composer.json'));
  2435. foreach (BasePackage::$supportedLinkTypes as $type => $meta) {
  2436. foreach ($package->{'get'.$meta['method']}() as $link) {
  2437. if ($link->getPrettyConstraint() === 'self.version') {
  2438. $configSource->addLink($type, $link->getTarget(), $package->getPrettyVersion());
  2439. }
  2440. }
  2441. }
  2442. }
  2443. if ($noScripts === false) {
  2444. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_CREATE_PROJECT_CMD, $installDevPackages);
  2445. }
  2446. chdir($oldCwd);
  2447. $vendorComposerDir = $config->get('vendor-dir').'/composer';
  2448. if (is_dir($vendorComposerDir) && $fs->isDirEmpty($vendorComposerDir)) {
  2449. Silencer::call('rmdir', $vendorComposerDir);
  2450. $vendorDir = $config->get('vendor-dir');
  2451. if (is_dir($vendorDir) && $fs->isDirEmpty($vendorDir)) {
  2452. Silencer::call('rmdir', $vendorDir);
  2453. }
  2454. }
  2455. return 0;
  2456. }
  2457. 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)
  2458. {
  2459. if (!$secureHttp) {
  2460. $config->merge(array('config' => array('secure-http' => false)));
  2461. }
  2462. if (null === $repository) {
  2463. $sourceRepo = new CompositeRepository(RepositoryFactory::defaultRepos($io, $config));
  2464. } else {
  2465. $sourceRepo = RepositoryFactory::fromString($io, $config, $repository, true);
  2466. }
  2467. $parser = new VersionParser();
  2468. $requirements = $parser->parseNameVersionPairs(array($packageName));
  2469. $name = strtolower($requirements[0]['name']);
  2470. if (!$packageVersion && isset($requirements[0]['version'])) {
  2471. $packageVersion = $requirements[0]['version'];
  2472. }
  2473. if (null === $stability) {
  2474. if (preg_match('{^[^,\s]*?@('.implode('|', array_keys(BasePackage::$stabilities)).')$}i', $packageVersion, $match)) {
  2475. $stability = $match[1];
  2476. } else {
  2477. $stability = VersionParser::parseStability($packageVersion);
  2478. }
  2479. }
  2480. $stability = VersionParser::normalizeStability($stability);
  2481. if (!isset(BasePackage::$stabilities[$stability])) {
  2482. throw new \InvalidArgumentException('Invalid stability provided ('.$stability.'), must be one of: '.implode(', ', array_keys(BasePackage::$stabilities)));
  2483. }
  2484. $pool = new Pool($stability);
  2485. $pool->addRepository($sourceRepo);
  2486. $phpVersion = null;
  2487. $prettyPhpVersion = null;
  2488. if (!$ignorePlatformReqs) {
  2489. $platformOverrides = $config->get('platform') ?: array();
  2490. $platform = new PlatformRepository(array(), $platformOverrides);
  2491. $phpPackage = $platform->findPackage('php', '*');
  2492. $phpVersion = $phpPackage->getVersion();
  2493. $prettyPhpVersion = $phpPackage->getPrettyVersion();
  2494. }
  2495. $versionSelector = new VersionSelector($pool);
  2496. $package = $versionSelector->findBestCandidate($name, $packageVersion, $phpVersion, $stability);
  2497. if (!$package) {
  2498. $errorMessage = "Could not find package $name with " . ($packageVersion ? "version $packageVersion" : "stability $stability");
  2499. if ($phpVersion && $versionSelector->findBestCandidate($name, $packageVersion, null, $stability)) {
  2500. throw new \InvalidArgumentException($errorMessage .' in a version installable using your PHP version '.$prettyPhpVersion.'.');
  2501. }
  2502. throw new \InvalidArgumentException($errorMessage .'.');
  2503. }
  2504. if (null === $directory) {
  2505. $parts = explode("/", $name, 2);
  2506. $directory = getcwd() . DIRECTORY_SEPARATOR . array_pop($parts);
  2507. }
  2508. if (function_exists('pcntl_async_signals')) {
  2509. @mkdir($directory, 0777, true);
  2510. if ($realDir = realpath($directory)) {
  2511. pcntl_async_signals(true);
  2512. pcntl_signal(SIGINT, function () use ($realDir) {
  2513. $fs = new Filesystem();
  2514. $fs->removeDirectory($realDir);
  2515. exit(130);
  2516. });
  2517. }
  2518. }
  2519. $io->writeError('<info>Installing ' . $package->getName() . ' (' . $package->getFullPrettyVersion(false) . ')</info>');
  2520. if ($disablePlugins) {
  2521. $io->writeError('<info>Plugins have been disabled.</info>');
  2522. }
  2523. if ($package instanceof AliasPackage) {
  2524. $package = $package->getAliasOf();
  2525. }
  2526. $dm = $this->createDownloadManager($io, $config);
  2527. $dm->setPreferSource($preferSource)
  2528. ->setPreferDist($preferDist)
  2529. ->setOutputProgress(!$noProgress);
  2530. $projectInstaller = new ProjectInstaller($directory, $dm);
  2531. $im = $this->createInstallationManager();
  2532. $im->addInstaller($projectInstaller);
  2533. $im->install(new InstalledFilesystemRepository(new JsonFile('php://memory')), new InstallOperation($package));
  2534. $im->notifyInstalls($io);
  2535. $this->suggestedPackagesReporter->addSuggestionsFromPackage($package);
  2536. $installedFromVcs = 'source' === $package->getInstallationSource();
  2537. $io->writeError('<info>Created project in ' . $directory . '</info>');
  2538. chdir($directory);
  2539. $_SERVER['COMPOSER_ROOT_VERSION'] = $package->getPrettyVersion();
  2540. putenv('COMPOSER_ROOT_VERSION='.$_SERVER['COMPOSER_ROOT_VERSION']);
  2541. return $installedFromVcs;
  2542. }
  2543. protected function createDownloadManager(IOInterface $io, Config $config)
  2544. {
  2545. $factory = new Factory();
  2546. return $factory->createDownloadManager($io, $config);
  2547. }
  2548. protected function createInstallationManager()
  2549. {
  2550. return new InstallationManager();
  2551. }
  2552. }
  2553. <?php
  2554. namespace Composer\Command;
  2555. use Symfony\Component\Console\Input\InputInterface;
  2556. use Symfony\Component\Console\Output\OutputInterface;
  2557. class DependsCommand extends BaseDependencyCommand
  2558. {
  2559. protected function configure()
  2560. {
  2561. parent::configure();
  2562. $this
  2563. ->setName('depends')
  2564. ->setAliases(array('why'))
  2565. ->setDescription('Shows which packages cause the given package to be installed.')
  2566. ->setHelp(
  2567. <<<EOT
  2568. Displays detailed information about where a package is referenced.
  2569. <info>php composer.phar depends composer/composer</info>
  2570. Read more at https://getcomposer.org/doc/03-cli.md#depends-why-
  2571. EOT
  2572. )
  2573. ;
  2574. }
  2575. protected function execute(InputInterface $input, OutputInterface $output)
  2576. {
  2577. return parent::doExecute($input, $output, false);
  2578. }
  2579. }
  2580. <?php
  2581. namespace Composer\Command;
  2582. use Composer\Composer;
  2583. use Composer\Factory;
  2584. use Composer\Config;
  2585. use Composer\Downloader\TransportException;
  2586. use Composer\Repository\PlatformRepository;
  2587. use Composer\Plugin\CommandEvent;
  2588. use Composer\Plugin\PluginEvents;
  2589. use Composer\Util\ConfigValidator;
  2590. use Composer\Util\IniHelper;
  2591. use Composer\Util\ProcessExecutor;
  2592. use Composer\Util\RemoteFilesystem;
  2593. use Composer\Util\StreamContextFactory;
  2594. use Composer\SelfUpdate\Keys;
  2595. use Composer\SelfUpdate\Versions;
  2596. use Composer\IO\NullIO;
  2597. use Symfony\Component\Console\Input\InputInterface;
  2598. use Symfony\Component\Console\Output\OutputInterface;
  2599. class DiagnoseCommand extends BaseCommand
  2600. {
  2601. protected $rfs;
  2602. protected $process;
  2603. protected $exitCode = 0;
  2604. protected function configure()
  2605. {
  2606. $this
  2607. ->setName('diagnose')
  2608. ->setDescription('Diagnoses the system to identify common errors.')
  2609. ->setHelp(
  2610. <<<EOT
  2611. The <info>diagnose</info> command checks common errors to help debugging problems.
  2612. The process exit code will be 1 in case of warnings and 2 for errors.
  2613. Read more at https://getcomposer.org/doc/03-cli.md#diagnose
  2614. EOT
  2615. )
  2616. ;
  2617. }
  2618. protected function execute(InputInterface $input, OutputInterface $output)
  2619. {
  2620. $composer = $this->getComposer(false);
  2621. $io = $this->getIO();
  2622. if ($composer) {
  2623. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'diagnose', $input, $output);
  2624. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  2625. $io->write('Checking composer.json: ', false);
  2626. $this->outputResult($this->checkComposerSchema());
  2627. }
  2628. if ($composer) {
  2629. $config = $composer->getConfig();
  2630. } else {
  2631. $config = Factory::createConfig();
  2632. }
  2633. $config->merge(array('config' => array('secure-http' => false)));
  2634. $config->prohibitUrlByConfig('http://repo.packagist.org', new NullIO);
  2635. $this->rfs = Factory::createRemoteFilesystem($io, $config);
  2636. $this->process = new ProcessExecutor($io);
  2637. $io->write('Checking platform settings: ', false);
  2638. $this->outputResult($this->checkPlatform());
  2639. $io->write('Checking git settings: ', false);
  2640. $this->outputResult($this->checkGit());
  2641. $io->write('Checking http connectivity to packagist: ', false);
  2642. $this->outputResult($this->checkHttp('http', $config));
  2643. $io->write('Checking https connectivity to packagist: ', false);
  2644. $this->outputResult($this->checkHttp('https', $config));
  2645. $opts = stream_context_get_options(StreamContextFactory::getContext('http://example.org'));
  2646. if (!empty($opts['http']['proxy'])) {
  2647. $io->write('Checking HTTP proxy: ', false);
  2648. $this->outputResult($this->checkHttpProxy());
  2649. $io->write('Checking HTTP proxy support for request_fulluri: ', false);
  2650. $this->outputResult($this->checkHttpProxyFullUriRequestParam());
  2651. $io->write('Checking HTTPS proxy support for request_fulluri: ', false);
  2652. $this->outputResult($this->checkHttpsProxyFullUriRequestParam());
  2653. }
  2654. if ($oauth = $config->get('github-oauth')) {
  2655. foreach ($oauth as $domain => $token) {
  2656. $io->write('Checking '.$domain.' oauth access: ', false);
  2657. $this->outputResult($this->checkGithubOauth($domain, $token));
  2658. }
  2659. } else {
  2660. $io->write('Checking github.com rate limit: ', false);
  2661. try {
  2662. $rate = $this->getGithubRateLimit('github.com');
  2663. if (!is_array($rate)) {
  2664. $this->outputResult($rate);
  2665. } elseif (10 > $rate['remaining']) {
  2666. $io->write('<warning>WARNING</warning>');
  2667. $io->write(sprintf(
  2668. '<comment>Github has a rate limit on their API. '
  2669. . 'You currently have <options=bold>%u</options=bold> '
  2670. . 'out of <options=bold>%u</options=bold> requests left.' . PHP_EOL
  2671. . 'See https://developer.github.com/v3/#rate-limiting and also' . PHP_EOL
  2672. . ' https://getcomposer.org/doc/articles/troubleshooting.md#api-rate-limit-and-oauth-tokens</comment>',
  2673. $rate['remaining'],
  2674. $rate['limit']
  2675. ));
  2676. } else {
  2677. $this->outputResult(true);
  2678. }
  2679. } catch (\Exception $e) {
  2680. if ($e instanceof TransportException && $e->getCode() === 401) {
  2681. $this->outputResult('<comment>The oauth token for github.com seems invalid, run "composer config --global --unset github-oauth.github.com" to remove it</comment>');
  2682. } else {
  2683. $this->outputResult($e);
  2684. }
  2685. }
  2686. }
  2687. $io->write('Checking disk free space: ', false);
  2688. $this->outputResult($this->checkDiskSpace($config));
  2689. if ('phar:' === substr(__FILE__, 0, 5)) {
  2690. $io->write('Checking pubkeys: ', false);
  2691. $this->outputResult($this->checkPubKeys($config));
  2692. $io->write('Checking composer version: ', false);
  2693. $this->outputResult($this->checkVersion($config));
  2694. }
  2695. $io->write(sprintf('Composer version: <comment>%s</comment>', Composer::VERSION));
  2696. $platformOverrides = $config->get('platform') ?: array();
  2697. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  2698. $phpPkg = $platformRepo->findPackage('php', '*');
  2699. $phpVersion = $phpPkg->getPrettyVersion();
  2700. if (false !== strpos($phpPkg->getDescription(), 'overridden')) {
  2701. $phpVersion .= ' - ' . $phpPkg->getDescription();
  2702. }
  2703. $io->write(sprintf('PHP version: <comment>%s</comment>', $phpVersion));
  2704. if (defined('PHP_BINARY')) {
  2705. $io->write(sprintf('PHP binary path: <comment>%s</comment>', PHP_BINARY));
  2706. }
  2707. return $this->exitCode;
  2708. }
  2709. private function checkComposerSchema()
  2710. {
  2711. $validator = new ConfigValidator($this->getIO());
  2712. list($errors, , $warnings) = $validator->validate(Factory::getComposerFile());
  2713. if ($errors || $warnings) {
  2714. $messages = array(
  2715. 'error' => $errors,
  2716. 'warning' => $warnings,
  2717. );
  2718. $output = '';
  2719. foreach ($messages as $style => $msgs) {
  2720. foreach ($msgs as $msg) {
  2721. $output .= '<' . $style . '>' . $msg . '</' . $style . '>' . PHP_EOL;
  2722. }
  2723. }
  2724. return rtrim($output);
  2725. }
  2726. return true;
  2727. }
  2728. private function checkGit()
  2729. {
  2730. $this->process->execute('git config color.ui', $output);
  2731. if (strtolower(trim($output)) === 'always') {
  2732. 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>';
  2733. }
  2734. return true;
  2735. }
  2736. private function checkHttp($proto, Config $config)
  2737. {
  2738. $result = $this->checkConnectivity();
  2739. if ($result !== true) {
  2740. return $result;
  2741. }
  2742. $disableTls = false;
  2743. $result = array();
  2744. if ($proto === 'https' && $config->get('disable-tls') === true) {
  2745. $disableTls = true;
  2746. $result[] = '<warning>Composer is configured to disable SSL/TLS protection. This will leave remote HTTPS requests vulnerable to Man-In-The-Middle attacks.</warning>';
  2747. }
  2748. if ($proto === 'https' && !extension_loaded('openssl') && !$disableTls) {
  2749. $result[] = '<error>Composer is configured to use SSL/TLS protection but the openssl extension is not available.</error>';
  2750. }
  2751. try {
  2752. $this->rfs->getContents('packagist.org', $proto . '://repo.packagist.org/packages.json', false);
  2753. } catch (TransportException $e) {
  2754. if (false !== strpos($e->getMessage(), 'cafile')) {
  2755. $result[] = '<error>[' . get_class($e) . '] ' . $e->getMessage() . '</error>';
  2756. $result[] = '<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>';
  2757. $result[] = '<error>You can alternatively disable this error, at your own risk, by enabling the \'disable-tls\' option.</error>';
  2758. } else {
  2759. array_unshift($result, '[' . get_class($e) . '] ' . $e->getMessage());
  2760. }
  2761. }
  2762. if (count($result) > 0) {
  2763. return $result;
  2764. }
  2765. return true;
  2766. }
  2767. private function checkHttpProxy()
  2768. {
  2769. $result = $this->checkConnectivity();
  2770. if ($result !== true) {
  2771. return $result;
  2772. }
  2773. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  2774. try {
  2775. $json = json_decode($this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/packages.json', false), true);
  2776. $hash = reset($json['provider-includes']);
  2777. $hash = $hash['sha256'];
  2778. $path = str_replace('%hash%', $hash, key($json['provider-includes']));
  2779. $provider = $this->rfs->getContents('packagist.org', $protocol . '://repo.packagist.org/'.$path, false);
  2780. if (hash('sha256', $provider) !== $hash) {
  2781. return 'It seems that your proxy is modifying http traffic on the fly';
  2782. }
  2783. } catch (\Exception $e) {
  2784. return $e;
  2785. }
  2786. return true;
  2787. }
  2788. private function checkHttpProxyFullUriRequestParam()
  2789. {
  2790. $result = $this->checkConnectivity();
  2791. if ($result !== true) {
  2792. return $result;
  2793. }
  2794. $url = 'http://repo.packagist.org/packages.json';
  2795. try {
  2796. $this->rfs->getContents('packagist.org', $url, false);
  2797. } catch (TransportException $e) {
  2798. try {
  2799. $this->rfs->getContents('packagist.org', $url, false, array('http' => array('request_fulluri' => false)));
  2800. } catch (TransportException $e) {
  2801. return 'Unable to assess the situation, maybe packagist.org is down ('.$e->getMessage().')';
  2802. }
  2803. 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"';
  2804. }
  2805. return true;
  2806. }
  2807. private function checkHttpsProxyFullUriRequestParam()
  2808. {
  2809. $result = $this->checkConnectivity();
  2810. if ($result !== true) {
  2811. return $result;
  2812. }
  2813. if (!extension_loaded('openssl')) {
  2814. return 'You need the openssl extension installed for this check';
  2815. }
  2816. $url = 'https://api.github.com/repos/Seldaek/jsonlint/zipball/1.0.0';
  2817. try {
  2818. $this->rfs->getContents('github.com', $url, false);
  2819. } catch (TransportException $e) {
  2820. try {
  2821. $this->rfs->getContents('github.com', $url, false, array('http' => array('request_fulluri' => false)));
  2822. } catch (TransportException $e) {
  2823. return 'Unable to assess the situation, maybe github is down ('.$e->getMessage().')';
  2824. }
  2825. return 'It seems there is a problem with your proxy server, try setting the "HTTPS_PROXY_REQUEST_FULLURI" environment variable to "false"';
  2826. }
  2827. return true;
  2828. }
  2829. private function checkGithubOauth($domain, $token)
  2830. {
  2831. $result = $this->checkConnectivity();
  2832. if ($result !== true) {
  2833. return $result;
  2834. }
  2835. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2836. try {
  2837. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/' : 'https://'.$domain.'/api/v3/';
  2838. return $this->rfs->getContents($domain, $url, false, array(
  2839. 'retry-auth-failure' => false,
  2840. )) ? true : 'Unexpected error';
  2841. } catch (\Exception $e) {
  2842. if ($e instanceof TransportException && $e->getCode() === 401) {
  2843. return '<comment>The oauth token for '.$domain.' seems invalid, run "composer config --global --unset github-oauth.'.$domain.'" to remove it</comment>';
  2844. }
  2845. return $e;
  2846. }
  2847. }
  2848. private function getGithubRateLimit($domain, $token = null)
  2849. {
  2850. $result = $this->checkConnectivity();
  2851. if ($result !== true) {
  2852. return $result;
  2853. }
  2854. if ($token) {
  2855. $this->getIO()->setAuthentication($domain, $token, 'x-oauth-basic');
  2856. }
  2857. $url = $domain === 'github.com' ? 'https://api.'.$domain.'/rate_limit' : 'https://'.$domain.'/api/rate_limit';
  2858. $json = $this->rfs->getContents($domain, $url, false, array('retry-auth-failure' => false));
  2859. $data = json_decode($json, true);
  2860. return $data['resources']['core'];
  2861. }
  2862. private function checkDiskSpace($config)
  2863. {
  2864. $minSpaceFree = 1024 * 1024;
  2865. if ((($df = @disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  2866. || (($df = @disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  2867. ) {
  2868. return '<error>The disk hosting '.$dir.' is full</error>';
  2869. }
  2870. return true;
  2871. }
  2872. private function checkPubKeys($config)
  2873. {
  2874. $home = $config->get('home');
  2875. $errors = array();
  2876. $io = $this->getIO();
  2877. if (file_exists($home.'/keys.tags.pub') && file_exists($home.'/keys.dev.pub')) {
  2878. $io->write('');
  2879. }
  2880. if (file_exists($home.'/keys.tags.pub')) {
  2881. $io->write('Tags Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.tags.pub'));
  2882. } else {
  2883. $errors[] = '<error>Missing pubkey for tags verification</error>';
  2884. }
  2885. if (file_exists($home.'/keys.dev.pub')) {
  2886. $io->write('Dev Public Key Fingerprint: ' . Keys::fingerprint($home.'/keys.dev.pub'));
  2887. } else {
  2888. $errors[] = '<error>Missing pubkey for dev verification</error>';
  2889. }
  2890. if ($errors) {
  2891. $errors[] = '<error>Run composer self-update --update-keys to set them up</error>';
  2892. }
  2893. return $errors ?: true;
  2894. }
  2895. private function checkVersion($config)
  2896. {
  2897. $result = $this->checkConnectivity();
  2898. if ($result !== true) {
  2899. return $result;
  2900. }
  2901. $versionsUtil = new Versions($config, $this->rfs);
  2902. $latest = $versionsUtil->getLatest();
  2903. if (Composer::VERSION !== $latest['version'] && Composer::VERSION !== '@package_version@') {
  2904. return '<comment>You are not running the latest '.$versionsUtil->getChannel().' version, run `composer self-update` to update ('.Composer::VERSION.' => '.$latest['version'].')</comment>';
  2905. }
  2906. return true;
  2907. }
  2908. private function outputResult($result)
  2909. {
  2910. $io = $this->getIO();
  2911. if (true === $result) {
  2912. $io->write('<info>OK</info>');
  2913. return;
  2914. }
  2915. $hadError = false;
  2916. $hadWarning = false;
  2917. if ($result instanceof \Exception) {
  2918. $result = '<error>['.get_class($result).'] '.$result->getMessage().'</error>';
  2919. }
  2920. if (!$result) {
  2921. $hadError = true;
  2922. } else {
  2923. if (!is_array($result)) {
  2924. $result = array($result);
  2925. }
  2926. foreach ($result as $message) {
  2927. if (false !== strpos($message, '<error>')) {
  2928. $hadError = true;
  2929. } elseif (false !== strpos($message, '<warning>')) {
  2930. $hadWarning = true;
  2931. }
  2932. }
  2933. }
  2934. if ($hadError) {
  2935. $io->write('<error>FAIL</error>');
  2936. $this->exitCode = max($this->exitCode, 2);
  2937. } elseif ($hadWarning) {
  2938. $io->write('<warning>WARNING</warning>');
  2939. $this->exitCode = max($this->exitCode, 1);
  2940. }
  2941. if ($result) {
  2942. foreach ($result as $message) {
  2943. $io->write($message);
  2944. }
  2945. }
  2946. }
  2947. private function checkPlatform()
  2948. {
  2949. $output = '';
  2950. $out = function ($msg, $style) use (&$output) {
  2951. $output .= '<'.$style.'>'.$msg.'</'.$style.'>'.PHP_EOL;
  2952. };
  2953. $errors = array();
  2954. $warnings = array();
  2955. $displayIniMessage = false;
  2956. $iniMessage = PHP_EOL.PHP_EOL.IniHelper::getMessage();
  2957. $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.';
  2958. if (!function_exists('json_decode')) {
  2959. $errors['json'] = true;
  2960. }
  2961. if (!extension_loaded('Phar')) {
  2962. $errors['phar'] = true;
  2963. }
  2964. if (!extension_loaded('filter')) {
  2965. $errors['filter'] = true;
  2966. }
  2967. if (!extension_loaded('hash')) {
  2968. $errors['hash'] = true;
  2969. }
  2970. if (!extension_loaded('iconv') && !extension_loaded('mbstring')) {
  2971. $errors['iconv_mbstring'] = true;
  2972. }
  2973. if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  2974. $errors['allow_url_fopen'] = true;
  2975. }
  2976. if (extension_loaded('ionCube Loader') && ioncube_loader_iversion() < 40009) {
  2977. $errors['ioncube'] = ioncube_loader_version();
  2978. }
  2979. if (PHP_VERSION_ID < 50302) {
  2980. $errors['php'] = PHP_VERSION;
  2981. }
  2982. if (!isset($errors['php']) && PHP_VERSION_ID < 50304) {
  2983. $warnings['php'] = PHP_VERSION;
  2984. }
  2985. if (!extension_loaded('openssl')) {
  2986. $errors['openssl'] = true;
  2987. }
  2988. if (extension_loaded('openssl') && OPENSSL_VERSION_NUMBER < 0x1000100f) {
  2989. $warnings['openssl_version'] = true;
  2990. }
  2991. if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
  2992. $warnings['apc_cli'] = true;
  2993. }
  2994. if (!extension_loaded('zlib')) {
  2995. $warnings['zlib'] = true;
  2996. }
  2997. ob_start();
  2998. phpinfo(INFO_GENERAL);
  2999. $phpinfo = ob_get_clean();
  3000. if (preg_match('{Configure Command(?: *</td><td class="v">| *=> *)(.*?)(?:</td>|$)}m', $phpinfo, $match)) {
  3001. $configure = $match[1];
  3002. if (false !== strpos($configure, '--enable-sigchild')) {
  3003. $warnings['sigchild'] = true;
  3004. }
  3005. if (false !== strpos($configure, '--with-curlwrappers')) {
  3006. $warnings['curlwrappers'] = true;
  3007. }
  3008. }
  3009. if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
  3010. $warnings['xdebug_profile'] = true;
  3011. } elseif (extension_loaded('xdebug')) {
  3012. $warnings['xdebug_loaded'] = true;
  3013. }
  3014. if (!empty($errors)) {
  3015. foreach ($errors as $error => $current) {
  3016. switch ($error) {
  3017. case 'json':
  3018. $text = PHP_EOL."The json extension is missing.".PHP_EOL;
  3019. $text .= "Install it or recompile php without --disable-json";
  3020. break;
  3021. case 'phar':
  3022. $text = PHP_EOL."The phar extension is missing.".PHP_EOL;
  3023. $text .= "Install it or recompile php without --disable-phar";
  3024. break;
  3025. case 'filter':
  3026. $text = PHP_EOL."The filter extension is missing.".PHP_EOL;
  3027. $text .= "Install it or recompile php without --disable-filter";
  3028. break;
  3029. case 'hash':
  3030. $text = PHP_EOL."The hash extension is missing.".PHP_EOL;
  3031. $text .= "Install it or recompile php without --disable-hash";
  3032. break;
  3033. case 'iconv_mbstring':
  3034. $text = PHP_EOL."The iconv OR mbstring extension is required and both are missing.".PHP_EOL;
  3035. $text .= "Install either of them or recompile php without --disable-iconv";
  3036. break;
  3037. case 'unicode':
  3038. $text = PHP_EOL."The detect_unicode setting must be disabled.".PHP_EOL;
  3039. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3040. $text .= " detect_unicode = Off";
  3041. $displayIniMessage = true;
  3042. break;
  3043. case 'suhosin':
  3044. $text = PHP_EOL."The suhosin.executor.include.whitelist setting is incorrect.".PHP_EOL;
  3045. $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;
  3046. $text .= " suhosin.executor.include.whitelist = phar ".$current;
  3047. $displayIniMessage = true;
  3048. break;
  3049. case 'php':
  3050. $text = PHP_EOL."Your PHP ({$current}) is too old, you must upgrade to PHP 5.3.2 or higher.";
  3051. break;
  3052. case 'allow_url_fopen':
  3053. $text = PHP_EOL."The allow_url_fopen setting is incorrect.".PHP_EOL;
  3054. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3055. $text .= " allow_url_fopen = On";
  3056. $displayIniMessage = true;
  3057. break;
  3058. case 'ioncube':
  3059. $text = PHP_EOL."Your ionCube Loader extension ($current) is incompatible with Phar files.".PHP_EOL;
  3060. $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;
  3061. $text .= " zend_extension = /usr/lib/php5/20090626+lfs/ioncube_loader_lin_5.3.so";
  3062. $displayIniMessage = true;
  3063. break;
  3064. case 'openssl':
  3065. $text = PHP_EOL."The openssl extension is missing, which means that secure HTTPS transfers are impossible.".PHP_EOL;
  3066. $text .= "If possible you should enable it or recompile php with --with-openssl";
  3067. break;
  3068. }
  3069. $out($text, 'error');
  3070. }
  3071. $output .= PHP_EOL;
  3072. }
  3073. if (!empty($warnings)) {
  3074. foreach ($warnings as $warning => $current) {
  3075. switch ($warning) {
  3076. case 'apc_cli':
  3077. $text = "The apc.enable_cli setting is incorrect.".PHP_EOL;
  3078. $text .= "Add the following to the end of your `php.ini`:".PHP_EOL;
  3079. $text .= " apc.enable_cli = Off";
  3080. $displayIniMessage = true;
  3081. break;
  3082. case 'zlib':
  3083. $text = 'The zlib extension is not loaded, this can slow down Composer a lot.'.PHP_EOL;
  3084. $text .= 'If possible, enable it or recompile php with --with-zlib'.PHP_EOL;
  3085. $displayIniMessage = true;
  3086. break;
  3087. case 'sigchild':
  3088. $text = "PHP was compiled with --enable-sigchild which can cause issues on some platforms.".PHP_EOL;
  3089. $text .= "Recompile it without this flag if possible, see also:".PHP_EOL;
  3090. $text .= " https://bugs.php.net/bug.php?id=22999";
  3091. break;
  3092. case 'curlwrappers':
  3093. $text = "PHP was compiled with --with-curlwrappers which will cause issues with HTTP authentication and GitHub.".PHP_EOL;
  3094. $text .= " Recompile it without this flag if possible";
  3095. break;
  3096. case 'php':
  3097. $text = "Your PHP ({$current}) is quite old, upgrading to PHP 5.3.4 or higher is recommended.".PHP_EOL;
  3098. $text .= " Composer works with 5.3.2+ for most people, but there might be edge case issues.";
  3099. break;
  3100. case 'openssl_version':
  3101. $opensslVersion = strstr(trim(strstr(OPENSSL_VERSION_TEXT, ' ')), ' ', true);
  3102. $opensslVersion = $opensslVersion ?: OPENSSL_VERSION_TEXT;
  3103. $text = "The OpenSSL library ({$opensslVersion}) used by PHP does not support TLSv1.2 or TLSv1.1.".PHP_EOL;
  3104. $text .= "If possible you should upgrade OpenSSL to version 1.0.1 or above.";
  3105. break;
  3106. case 'xdebug_loaded':
  3107. $text = "The xdebug extension is loaded, this can slow down Composer a little.".PHP_EOL;
  3108. $text .= " Disabling it when using Composer is recommended.";
  3109. break;
  3110. case 'xdebug_profile':
  3111. $text = "The xdebug.profiler_enabled setting is enabled, this can slow down Composer a lot.".PHP_EOL;
  3112. $text .= "Add the following to the end of your `php.ini` to disable it:".PHP_EOL;
  3113. $text .= " xdebug.profiler_enabled = 0";
  3114. $displayIniMessage = true;
  3115. break;
  3116. }
  3117. $out($text, 'comment');
  3118. }
  3119. }
  3120. if ($displayIniMessage) {
  3121. $out($iniMessage, 'comment');
  3122. }
  3123. return !$warnings && !$errors ? true : $output;
  3124. }
  3125. private function checkConnectivity()
  3126. {
  3127. if (!ini_get('allow_url_fopen')) {
  3128. $result = '<info>Skipped because allow_url_fopen is missing.</info>';
  3129. return $result;
  3130. }
  3131. return true;
  3132. }
  3133. }
  3134. <?php
  3135. namespace Composer\Command;
  3136. use Composer\Plugin\CommandEvent;
  3137. use Composer\Plugin\PluginEvents;
  3138. use Symfony\Component\Console\Input\InputInterface;
  3139. use Symfony\Component\Console\Input\InputOption;
  3140. use Symfony\Component\Console\Output\OutputInterface;
  3141. class DumpAutoloadCommand extends BaseCommand
  3142. {
  3143. protected function configure()
  3144. {
  3145. $this
  3146. ->setName('dump-autoload')
  3147. ->setAliases(array('dumpautoload'))
  3148. ->setDescription('Dumps the autoloader.')
  3149. ->setDefinition(array(
  3150. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  3151. new InputOption('optimize', 'o', InputOption::VALUE_NONE, 'Optimizes PSR0 and PSR4 packages to be loaded with classmaps too, good for production.'),
  3152. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize`.'),
  3153. new InputOption('apcu', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  3154. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables autoload-dev rules.'),
  3155. ))
  3156. ->setHelp(
  3157. <<<EOT
  3158. <info>php composer.phar dump-autoload</info>
  3159. Read more at https://getcomposer.org/doc/03-cli.md#dump-autoload-dumpautoload-
  3160. EOT
  3161. )
  3162. ;
  3163. }
  3164. protected function execute(InputInterface $input, OutputInterface $output)
  3165. {
  3166. $composer = $this->getComposer();
  3167. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'dump-autoload', $input, $output);
  3168. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  3169. $installationManager = $composer->getInstallationManager();
  3170. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  3171. $package = $composer->getPackage();
  3172. $config = $composer->getConfig();
  3173. $optimize = $input->getOption('optimize') || $config->get('optimize-autoloader');
  3174. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  3175. $apcu = $input->getOption('apcu') || $config->get('apcu-autoloader');
  3176. if ($authoritative) {
  3177. $this->getIO()->writeError('<info>Generating optimized autoload files (authoritative)</info>', false);
  3178. } elseif ($optimize) {
  3179. $this->getIO()->writeError('<info>Generating optimized autoload files</info>', false);
  3180. } else {
  3181. $this->getIO()->writeError('<info>Generating autoload files</info>', false);
  3182. }
  3183. $generator = $composer->getAutoloadGenerator();
  3184. $generator->setDevMode(!$input->getOption('no-dev'));
  3185. $generator->setClassMapAuthoritative($authoritative);
  3186. $generator->setApcu($apcu);
  3187. $generator->setRunScripts(!$input->getOption('no-scripts'));
  3188. $numberOfClasses = $generator->dump($config, $localRepo, $package, $installationManager, 'composer', $optimize);
  3189. if ($authoritative) {
  3190. $this->getIO()->overwriteError('<info>Generated optimized autoload files (authoritative) containing '. $numberOfClasses .' classes</info>');
  3191. } elseif ($optimize) {
  3192. $this->getIO()->overwriteError('<info>Generated optimized autoload files containing '. $numberOfClasses .' classes</info>');
  3193. } else {
  3194. $this->getIO()->overwriteError('<info>Generated autoload files containing '. $numberOfClasses .' classes</info>');
  3195. }
  3196. return 0;
  3197. }
  3198. }
  3199. <?php
  3200. namespace Composer\Command;
  3201. use Symfony\Component\Console\Input\InputInterface;
  3202. use Symfony\Component\Console\Input\InputOption;
  3203. use Symfony\Component\Console\Output\OutputInterface;
  3204. use Symfony\Component\Console\Input\InputArgument;
  3205. class ExecCommand extends BaseCommand
  3206. {
  3207. protected function configure()
  3208. {
  3209. $this
  3210. ->setName('exec')
  3211. ->setDescription('Executes a vendored binary/script.')
  3212. ->setDefinition(array(
  3213. new InputOption('list', 'l', InputOption::VALUE_NONE),
  3214. new InputArgument('binary', InputArgument::OPTIONAL, 'The binary to run, e.g. phpunit'),
  3215. new InputArgument(
  3216. 'args',
  3217. InputArgument::IS_ARRAY | InputArgument::OPTIONAL,
  3218. 'Arguments to pass to the binary. Use <info>--</info> to separate from composer arguments'
  3219. ),
  3220. ))
  3221. ->setHelp(
  3222. <<<EOT
  3223. Executes a vendored binary/script.
  3224. Read more at https://getcomposer.org/doc/03-cli.md#exec
  3225. EOT
  3226. )
  3227. ;
  3228. }
  3229. protected function execute(InputInterface $input, OutputInterface $output)
  3230. {
  3231. $composer = $this->getComposer();
  3232. $binDir = $composer->getConfig()->get('bin-dir');
  3233. if ($input->getOption('list') || !$input->getArgument('binary')) {
  3234. $bins = glob($binDir . '/*');
  3235. $bins = array_merge($bins, array_map(function ($e) {
  3236. return "$e (local)";
  3237. }, $composer->getPackage()->getBinaries()));
  3238. if (!$bins) {
  3239. throw new \RuntimeException("No binaries found in composer.json or in bin-dir ($binDir)");
  3240. }
  3241. $this->getIO()->write(
  3242. <<<EOT
  3243. <comment>Available binaries:</comment>
  3244. EOT
  3245. );
  3246. foreach ($bins as $bin) {
  3247. if (isset($previousBin) && $bin === $previousBin.'.bat') {
  3248. continue;
  3249. }
  3250. $previousBin = $bin;
  3251. $bin = basename($bin);
  3252. $this->getIO()->write(
  3253. <<<EOT
  3254. <info>- $bin</info>
  3255. EOT
  3256. );
  3257. }
  3258. return 0;
  3259. }
  3260. $binary = $input->getArgument('binary');
  3261. $dispatcher = $composer->getEventDispatcher();
  3262. $dispatcher->addListener('__exec_command', $binary);
  3263. if ($output->getVerbosity() === OutputInterface::VERBOSITY_NORMAL) {
  3264. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  3265. }
  3266. return $dispatcher->dispatchScript('__exec_command', true, $input->getArgument('args'));
  3267. }
  3268. }
  3269. <?php
  3270. namespace Composer\Command;
  3271. use Composer\Factory;
  3272. use Composer\Util\Filesystem;
  3273. use Symfony\Component\Console\Input\InputInterface;
  3274. use Symfony\Component\Console\Input\InputArgument;
  3275. use Symfony\Component\Console\Input\StringInput;
  3276. use Symfony\Component\Console\Output\OutputInterface;
  3277. class GlobalCommand extends BaseCommand
  3278. {
  3279. protected function configure()
  3280. {
  3281. $this
  3282. ->setName('global')
  3283. ->setDescription('Allows running commands in the global composer dir ($COMPOSER_HOME).')
  3284. ->setDefinition(array(
  3285. new InputArgument('command-name', InputArgument::REQUIRED, ''),
  3286. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  3287. ))
  3288. ->setHelp(
  3289. <<<EOT
  3290. Use this command as a wrapper to run other Composer commands
  3291. within the global context of COMPOSER_HOME.
  3292. You can use this to install CLI utilities globally, all you need
  3293. is to add the COMPOSER_HOME/vendor/bin dir to your PATH env var.
  3294. COMPOSER_HOME is c:\Users\<user>\AppData\Roaming\Composer on Windows
  3295. and /home/<user>/.composer on unix systems.
  3296. If your system uses freedesktop.org standards, then it will first check
  3297. XDG_CONFIG_HOME or default to /home/<user>/.config/composer
  3298. Note: This path may vary depending on customizations to bin-dir in
  3299. composer.json or the environmental variable COMPOSER_BIN_DIR.
  3300. Read more at https://getcomposer.org/doc/03-cli.md#global
  3301. EOT
  3302. )
  3303. ;
  3304. }
  3305. public function run(InputInterface $input, OutputInterface $output)
  3306. {
  3307. $tokens = preg_split('{\s+}', $input->__toString());
  3308. $args = array();
  3309. foreach ($tokens as $token) {
  3310. if ($token && $token[0] !== '-') {
  3311. $args[] = $token;
  3312. if (count($args) >= 2) {
  3313. break;
  3314. }
  3315. }
  3316. }
  3317. if (count($args) < 2) {
  3318. return parent::run($input, $output);
  3319. }
  3320. $config = Factory::createConfig();
  3321. $home = $config->get('home');
  3322. if (!is_dir($home)) {
  3323. $fs = new Filesystem();
  3324. $fs->ensureDirectoryExists($home);
  3325. if (!is_dir($home)) {
  3326. throw new \RuntimeException('Could not create home directory');
  3327. }
  3328. }
  3329. try {
  3330. chdir($home);
  3331. } catch (\Exception $e) {
  3332. throw new \RuntimeException('Could not switch to home directory "'.$home.'"', 0, $e);
  3333. }
  3334. $this->getIO()->writeError('<info>Changed current directory to '.$home.'</info>');
  3335. $input = new StringInput(preg_replace('{\bg(?:l(?:o(?:b(?:a(?:l)?)?)?)?)?\b}', '', $input->__toString(), 1));
  3336. $this->getApplication()->resetComposer();
  3337. return $this->getApplication()->run($input, $output);
  3338. }
  3339. public function isProxyCommand()
  3340. {
  3341. return true;
  3342. }
  3343. }
  3344. <?php
  3345. namespace Composer\Command;
  3346. use Composer\Package\CompletePackageInterface;
  3347. use Composer\Repository\RepositoryInterface;
  3348. use Composer\Repository\ArrayRepository;
  3349. use Composer\Repository\RepositoryFactory;
  3350. use Composer\Util\Platform;
  3351. use Composer\Util\ProcessExecutor;
  3352. use Symfony\Component\Console\Input\InputArgument;
  3353. use Symfony\Component\Console\Input\InputOption;
  3354. use Symfony\Component\Console\Input\InputInterface;
  3355. use Symfony\Component\Console\Output\OutputInterface;
  3356. class HomeCommand extends BaseCommand
  3357. {
  3358. protected function configure()
  3359. {
  3360. $this
  3361. ->setName('browse')
  3362. ->setAliases(array('home'))
  3363. ->setDescription('Opens the package\'s repository URL or homepage in your browser.')
  3364. ->setDefinition(array(
  3365. new InputArgument('packages', InputArgument::IS_ARRAY, 'Package(s) to browse to.'),
  3366. new InputOption('homepage', 'H', InputOption::VALUE_NONE, 'Open the homepage instead of the repository URL.'),
  3367. new InputOption('show', 's', InputOption::VALUE_NONE, 'Only show the homepage or repository URL.'),
  3368. ))
  3369. ->setHelp(
  3370. <<<EOT
  3371. The home command opens or shows a package's repository URL or
  3372. homepage in your default browser.
  3373. To open the homepage by default, use -H or --homepage.
  3374. To show instead of open the repository or homepage URL, use -s or --show.
  3375. Read more at https://getcomposer.org/doc/03-cli.md#browse-home
  3376. EOT
  3377. );
  3378. }
  3379. protected function execute(InputInterface $input, OutputInterface $output)
  3380. {
  3381. $repos = $this->initializeRepos();
  3382. $io = $this->getIO();
  3383. $return = 0;
  3384. $packages = $input->getArgument('packages');
  3385. if (!$packages) {
  3386. $io->writeError('No package specified, opening homepage for the root package');
  3387. $packages = array($this->getComposer()->getPackage()->getName());
  3388. }
  3389. foreach ($packages as $packageName) {
  3390. $handled = false;
  3391. $packageExists = false;
  3392. foreach ($repos as $repo) {
  3393. foreach ($repo->findPackages($packageName) as $package) {
  3394. $packageExists = true;
  3395. if ($package instanceof CompletePackageInterface && $this->handlePackage($package, $input->getOption('homepage'), $input->getOption('show'))) {
  3396. $handled = true;
  3397. break 2;
  3398. }
  3399. }
  3400. }
  3401. if (!$packageExists) {
  3402. $return = 1;
  3403. $io->writeError('<warning>Package '.$packageName.' not found</warning>');
  3404. }
  3405. if (!$handled) {
  3406. $return = 1;
  3407. $io->writeError('<warning>'.($input->getOption('homepage') ? 'Invalid or missing homepage' : 'Invalid or missing repository URL').' for '.$packageName.'</warning>');
  3408. }
  3409. }
  3410. return $return;
  3411. }
  3412. private function handlePackage(CompletePackageInterface $package, $showHomepage, $showOnly)
  3413. {
  3414. $support = $package->getSupport();
  3415. $url = isset($support['source']) ? $support['source'] : $package->getSourceUrl();
  3416. if (!$url || $showHomepage) {
  3417. $url = $package->getHomepage();
  3418. }
  3419. if (!$url || !filter_var($url, FILTER_VALIDATE_URL)) {
  3420. return false;
  3421. }
  3422. if ($showOnly) {
  3423. $this->getIO()->write(sprintf('<info>%s</info>', $url));
  3424. } else {
  3425. $this->openBrowser($url);
  3426. }
  3427. return true;
  3428. }
  3429. private function openBrowser($url)
  3430. {
  3431. $url = ProcessExecutor::escape($url);
  3432. $process = new ProcessExecutor($this->getIO());
  3433. if (Platform::isWindows()) {
  3434. return $process->execute('start "web" explorer "' . $url . '"', $output);
  3435. }
  3436. $linux = $process->execute('which xdg-open', $output);
  3437. $osx = $process->execute('which open', $output);
  3438. if (0 === $linux) {
  3439. $process->execute('xdg-open ' . $url, $output);
  3440. } elseif (0 === $osx) {
  3441. $process->execute('open ' . $url, $output);
  3442. } else {
  3443. $this->getIO()->writeError('No suitable browser opening command found, open yourself: ' . $url);
  3444. }
  3445. }
  3446. private function initializeRepos()
  3447. {
  3448. $composer = $this->getComposer(false);
  3449. if ($composer) {
  3450. return array_merge(
  3451. array(new ArrayRepository(array($composer->getPackage()))),
  3452. array($composer->getRepositoryManager()->getLocalRepository()),
  3453. $composer->getRepositoryManager()->getRepositories()
  3454. );
  3455. }
  3456. return RepositoryFactory::defaultRepos($this->getIO());
  3457. }
  3458. }
  3459. <?php
  3460. namespace Composer\Command;
  3461. use Composer\DependencyResolver\Pool;
  3462. use Composer\Factory;
  3463. use Composer\Json\JsonFile;
  3464. use Composer\Package\BasePackage;
  3465. use Composer\Package\Version\VersionParser;
  3466. use Composer\Package\Version\VersionSelector;
  3467. use Composer\Repository\CompositeRepository;
  3468. use Composer\Repository\PlatformRepository;
  3469. use Composer\Repository\RepositoryFactory;
  3470. use Composer\Util\ProcessExecutor;
  3471. use Symfony\Component\Console\Input\ArrayInput;
  3472. use Symfony\Component\Console\Input\InputInterface;
  3473. use Symfony\Component\Console\Input\InputOption;
  3474. use Symfony\Component\Console\Output\OutputInterface;
  3475. use Symfony\Component\Process\ExecutableFinder;
  3476. use Symfony\Component\Process\Process;
  3477. class InitCommand extends BaseCommand
  3478. {
  3479. protected $repos;
  3480. private $gitConfig;
  3481. private $pools;
  3482. protected function configure()
  3483. {
  3484. $this
  3485. ->setName('init')
  3486. ->setDescription('Creates a basic composer.json file in current directory.')
  3487. ->setDefinition(array(
  3488. new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
  3489. new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
  3490. new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
  3491. new InputOption('type', null, InputOption::VALUE_OPTIONAL, 'Type of package (e.g. library, project, metapackage, composer-plugin)'),
  3492. new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
  3493. 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"'),
  3494. 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"'),
  3495. new InputOption('stability', 's', InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
  3496. new InputOption('license', 'l', InputOption::VALUE_REQUIRED, 'License of package'),
  3497. new InputOption('repository', null, InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Add custom repositories, either by URL or using JSON arrays'),
  3498. ))
  3499. ->setHelp(
  3500. <<<EOT
  3501. The <info>init</info> command creates a basic composer.json file
  3502. in the current directory.
  3503. <info>php composer.phar init</info>
  3504. Read more at https://getcomposer.org/doc/03-cli.md#init
  3505. EOT
  3506. )
  3507. ;
  3508. }
  3509. protected function execute(InputInterface $input, OutputInterface $output)
  3510. {
  3511. $io = $this->getIO();
  3512. $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
  3513. $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
  3514. if (isset($options['author'])) {
  3515. $options['authors'] = $this->formatAuthors($options['author']);
  3516. unset($options['author']);
  3517. }
  3518. $repositories = $input->getOption('repository');
  3519. if ($repositories) {
  3520. $config = Factory::createConfig($io);
  3521. foreach ($repositories as $repo) {
  3522. $options['repositories'][] = RepositoryFactory::configFromString($io, $config, $repo);
  3523. }
  3524. }
  3525. if (isset($options['stability'])) {
  3526. $options['minimum-stability'] = $options['stability'];
  3527. unset($options['stability']);
  3528. }
  3529. $options['require'] = isset($options['require']) ? $this->formatRequirements($options['require']) : new \stdClass;
  3530. if (array() === $options['require']) {
  3531. $options['require'] = new \stdClass;
  3532. }
  3533. if (isset($options['require-dev'])) {
  3534. $options['require-dev'] = $this->formatRequirements($options['require-dev']);
  3535. if (array() === $options['require-dev']) {
  3536. $options['require-dev'] = new \stdClass;
  3537. }
  3538. }
  3539. $file = new JsonFile(Factory::getComposerFile());
  3540. $json = $file->encode($options);
  3541. if ($input->isInteractive()) {
  3542. $io->writeError(array('', $json, ''));
  3543. if (!$io->askConfirmation('Do you confirm generation [<comment>yes</comment>]? ', true)) {
  3544. $io->writeError('<error>Command aborted</error>');
  3545. return 1;
  3546. }
  3547. }
  3548. $file->write($options);
  3549. if ($input->isInteractive() && is_dir('.git')) {
  3550. $ignoreFile = realpath('.gitignore');
  3551. if (false === $ignoreFile) {
  3552. $ignoreFile = realpath('.') . '/.gitignore';
  3553. }
  3554. if (!$this->hasVendorIgnore($ignoreFile)) {
  3555. $question = 'Would you like the <info>vendor</info> directory added to your <info>.gitignore</info> [<comment>yes</comment>]? ';
  3556. if ($io->askConfirmation($question, true)) {
  3557. $this->addVendorIgnore($ignoreFile);
  3558. }
  3559. }
  3560. }
  3561. $question = 'Would you like to install dependencies now [<comment>yes</comment>]? ';
  3562. if ($input->isInteractive() && $this->hasDependencies($options) && $io->askConfirmation($question, true)) {
  3563. $this->installDependencies($output);
  3564. }
  3565. return 0;
  3566. }
  3567. protected function interact(InputInterface $input, OutputInterface $output)
  3568. {
  3569. $git = $this->getGitConfig();
  3570. $io = $this->getIO();
  3571. $formatter = $this->getHelperSet()->get('formatter');
  3572. $repositories = $input->getOption('repository');
  3573. if ($repositories) {
  3574. $config = Factory::createConfig($io);
  3575. $repos = array(new PlatformRepository);
  3576. $createDefaultPackagistRepo = true;
  3577. foreach ($repositories as $repo) {
  3578. $repoConfig = RepositoryFactory::configFromString($io, $config, $repo);
  3579. if (
  3580. (isset($repoConfig['packagist']) && $repoConfig === array('packagist' => false))
  3581. || (isset($repoConfig['packagist.org']) && $repoConfig === array('packagist.org' => false))
  3582. ) {
  3583. $createDefaultPackagistRepo = false;
  3584. continue;
  3585. }
  3586. $repos[] = RepositoryFactory::createRepo($io, $config, $repoConfig);
  3587. }
  3588. if ($createDefaultPackagistRepo) {
  3589. $repos[] = RepositoryFactory::createRepo($io, $config, array(
  3590. 'type' => 'composer',
  3591. 'url' => 'https://repo.packagist.org',
  3592. ));
  3593. }
  3594. $this->repos = new CompositeRepository($repos);
  3595. unset($repos, $config, $repositories);
  3596. }
  3597. $io->writeError(array(
  3598. '',
  3599. $formatter->formatBlock('Welcome to the Composer config generator', 'bg=blue;fg=white', true),
  3600. '',
  3601. ));
  3602. $io->writeError(array(
  3603. '',
  3604. 'This command will guide you through creating your composer.json config.',
  3605. '',
  3606. ));
  3607. $cwd = realpath(".");
  3608. if (!$name = $input->getOption('name')) {
  3609. $name = basename($cwd);
  3610. $name = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  3611. $name = strtolower($name);
  3612. if (!empty($_SERVER['COMPOSER_DEFAULT_VENDOR'])) {
  3613. $name = $_SERVER['COMPOSER_DEFAULT_VENDOR'] . '/' . $name;
  3614. } elseif (isset($git['github.user'])) {
  3615. $name = $git['github.user'] . '/' . $name;
  3616. } elseif (!empty($_SERVER['USERNAME'])) {
  3617. $name = $_SERVER['USERNAME'] . '/' . $name;
  3618. } elseif (!empty($_SERVER['USER'])) {
  3619. $name = $_SERVER['USER'] . '/' . $name;
  3620. } elseif (get_current_user()) {
  3621. $name = get_current_user() . '/' . $name;
  3622. } else {
  3623. $name .= '/' . $name;
  3624. }
  3625. $name = strtolower($name);
  3626. } else {
  3627. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $name)) {
  3628. throw new \InvalidArgumentException(
  3629. '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_.-]+'
  3630. );
  3631. }
  3632. }
  3633. $name = $io->askAndValidate(
  3634. 'Package name (<vendor>/<name>) [<comment>'.$name.'</comment>]: ',
  3635. function ($value) use ($name) {
  3636. if (null === $value) {
  3637. return $name;
  3638. }
  3639. if (!preg_match('{^[a-z0-9_.-]+/[a-z0-9_.-]+$}D', $value)) {
  3640. throw new \InvalidArgumentException(
  3641. '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_.-]+'
  3642. );
  3643. }
  3644. return $value;
  3645. },
  3646. null,
  3647. $name
  3648. );
  3649. $input->setOption('name', $name);
  3650. $description = $input->getOption('description') ?: false;
  3651. $description = $io->ask(
  3652. 'Description [<comment>'.$description.'</comment>]: ',
  3653. $description
  3654. );
  3655. $input->setOption('description', $description);
  3656. if (null === $author = $input->getOption('author')) {
  3657. if (!empty($_SERVER['COMPOSER_DEFAULT_AUTHOR'])) {
  3658. $author_name = $_SERVER['COMPOSER_DEFAULT_AUTHOR'];
  3659. } elseif (isset($git['user.name'])) {
  3660. $author_name = $git['user.name'];
  3661. }
  3662. if (!empty($_SERVER['COMPOSER_DEFAULT_EMAIL'])) {
  3663. $author_email = $_SERVER['COMPOSER_DEFAULT_EMAIL'];
  3664. } elseif (isset($git['user.email'])) {
  3665. $author_email = $git['user.email'];
  3666. }
  3667. if (isset($author_name) && isset($author_email)) {
  3668. $author = sprintf('%s <%s>', $author_name, $author_email);
  3669. }
  3670. }
  3671. $self = $this;
  3672. $author = $io->askAndValidate(
  3673. 'Author [<comment>'.$author.'</comment>, n to skip]: ',
  3674. function ($value) use ($self, $author) {
  3675. if ($value === 'n' || $value === 'no') {
  3676. return;
  3677. }
  3678. $value = $value ?: $author;
  3679. $author = $self->parseAuthorString($value);
  3680. return sprintf('%s <%s>', $author['name'], $author['email']);
  3681. },
  3682. null,
  3683. $author
  3684. );
  3685. $input->setOption('author', $author);
  3686. $minimumStability = $input->getOption('stability') ?: null;
  3687. $minimumStability = $io->askAndValidate(
  3688. 'Minimum Stability [<comment>'.$minimumStability.'</comment>]: ',
  3689. function ($value) use ($minimumStability) {
  3690. if (null === $value) {
  3691. return $minimumStability;
  3692. }
  3693. if (!isset(BasePackage::$stabilities[$value])) {
  3694. throw new \InvalidArgumentException(
  3695. 'Invalid minimum stability "'.$value.'". Must be empty or one of: '.
  3696. implode(', ', array_keys(BasePackage::$stabilities))
  3697. );
  3698. }
  3699. return $value;
  3700. },
  3701. null,
  3702. $minimumStability
  3703. );
  3704. $input->setOption('stability', $minimumStability);
  3705. $type = $input->getOption('type') ?: false;
  3706. $type = $io->ask(
  3707. 'Package Type (e.g. library, project, metapackage, composer-plugin) [<comment>'.$type.'</comment>]: ',
  3708. $type
  3709. );
  3710. $input->setOption('type', $type);
  3711. if (null === $license = $input->getOption('license')) {
  3712. if (!empty($_SERVER['COMPOSER_DEFAULT_LICENSE'])) {
  3713. $license = $_SERVER['COMPOSER_DEFAULT_LICENSE'];
  3714. }
  3715. }
  3716. $license = $io->ask(
  3717. 'License [<comment>'.$license.'</comment>]: ',
  3718. $license
  3719. );
  3720. $input->setOption('license', $license);
  3721. $io->writeError(array('', 'Define your dependencies.', ''));
  3722. $repos = $this->getRepos();
  3723. $preferredStability = $minimumStability ?: 'stable';
  3724. $phpVersion = $repos->findPackage('php', '*')->getPrettyVersion();
  3725. $question = 'Would you like to define your dependencies (require) interactively [<comment>yes</comment>]? ';
  3726. $require = $input->getOption('require');
  3727. $requirements = array();
  3728. if ($require || $io->askConfirmation($question, true)) {
  3729. $requirements = $this->determineRequirements($input, $output, $require, $phpVersion, $preferredStability);
  3730. }
  3731. $input->setOption('require', $requirements);
  3732. $question = 'Would you like to define your dev dependencies (require-dev) interactively [<comment>yes</comment>]? ';
  3733. $requireDev = $input->getOption('require-dev');
  3734. $devRequirements = array();
  3735. if ($requireDev || $io->askConfirmation($question, true)) {
  3736. $devRequirements = $this->determineRequirements($input, $output, $requireDev, $phpVersion, $preferredStability);
  3737. }
  3738. $input->setOption('require-dev', $devRequirements);
  3739. }
  3740. public function parseAuthorString($author)
  3741. {
  3742. if (preg_match('/^(?P<name>[- .,\p{L}\p{N}\p{Mn}\'’"()]+) <(?P<email>.+?)>$/u', $author, $match)) {
  3743. if ($this->isValidEmail($match['email'])) {
  3744. return array(
  3745. 'name' => trim($match['name']),
  3746. 'email' => $match['email'],
  3747. );
  3748. }
  3749. }
  3750. throw new \InvalidArgumentException(
  3751. 'Invalid author string. Must be in the format: '.
  3752. 'John Smith <john@example.com>'
  3753. );
  3754. }
  3755. protected function findPackages($name)
  3756. {
  3757. return $this->getRepos()->search($name);
  3758. }
  3759. protected function getRepos()
  3760. {
  3761. if (!$this->repos) {
  3762. $this->repos = new CompositeRepository(array_merge(
  3763. array(new PlatformRepository),
  3764. RepositoryFactory::defaultRepos($this->getIO())
  3765. ));
  3766. }
  3767. return $this->repos;
  3768. }
  3769. protected function determineRequirements(InputInterface $input, OutputInterface $output, $requires = array(), $phpVersion = null, $preferredStability = 'stable', $checkProvidedVersions = true)
  3770. {
  3771. if ($requires) {
  3772. $requires = $this->normalizeRequirements($requires);
  3773. $result = array();
  3774. $io = $this->getIO();
  3775. foreach ($requires as $requirement) {
  3776. if (!isset($requirement['version'])) {
  3777. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability);
  3778. $requirement['version'] = $version;
  3779. $requirement['name'] = $name;
  3780. $io->writeError(sprintf(
  3781. 'Using version <info>%s</info> for <info>%s</info>',
  3782. $requirement['version'],
  3783. $requirement['name']
  3784. ));
  3785. } else {
  3786. list($name, $version) = $this->findBestVersionAndNameForPackage($input, $requirement['name'], $phpVersion, $preferredStability, $checkProvidedVersions ? $requirement['version'] : null, 'dev');
  3787. $requirement['name'] = $name;
  3788. }
  3789. $result[] = $requirement['name'] . ' ' . $requirement['version'];
  3790. }
  3791. return $result;
  3792. }
  3793. $versionParser = new VersionParser();
  3794. $io = $this->getIO();
  3795. while (null !== $package = $io->ask('Search for a package: ')) {
  3796. $matches = $this->findPackages($package);
  3797. if (count($matches)) {
  3798. $exactMatch = null;
  3799. $choices = array();
  3800. foreach ($matches as $position => $foundPackage) {
  3801. $abandoned = '';
  3802. if (isset($foundPackage['abandoned'])) {
  3803. if (is_string($foundPackage['abandoned'])) {
  3804. $replacement = sprintf('Use %s instead', $foundPackage['abandoned']);
  3805. } else {
  3806. $replacement = 'No replacement was suggested';
  3807. }
  3808. $abandoned = sprintf('<warning>Abandoned. %s.</warning>', $replacement);
  3809. }
  3810. $choices[] = sprintf(' <info>%5s</info> %s %s', "[$position]", $foundPackage['name'], $abandoned);
  3811. if ($foundPackage['name'] === $package) {
  3812. $exactMatch = true;
  3813. break;
  3814. }
  3815. }
  3816. if (!$exactMatch) {
  3817. $io->writeError(array(
  3818. '',
  3819. sprintf('Found <info>%s</info> packages matching <info>%s</info>', count($matches), $package),
  3820. '',
  3821. ));
  3822. $io->writeError($choices);
  3823. $io->writeError('');
  3824. $validator = function ($selection) use ($matches, $versionParser) {
  3825. if ('' === $selection) {
  3826. return false;
  3827. }
  3828. if (is_numeric($selection) && isset($matches[(int) $selection])) {
  3829. $package = $matches[(int) $selection];
  3830. return $package['name'];
  3831. }
  3832. if (preg_match('{^\s*(?P<name>[\S/]+)(?:\s+(?P<version>\S+))?\s*$}', $selection, $packageMatches)) {
  3833. if (isset($packageMatches['version'])) {
  3834. $versionParser->parseConstraints($packageMatches['version']);
  3835. return $packageMatches['name'].' '.$packageMatches['version'];
  3836. }
  3837. return $packageMatches['name'];
  3838. }
  3839. throw new \Exception('Not a valid selection');
  3840. };
  3841. $package = $io->askAndValidate(
  3842. 'Enter package # to add, or the complete package name if it is not listed: ',
  3843. $validator,
  3844. 3,
  3845. false
  3846. );
  3847. }
  3848. if (false !== $package && false === strpos($package, ' ')) {
  3849. $validator = function ($input) {
  3850. $input = trim($input);
  3851. return $input ?: false;
  3852. };
  3853. $constraint = $io->askAndValidate(
  3854. 'Enter the version constraint to require (or leave blank to use the latest version): ',
  3855. $validator,
  3856. 3,
  3857. false
  3858. );
  3859. if (false === $constraint) {
  3860. list($name, $constraint) = $this->findBestVersionAndNameForPackage($input, $package, $phpVersion, $preferredStability);
  3861. $io->writeError(sprintf(
  3862. 'Using version <info>%s</info> for <info>%s</info>',
  3863. $constraint,
  3864. $package
  3865. ));
  3866. }
  3867. $package .= ' '.$constraint;
  3868. }
  3869. if (false !== $package) {
  3870. $requires[] = $package;
  3871. }
  3872. }
  3873. }
  3874. return $requires;
  3875. }
  3876. protected function formatAuthors($author)
  3877. {
  3878. return array($this->parseAuthorString($author));
  3879. }
  3880. protected function formatRequirements(array $requirements)
  3881. {
  3882. $requires = array();
  3883. $requirements = $this->normalizeRequirements($requirements);
  3884. foreach ($requirements as $requirement) {
  3885. $requires[$requirement['name']] = $requirement['version'];
  3886. }
  3887. return $requires;
  3888. }
  3889. protected function getGitConfig()
  3890. {
  3891. if (null !== $this->gitConfig) {
  3892. return $this->gitConfig;
  3893. }
  3894. $finder = new ExecutableFinder();
  3895. $gitBin = $finder->find('git');
  3896. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  3897. $cmd = new Process(array($gitBin, 'config', '-l'));
  3898. } else {
  3899. $cmd = new Process(sprintf('%s config -l', ProcessExecutor::escape($gitBin)));
  3900. }
  3901. $cmd->run();
  3902. if ($cmd->isSuccessful()) {
  3903. $this->gitConfig = array();
  3904. preg_match_all('{^([^=]+)=(.*)$}m', $cmd->getOutput(), $matches, PREG_SET_ORDER);
  3905. foreach ($matches as $match) {
  3906. $this->gitConfig[$match[1]] = $match[2];
  3907. }
  3908. return $this->gitConfig;
  3909. }
  3910. return $this->gitConfig = array();
  3911. }
  3912. protected function hasVendorIgnore($ignoreFile, $vendor = 'vendor')
  3913. {
  3914. if (!file_exists($ignoreFile)) {
  3915. return false;
  3916. }
  3917. $pattern = sprintf('{^/?%s(/\*?)?$}', preg_quote($vendor));
  3918. $lines = file($ignoreFile, FILE_IGNORE_NEW_LINES);
  3919. foreach ($lines as $line) {
  3920. if (preg_match($pattern, $line)) {
  3921. return true;
  3922. }
  3923. }
  3924. return false;
  3925. }
  3926. protected function normalizeRequirements(array $requirements)
  3927. {
  3928. $parser = new VersionParser();
  3929. return $parser->parseNameVersionPairs($requirements);
  3930. }
  3931. protected function addVendorIgnore($ignoreFile, $vendor = '/vendor/')
  3932. {
  3933. $contents = "";
  3934. if (file_exists($ignoreFile)) {
  3935. $contents = file_get_contents($ignoreFile);
  3936. if ("\n" !== substr($contents, 0, -1)) {
  3937. $contents .= "\n";
  3938. }
  3939. }
  3940. file_put_contents($ignoreFile, $contents . $vendor. "\n");
  3941. }
  3942. protected function isValidEmail($email)
  3943. {
  3944. if (!function_exists('filter_var')) {
  3945. return true;
  3946. }
  3947. if (PHP_VERSION_ID < 50303) {
  3948. return true;
  3949. }
  3950. return false !== filter_var($email, FILTER_VALIDATE_EMAIL);
  3951. }
  3952. private function getPool(InputInterface $input, $minimumStability = null)
  3953. {
  3954. $key = $minimumStability ?: 'default';
  3955. if (!isset($this->pools[$key])) {
  3956. $this->pools[$key] = $pool = new Pool($minimumStability ?: $this->getMinimumStability($input));
  3957. $pool->addRepository($this->getRepos());
  3958. }
  3959. return $this->pools[$key];
  3960. }
  3961. private function getMinimumStability(InputInterface $input)
  3962. {
  3963. if ($input->hasOption('stability')) {
  3964. return $input->getOption('stability') ?: 'stable';
  3965. }
  3966. $file = Factory::getComposerFile();
  3967. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  3968. if (!empty($composer['minimum-stability'])) {
  3969. return $composer['minimum-stability'];
  3970. }
  3971. }
  3972. return 'stable';
  3973. }
  3974. private function findBestVersionAndNameForPackage(InputInterface $input, $name, $phpVersion, $preferredStability = 'stable', $requiredVersion = null, $minimumStability = null)
  3975. {
  3976. $versionSelector = new VersionSelector($this->getPool($input, $minimumStability));
  3977. $ignorePlatformReqs = $input->hasOption('ignore-platform-reqs') && $input->getOption('ignore-platform-reqs');
  3978. if ($ignorePlatformReqs) {
  3979. $phpVersion = null;
  3980. }
  3981. $package = $versionSelector->findBestCandidate($name, $requiredVersion, $phpVersion, $preferredStability);
  3982. if (!$package) {
  3983. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  3984. return array($name, $requiredVersion ?: '*');
  3985. }
  3986. if ($phpVersion && $versionSelector->findBestCandidate($name, $requiredVersion, null, $preferredStability)) {
  3987. throw new \InvalidArgumentException(sprintf(
  3988. 'Package %s at version %s has a PHP requirement incompatible with your PHP version (%s)',
  3989. $name,
  3990. $requiredVersion,
  3991. $phpVersion
  3992. ));
  3993. }
  3994. if ($requiredVersion && $versionSelector->findBestCandidate($name, null, $phpVersion, $preferredStability)) {
  3995. throw new \InvalidArgumentException(sprintf(
  3996. 'Could not find package %s in a version matching %s',
  3997. $name,
  3998. $requiredVersion
  3999. ));
  4000. }
  4001. if ($phpVersion && $versionSelector->findBestCandidate($name)) {
  4002. throw new \InvalidArgumentException(sprintf(
  4003. 'Could not find package %s in any version matching your PHP version (%s)',
  4004. $name,
  4005. $phpVersion
  4006. ));
  4007. }
  4008. $similar = $this->findSimilar($name);
  4009. if ($similar) {
  4010. if ($requiredVersion === null && in_array($name, $similar, true)) {
  4011. throw new \InvalidArgumentException(sprintf(
  4012. 'Could not find a version of package %s matching your minimum-stability (%s). Require it with an explicit version constraint allowing its desired stability.',
  4013. $name,
  4014. $this->getMinimumStability($input)
  4015. ));
  4016. }
  4017. throw new \InvalidArgumentException(sprintf(
  4018. "Could not find package %s.\n\nDid you mean " . (count($similar) > 1 ? 'one of these' : 'this') . "?\n %s",
  4019. $name,
  4020. implode("\n ", $similar)
  4021. ));
  4022. }
  4023. throw new \InvalidArgumentException(sprintf(
  4024. '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).',
  4025. $name,
  4026. $this->getMinimumStability($input)
  4027. ));
  4028. }
  4029. return array(
  4030. $package->getPrettyName(),
  4031. $versionSelector->findRecommendedRequireVersion($package),
  4032. );
  4033. }
  4034. private function findSimilar($package)
  4035. {
  4036. try {
  4037. $results = $this->repos->search($package);
  4038. } catch (\Exception $e) {
  4039. return array();
  4040. }
  4041. $similarPackages = array();
  4042. foreach ($results as $result) {
  4043. $similarPackages[$result['name']] = levenshtein($package, $result['name']);
  4044. }
  4045. asort($similarPackages);
  4046. return array_keys(array_slice($similarPackages, 0, 5));
  4047. }
  4048. private function installDependencies($output)
  4049. {
  4050. try {
  4051. $installCommand = $this->getApplication()->find('install');
  4052. $installCommand->run(new ArrayInput(array()), $output);
  4053. } catch (\Exception $e) {
  4054. $this->getIO()->writeError('Could not install dependencies. Run `composer install` to see more information.');
  4055. }
  4056. }
  4057. private function hasDependencies($options)
  4058. {
  4059. $requires = (array) $options['require'];
  4060. $devRequires = isset($options['require-dev']) ? (array) $options['require-dev'] : array();
  4061. return !empty($requires) || !empty($devRequires);
  4062. }
  4063. }
  4064. <?php
  4065. namespace Composer\Command;
  4066. use Composer\Installer;
  4067. use Composer\Plugin\CommandEvent;
  4068. use Composer\Plugin\PluginEvents;
  4069. use Symfony\Component\Console\Input\InputInterface;
  4070. use Symfony\Component\Console\Input\InputOption;
  4071. use Symfony\Component\Console\Input\InputArgument;
  4072. use Symfony\Component\Console\Output\OutputInterface;
  4073. class InstallCommand extends BaseCommand
  4074. {
  4075. protected function configure()
  4076. {
  4077. $this
  4078. ->setName('install')
  4079. ->setAliases(array('i'))
  4080. ->setDescription('Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.')
  4081. ->setDefinition(array(
  4082. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4083. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4084. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  4085. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  4086. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  4087. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  4088. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  4089. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4090. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4091. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4092. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  4093. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4094. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4095. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4096. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4097. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Should not be provided, use composer require instead to add a given package to composer.json.'),
  4098. ))
  4099. ->setHelp(
  4100. <<<EOT
  4101. The <info>install</info> command reads the composer.lock file from
  4102. the current directory, processes it, and downloads and installs all the
  4103. libraries and dependencies outlined in that file. If the file does not
  4104. exist it will look for composer.json and do the same.
  4105. <info>php composer.phar install</info>
  4106. Read more at https://getcomposer.org/doc/03-cli.md#install-i
  4107. EOT
  4108. )
  4109. ;
  4110. }
  4111. protected function execute(InputInterface $input, OutputInterface $output)
  4112. {
  4113. $io = $this->getIO();
  4114. if ($args = $input->getArgument('packages')) {
  4115. $io->writeError('<error>Invalid argument '.implode(' ', $args).'. Use "composer require '.implode(' ', $args).'" instead to add packages to your composer.json.</error>');
  4116. return 1;
  4117. }
  4118. if ($input->getOption('no-custom-installers')) {
  4119. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  4120. $input->setOption('no-plugins', true);
  4121. }
  4122. if ($input->getOption('dev')) {
  4123. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  4124. }
  4125. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4126. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4127. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'install', $input, $output);
  4128. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4129. $install = Installer::create($io, $composer);
  4130. $config = $composer->getConfig();
  4131. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  4132. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  4133. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  4134. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  4135. $install
  4136. ->setDryRun($input->getOption('dry-run'))
  4137. ->setVerbose($input->getOption('verbose'))
  4138. ->setPreferSource($preferSource)
  4139. ->setPreferDist($preferDist)
  4140. ->setDevMode(!$input->getOption('no-dev'))
  4141. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  4142. ->setRunScripts(!$input->getOption('no-scripts'))
  4143. ->setSkipSuggest($input->getOption('no-suggest'))
  4144. ->setOptimizeAutoloader($optimize)
  4145. ->setClassMapAuthoritative($authoritative)
  4146. ->setApcuAutoloader($apcu)
  4147. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4148. ;
  4149. if ($input->getOption('no-plugins')) {
  4150. $install->disablePlugins();
  4151. }
  4152. return $install->run();
  4153. }
  4154. }
  4155. <?php
  4156. namespace Composer\Command;
  4157. use Composer\Json\JsonFile;
  4158. use Composer\Plugin\CommandEvent;
  4159. use Composer\Plugin\PluginEvents;
  4160. use Composer\Package\PackageInterface;
  4161. use Composer\Repository\RepositoryInterface;
  4162. use Symfony\Component\Console\Helper\Table;
  4163. use Symfony\Component\Console\Input\InputInterface;
  4164. use Symfony\Component\Console\Input\InputOption;
  4165. use Symfony\Component\Console\Output\OutputInterface;
  4166. class LicensesCommand extends BaseCommand
  4167. {
  4168. protected function configure()
  4169. {
  4170. $this
  4171. ->setName('licenses')
  4172. ->setDescription('Shows information about licenses of dependencies.')
  4173. ->setDefinition(array(
  4174. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4175. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables search in require-dev packages.'),
  4176. ))
  4177. ->setHelp(
  4178. <<<EOT
  4179. The license command displays detailed information about the licenses of
  4180. the installed dependencies.
  4181. Read more at https://getcomposer.org/doc/03-cli.md#licenses
  4182. EOT
  4183. )
  4184. ;
  4185. }
  4186. protected function execute(InputInterface $input, OutputInterface $output)
  4187. {
  4188. $composer = $this->getComposer();
  4189. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'licenses', $input, $output);
  4190. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4191. $root = $composer->getPackage();
  4192. $repo = $composer->getRepositoryManager()->getLocalRepository();
  4193. if ($input->getOption('no-dev')) {
  4194. $packages = $this->filterRequiredPackages($repo, $root);
  4195. } else {
  4196. $packages = $this->appendPackages($repo->getPackages(), array());
  4197. }
  4198. ksort($packages);
  4199. $io = $this->getIO();
  4200. switch ($format = $input->getOption('format')) {
  4201. case 'text':
  4202. $io->write('Name: <comment>'.$root->getPrettyName().'</comment>');
  4203. $io->write('Version: <comment>'.$root->getFullPrettyVersion().'</comment>');
  4204. $io->write('Licenses: <comment>'.(implode(', ', $root->getLicense()) ?: 'none').'</comment>');
  4205. $io->write('Dependencies:');
  4206. $io->write('');
  4207. $table = new Table($output);
  4208. $table->setStyle('compact');
  4209. $tableStyle = $table->getStyle();
  4210. $tableStyle->setVerticalBorderChar('');
  4211. $tableStyle->setCellRowContentFormat('%s ');
  4212. $table->setHeaders(array('Name', 'Version', 'License'));
  4213. foreach ($packages as $package) {
  4214. $table->addRow(array(
  4215. $package->getPrettyName(),
  4216. $package->getFullPrettyVersion(),
  4217. implode(', ', $package->getLicense()) ?: 'none',
  4218. ));
  4219. }
  4220. $table->render();
  4221. break;
  4222. case 'json':
  4223. $dependencies = array();
  4224. foreach ($packages as $package) {
  4225. $dependencies[$package->getPrettyName()] = array(
  4226. 'version' => $package->getFullPrettyVersion(),
  4227. 'license' => $package->getLicense(),
  4228. );
  4229. }
  4230. $io->write(JsonFile::encode(array(
  4231. 'name' => $root->getPrettyName(),
  4232. 'version' => $root->getFullPrettyVersion(),
  4233. 'license' => $root->getLicense(),
  4234. 'dependencies' => $dependencies,
  4235. )));
  4236. break;
  4237. default:
  4238. throw new \RuntimeException(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  4239. }
  4240. return 0;
  4241. }
  4242. private function filterRequiredPackages(RepositoryInterface $repo, PackageInterface $package, $bucket = array())
  4243. {
  4244. $requires = array_keys($package->getRequires());
  4245. $packageListNames = array_keys($bucket);
  4246. $packages = array_filter(
  4247. $repo->getPackages(),
  4248. function ($package) use ($requires, $packageListNames) {
  4249. return in_array($package->getName(), $requires) && !in_array($package->getName(), $packageListNames);
  4250. }
  4251. );
  4252. $bucket = $this->appendPackages($packages, $bucket);
  4253. foreach ($packages as $package) {
  4254. $bucket = $this->filterRequiredPackages($repo, $package, $bucket);
  4255. }
  4256. return $bucket;
  4257. }
  4258. public function appendPackages(array $packages, array $bucket)
  4259. {
  4260. foreach ($packages as $package) {
  4261. $bucket[$package->getName()] = $package;
  4262. }
  4263. return $bucket;
  4264. }
  4265. }
  4266. <?php
  4267. namespace Composer\Command;
  4268. use Symfony\Component\Console\Input\InputInterface;
  4269. use Symfony\Component\Console\Input\InputArgument;
  4270. use Symfony\Component\Console\Input\ArrayInput;
  4271. use Symfony\Component\Console\Input\InputOption;
  4272. use Symfony\Component\Console\Output\OutputInterface;
  4273. class OutdatedCommand extends ShowCommand
  4274. {
  4275. protected function configure()
  4276. {
  4277. $this
  4278. ->setName('outdated')
  4279. ->setDescription('Shows a list of installed packages that have updates available, including their latest version.')
  4280. ->setDefinition(array(
  4281. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  4282. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show only packages that are outdated (this is the default, but present here for compat with `show`'),
  4283. new InputOption('all', 'a', InputOption::VALUE_NONE, 'Show all installed packages with their latest versions'),
  4284. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  4285. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  4286. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  4287. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  4288. 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.'),
  4289. ))
  4290. ->setHelp(
  4291. <<<EOT
  4292. The outdated command is just a proxy for `composer show -l`
  4293. The color coding (or signage if you have ANSI colors disabled) for dependency versions is as such:
  4294. - <info>green</info> (=): Dependency is in the latest version and is up to date.
  4295. - <comment>yellow</comment> (~): Dependency has a new version available that includes backwards
  4296. compatibility breaks according to semver, so upgrade when you can but it
  4297. may involve work.
  4298. - <highlight>red</highlight> (!): Dependency has a new version that is semver-compatible and you should upgrade it.
  4299. Read more at https://getcomposer.org/doc/03-cli.md#outdated
  4300. EOT
  4301. )
  4302. ;
  4303. }
  4304. protected function execute(InputInterface $input, OutputInterface $output)
  4305. {
  4306. $args = array(
  4307. 'command' => 'show',
  4308. '--latest' => true,
  4309. );
  4310. if (!$input->getOption('all')) {
  4311. $args['--outdated'] = true;
  4312. }
  4313. if ($input->getOption('direct')) {
  4314. $args['--direct'] = true;
  4315. }
  4316. if ($input->getArgument('package')) {
  4317. $args['package'] = $input->getArgument('package');
  4318. }
  4319. if ($input->getOption('strict')) {
  4320. $args['--strict'] = true;
  4321. }
  4322. if ($input->getOption('minor-only')) {
  4323. $args['--minor-only'] = true;
  4324. }
  4325. $args['--format'] = $input->getOption('format');
  4326. $args['--ignore'] = $input->getOption('ignore');
  4327. $input = new ArrayInput($args);
  4328. return $this->getApplication()->run($input, $output);
  4329. }
  4330. public function isProxyCommand()
  4331. {
  4332. return true;
  4333. }
  4334. }
  4335. <?php
  4336. namespace Composer\Command;
  4337. use Symfony\Component\Console\Input\InputInterface;
  4338. use Symfony\Component\Console\Output\OutputInterface;
  4339. class ProhibitsCommand extends BaseDependencyCommand
  4340. {
  4341. protected function configure()
  4342. {
  4343. parent::configure();
  4344. $this
  4345. ->setName('prohibits')
  4346. ->setAliases(array('why-not'))
  4347. ->setDescription('Shows which packages prevent the given package from being installed.')
  4348. ->setHelp(
  4349. <<<EOT
  4350. Displays detailed information about why a package cannot be installed.
  4351. <info>php composer.phar prohibits composer/composer</info>
  4352. Read more at https://getcomposer.org/doc/03-cli.md#prohibits-why-not-
  4353. EOT
  4354. )
  4355. ;
  4356. }
  4357. protected function execute(InputInterface $input, OutputInterface $output)
  4358. {
  4359. return parent::doExecute($input, $output, true);
  4360. }
  4361. }
  4362. <?php
  4363. namespace Composer\Command;
  4364. use Composer\Config\JsonConfigSource;
  4365. use Composer\Installer;
  4366. use Composer\Plugin\CommandEvent;
  4367. use Composer\Plugin\PluginEvents;
  4368. use Composer\Json\JsonFile;
  4369. use Composer\Factory;
  4370. use Symfony\Component\Console\Input\InputInterface;
  4371. use Symfony\Component\Console\Input\InputOption;
  4372. use Symfony\Component\Console\Input\InputArgument;
  4373. use Symfony\Component\Console\Output\OutputInterface;
  4374. use Composer\Package\BasePackage;
  4375. class RemoveCommand extends BaseCommand
  4376. {
  4377. protected function configure()
  4378. {
  4379. $this
  4380. ->setName('remove')
  4381. ->setDescription('Removes a package from the require or require-dev.')
  4382. ->setDefinition(array(
  4383. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'Packages that should be removed.'),
  4384. new InputOption('dev', null, InputOption::VALUE_NONE, 'Removes a package from the require-dev section.'),
  4385. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4386. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4387. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4388. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4389. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated with explicit dependencies. (Deprecrated, is now default behavior)'),
  4390. new InputOption('no-update-with-dependencies', null, InputOption::VALUE_NONE, 'Does not allow inherited dependencies to be updated with explicit dependencies.'),
  4391. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4392. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4393. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4394. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4395. ))
  4396. ->setHelp(
  4397. <<<EOT
  4398. The <info>remove</info> command removes a package from the current
  4399. list of installed packages
  4400. <info>php composer.phar remove</info>
  4401. Read more at https://getcomposer.org/doc/03-cli.md#remove
  4402. EOT
  4403. )
  4404. ;
  4405. }
  4406. protected function execute(InputInterface $input, OutputInterface $output)
  4407. {
  4408. $packages = $input->getArgument('packages');
  4409. $packages = array_map('strtolower', $packages);
  4410. $file = Factory::getComposerFile();
  4411. $jsonFile = new JsonFile($file);
  4412. $composer = $jsonFile->read();
  4413. $composerBackup = file_get_contents($jsonFile->getPath());
  4414. $json = new JsonConfigSource($jsonFile);
  4415. $type = $input->getOption('dev') ? 'require-dev' : 'require';
  4416. $altType = !$input->getOption('dev') ? 'require-dev' : 'require';
  4417. $io = $this->getIO();
  4418. if ($input->getOption('update-with-dependencies')) {
  4419. $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>');
  4420. }
  4421. foreach (array('require', 'require-dev') as $linkType) {
  4422. if (isset($composer[$linkType])) {
  4423. foreach ($composer[$linkType] as $name => $version) {
  4424. $composer[$linkType][strtolower($name)] = $name;
  4425. }
  4426. }
  4427. }
  4428. foreach ($packages as $package) {
  4429. if (isset($composer[$type][$package])) {
  4430. $json->removeLink($type, $composer[$type][$package]);
  4431. } elseif (isset($composer[$altType][$package])) {
  4432. $io->writeError('<warning>' . $composer[$altType][$package] . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4433. if ($io->isInteractive()) {
  4434. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4435. $json->removeLink($altType, $composer[$altType][$package]);
  4436. }
  4437. }
  4438. } elseif (isset($composer[$type]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$type]))) {
  4439. foreach ($matches as $matchedPackage) {
  4440. $json->removeLink($type, $matchedPackage);
  4441. }
  4442. } elseif (isset($composer[$altType]) && $matches = preg_grep(BasePackage::packageNameToRegexp($package), array_keys($composer[$altType]))) {
  4443. foreach ($matches as $matchedPackage) {
  4444. $io->writeError('<warning>' . $matchedPackage . ' could not be found in ' . $type . ' but it is present in ' . $altType . '</warning>');
  4445. if ($io->isInteractive()) {
  4446. if ($io->askConfirmation('Do you want to remove it from ' . $altType . ' [<comment>yes</comment>]? ', true)) {
  4447. $json->removeLink($altType, $matchedPackage);
  4448. }
  4449. }
  4450. }
  4451. } else {
  4452. $io->writeError('<warning>'.$package.' is not required in your composer.json and has not been removed</warning>');
  4453. }
  4454. }
  4455. if ($input->getOption('no-update')) {
  4456. return 0;
  4457. }
  4458. $this->resetComposer();
  4459. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4460. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4461. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'remove', $input, $output);
  4462. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4463. $install = Installer::create($io, $composer);
  4464. $updateDevMode = !$input->getOption('update-no-dev');
  4465. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4466. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4467. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4468. $install
  4469. ->setVerbose($input->getOption('verbose'))
  4470. ->setDevMode($updateDevMode)
  4471. ->setOptimizeAutoloader($optimize)
  4472. ->setClassMapAuthoritative($authoritative)
  4473. ->setApcuAutoloader($apcu)
  4474. ->setUpdate(true)
  4475. ->setUpdateWhitelist($packages)
  4476. ->setWhitelistTransitiveDependencies(!$input->getOption('no-update-with-dependencies'))
  4477. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4478. ->setRunScripts(!$input->getOption('no-scripts'))
  4479. ;
  4480. $status = $install->run();
  4481. if ($status !== 0) {
  4482. $io->writeError("\n".'<error>Removal failed, reverting '.$file.' to its original content.</error>');
  4483. file_put_contents($jsonFile->getPath(), $composerBackup);
  4484. }
  4485. return $status;
  4486. }
  4487. }
  4488. <?php
  4489. namespace Composer\Command;
  4490. use Symfony\Component\Console\Input\InputInterface;
  4491. use Symfony\Component\Console\Input\InputArgument;
  4492. use Symfony\Component\Console\Input\InputOption;
  4493. use Symfony\Component\Console\Output\OutputInterface;
  4494. use Composer\Factory;
  4495. use Composer\Installer;
  4496. use Composer\Json\JsonFile;
  4497. use Composer\Json\JsonManipulator;
  4498. use Composer\Package\Version\VersionParser;
  4499. use Composer\Plugin\CommandEvent;
  4500. use Composer\Plugin\PluginEvents;
  4501. use Composer\Repository\CompositeRepository;
  4502. use Composer\Repository\PlatformRepository;
  4503. use Composer\IO\IOInterface;
  4504. use Composer\Util\Silencer;
  4505. class RequireCommand extends InitCommand
  4506. {
  4507. private $newlyCreated;
  4508. private $json;
  4509. private $file;
  4510. private $composerBackup;
  4511. protected function configure()
  4512. {
  4513. $this
  4514. ->setName('require')
  4515. ->setDescription('Adds required packages to your composer.json and installs them.')
  4516. ->setDefinition(array(
  4517. 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"'),
  4518. new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'),
  4519. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  4520. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  4521. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4522. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  4523. new InputOption('no-update', null, InputOption::VALUE_NONE, 'Disables the automatic update of the dependencies.'),
  4524. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  4525. new InputOption('update-no-dev', null, InputOption::VALUE_NONE, 'Run the dependency update with the --no-dev option.'),
  4526. new InputOption('update-with-dependencies', null, InputOption::VALUE_NONE, 'Allows inherited dependencies to be updated, except those that are root requirements.'),
  4527. new InputOption('update-with-all-dependencies', null, InputOption::VALUE_NONE, 'Allows all inherited dependencies to be updated, including those that are root requirements.'),
  4528. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  4529. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  4530. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  4531. new InputOption('sort-packages', null, InputOption::VALUE_NONE, 'Sorts packages when adding/updating a new dependency'),
  4532. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump'),
  4533. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  4534. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  4535. ))
  4536. ->setHelp(
  4537. <<<EOT
  4538. The require command adds required packages to your composer.json and installs them.
  4539. If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of
  4540. matches to require.
  4541. If you do not specify a version constraint, composer will choose a suitable one based on the available package versions.
  4542. If you do not want to install the new dependencies immediately you can call it with --no-update
  4543. Read more at https://getcomposer.org/doc/03-cli.md#require
  4544. EOT
  4545. )
  4546. ;
  4547. }
  4548. protected function execute(InputInterface $input, OutputInterface $output)
  4549. {
  4550. if (function_exists('pcntl_async_signals')) {
  4551. pcntl_async_signals(true);
  4552. pcntl_signal(SIGINT, array($this, 'revertComposerFile'));
  4553. pcntl_signal(SIGTERM, array($this, 'revertComposerFile'));
  4554. pcntl_signal(SIGHUP, array($this, 'revertComposerFile'));
  4555. }
  4556. $this->file = Factory::getComposerFile();
  4557. $io = $this->getIO();
  4558. $this->newlyCreated = !file_exists($this->file);
  4559. if ($this->newlyCreated && !file_put_contents($this->file, "{\n}\n")) {
  4560. $io->writeError('<error>'.$this->file.' could not be created.</error>');
  4561. return 1;
  4562. }
  4563. if (!is_readable($this->file) && false === Silencer::call('file_get_contents', $this->file)) {
  4564. $io->writeError('<error>'.$this->file.' is not readable.</error>');
  4565. return 1;
  4566. }
  4567. if (filesize($this->file) === 0) {
  4568. file_put_contents($this->file, "{\n}\n");
  4569. }
  4570. $this->json = new JsonFile($this->file);
  4571. $this->composerBackup = file_get_contents($this->json->getPath());
  4572. if (!is_writable($this->file) && !Silencer::call('file_put_contents', $this->file, $this->composerBackup)) {
  4573. $io->writeError('<error>'.$this->file.' is not writable.</error>');
  4574. return 1;
  4575. }
  4576. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4577. $repos = $composer->getRepositoryManager()->getRepositories();
  4578. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  4579. $this->repos = new CompositeRepository(array_merge(
  4580. array(new PlatformRepository(array(), $platformOverrides)),
  4581. $repos
  4582. ));
  4583. if ($composer->getPackage()->getPreferStable()) {
  4584. $preferredStability = 'stable';
  4585. } else {
  4586. $preferredStability = $composer->getPackage()->getMinimumStability();
  4587. }
  4588. $phpVersion = $this->repos->findPackage('php', '*')->getPrettyVersion();
  4589. try {
  4590. $requirements = $this->determineRequirements($input, $output, $input->getArgument('packages'), $phpVersion, $preferredStability, !$input->getOption('no-update'));
  4591. } catch (\Exception $e) {
  4592. if ($this->newlyCreated) {
  4593. throw new \RuntimeException('No composer.json present in the current directory, this may be the cause of the following exception.', 0, $e);
  4594. }
  4595. throw $e;
  4596. }
  4597. $requireKey = $input->getOption('dev') ? 'require-dev' : 'require';
  4598. $removeKey = $input->getOption('dev') ? 'require' : 'require-dev';
  4599. $requirements = $this->formatRequirements($requirements);
  4600. $versionParser = new VersionParser();
  4601. foreach ($requirements as $package => $constraint) {
  4602. if (strtolower($package) === $composer->getPackage()->getName()) {
  4603. $io->writeError(sprintf('<error>Root package \'%s\' cannot require itself in its composer.json</error>', $package));
  4604. return 1;
  4605. }
  4606. $versionParser->parseConstraints($constraint);
  4607. }
  4608. $sortPackages = $input->getOption('sort-packages') || $composer->getConfig()->get('sort-packages');
  4609. if (!$this->updateFileCleanly($this->json, $requirements, $requireKey, $removeKey, $sortPackages)) {
  4610. $composerDefinition = $this->json->read();
  4611. foreach ($requirements as $package => $version) {
  4612. $composerDefinition[$requireKey][$package] = $version;
  4613. unset($composerDefinition[$removeKey][$package]);
  4614. }
  4615. $this->json->write($composerDefinition);
  4616. }
  4617. $io->writeError('<info>'.$this->file.' has been '.($this->newlyCreated ? 'created' : 'updated').'</info>');
  4618. if ($input->getOption('no-update')) {
  4619. return 0;
  4620. }
  4621. try {
  4622. return $this->doUpdate($input, $output, $io, $requirements);
  4623. } catch (\Exception $e) {
  4624. $this->revertComposerFile(false);
  4625. throw $e;
  4626. }
  4627. }
  4628. private function doUpdate(InputInterface $input, OutputInterface $output, IOInterface $io, array $requirements)
  4629. {
  4630. $this->resetComposer();
  4631. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  4632. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  4633. $updateDevMode = !$input->getOption('update-no-dev');
  4634. $optimize = $input->getOption('optimize-autoloader') || $composer->getConfig()->get('optimize-autoloader');
  4635. $authoritative = $input->getOption('classmap-authoritative') || $composer->getConfig()->get('classmap-authoritative');
  4636. $apcu = $input->getOption('apcu-autoloader') || $composer->getConfig()->get('apcu-autoloader');
  4637. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'require', $input, $output);
  4638. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4639. $install = Installer::create($io, $composer);
  4640. $install
  4641. ->setVerbose($input->getOption('verbose'))
  4642. ->setPreferSource($input->getOption('prefer-source'))
  4643. ->setPreferDist($input->getOption('prefer-dist'))
  4644. ->setDevMode($updateDevMode)
  4645. ->setRunScripts(!$input->getOption('no-scripts'))
  4646. ->setSkipSuggest($input->getOption('no-suggest'))
  4647. ->setOptimizeAutoloader($optimize)
  4648. ->setClassMapAuthoritative($authoritative)
  4649. ->setApcuAutoloader($apcu)
  4650. ->setUpdate(true)
  4651. ->setUpdateWhitelist(array_keys($requirements))
  4652. ->setWhitelistTransitiveDependencies($input->getOption('update-with-dependencies'))
  4653. ->setWhitelistAllDependencies($input->getOption('update-with-all-dependencies'))
  4654. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  4655. ->setPreferStable($input->getOption('prefer-stable'))
  4656. ->setPreferLowest($input->getOption('prefer-lowest'))
  4657. ;
  4658. $status = $install->run();
  4659. if ($status !== 0) {
  4660. $this->revertComposerFile(false);
  4661. }
  4662. return $status;
  4663. }
  4664. private function updateFileCleanly($json, array $new, $requireKey, $removeKey, $sortPackages)
  4665. {
  4666. $contents = file_get_contents($json->getPath());
  4667. $manipulator = new JsonManipulator($contents);
  4668. foreach ($new as $package => $constraint) {
  4669. if (!$manipulator->addLink($requireKey, $package, $constraint, $sortPackages)) {
  4670. return false;
  4671. }
  4672. if (!$manipulator->removeSubNode($removeKey, $package)) {
  4673. return false;
  4674. }
  4675. }
  4676. file_put_contents($json->getPath(), $manipulator->getContents());
  4677. return true;
  4678. }
  4679. protected function interact(InputInterface $input, OutputInterface $output)
  4680. {
  4681. return;
  4682. }
  4683. public function revertComposerFile($hardExit = true)
  4684. {
  4685. $io = $this->getIO();
  4686. if ($this->newlyCreated) {
  4687. $io->writeError("\n".'<error>Installation failed, deleting '.$this->file.'.</error>');
  4688. unlink($this->json->getPath());
  4689. } else {
  4690. $io->writeError("\n".'<error>Installation failed, reverting '.$this->file.' to its original content.</error>');
  4691. file_put_contents($this->json->getPath(), $this->composerBackup);
  4692. }
  4693. if ($hardExit) {
  4694. exit(1);
  4695. }
  4696. }
  4697. }
  4698. <?php
  4699. namespace Composer\Command;
  4700. use Composer\Script\Event as ScriptEvent;
  4701. use Composer\Script\ScriptEvents;
  4702. use Composer\Util\ProcessExecutor;
  4703. use Symfony\Component\Console\Input\InputInterface;
  4704. use Symfony\Component\Console\Input\InputOption;
  4705. use Symfony\Component\Console\Input\InputArgument;
  4706. use Symfony\Component\Console\Output\OutputInterface;
  4707. use Symfony\Component\Console\Helper\Table;
  4708. class RunScriptCommand extends BaseCommand
  4709. {
  4710. protected $scriptEvents = array(
  4711. ScriptEvents::PRE_INSTALL_CMD,
  4712. ScriptEvents::POST_INSTALL_CMD,
  4713. ScriptEvents::PRE_UPDATE_CMD,
  4714. ScriptEvents::POST_UPDATE_CMD,
  4715. ScriptEvents::PRE_STATUS_CMD,
  4716. ScriptEvents::POST_STATUS_CMD,
  4717. ScriptEvents::POST_ROOT_PACKAGE_INSTALL,
  4718. ScriptEvents::POST_CREATE_PROJECT_CMD,
  4719. ScriptEvents::PRE_ARCHIVE_CMD,
  4720. ScriptEvents::POST_ARCHIVE_CMD,
  4721. ScriptEvents::PRE_AUTOLOAD_DUMP,
  4722. ScriptEvents::POST_AUTOLOAD_DUMP,
  4723. );
  4724. protected function configure()
  4725. {
  4726. $this
  4727. ->setName('run-script')
  4728. ->setAliases(array('run'))
  4729. ->setDescription('Runs the scripts defined in composer.json.')
  4730. ->setDefinition(array(
  4731. new InputArgument('script', InputArgument::OPTIONAL, 'Script name to run.'),
  4732. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4733. new InputOption('timeout', null, InputOption::VALUE_REQUIRED, 'Sets script timeout in seconds, or 0 for never.'),
  4734. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4735. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4736. new InputOption('list', 'l', InputOption::VALUE_NONE, 'List scripts.'),
  4737. ))
  4738. ->setHelp(
  4739. <<<EOT
  4740. The <info>run-script</info> command runs scripts defined in composer.json:
  4741. <info>php composer.phar run-script post-update-cmd</info>
  4742. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4743. EOT
  4744. )
  4745. ;
  4746. }
  4747. protected function execute(InputInterface $input, OutputInterface $output)
  4748. {
  4749. if ($input->getOption('list')) {
  4750. return $this->listScripts($output);
  4751. } elseif (!$input->getArgument('script')) {
  4752. throw new \RuntimeException('Missing required argument "script"');
  4753. }
  4754. $script = $input->getArgument('script');
  4755. if (!in_array($script, $this->scriptEvents)) {
  4756. if (defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  4757. throw new \InvalidArgumentException(sprintf('Script "%s" cannot be run with this command', $script));
  4758. }
  4759. }
  4760. $composer = $this->getComposer();
  4761. $devMode = $input->getOption('dev') || !$input->getOption('no-dev');
  4762. $event = new ScriptEvent($script, $composer, $this->getIO(), $devMode);
  4763. $hasListeners = $composer->getEventDispatcher()->hasEventListeners($event);
  4764. if (!$hasListeners) {
  4765. throw new \InvalidArgumentException(sprintf('Script "%s" is not defined in this package', $script));
  4766. }
  4767. $args = $input->getArgument('args');
  4768. if (null !== $timeout = $input->getOption('timeout')) {
  4769. if (!ctype_digit($timeout)) {
  4770. throw new \RuntimeException('Timeout value must be numeric and positive if defined, or 0 for forever');
  4771. }
  4772. ProcessExecutor::setTimeout((int) $timeout);
  4773. }
  4774. return $composer->getEventDispatcher()->dispatchScript($script, $devMode, $args);
  4775. }
  4776. protected function listScripts(OutputInterface $output)
  4777. {
  4778. $scripts = $this->getComposer()->getPackage()->getScripts();
  4779. if (!count($scripts)) {
  4780. return 0;
  4781. }
  4782. $io = $this->getIO();
  4783. $io->writeError('<info>scripts:</info>');
  4784. $table = array();
  4785. foreach ($scripts as $name => $script) {
  4786. $description = '';
  4787. try {
  4788. $cmd = $this->getApplication()->find($name);
  4789. if ($cmd instanceof ScriptAliasCommand) {
  4790. $description = $cmd->getDescription();
  4791. }
  4792. } catch (\Symfony\Component\Console\Exception\CommandNotFoundException $e) {
  4793. }
  4794. $table[] = array(' '.$name, $description);
  4795. }
  4796. $renderer = new Table($output);
  4797. $renderer->setStyle('compact');
  4798. $rendererStyle = $renderer->getStyle();
  4799. $rendererStyle->setVerticalBorderChar('');
  4800. $rendererStyle->setCellRowContentFormat('%s ');
  4801. $renderer->setRows($table)->render();
  4802. return 0;
  4803. }
  4804. }
  4805. <?php
  4806. namespace Composer\Command;
  4807. use Symfony\Component\Console\Input\InputInterface;
  4808. use Symfony\Component\Console\Input\InputOption;
  4809. use Symfony\Component\Console\Input\InputArgument;
  4810. use Symfony\Component\Console\Output\OutputInterface;
  4811. class ScriptAliasCommand extends BaseCommand
  4812. {
  4813. private $script;
  4814. private $description;
  4815. public function __construct($script, $description)
  4816. {
  4817. $this->script = $script;
  4818. $this->description = empty($description) ? 'Runs the '.$script.' script as defined in composer.json.' : $description;
  4819. parent::__construct();
  4820. }
  4821. protected function configure()
  4822. {
  4823. $this
  4824. ->setName($this->script)
  4825. ->setDescription($this->description)
  4826. ->setDefinition(array(
  4827. new InputOption('dev', null, InputOption::VALUE_NONE, 'Sets the dev mode.'),
  4828. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables the dev mode.'),
  4829. new InputArgument('args', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, ''),
  4830. ))
  4831. ->setHelp(
  4832. <<<EOT
  4833. The <info>run-script</info> command runs scripts defined in composer.json:
  4834. <info>php composer.phar run-script post-update-cmd</info>
  4835. Read more at https://getcomposer.org/doc/03-cli.md#run-script
  4836. EOT
  4837. )
  4838. ;
  4839. }
  4840. protected function execute(InputInterface $input, OutputInterface $output)
  4841. {
  4842. $composer = $this->getComposer();
  4843. $args = $input->getArguments();
  4844. return $composer->getEventDispatcher()->dispatchScript($this->script, $input->getOption('dev') || !$input->getOption('no-dev'), $args['args']);
  4845. }
  4846. }
  4847. <?php
  4848. namespace Composer\Command;
  4849. use Composer\Factory;
  4850. use Symfony\Component\Console\Input\InputInterface;
  4851. use Symfony\Component\Console\Input\InputArgument;
  4852. use Symfony\Component\Console\Input\InputOption;
  4853. use Symfony\Component\Console\Output\OutputInterface;
  4854. use Composer\Repository\CompositeRepository;
  4855. use Composer\Repository\PlatformRepository;
  4856. use Composer\Repository\RepositoryInterface;
  4857. use Composer\Plugin\CommandEvent;
  4858. use Composer\Plugin\PluginEvents;
  4859. class SearchCommand extends BaseCommand
  4860. {
  4861. protected $matches;
  4862. protected $lowMatches = array();
  4863. protected $tokens;
  4864. protected $output;
  4865. protected $onlyName;
  4866. protected function configure()
  4867. {
  4868. $this
  4869. ->setName('search')
  4870. ->setDescription('Searches for packages.')
  4871. ->setDefinition(array(
  4872. new InputOption('only-name', 'N', InputOption::VALUE_NONE, 'Search only in name'),
  4873. new InputOption('type', 't', InputOption::VALUE_REQUIRED, 'Search for a specific package type'),
  4874. new InputArgument('tokens', InputArgument::IS_ARRAY | InputArgument::REQUIRED, 'tokens to search for'),
  4875. ))
  4876. ->setHelp(
  4877. <<<EOT
  4878. The search command searches for packages by its name
  4879. <info>php composer.phar search symfony composer</info>
  4880. Read more at https://getcomposer.org/doc/03-cli.md#search
  4881. EOT
  4882. )
  4883. ;
  4884. }
  4885. protected function execute(InputInterface $input, OutputInterface $output)
  4886. {
  4887. $platformRepo = new PlatformRepository;
  4888. $io = $this->getIO();
  4889. if (!($composer = $this->getComposer(false))) {
  4890. $composer = Factory::create($this->getIO(), array(), $input->hasParameterOption('--no-plugins'));
  4891. }
  4892. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  4893. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  4894. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  4895. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'search', $input, $output);
  4896. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  4897. $onlyName = $input->getOption('only-name');
  4898. $type = $input->getOption('type') ?: null;
  4899. $flags = $onlyName ? RepositoryInterface::SEARCH_NAME : RepositoryInterface::SEARCH_FULLTEXT;
  4900. $results = $repos->search(implode(' ', $input->getArgument('tokens')), $flags, $type);
  4901. foreach ($results as $result) {
  4902. $io->write($result['name'] . (isset($result['description']) ? ' '. $result['description'] : ''));
  4903. }
  4904. return 0;
  4905. }
  4906. }
  4907. <?php
  4908. namespace Composer\Command;
  4909. use Composer\Composer;
  4910. use Composer\Factory;
  4911. use Composer\Config;
  4912. use Composer\Util\Filesystem;
  4913. use Composer\SelfUpdate\Keys;
  4914. use Composer\SelfUpdate\Versions;
  4915. use Composer\IO\IOInterface;
  4916. use Composer\Downloader\FilesystemException;
  4917. use Symfony\Component\Console\Input\InputInterface;
  4918. use Symfony\Component\Console\Input\InputOption;
  4919. use Symfony\Component\Console\Input\InputArgument;
  4920. use Symfony\Component\Console\Output\OutputInterface;
  4921. use Symfony\Component\Finder\Finder;
  4922. class SelfUpdateCommand extends BaseCommand
  4923. {
  4924. const HOMEPAGE = 'getcomposer.org';
  4925. const OLD_INSTALL_EXT = '-old.phar';
  4926. protected function configure()
  4927. {
  4928. $this
  4929. ->setName('self-update')
  4930. ->setAliases(array('selfupdate'))
  4931. ->setDescription('Updates composer.phar to the latest version.')
  4932. ->setDefinition(array(
  4933. new InputOption('rollback', 'r', InputOption::VALUE_NONE, 'Revert to an older installation of composer'),
  4934. 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'),
  4935. new InputArgument('version', InputArgument::OPTIONAL, 'The version to update to'),
  4936. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  4937. new InputOption('update-keys', null, InputOption::VALUE_NONE, 'Prompt user for a key update'),
  4938. new InputOption('stable', null, InputOption::VALUE_NONE, 'Force an update to the stable channel'),
  4939. new InputOption('preview', null, InputOption::VALUE_NONE, 'Force an update to the preview channel'),
  4940. new InputOption('snapshot', null, InputOption::VALUE_NONE, 'Force an update to the snapshot channel'),
  4941. new InputOption('set-channel-only', null, InputOption::VALUE_NONE, 'Only store the channel as the default one and then exit'),
  4942. ))
  4943. ->setHelp(
  4944. <<<EOT
  4945. The <info>self-update</info> command checks getcomposer.org for newer
  4946. versions of composer and if found, installs the latest.
  4947. <info>php composer.phar self-update</info>
  4948. Read more at https://getcomposer.org/doc/03-cli.md#self-update-selfupdate-
  4949. EOT
  4950. )
  4951. ;
  4952. }
  4953. protected function execute(InputInterface $input, OutputInterface $output)
  4954. {
  4955. $config = Factory::createConfig();
  4956. if ($config->get('disable-tls') === true) {
  4957. $baseUrl = 'http://' . self::HOMEPAGE;
  4958. } else {
  4959. $baseUrl = 'https://' . self::HOMEPAGE;
  4960. }
  4961. $io = $this->getIO();
  4962. $remoteFilesystem = Factory::createRemoteFilesystem($io, $config);
  4963. $versionsUtil = new Versions($config, $remoteFilesystem);
  4964. foreach (array('stable', 'preview', 'snapshot') as $channel) {
  4965. if ($input->getOption($channel)) {
  4966. $versionsUtil->setChannel($channel);
  4967. }
  4968. }
  4969. if ($input->getOption('set-channel-only')) {
  4970. return 0;
  4971. }
  4972. $cacheDir = $config->get('cache-dir');
  4973. $rollbackDir = $config->get('data-dir');
  4974. $home = $config->get('home');
  4975. $localFilename = realpath($_SERVER['argv'][0]) ?: $_SERVER['argv'][0];
  4976. if ($input->getOption('update-keys')) {
  4977. return $this->fetchKeys($io, $config);
  4978. }
  4979. $tmpDir = is_writable(dirname($localFilename)) ? dirname($localFilename) : $cacheDir;
  4980. if (!is_writable($tmpDir)) {
  4981. throw new FilesystemException('Composer update failed: the "'.$tmpDir.'" directory used to download the temp file could not be written');
  4982. }
  4983. if (function_exists('posix_getpwuid') && function_exists('posix_geteuid')) {
  4984. $composeUser = posix_getpwuid(posix_geteuid());
  4985. $homeOwner = posix_getpwuid(fileowner($home));
  4986. if (isset($composeUser['name']) && isset($homeOwner['name']) && $composeUser['name'] !== $homeOwner['name']) {
  4987. $io->writeError('<warning>You are running composer as "'.$composeUser['name'].'", while "'.$home.'" is owned by "'.$homeOwner['name'].'"</warning>');
  4988. }
  4989. }
  4990. if ($input->getOption('rollback')) {
  4991. return $this->rollback($output, $rollbackDir, $localFilename);
  4992. }
  4993. $latest = $versionsUtil->getLatest();
  4994. $latestVersion = $latest['version'];
  4995. $updateVersion = $input->getArgument('version') ?: $latestVersion;
  4996. if (preg_match('{^[0-9a-f]{40}$}', $updateVersion) && $updateVersion !== $latestVersion) {
  4997. $io->writeError('<error>You can not update to a specific SHA-1 as those phars are not available for download</error>');
  4998. return 1;
  4999. }
  5000. if (Composer::VERSION === $updateVersion) {
  5001. $io->writeError(sprintf('<info>You are already using composer version %s (%s channel).</info>', $updateVersion, $versionsUtil->getChannel()));
  5002. if ($input->getOption('clean-backups')) {
  5003. $this->cleanBackups($rollbackDir, $this->getLastBackupVersion($rollbackDir));
  5004. }
  5005. return 0;
  5006. }
  5007. $tempFilename = $tmpDir . '/' . basename($localFilename, '.phar').'-temp.phar';
  5008. $backupFile = sprintf(
  5009. '%s/%s-%s%s',
  5010. $rollbackDir,
  5011. strtr(Composer::RELEASE_DATE, ' :', '_-'),
  5012. preg_replace('{^([0-9a-f]{7})[0-9a-f]{33}$}', '$1', Composer::VERSION),
  5013. self::OLD_INSTALL_EXT
  5014. );
  5015. $updatingToTag = !preg_match('{^[0-9a-f]{40}$}', $updateVersion);
  5016. $io->write(sprintf("Updating to version <info>%s</info> (%s channel).", $updateVersion, $versionsUtil->getChannel()));
  5017. $remoteFilename = $baseUrl . ($updatingToTag ? "/download/{$updateVersion}/composer.phar" : '/composer.phar');
  5018. $signature = $remoteFilesystem->getContents(self::HOMEPAGE, $remoteFilename.'.sig', false);
  5019. $io->writeError(' ', false);
  5020. $remoteFilesystem->copy(self::HOMEPAGE, $remoteFilename, $tempFilename, !$input->getOption('no-progress'));
  5021. $io->writeError('');
  5022. if (!file_exists($tempFilename) || !$signature) {
  5023. $io->writeError('<error>The download of the new composer version failed for an unexpected reason</error>');
  5024. return 1;
  5025. }
  5026. if (!extension_loaded('openssl') && $config->get('disable-tls')) {
  5027. $io->writeError('<warning>Skipping phar signature verification as you have disabled OpenSSL via config.disable-tls</warning>');
  5028. } else {
  5029. if (!extension_loaded('openssl')) {
  5030. throw new \RuntimeException('The openssl extension is required for phar signatures to be verified but it is not available. '
  5031. . '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.');
  5032. }
  5033. $sigFile = 'file://'.$home.'/' . ($updatingToTag ? 'keys.tags.pub' : 'keys.dev.pub');
  5034. if (!file_exists($sigFile)) {
  5035. file_put_contents(
  5036. $home.'/keys.dev.pub',
  5037. <<<DEVPUBKEY
  5038. -----BEGIN PUBLIC KEY-----
  5039. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAnBDHjZS6e0ZMoK3xTD7f
  5040. FNCzlXjX/Aie2dit8QXA03pSrOTbaMnxON3hUL47Lz3g1SC6YJEMVHr0zYq4elWi
  5041. i3ecFEgzLcj+pZM5X6qWu2Ozz4vWx3JYo1/a/HYdOuW9e3lwS8VtS0AVJA+U8X0A
  5042. hZnBmGpltHhO8hPKHgkJtkTUxCheTcbqn4wGHl8Z2SediDcPTLwqezWKUfrYzu1f
  5043. o/j3WFwFs6GtK4wdYtiXr+yspBZHO3y1udf8eFFGcb2V3EaLOrtfur6XQVizjOuk
  5044. 8lw5zzse1Qp/klHqbDRsjSzJ6iL6F4aynBc6Euqt/8ccNAIz0rLjLhOraeyj4eNn
  5045. 8iokwMKiXpcrQLTKH+RH1JCuOVxQ436bJwbSsp1VwiqftPQieN+tzqy+EiHJJmGf
  5046. TBAbWcncicCk9q2md+AmhNbvHO4PWbbz9TzC7HJb460jyWeuMEvw3gNIpEo2jYa9
  5047. pMV6cVqnSa+wOc0D7pC9a6bne0bvLcm3S+w6I5iDB3lZsb3A9UtRiSP7aGSo7D72
  5048. 8tC8+cIgZcI7k9vjvOqH+d7sdOU2yPCnRY6wFh62/g8bDnUpr56nZN1G89GwM4d4
  5049. r/TU7BQQIzsZgAiqOGXvVklIgAMiV0iucgf3rNBLjjeNEwNSTTG9F0CtQ+7JLwaE
  5050. wSEuAuRm+pRqi8BRnQ/GKUcCAwEAAQ==
  5051. -----END PUBLIC KEY-----
  5052. DEVPUBKEY
  5053. );
  5054. file_put_contents(
  5055. $home.'/keys.tags.pub',
  5056. <<<TAGSPUBKEY
  5057. -----BEGIN PUBLIC KEY-----
  5058. MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA0Vi/2K6apCVj76nCnCl2
  5059. MQUPdK+A9eqkYBacXo2wQBYmyVlXm2/n/ZsX6pCLYPQTHyr5jXbkQzBw8SKqPdlh
  5060. vA7NpbMeNCz7wP/AobvUXM8xQuXKbMDTY2uZ4O7sM+PfGbptKPBGLe8Z8d2sUnTO
  5061. bXtX6Lrj13wkRto7st/w/Yp33RHe9SlqkiiS4MsH1jBkcIkEHsRaveZzedUaxY0M
  5062. mba0uPhGUInpPzEHwrYqBBEtWvP97t2vtfx8I5qv28kh0Y6t+jnjL1Urid2iuQZf
  5063. noCMFIOu4vksK5HxJxxrN0GOmGmwVQjOOtxkwikNiotZGPR4KsVj8NnBrLX7oGuM
  5064. nQvGciiu+KoC2r3HDBrpDeBVdOWxDzT5R4iI0KoLzFh2pKqwbY+obNPS2bj+2dgJ
  5065. rV3V5Jjry42QOCBN3c88wU1PKftOLj2ECpewY6vnE478IipiEu7EAdK8Zwj2LmTr
  5066. RKQUSa9k7ggBkYZWAeO/2Ag0ey3g2bg7eqk+sHEq5ynIXd5lhv6tC5PBdHlWipDK
  5067. tl2IxiEnejnOmAzGVivE1YGduYBjN+mjxDVy8KGBrjnz1JPgAvgdwJ2dYw4Rsc/e
  5068. TzCFWGk/HM6a4f0IzBWbJ5ot0PIi4amk07IotBXDWwqDiQTwyuGCym5EqWQ2BD95
  5069. RGv89BPD+2DLnJysngsvVaUCAwEAAQ==
  5070. -----END PUBLIC KEY-----
  5071. TAGSPUBKEY
  5072. );
  5073. }
  5074. $pubkeyid = openssl_pkey_get_public($sigFile);
  5075. $algo = defined('OPENSSL_ALGO_SHA384') ? OPENSSL_ALGO_SHA384 : 'SHA384';
  5076. if (!in_array('sha384', array_map('strtolower', openssl_get_md_methods()))) {
  5077. throw new \RuntimeException('SHA384 is not supported by your openssl extension, could not verify the phar file integrity');
  5078. }
  5079. $signature = json_decode($signature, true);
  5080. $signature = base64_decode($signature['sha384']);
  5081. $verified = 1 === openssl_verify(file_get_contents($tempFilename), $signature, $pubkeyid, $algo);
  5082. openssl_free_key($pubkeyid);
  5083. if (!$verified) {
  5084. 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');
  5085. }
  5086. }
  5087. if ($input->getOption('clean-backups')) {
  5088. $this->cleanBackups($rollbackDir);
  5089. }
  5090. if ($err = $this->setLocalPhar($localFilename, $tempFilename, $backupFile)) {
  5091. @unlink($tempFilename);
  5092. $io->writeError('<error>The file is corrupted ('.$err->getMessage().').</error>');
  5093. $io->writeError('<error>Please re-run the self-update command to try again.</error>');
  5094. return 1;
  5095. }
  5096. if (file_exists($backupFile)) {
  5097. $io->writeError(sprintf(
  5098. 'Use <info>composer self-update --rollback</info> to return to version <comment>%s</comment>',
  5099. Composer::VERSION
  5100. ));
  5101. } else {
  5102. $io->writeError('<warning>A backup of the current version could not be written to '.$backupFile.', no rollback possible</warning>');
  5103. }
  5104. return 0;
  5105. }
  5106. protected function fetchKeys(IOInterface $io, Config $config)
  5107. {
  5108. if (!$io->isInteractive()) {
  5109. throw new \RuntimeException('Public keys can not be fetched in non-interactive mode, please run Composer interactively');
  5110. }
  5111. $io->write('Open <info>https://composer.github.io/pubkeys.html</info> to find the latest keys');
  5112. $validator = function ($value) {
  5113. if (!preg_match('{^-----BEGIN PUBLIC KEY-----$}', trim($value))) {
  5114. throw new \UnexpectedValueException('Invalid input');
  5115. }
  5116. return trim($value)."\n";
  5117. };
  5118. $devKey = '';
  5119. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $devKey, $match)) {
  5120. $devKey = $io->askAndValidate('Enter Dev / Snapshot Public Key (including lines with -----): ', $validator);
  5121. while ($line = $io->ask('')) {
  5122. $devKey .= trim($line)."\n";
  5123. if (trim($line) === '-----END PUBLIC KEY-----') {
  5124. break;
  5125. }
  5126. }
  5127. }
  5128. file_put_contents($keyPath = $config->get('home').'/keys.dev.pub', $match[0]);
  5129. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5130. $tagsKey = '';
  5131. while (!preg_match('{(-----BEGIN PUBLIC KEY-----.+?-----END PUBLIC KEY-----)}s', $tagsKey, $match)) {
  5132. $tagsKey = $io->askAndValidate('Enter Tags Public Key (including lines with -----): ', $validator);
  5133. while ($line = $io->ask('')) {
  5134. $tagsKey .= trim($line)."\n";
  5135. if (trim($line) === '-----END PUBLIC KEY-----') {
  5136. break;
  5137. }
  5138. }
  5139. }
  5140. file_put_contents($keyPath = $config->get('home').'/keys.tags.pub', $match[0]);
  5141. $io->write('Stored key with fingerprint: ' . Keys::fingerprint($keyPath));
  5142. $io->write('Public keys stored in '.$config->get('home'));
  5143. }
  5144. protected function rollback(OutputInterface $output, $rollbackDir, $localFilename)
  5145. {
  5146. $rollbackVersion = $this->getLastBackupVersion($rollbackDir);
  5147. if (!$rollbackVersion) {
  5148. throw new \UnexpectedValueException('Composer rollback failed: no installation to roll back to in "'.$rollbackDir.'"');
  5149. }
  5150. $oldFile = $rollbackDir . '/' . $rollbackVersion . self::OLD_INSTALL_EXT;
  5151. if (!is_file($oldFile)) {
  5152. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be found');
  5153. }
  5154. if (!is_readable($oldFile)) {
  5155. throw new FilesystemException('Composer rollback failed: "'.$oldFile.'" could not be read');
  5156. }
  5157. $io = $this->getIO();
  5158. $io->writeError(sprintf("Rolling back to version <info>%s</info>.", $rollbackVersion));
  5159. if ($err = $this->setLocalPhar($localFilename, $oldFile)) {
  5160. $io->writeError('<error>The backup file was corrupted ('.$err->getMessage().').</error>');
  5161. return 1;
  5162. }
  5163. return 0;
  5164. }
  5165. protected function setLocalPhar($localFilename, $newFilename, $backupTarget = null)
  5166. {
  5167. try {
  5168. @chmod($newFilename, fileperms($localFilename));
  5169. if (!ini_get('phar.readonly')) {
  5170. $phar = new \Phar($newFilename);
  5171. unset($phar);
  5172. }
  5173. if ($backupTarget && file_exists($localFilename)) {
  5174. @copy($localFilename, $backupTarget);
  5175. }
  5176. rename($newFilename, $localFilename);
  5177. return null;
  5178. } catch (\Exception $e) {
  5179. if (!$e instanceof \UnexpectedValueException && !$e instanceof \PharException) {
  5180. throw $e;
  5181. }
  5182. return $e;
  5183. }
  5184. }
  5185. protected function cleanBackups($rollbackDir, $except = null)
  5186. {
  5187. $finder = $this->getOldInstallationFinder($rollbackDir);
  5188. $io = $this->getIO();
  5189. $fs = new Filesystem;
  5190. foreach ($finder as $file) {
  5191. if ($except && $file->getBasename(self::OLD_INSTALL_EXT) === $except) {
  5192. continue;
  5193. }
  5194. $file = (string) $file;
  5195. $io->writeError('<info>Removing: '.$file.'</info>');
  5196. $fs->remove($file);
  5197. }
  5198. }
  5199. protected function getLastBackupVersion($rollbackDir)
  5200. {
  5201. $finder = $this->getOldInstallationFinder($rollbackDir);
  5202. $finder->sortByName();
  5203. $files = iterator_to_array($finder);
  5204. if (count($files)) {
  5205. return basename(end($files), self::OLD_INSTALL_EXT);
  5206. }
  5207. return false;
  5208. }
  5209. protected function getOldInstallationFinder($rollbackDir)
  5210. {
  5211. $finder = Finder::create()
  5212. ->depth(0)
  5213. ->files()
  5214. ->name('*' . self::OLD_INSTALL_EXT)
  5215. ->in($rollbackDir);
  5216. return $finder;
  5217. }
  5218. }
  5219. <?php
  5220. namespace Composer\Command;
  5221. use Composer\Composer;
  5222. use Composer\DependencyResolver\DefaultPolicy;
  5223. use Composer\DependencyResolver\Pool;
  5224. use Composer\Json\JsonFile;
  5225. use Composer\Package\BasePackage;
  5226. use Composer\Package\CompletePackageInterface;
  5227. use Composer\Package\PackageInterface;
  5228. use Composer\Package\Version\VersionParser;
  5229. use Composer\Package\Version\VersionSelector;
  5230. use Composer\Plugin\CommandEvent;
  5231. use Composer\Plugin\PluginEvents;
  5232. use Composer\Repository\ArrayRepository;
  5233. use Composer\Repository\ComposerRepository;
  5234. use Composer\Repository\CompositeRepository;
  5235. use Composer\Repository\PlatformRepository;
  5236. use Composer\Repository\RepositoryFactory;
  5237. use Composer\Repository\RepositoryInterface;
  5238. use Composer\Semver\Constraint\ConstraintInterface;
  5239. use Composer\Semver\Semver;
  5240. use Composer\Spdx\SpdxLicenses;
  5241. use Composer\Util\Platform;
  5242. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  5243. use Symfony\Component\Console\Input\InputArgument;
  5244. use Symfony\Component\Console\Input\InputInterface;
  5245. use Symfony\Component\Console\Input\InputOption;
  5246. use Symfony\Component\Console\Output\OutputInterface;
  5247. use Symfony\Component\Console\Terminal;
  5248. class ShowCommand extends BaseCommand
  5249. {
  5250. protected $versionParser;
  5251. protected $colors;
  5252. private $pool;
  5253. protected function configure()
  5254. {
  5255. $this
  5256. ->setName('show')
  5257. ->setAliases(array('info'))
  5258. ->setDescription('Shows information about packages.')
  5259. ->setDefinition(array(
  5260. new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
  5261. new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
  5262. new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
  5263. new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
  5264. new InputOption('platform', 'p', InputOption::VALUE_NONE, 'List platform packages only'),
  5265. new InputOption('available', 'a', InputOption::VALUE_NONE, 'List available packages only'),
  5266. new InputOption('self', 's', InputOption::VALUE_NONE, 'Show the root package information'),
  5267. new InputOption('name-only', 'N', InputOption::VALUE_NONE, 'List package names only'),
  5268. new InputOption('path', 'P', InputOption::VALUE_NONE, 'Show package paths'),
  5269. new InputOption('tree', 't', InputOption::VALUE_NONE, 'List the dependencies as a tree'),
  5270. new InputOption('latest', 'l', InputOption::VALUE_NONE, 'Show the latest version'),
  5271. new InputOption('outdated', 'o', InputOption::VALUE_NONE, 'Show the latest version but only for packages that are outdated'),
  5272. 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.'),
  5273. new InputOption('minor-only', 'm', InputOption::VALUE_NONE, 'Show only packages that have minor SemVer-compatible updates. Use with the --outdated option.'),
  5274. new InputOption('direct', 'D', InputOption::VALUE_NONE, 'Shows only packages that are directly required by the root package'),
  5275. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code when there are outdated packages'),
  5276. new InputOption('format', 'f', InputOption::VALUE_REQUIRED, 'Format of the output: text or json', 'text'),
  5277. ))
  5278. ->setHelp(
  5279. <<<EOT
  5280. The show command displays detailed information about a package, or
  5281. lists all packages available.
  5282. Read more at https://getcomposer.org/doc/03-cli.md#show
  5283. EOT
  5284. )
  5285. ;
  5286. }
  5287. protected function execute(InputInterface $input, OutputInterface $output)
  5288. {
  5289. $this->versionParser = new VersionParser;
  5290. if ($input->getOption('tree')) {
  5291. $this->initStyles($output);
  5292. }
  5293. $composer = $this->getComposer(false);
  5294. $io = $this->getIO();
  5295. if ($input->getOption('installed')) {
  5296. $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>');
  5297. }
  5298. if ($input->getOption('outdated')) {
  5299. $input->setOption('latest', true);
  5300. } elseif ($input->getOption('ignore')) {
  5301. $io->writeError('<warning>You are using the option "ignore" for action other than "outdated", it will be ignored.</warning>');
  5302. }
  5303. if ($input->getOption('direct') && ($input->getOption('all') || $input->getOption('available') || $input->getOption('platform'))) {
  5304. $io->writeError('The --direct (-D) option is not usable in combination with --all, --platform (-p) or --available (-a)');
  5305. return 1;
  5306. }
  5307. if ($input->getOption('tree') && ($input->getOption('all') || $input->getOption('available'))) {
  5308. $io->writeError('The --tree (-t) option is not usable in combination with --all or --available (-a)');
  5309. return 1;
  5310. }
  5311. if ($input->getOption('tree') && $input->getOption('latest')) {
  5312. $io->writeError('The --tree (-t) option is not usable in combination with --latest (-l)');
  5313. return 1;
  5314. }
  5315. $format = $input->getOption('format');
  5316. if (!in_array($format, array('text', 'json'))) {
  5317. $io->writeError(sprintf('Unsupported format "%s". See help for supported formats.', $format));
  5318. return 1;
  5319. }
  5320. $platformOverrides = array();
  5321. if ($composer) {
  5322. $platformOverrides = $composer->getConfig()->get('platform') ?: array();
  5323. }
  5324. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  5325. $phpVersion = $platformRepo->findPackage('php', '*')->getVersion();
  5326. if ($input->getOption('self')) {
  5327. $package = $this->getComposer()->getPackage();
  5328. $repos = $installedRepo = new ArrayRepository(array($package));
  5329. } elseif ($input->getOption('platform')) {
  5330. $repos = $installedRepo = $platformRepo;
  5331. } elseif ($input->getOption('available')) {
  5332. $installedRepo = $platformRepo;
  5333. if ($composer) {
  5334. $repos = new CompositeRepository($composer->getRepositoryManager()->getRepositories());
  5335. } else {
  5336. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5337. $repos = new CompositeRepository($defaultRepos);
  5338. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5339. }
  5340. } elseif ($input->getOption('all') && $composer) {
  5341. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  5342. $installedRepo = new CompositeRepository(array($localRepo, $platformRepo));
  5343. $repos = new CompositeRepository(array_merge(array($installedRepo), $composer->getRepositoryManager()->getRepositories()));
  5344. } elseif ($input->getOption('all')) {
  5345. $defaultRepos = RepositoryFactory::defaultRepos($io);
  5346. $io->writeError('No composer.json found in the current directory, showing available packages from ' . implode(', ', array_keys($defaultRepos)));
  5347. $installedRepo = $platformRepo;
  5348. $repos = new CompositeRepository(array_merge(array($installedRepo), $defaultRepos));
  5349. } else {
  5350. $repos = $installedRepo = $this->getComposer()->getRepositoryManager()->getLocalRepository();
  5351. $rootPkg = $this->getComposer()->getPackage();
  5352. if (!$installedRepo->getPackages() && ($rootPkg->getRequires() || $rootPkg->getDevRequires())) {
  5353. $io->writeError('<warning>No dependencies installed. Try running composer install or update.</warning>');
  5354. }
  5355. }
  5356. if ($composer) {
  5357. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'show', $input, $output);
  5358. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  5359. }
  5360. if ($input->getOption('latest') && null === $composer) {
  5361. $io->writeError('No composer.json found in the current directory, disabling "latest" option');
  5362. $input->setOption('latest', false);
  5363. }
  5364. $packageFilter = $input->getArgument('package');
  5365. if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
  5366. if (empty($package)) {
  5367. list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
  5368. if (empty($package)) {
  5369. $options = $input->getOptions();
  5370. if (!isset($options['working-dir']) || !file_exists('composer.json')) {
  5371. throw new \InvalidArgumentException('Package ' . $packageFilter . ' not found');
  5372. }
  5373. $io->writeError('Package ' . $packageFilter . ' not found in ' . $options['working-dir'] . '/composer.json');
  5374. return 1;
  5375. }
  5376. } else {
  5377. $versions = array($package->getPrettyVersion() => $package->getVersion());
  5378. }
  5379. $exitCode = 0;
  5380. if ($input->getOption('tree')) {
  5381. $arrayTree = $this->generatePackageTree($package, $installedRepo, $repos);
  5382. if ('json' === $format) {
  5383. $io->write(JsonFile::encode(array('installed' => array($arrayTree))));
  5384. } else {
  5385. $this->displayPackageTree(array($arrayTree));
  5386. }
  5387. } else {
  5388. $latestPackage = null;
  5389. if ($input->getOption('latest')) {
  5390. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion);
  5391. }
  5392. if ($input->getOption('outdated') && $input->getOption('strict') && $latestPackage && $latestPackage->getFullPrettyVersion() !== $package->getFullPrettyVersion() && !$latestPackage->isAbandoned()) {
  5393. $exitCode = 1;
  5394. }
  5395. if ($input->getOption('path')) {
  5396. $io->write($package->getName(), false);
  5397. $io->write(' ' . strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n"));
  5398. return $exitCode;
  5399. }
  5400. $this->printMeta($package, $versions, $installedRepo, $latestPackage ?: null);
  5401. $this->printLinks($package, 'requires');
  5402. $this->printLinks($package, 'devRequires', 'requires (dev)');
  5403. if ($package->getSuggests()) {
  5404. $io->write("\n<info>suggests</info>");
  5405. foreach ($package->getSuggests() as $suggested => $reason) {
  5406. $io->write($suggested . ' <comment>' . $reason . '</comment>');
  5407. }
  5408. }
  5409. $this->printLinks($package, 'provides');
  5410. $this->printLinks($package, 'conflicts');
  5411. $this->printLinks($package, 'replaces');
  5412. }
  5413. return $exitCode;
  5414. }
  5415. if ($input->getOption('tree')) {
  5416. $rootRequires = $this->getRootRequires();
  5417. $packages = $installedRepo->getPackages();
  5418. usort($packages, 'strcmp');
  5419. $arrayTree = array();
  5420. foreach ($packages as $package) {
  5421. if (in_array($package->getName(), $rootRequires, true)) {
  5422. $arrayTree[] = $this->generatePackageTree($package, $installedRepo, $repos);
  5423. }
  5424. }
  5425. if ('json' === $format) {
  5426. $io->write(JsonFile::encode(array('installed' => $arrayTree)));
  5427. } else {
  5428. $this->displayPackageTree($arrayTree);
  5429. }
  5430. return 0;
  5431. }
  5432. if ($repos instanceof CompositeRepository) {
  5433. $repos = $repos->getRepositories();
  5434. } elseif (!is_array($repos)) {
  5435. $repos = array($repos);
  5436. }
  5437. $packages = array();
  5438. if (null !== $packageFilter) {
  5439. $packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
  5440. }
  5441. $packageListFilter = array();
  5442. if ($input->getOption('direct')) {
  5443. $packageListFilter = $this->getRootRequires();
  5444. }
  5445. if (class_exists('Symfony\Component\Console\Terminal')) {
  5446. $terminal = new Terminal();
  5447. $width = $terminal->getWidth();
  5448. } else {
  5449. list($width) = $this->getApplication()->getTerminalDimensions();
  5450. }
  5451. if (null === $width) {
  5452. $width = PHP_INT_MAX;
  5453. }
  5454. if (Platform::isWindows()) {
  5455. $width--;
  5456. } else {
  5457. $width = max(80, $width);
  5458. }
  5459. if ($input->getOption('path') && null === $composer) {
  5460. $io->writeError('No composer.json found in the current directory, disabling "path" option');
  5461. $input->setOption('path', false);
  5462. }
  5463. foreach ($repos as $repo) {
  5464. if ($repo === $platformRepo) {
  5465. $type = 'platform';
  5466. } elseif (
  5467. $repo === $installedRepo
  5468. || ($installedRepo instanceof CompositeRepository && in_array($repo, $installedRepo->getRepositories(), true))
  5469. ) {
  5470. $type = 'installed';
  5471. } else {
  5472. $type = 'available';
  5473. }
  5474. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  5475. foreach ($repo->getProviderNames() as $name) {
  5476. if (!$packageFilter || preg_match($packageFilter, $name)) {
  5477. $packages[$type][$name] = $name;
  5478. }
  5479. }
  5480. } else {
  5481. foreach ($repo->getPackages() as $package) {
  5482. if (!isset($packages[$type][$package->getName()])
  5483. || !is_object($packages[$type][$package->getName()])
  5484. || version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
  5485. ) {
  5486. if (!$packageFilter || preg_match($packageFilter, $package->getName())) {
  5487. if (!$packageListFilter || in_array($package->getName(), $packageListFilter, true)) {
  5488. $packages[$type][$package->getName()] = $package;
  5489. }
  5490. }
  5491. }
  5492. }
  5493. }
  5494. }
  5495. $showAllTypes = $input->getOption('all');
  5496. $showLatest = $input->getOption('latest');
  5497. $showMinorOnly = $input->getOption('minor-only');
  5498. $ignoredPackages = array_map('strtolower', $input->getOption('ignore'));
  5499. $indent = $showAllTypes ? ' ' : '';
  5500. $latestPackages = array();
  5501. $exitCode = 0;
  5502. $viewData = array();
  5503. $viewMetaData = array();
  5504. foreach (array('platform' => true, 'available' => false, 'installed' => true) as $type => $showVersion) {
  5505. if (isset($packages[$type])) {
  5506. ksort($packages[$type]);
  5507. $nameLength = $versionLength = $latestLength = 0;
  5508. if ($showLatest && $showVersion) {
  5509. foreach ($packages[$type] as $package) {
  5510. if (is_object($package)) {
  5511. $latestPackage = $this->findLatestPackage($package, $composer, $phpVersion, $showMinorOnly);
  5512. if ($latestPackage === false) {
  5513. continue;
  5514. }
  5515. $latestPackages[$package->getPrettyName()] = $latestPackage;
  5516. }
  5517. }
  5518. }
  5519. $writePath = !$input->getOption('name-only') && $input->getOption('path');
  5520. $writeVersion = !$input->getOption('name-only') && !$input->getOption('path') && $showVersion;
  5521. $writeLatest = $writeVersion && $showLatest;
  5522. $writeDescription = !$input->getOption('name-only') && !$input->getOption('path');
  5523. $hasOutdatedPackages = false;
  5524. $viewData[$type] = array();
  5525. foreach ($packages[$type] as $package) {
  5526. $packageViewData = array();
  5527. if (is_object($package)) {
  5528. $latestPackage = null;
  5529. if ($showLatest && isset($latestPackages[$package->getPrettyName()])) {
  5530. $latestPackage = $latestPackages[$package->getPrettyName()];
  5531. }
  5532. $packageIsUpToDate = $latestPackage && $latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion() && !$latestPackage->isAbandoned();
  5533. $packageIsIgnored = \in_array($package->getPrettyName(), $ignoredPackages, true);
  5534. if ($input->getOption('outdated') && ($packageIsUpToDate || $packageIsIgnored)) {
  5535. continue;
  5536. } elseif ($input->getOption('outdated') || $input->getOption('strict')) {
  5537. $hasOutdatedPackages = true;
  5538. }
  5539. $packageViewData['name'] = $package->getPrettyName();
  5540. $nameLength = max($nameLength, strlen($package->getPrettyName()));
  5541. if ($writeVersion) {
  5542. $packageViewData['version'] = $package->getFullPrettyVersion();
  5543. $versionLength = max($versionLength, strlen($package->getFullPrettyVersion()));
  5544. }
  5545. if ($writeLatest && $latestPackage) {
  5546. $packageViewData['latest'] = $latestPackage->getFullPrettyVersion();
  5547. $packageViewData['latest-status'] = $this->getUpdateStatus($latestPackage, $package);
  5548. $latestLength = max($latestLength, strlen($latestPackage->getFullPrettyVersion()));
  5549. }
  5550. if ($writeDescription) {
  5551. $packageViewData['description'] = $package->getDescription();
  5552. }
  5553. if ($writePath) {
  5554. $packageViewData['path'] = strtok(realpath($composer->getInstallationManager()->getInstallPath($package)), "\r\n");
  5555. }
  5556. if ($latestPackage && $latestPackage->isAbandoned()) {
  5557. $replacement = is_string($latestPackage->getReplacementPackage())
  5558. ? 'Use ' . $latestPackage->getReplacementPackage() . ' instead'
  5559. : 'No replacement was suggested';
  5560. $packageWarning = sprintf(
  5561. 'Package %s is abandoned, you should avoid using it. %s.',
  5562. $package->getPrettyName(),
  5563. $replacement
  5564. );
  5565. $packageViewData['warning'] = $packageWarning;
  5566. }
  5567. } else {
  5568. $packageViewData['name'] = $package;
  5569. $nameLength = max($nameLength, strlen($package));
  5570. }
  5571. $viewData[$type][] = $packageViewData;
  5572. }
  5573. $viewMetaData[$type] = array(
  5574. 'nameLength' => $nameLength,
  5575. 'versionLength' => $versionLength,
  5576. 'latestLength' => $latestLength,
  5577. );
  5578. if ($input->getOption('strict') && $hasOutdatedPackages) {
  5579. $exitCode = 1;
  5580. break;
  5581. }
  5582. }
  5583. }
  5584. if ('json' === $format) {
  5585. $io->write(JsonFile::encode($viewData));
  5586. } else {
  5587. foreach ($viewData as $type => $packages) {
  5588. $nameLength = $viewMetaData[$type]['nameLength'];
  5589. $versionLength = $viewMetaData[$type]['versionLength'];
  5590. $latestLength = $viewMetaData[$type]['latestLength'];
  5591. $writeVersion = $nameLength + $versionLength + 3 <= $width;
  5592. $writeLatest = $nameLength + $versionLength + $latestLength + 3 <= $width;
  5593. $writeDescription = $nameLength + $versionLength + $latestLength + 24 <= $width;
  5594. if ($writeLatest && !$io->isDecorated()) {
  5595. $latestLength += 2;
  5596. }
  5597. if ($showAllTypes) {
  5598. if ('available' === $type) {
  5599. $io->write('<comment>' . $type . '</comment>:');
  5600. } else {
  5601. $io->write('<info>' . $type . '</info>:');
  5602. }
  5603. }
  5604. foreach ($packages as $package) {
  5605. $io->write($indent . str_pad($package['name'], $nameLength, ' '), false);
  5606. if (isset($package['version']) && $writeVersion) {
  5607. $io->write(' ' . str_pad($package['version'], $versionLength, ' '), false);
  5608. }
  5609. if (isset($package['latest']) && $writeLatest) {
  5610. $latestVersion = $package['latest'];
  5611. $updateStatus = $package['latest-status'];
  5612. $style = $this->updateStatusToVersionStyle($updateStatus);
  5613. if (!$io->isDecorated()) {
  5614. $latestVersion = str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('=', '!', '~'), $updateStatus) . ' ' . $latestVersion;
  5615. }
  5616. $io->write(' <' . $style . '>' . str_pad($latestVersion, $latestLength, ' ') . '</' . $style . '>', false);
  5617. }
  5618. if (isset($package['description']) && $writeDescription) {
  5619. $description = strtok($package['description'], "\r\n");
  5620. $remaining = $width - $nameLength - $versionLength - 4;
  5621. if ($writeLatest) {
  5622. $remaining -= $latestLength;
  5623. }
  5624. if (strlen($description) > $remaining) {
  5625. $description = substr($description, 0, $remaining - 3) . '...';
  5626. }
  5627. $io->write(' ' . $description, false);
  5628. }
  5629. if (isset($package['path'])) {
  5630. $io->write(' ' . $package['path'], false);
  5631. }
  5632. $io->write('');
  5633. if (isset($package['warning'])) {
  5634. $io->writeError('<warning>' . $package['warning'] . '</warning>');
  5635. }
  5636. }
  5637. if ($showAllTypes) {
  5638. $io->write('');
  5639. }
  5640. }
  5641. }
  5642. return $exitCode;
  5643. }
  5644. protected function getRootRequires()
  5645. {
  5646. $rootPackage = $this->getComposer()->getPackage();
  5647. return array_map(
  5648. 'strtolower',
  5649. array_keys(array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()))
  5650. );
  5651. }
  5652. protected function getVersionStyle(PackageInterface $latestPackage, PackageInterface $package)
  5653. {
  5654. return $this->updateStatusToVersionStyle($this->getUpdateStatus($latestPackage, $package));
  5655. }
  5656. protected function getPackage(RepositoryInterface $installedRepo, RepositoryInterface $repos, $name, $version = null)
  5657. {
  5658. $name = strtolower($name);
  5659. $constraint = is_string($version) ? $this->versionParser->parseConstraints($version) : $version;
  5660. $policy = new DefaultPolicy();
  5661. $pool = new Pool('dev');
  5662. $pool->addRepository($repos);
  5663. $matchedPackage = null;
  5664. $versions = array();
  5665. $matches = $pool->whatProvides($name, $constraint);
  5666. foreach ($matches as $index => $package) {
  5667. if ($package->getName() !== $name) {
  5668. unset($matches[$index]);
  5669. continue;
  5670. }
  5671. if (null === $version && $installedRepo->hasPackage($package)) {
  5672. $matchedPackage = $package;
  5673. }
  5674. $versions[$package->getPrettyVersion()] = $package->getVersion();
  5675. $matches[$index] = $package->getId();
  5676. }
  5677. if (!$matchedPackage && $matches && $preferred = $policy->selectPreferredPackages($pool, array(), $matches)) {
  5678. $matchedPackage = $pool->literalToPackage($preferred[0]);
  5679. }
  5680. return array($matchedPackage, $versions);
  5681. }
  5682. protected function printMeta(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo, PackageInterface $latestPackage = null)
  5683. {
  5684. $io = $this->getIO();
  5685. $io->write('<info>name</info> : ' . $package->getPrettyName());
  5686. $io->write('<info>descrip.</info> : ' . $package->getDescription());
  5687. $io->write('<info>keywords</info> : ' . implode(', ', $package->getKeywords() ?: array()));
  5688. $this->printVersions($package, $versions, $installedRepo);
  5689. if ($latestPackage) {
  5690. $style = $this->getVersionStyle($latestPackage, $package);
  5691. $io->write('<info>latest</info> : <'.$style.'>' . $latestPackage->getPrettyVersion() . '</'.$style.'>');
  5692. } else {
  5693. $latestPackage = $package;
  5694. }
  5695. $io->write('<info>type</info> : ' . $package->getType());
  5696. $this->printLicenses($package);
  5697. $io->write('<info>source</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getSourceType(), $package->getSourceUrl(), $package->getSourceReference()));
  5698. $io->write('<info>dist</info> : ' . sprintf('[%s] <comment>%s</comment> %s', $package->getDistType(), $package->getDistUrl(), $package->getDistReference()));
  5699. if ($installedRepo->hasPackage($package)) {
  5700. $io->write('<info>path</info> : ' . sprintf('%s', realpath($this->getComposer()->getInstallationManager()->getInstallPath($package))));
  5701. }
  5702. $io->write('<info>names</info> : ' . implode(', ', $package->getNames()));
  5703. if ($latestPackage->isAbandoned()) {
  5704. $replacement = ($latestPackage->getReplacementPackage() !== null)
  5705. ? ' The author suggests using the ' . $latestPackage->getReplacementPackage(). ' package instead.'
  5706. : null;
  5707. $io->writeError(
  5708. sprintf('<warning>Attention: This package is abandoned and no longer maintained.%s</warning>', $replacement)
  5709. );
  5710. }
  5711. if ($package->getSupport()) {
  5712. $io->write("\n<info>support</info>");
  5713. foreach ($package->getSupport() as $type => $value) {
  5714. $io->write('<comment>' . $type . '</comment> : '.$value);
  5715. }
  5716. }
  5717. if ($package->getAutoload()) {
  5718. $io->write("\n<info>autoload</info>");
  5719. foreach ($package->getAutoload() as $type => $autoloads) {
  5720. $io->write('<comment>' . $type . '</comment>');
  5721. if ($type === 'psr-0') {
  5722. foreach ($autoloads as $name => $path) {
  5723. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5724. }
  5725. } elseif ($type === 'psr-4') {
  5726. foreach ($autoloads as $name => $path) {
  5727. $io->write(($name ?: '*') . ' => ' . (is_array($path) ? implode(', ', $path) : ($path ?: '.')));
  5728. }
  5729. } elseif ($type === 'classmap') {
  5730. $io->write(implode(', ', $autoloads));
  5731. }
  5732. }
  5733. if ($package->getIncludePaths()) {
  5734. $io->write('<comment>include-path</comment>');
  5735. $io->write(implode(', ', $package->getIncludePaths()));
  5736. }
  5737. }
  5738. }
  5739. protected function printVersions(CompletePackageInterface $package, array $versions, RepositoryInterface $installedRepo)
  5740. {
  5741. uasort($versions, 'version_compare');
  5742. $versions = array_keys(array_reverse($versions));
  5743. if ($installedRepo->hasPackage($package)) {
  5744. $installedVersion = $package->getPrettyVersion();
  5745. $key = array_search($installedVersion, $versions);
  5746. if (false !== $key) {
  5747. $versions[$key] = '<info>* ' . $installedVersion . '</info>';
  5748. }
  5749. }
  5750. $versions = implode(', ', $versions);
  5751. $this->getIO()->write('<info>versions</info> : ' . $versions);
  5752. }
  5753. protected function printLinks(CompletePackageInterface $package, $linkType, $title = null)
  5754. {
  5755. $title = $title ?: $linkType;
  5756. $io = $this->getIO();
  5757. if ($links = $package->{'get'.ucfirst($linkType)}()) {
  5758. $io->write("\n<info>" . $title . "</info>");
  5759. foreach ($links as $link) {
  5760. $io->write($link->getTarget() . ' <comment>' . $link->getPrettyConstraint() . '</comment>');
  5761. }
  5762. }
  5763. }
  5764. protected function printLicenses(CompletePackageInterface $package)
  5765. {
  5766. $spdxLicenses = new SpdxLicenses();
  5767. $licenses = $package->getLicense();
  5768. $io = $this->getIO();
  5769. foreach ($licenses as $licenseId) {
  5770. $license = $spdxLicenses->getLicenseByIdentifier($licenseId);
  5771. if (!$license) {
  5772. $out = $licenseId;
  5773. } else {
  5774. if ($license[1] === true) {
  5775. $out = sprintf('%s (%s) (OSI approved) %s', $license[0], $licenseId, $license[2]);
  5776. } else {
  5777. $out = sprintf('%s (%s) %s', $license[0], $licenseId, $license[2]);
  5778. }
  5779. }
  5780. $io->write('<info>license</info> : ' . $out);
  5781. }
  5782. }
  5783. protected function initStyles(OutputInterface $output)
  5784. {
  5785. $this->colors = array(
  5786. 'green',
  5787. 'yellow',
  5788. 'cyan',
  5789. 'magenta',
  5790. 'blue',
  5791. );
  5792. foreach ($this->colors as $color) {
  5793. $style = new OutputFormatterStyle($color);
  5794. $output->getFormatter()->setStyle($color, $style);
  5795. }
  5796. }
  5797. protected function displayPackageTree(array $arrayTree)
  5798. {
  5799. $io = $this->getIO();
  5800. foreach ($arrayTree as $package) {
  5801. $io->write(sprintf('<info>%s</info>', $package['name']), false);
  5802. $io->write(' ' . $package['version'], false);
  5803. $io->write(' ' . strtok($package['description'], "\r\n"));
  5804. if (isset($package['requires'])) {
  5805. $requires = $package['requires'];
  5806. $treeBar = '├';
  5807. $j = 0;
  5808. $total = count($requires);
  5809. foreach ($requires as $require) {
  5810. $requireName = $require['name'];
  5811. $j++;
  5812. if ($j === $total) {
  5813. $treeBar = 'â””';
  5814. }
  5815. $level = 1;
  5816. $color = $this->colors[$level];
  5817. $info = sprintf(
  5818. '%s──<%s>%s</%s> %s',
  5819. $treeBar,
  5820. $color,
  5821. $requireName,
  5822. $color,
  5823. $require['version']
  5824. );
  5825. $this->writeTreeLine($info);
  5826. $treeBar = str_replace('â””', ' ', $treeBar);
  5827. $packagesInTree = array($package['name'], $requireName);
  5828. $this->displayTree($require, $packagesInTree, $treeBar, $level + 1);
  5829. }
  5830. }
  5831. }
  5832. }
  5833. protected function generatePackageTree(
  5834. PackageInterface $package,
  5835. RepositoryInterface $installedRepo,
  5836. RepositoryInterface $distantRepos
  5837. ) {
  5838. $requires = $package->getRequires();
  5839. ksort($requires);
  5840. $children = array();
  5841. foreach ($requires as $requireName => $require) {
  5842. $packagesInTree = array($package->getName(), $requireName);
  5843. $treeChildDesc = array(
  5844. 'name' => $requireName,
  5845. 'version' => $require->getPrettyConstraint(),
  5846. );
  5847. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $packagesInTree);
  5848. if ($deepChildren) {
  5849. $treeChildDesc['requires'] = $deepChildren;
  5850. }
  5851. $children[] = $treeChildDesc;
  5852. }
  5853. $tree = array(
  5854. 'name' => $package->getPrettyName(),
  5855. 'version' => $package->getPrettyVersion(),
  5856. 'description' => $package->getDescription(),
  5857. );
  5858. if ($children) {
  5859. $tree['requires'] = $children;
  5860. }
  5861. return $tree;
  5862. }
  5863. protected function displayTree(
  5864. $package,
  5865. array $packagesInTree,
  5866. $previousTreeBar = '├',
  5867. $level = 1
  5868. ) {
  5869. $previousTreeBar = str_replace('├', '│', $previousTreeBar);
  5870. if (isset($package['requires'])) {
  5871. $requires = $package['requires'];
  5872. $treeBar = $previousTreeBar . ' ├';
  5873. $i = 0;
  5874. $total = count($requires);
  5875. foreach ($requires as $require) {
  5876. $currentTree = $packagesInTree;
  5877. $i++;
  5878. if ($i === $total) {
  5879. $treeBar = $previousTreeBar . ' â””';
  5880. }
  5881. $colorIdent = $level % count($this->colors);
  5882. $color = $this->colors[$colorIdent];
  5883. $circularWarn = in_array(
  5884. $require['name'],
  5885. $currentTree,
  5886. true
  5887. ) ? '(circular dependency aborted here)' : '';
  5888. $info = rtrim(sprintf(
  5889. '%s──<%s>%s</%s> %s %s',
  5890. $treeBar,
  5891. $color,
  5892. $require['name'],
  5893. $color,
  5894. $require['version'],
  5895. $circularWarn
  5896. ));
  5897. $this->writeTreeLine($info);
  5898. $treeBar = str_replace('â””', ' ', $treeBar);
  5899. $currentTree[] = $require['name'];
  5900. $this->displayTree($require, $currentTree, $treeBar, $level + 1);
  5901. }
  5902. }
  5903. }
  5904. protected function addTree(
  5905. $name,
  5906. $package,
  5907. RepositoryInterface $installedRepo,
  5908. RepositoryInterface $distantRepos,
  5909. array $packagesInTree
  5910. ) {
  5911. $children = array();
  5912. list($package, $versions) = $this->getPackage(
  5913. $installedRepo,
  5914. $distantRepos,
  5915. $name,
  5916. $package->getPrettyConstraint() === 'self.version' ? $package->getConstraint() : $package->getPrettyConstraint()
  5917. );
  5918. if (is_object($package)) {
  5919. $requires = $package->getRequires();
  5920. ksort($requires);
  5921. foreach ($requires as $requireName => $require) {
  5922. $currentTree = $packagesInTree;
  5923. $treeChildDesc = array(
  5924. 'name' => $requireName,
  5925. 'version' => $require->getPrettyConstraint(),
  5926. );
  5927. if (!in_array($requireName, $currentTree, true)) {
  5928. $currentTree[] = $requireName;
  5929. $deepChildren = $this->addTree($requireName, $require, $installedRepo, $distantRepos, $currentTree);
  5930. if ($deepChildren) {
  5931. $treeChildDesc['requires'] = $deepChildren;
  5932. }
  5933. }
  5934. $children[] = $treeChildDesc;
  5935. }
  5936. }
  5937. return $children;
  5938. }
  5939. private function updateStatusToVersionStyle($updateStatus)
  5940. {
  5941. return str_replace(array('up-to-date', 'semver-safe-update', 'update-possible'), array('info', 'highlight', 'comment'), $updateStatus);
  5942. }
  5943. private function getUpdateStatus(PackageInterface $latestPackage, PackageInterface $package)
  5944. {
  5945. if ($latestPackage->getFullPrettyVersion() === $package->getFullPrettyVersion()) {
  5946. return 'up-to-date';
  5947. }
  5948. $constraint = $package->getVersion();
  5949. if (0 !== strpos($constraint, 'dev-')) {
  5950. $constraint = '^'.$constraint;
  5951. }
  5952. if ($latestPackage->getVersion() && Semver::satisfies($latestPackage->getVersion(), $constraint)) {
  5953. return 'semver-safe-update';
  5954. }
  5955. return 'update-possible';
  5956. }
  5957. private function writeTreeLine($line)
  5958. {
  5959. $io = $this->getIO();
  5960. if (!$io->isDecorated()) {
  5961. $line = str_replace(array('└', '├', '──', '│'), array('`-', '|-', '-', '|'), $line);
  5962. }
  5963. $io->write($line);
  5964. }
  5965. private function findLatestPackage(PackageInterface $package, Composer $composer, $phpVersion, $minorOnly = false)
  5966. {
  5967. $name = $package->getName();
  5968. $versionSelector = new VersionSelector($this->getPool($composer));
  5969. $stability = $composer->getPackage()->getMinimumStability();
  5970. $flags = $composer->getPackage()->getStabilityFlags();
  5971. if (isset($flags[$name])) {
  5972. $stability = array_search($flags[$name], BasePackage::$stabilities, true);
  5973. }
  5974. $bestStability = $stability;
  5975. if ($composer->getPackage()->getPreferStable()) {
  5976. $bestStability = $package->getStability();
  5977. }
  5978. $targetVersion = null;
  5979. if (0 === strpos($package->getVersion(), 'dev-')) {
  5980. $targetVersion = $package->getVersion();
  5981. }
  5982. if ($targetVersion === null && $minorOnly) {
  5983. $targetVersion = '^' . $package->getVersion();
  5984. }
  5985. return $versionSelector->findBestCandidate($name, $targetVersion, $phpVersion, $bestStability);
  5986. }
  5987. private function getPool(Composer $composer)
  5988. {
  5989. if (!$this->pool) {
  5990. $this->pool = new Pool($composer->getPackage()->getMinimumStability(), $composer->getPackage()->getStabilityFlags());
  5991. $this->pool->addRepository(new CompositeRepository($composer->getRepositoryManager()->getRepositories()));
  5992. }
  5993. return $this->pool;
  5994. }
  5995. }
  5996. <?php
  5997. namespace Composer\Command;
  5998. use Symfony\Component\Console\Input\InputInterface;
  5999. use Symfony\Component\Console\Input\InputOption;
  6000. use Symfony\Component\Console\Output\OutputInterface;
  6001. use Composer\Downloader\ChangeReportInterface;
  6002. use Composer\Downloader\DvcsDownloaderInterface;
  6003. use Composer\Downloader\VcsCapableDownloaderInterface;
  6004. use Composer\Package\Dumper\ArrayDumper;
  6005. use Composer\Package\Version\VersionGuesser;
  6006. use Composer\Package\Version\VersionParser;
  6007. use Composer\Plugin\CommandEvent;
  6008. use Composer\Plugin\PluginEvents;
  6009. use Composer\Script\ScriptEvents;
  6010. use Composer\Util\ProcessExecutor;
  6011. class StatusCommand extends BaseCommand
  6012. {
  6013. const EXIT_CODE_ERRORS = 1;
  6014. const EXIT_CODE_UNPUSHED_CHANGES = 2;
  6015. const EXIT_CODE_VERSION_CHANGES = 4;
  6016. protected function configure()
  6017. {
  6018. $this
  6019. ->setName('status')
  6020. ->setDescription('Shows a list of locally modified packages, for packages installed from source.')
  6021. ->setDefinition(array(
  6022. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Show modified files for each directory that contains changes.'),
  6023. ))
  6024. ->setHelp(
  6025. <<<EOT
  6026. The status command displays a list of dependencies that have
  6027. been modified locally.
  6028. Read more at https://getcomposer.org/doc/03-cli.md#status
  6029. EOT
  6030. )
  6031. ;
  6032. }
  6033. protected function execute(InputInterface $input, OutputInterface $output)
  6034. {
  6035. $composer = $this->getComposer();
  6036. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'status', $input, $output);
  6037. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6038. $installedRepo = $composer->getRepositoryManager()->getLocalRepository();
  6039. $dm = $composer->getDownloadManager();
  6040. $im = $composer->getInstallationManager();
  6041. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::PRE_STATUS_CMD, true);
  6042. $errors = array();
  6043. $io = $this->getIO();
  6044. $unpushedChanges = array();
  6045. $vcsVersionChanges = array();
  6046. $parser = new VersionParser;
  6047. $guesser = new VersionGuesser($composer->getConfig(), new ProcessExecutor($io), $parser);
  6048. $dumper = new ArrayDumper;
  6049. foreach ($installedRepo->getCanonicalPackages() as $package) {
  6050. $downloader = $dm->getDownloaderForInstalledPackage($package);
  6051. $targetDir = $im->getInstallPath($package);
  6052. if ($downloader instanceof ChangeReportInterface) {
  6053. if (is_link($targetDir)) {
  6054. $errors[$targetDir] = $targetDir . ' is a symbolic link.';
  6055. }
  6056. if ($changes = $downloader->getLocalChanges($package, $targetDir)) {
  6057. $errors[$targetDir] = $changes;
  6058. }
  6059. }
  6060. if ($downloader instanceof VcsCapableDownloaderInterface) {
  6061. if ($currentRef = $downloader->getVcsReference($package, $targetDir)) {
  6062. switch ($package->getInstallationSource()) {
  6063. case 'source':
  6064. $previousRef = $package->getSourceReference();
  6065. break;
  6066. case 'dist':
  6067. $previousRef = $package->getDistReference();
  6068. break;
  6069. default:
  6070. $previousRef = null;
  6071. }
  6072. $currentVersion = $guesser->guessVersion($dumper->dump($package), $targetDir);
  6073. if ($previousRef && $currentVersion && $currentVersion['commit'] !== $previousRef) {
  6074. $vcsVersionChanges[$targetDir] = array(
  6075. 'previous' => array(
  6076. 'version' => $package->getPrettyVersion(),
  6077. 'ref' => $previousRef,
  6078. ),
  6079. 'current' => array(
  6080. 'version' => $currentVersion['pretty_version'],
  6081. 'ref' => $currentVersion['commit'],
  6082. ),
  6083. );
  6084. }
  6085. }
  6086. }
  6087. if ($downloader instanceof DvcsDownloaderInterface) {
  6088. if ($unpushed = $downloader->getUnpushedChanges($package, $targetDir)) {
  6089. $unpushedChanges[$targetDir] = $unpushed;
  6090. }
  6091. }
  6092. }
  6093. if (!$errors && !$unpushedChanges && !$vcsVersionChanges) {
  6094. $io->writeError('<info>No local changes</info>');
  6095. return 0;
  6096. }
  6097. if ($errors) {
  6098. $io->writeError('<error>You have changes in the following dependencies:</error>');
  6099. foreach ($errors as $path => $changes) {
  6100. if ($input->getOption('verbose')) {
  6101. $indentedChanges = implode("\n", array_map(function ($line) {
  6102. return ' ' . ltrim($line);
  6103. }, explode("\n", $changes)));
  6104. $io->write('<info>'.$path.'</info>:');
  6105. $io->write($indentedChanges);
  6106. } else {
  6107. $io->write($path);
  6108. }
  6109. }
  6110. }
  6111. if ($unpushedChanges) {
  6112. $io->writeError('<warning>You have unpushed changes on the current branch in the following dependencies:</warning>');
  6113. foreach ($unpushedChanges as $path => $changes) {
  6114. if ($input->getOption('verbose')) {
  6115. $indentedChanges = implode("\n", array_map(function ($line) {
  6116. return ' ' . ltrim($line);
  6117. }, explode("\n", $changes)));
  6118. $io->write('<info>'.$path.'</info>:');
  6119. $io->write($indentedChanges);
  6120. } else {
  6121. $io->write($path);
  6122. }
  6123. }
  6124. }
  6125. if ($vcsVersionChanges) {
  6126. $io->writeError('<warning>You have version variations in the following dependencies:</warning>');
  6127. foreach ($vcsVersionChanges as $path => $changes) {
  6128. if ($input->getOption('verbose')) {
  6129. $currentVersion = $changes['current']['version'] ?: $changes['current']['ref'];
  6130. $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref'];
  6131. if ($io->isVeryVerbose()) {
  6132. $currentVersion .= sprintf(' (%s)', $changes['current']['ref']);
  6133. $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']);
  6134. }
  6135. $io->write('<info>'.$path.'</info>:');
  6136. $io->write(sprintf(' From <comment>%s</comment> to <comment>%s</comment>', $previousVersion, $currentVersion));
  6137. } else {
  6138. $io->write($path);
  6139. }
  6140. }
  6141. }
  6142. if (($errors || $unpushedChanges || $vcsVersionChanges) && !$input->getOption('verbose')) {
  6143. $io->writeError('Use --verbose (-v) to see a list of files');
  6144. }
  6145. $composer->getEventDispatcher()->dispatchScript(ScriptEvents::POST_STATUS_CMD, true);
  6146. return ($errors ? self::EXIT_CODE_ERRORS : 0) + ($unpushedChanges ? self::EXIT_CODE_UNPUSHED_CHANGES : 0) + ($vcsVersionChanges ? self::EXIT_CODE_VERSION_CHANGES : 0);
  6147. }
  6148. }
  6149. <?php
  6150. namespace Composer\Command;
  6151. use Composer\Repository\PlatformRepository;
  6152. use Symfony\Component\Console\Input\InputArgument;
  6153. use Symfony\Component\Console\Input\InputInterface;
  6154. use Symfony\Component\Console\Input\InputOption;
  6155. use Symfony\Component\Console\Output\OutputInterface;
  6156. class SuggestsCommand extends BaseCommand
  6157. {
  6158. protected function configure()
  6159. {
  6160. $this
  6161. ->setName('suggests')
  6162. ->setDescription('Shows package suggestions.')
  6163. ->setDefinition(array(
  6164. new InputOption('by-package', null, InputOption::VALUE_NONE, 'Groups output by suggesting package'),
  6165. new InputOption('by-suggestion', null, InputOption::VALUE_NONE, 'Groups output by suggested package'),
  6166. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Exclude suggestions from require-dev packages'),
  6167. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that you want to list suggestions from.'),
  6168. ))
  6169. ->setHelp(
  6170. <<<EOT
  6171. The <info>%command.name%</info> command shows a sorted list of suggested packages.
  6172. Enabling <info>-v</info> implies <info>--by-package --by-suggestion</info>, showing both lists.
  6173. Read more at https://getcomposer.org/doc/03-cli.md#suggests
  6174. EOT
  6175. )
  6176. ;
  6177. }
  6178. protected function execute(InputInterface $input, OutputInterface $output)
  6179. {
  6180. $lock = $this->getComposer()->getLocker()->getLockData();
  6181. if (empty($lock)) {
  6182. throw new \RuntimeException('Lockfile seems to be empty?');
  6183. }
  6184. $packages = $lock['packages'];
  6185. if (!$input->getOption('no-dev')) {
  6186. $packages += $lock['packages-dev'];
  6187. }
  6188. $filter = $input->getArgument('packages');
  6189. $installed = array();
  6190. foreach ($packages as $package) {
  6191. $installed[] = $package['name'];
  6192. if (!empty($package['provide'])) {
  6193. $installed = array_merge($installed, array_keys($package['provide']));
  6194. }
  6195. if (!empty($package['replace'])) {
  6196. $installed = array_merge($installed, array_keys($package['replace']));
  6197. }
  6198. }
  6199. $installed = array_flip($installed);
  6200. ksort($installed);
  6201. $platform = new PlatformRepository(array(), $this->getComposer()->getConfig()->get('platform') ?: array());
  6202. $suggesters = array();
  6203. $suggested = array();
  6204. foreach ($packages as $package) {
  6205. $packageName = $package['name'];
  6206. if ((!empty($filter) && !in_array($packageName, $filter)) || empty($package['suggest'])) {
  6207. continue;
  6208. }
  6209. foreach ($package['suggest'] as $suggestion => $reason) {
  6210. if (false === strpos('/', $suggestion) && null !== $platform->findPackage($suggestion, '*')) {
  6211. continue;
  6212. }
  6213. if (!isset($installed[$suggestion])) {
  6214. $suggesters[$packageName][$suggestion] = $reason;
  6215. $suggested[$suggestion][$packageName] = $reason;
  6216. }
  6217. }
  6218. }
  6219. ksort($suggesters);
  6220. ksort($suggested);
  6221. $mode = 0;
  6222. $io = $this->getIO();
  6223. if ($input->getOption('by-package') || $io->isVerbose()) {
  6224. $mode |= 1;
  6225. }
  6226. if ($input->getOption('by-suggestion')) {
  6227. $mode |= 2;
  6228. }
  6229. if ($mode === 0) {
  6230. foreach (array_keys($suggested) as $suggestion) {
  6231. $io->write(sprintf('<info>%s</info>', $suggestion));
  6232. }
  6233. return 0;
  6234. }
  6235. if ($mode & 1) {
  6236. foreach ($suggesters as $suggester => $suggestions) {
  6237. $io->write(sprintf('<comment>%s</comment> suggests:', $suggester));
  6238. foreach ($suggestions as $suggestion => $reason) {
  6239. $io->write(sprintf(' - <info>%s</info>: %s', $suggestion, $reason ?: '*'));
  6240. }
  6241. $io->write('');
  6242. }
  6243. }
  6244. if ($mode & 2) {
  6245. if ($mode & 1) {
  6246. $io->write(str_repeat('-', 78));
  6247. }
  6248. foreach ($suggested as $suggestion => $suggesters) {
  6249. $io->write(sprintf('<comment>%s</comment> is suggested by:', $suggestion));
  6250. foreach ($suggesters as $suggester => $reason) {
  6251. $io->write(sprintf(' - <info>%s</info>: %s', $suggester, $reason ?: '*'));
  6252. }
  6253. $io->write('');
  6254. }
  6255. }
  6256. return 0;
  6257. }
  6258. }
  6259. <?php
  6260. namespace Composer\Command;
  6261. use Composer\Composer;
  6262. use Composer\Installer;
  6263. use Composer\IO\IOInterface;
  6264. use Composer\Plugin\CommandEvent;
  6265. use Composer\Plugin\PluginEvents;
  6266. use Symfony\Component\Console\Helper\Table;
  6267. use Symfony\Component\Console\Input\InputInterface;
  6268. use Symfony\Component\Console\Input\InputOption;
  6269. use Symfony\Component\Console\Input\InputArgument;
  6270. use Symfony\Component\Console\Output\OutputInterface;
  6271. use Symfony\Component\Console\Question\Question;
  6272. class UpdateCommand extends BaseCommand
  6273. {
  6274. protected function configure()
  6275. {
  6276. $this
  6277. ->setName('update')
  6278. ->setAliases(array('u', 'upgrade'))
  6279. ->setDescription('Upgrades your dependencies to the latest version according to composer.json, and updates the composer.lock file.')
  6280. ->setDefinition(array(
  6281. new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Packages that should be updated, if not provided all packages are.'),
  6282. new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'),
  6283. new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'),
  6284. new InputOption('dry-run', null, InputOption::VALUE_NONE, 'Outputs the operations but will not execute anything (implicitly enables --verbose).'),
  6285. new InputOption('dev', null, InputOption::VALUE_NONE, 'Enables installation of require-dev packages (enabled by default, only present for BC).'),
  6286. new InputOption('no-dev', null, InputOption::VALUE_NONE, 'Disables installation of require-dev packages.'),
  6287. new InputOption('lock', null, InputOption::VALUE_NONE, 'Only updates the lock file hash to suppress warning about the lock file being out of date.'),
  6288. new InputOption('no-custom-installers', null, InputOption::VALUE_NONE, 'DEPRECATED: Use no-plugins instead.'),
  6289. new InputOption('no-autoloader', null, InputOption::VALUE_NONE, 'Skips autoloader generation'),
  6290. new InputOption('no-scripts', null, InputOption::VALUE_NONE, 'Skips the execution of all scripts defined in composer.json file.'),
  6291. new InputOption('no-progress', null, InputOption::VALUE_NONE, 'Do not output download progress.'),
  6292. new InputOption('no-suggest', null, InputOption::VALUE_NONE, 'Do not show package suggestions.'),
  6293. new InputOption('with-dependencies', null, InputOption::VALUE_NONE, 'Add also dependencies of whitelisted packages to the whitelist, except those defined in root package.'),
  6294. new InputOption('with-all-dependencies', null, InputOption::VALUE_NONE, 'Add also all dependencies of whitelisted packages to the whitelist, including those defined in root package.'),
  6295. new InputOption('verbose', 'v|vv|vvv', InputOption::VALUE_NONE, 'Shows more details including new commits pulled in when updating packages.'),
  6296. new InputOption('optimize-autoloader', 'o', InputOption::VALUE_NONE, 'Optimize autoloader during autoloader dump.'),
  6297. new InputOption('classmap-authoritative', 'a', InputOption::VALUE_NONE, 'Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`.'),
  6298. new InputOption('apcu-autoloader', null, InputOption::VALUE_NONE, 'Use APCu to cache found/not-found classes.'),
  6299. new InputOption('ignore-platform-reqs', null, InputOption::VALUE_NONE, 'Ignore platform requirements (php & ext- packages).'),
  6300. new InputOption('prefer-stable', null, InputOption::VALUE_NONE, 'Prefer stable versions of dependencies.'),
  6301. new InputOption('prefer-lowest', null, InputOption::VALUE_NONE, 'Prefer lowest versions of dependencies.'),
  6302. new InputOption('interactive', 'i', InputOption::VALUE_NONE, 'Interactive interface with autocompletion to select the packages to update.'),
  6303. new InputOption('root-reqs', null, InputOption::VALUE_NONE, 'Restricts the update to your first degree dependencies.'),
  6304. ))
  6305. ->setHelp(
  6306. <<<EOT
  6307. The <info>update</info> command reads the composer.json file from the
  6308. current directory, processes it, and updates, removes or installs all the
  6309. dependencies.
  6310. <info>php composer.phar update</info>
  6311. To limit the update operation to a few packages, you can list the package(s)
  6312. you want to update as such:
  6313. <info>php composer.phar update vendor/package1 foo/mypackage [...]</info>
  6314. You may also use an asterisk (*) pattern to limit the update operation to package(s)
  6315. from a specific vendor:
  6316. <info>php composer.phar update vendor/package1 foo/* [...]</info>
  6317. To select packages names interactively with auto-completion use <info>-i</info>.
  6318. Read more at https://getcomposer.org/doc/03-cli.md#update-u
  6319. EOT
  6320. )
  6321. ;
  6322. }
  6323. protected function execute(InputInterface $input, OutputInterface $output)
  6324. {
  6325. $io = $this->getIO();
  6326. if ($input->getOption('no-custom-installers')) {
  6327. $io->writeError('<warning>You are using the deprecated option "no-custom-installers". Use "no-plugins" instead.</warning>');
  6328. $input->setOption('no-plugins', true);
  6329. }
  6330. if ($input->getOption('dev')) {
  6331. $io->writeError('<warning>You are using the deprecated option "dev". Dev packages are installed by default now.</warning>');
  6332. }
  6333. $composer = $this->getComposer(true, $input->getOption('no-plugins'));
  6334. $packages = $input->getArgument('packages');
  6335. if ($input->getOption('interactive')) {
  6336. $packages = $this->getPackagesInteractively($io, $input, $output, $composer, $packages);
  6337. }
  6338. if ($input->getOption('root-reqs')) {
  6339. $require = array_keys($composer->getPackage()->getRequires());
  6340. if (!$input->getOption('no-dev')) {
  6341. $requireDev = array_keys($composer->getPackage()->getDevRequires());
  6342. $require = array_merge($require, $requireDev);
  6343. }
  6344. if (!empty($packages)) {
  6345. $packages = array_intersect($packages, $require);
  6346. } else {
  6347. $packages = $require;
  6348. }
  6349. }
  6350. $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress'));
  6351. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'update', $input, $output);
  6352. $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6353. $install = Installer::create($io, $composer);
  6354. $config = $composer->getConfig();
  6355. list($preferSource, $preferDist) = $this->getPreferredInstallOptions($config, $input);
  6356. $optimize = $input->getOption('optimize-autoloader') || $config->get('optimize-autoloader');
  6357. $authoritative = $input->getOption('classmap-authoritative') || $config->get('classmap-authoritative');
  6358. $apcu = $input->getOption('apcu-autoloader') || $config->get('apcu-autoloader');
  6359. $install
  6360. ->setDryRun($input->getOption('dry-run'))
  6361. ->setVerbose($input->getOption('verbose'))
  6362. ->setPreferSource($preferSource)
  6363. ->setPreferDist($preferDist)
  6364. ->setDevMode(!$input->getOption('no-dev'))
  6365. ->setDumpAutoloader(!$input->getOption('no-autoloader'))
  6366. ->setRunScripts(!$input->getOption('no-scripts'))
  6367. ->setSkipSuggest($input->getOption('no-suggest'))
  6368. ->setOptimizeAutoloader($optimize)
  6369. ->setClassMapAuthoritative($authoritative)
  6370. ->setApcuAutoloader($apcu)
  6371. ->setUpdate(true)
  6372. ->setUpdateWhitelist($input->getOption('lock') ? array('lock') : $packages)
  6373. ->setWhitelistTransitiveDependencies($input->getOption('with-dependencies'))
  6374. ->setWhitelistAllDependencies($input->getOption('with-all-dependencies'))
  6375. ->setIgnorePlatformRequirements($input->getOption('ignore-platform-reqs'))
  6376. ->setPreferStable($input->getOption('prefer-stable'))
  6377. ->setPreferLowest($input->getOption('prefer-lowest'))
  6378. ;
  6379. if ($input->getOption('no-plugins')) {
  6380. $install->disablePlugins();
  6381. }
  6382. return $install->run();
  6383. }
  6384. private function getPackagesInteractively(IOInterface $io, InputInterface $input, OutputInterface $output, Composer $composer, array $packages)
  6385. {
  6386. if (!$input->isInteractive()) {
  6387. throw new \InvalidArgumentException('--interactive cannot be used in non-interactive terminals.');
  6388. }
  6389. $requires = array_merge(
  6390. $composer->getPackage()->getRequires(),
  6391. $composer->getPackage()->getDevRequires()
  6392. );
  6393. $autocompleterValues = array();
  6394. foreach ($requires as $require) {
  6395. $target = $require->getTarget();
  6396. $autocompleterValues[strtolower($target)] = $target;
  6397. }
  6398. $installedPackages = $composer->getRepositoryManager()->getLocalRepository()->getPackages();
  6399. foreach ($installedPackages as $package) {
  6400. $autocompleterValues[$package->getName()] = $package->getPrettyName();
  6401. }
  6402. $helper = $this->getHelper('question');
  6403. $question = new Question('<comment>Enter package name: </comment>', null);
  6404. $io->writeError('<info>Press enter without value to end submission</info>');
  6405. do {
  6406. $autocompleterValues = array_diff($autocompleterValues, $packages);
  6407. $question->setAutocompleterValues($autocompleterValues);
  6408. $addedPackage = $helper->ask($input, $output, $question);
  6409. if (!is_string($addedPackage) || empty($addedPackage)) {
  6410. break;
  6411. }
  6412. $addedPackage = strtolower($addedPackage);
  6413. if (!in_array($addedPackage, $packages)) {
  6414. $packages[] = $addedPackage;
  6415. }
  6416. } while (true);
  6417. $packages = array_filter($packages);
  6418. if (!$packages) {
  6419. throw new \InvalidArgumentException('You must enter minimum one package.');
  6420. }
  6421. $table = new Table($output);
  6422. $table->setHeaders(array('Selected packages'));
  6423. foreach ($packages as $package) {
  6424. $table->addRow(array($package));
  6425. }
  6426. $table->render();
  6427. if ($io->askConfirmation(sprintf(
  6428. 'Would you like to continue and update the above package%s [<comment>yes</comment>]? ',
  6429. 1 === count($packages) ? '' : 's'
  6430. ), true)) {
  6431. return $packages;
  6432. }
  6433. throw new \RuntimeException('Installation aborted.');
  6434. }
  6435. }
  6436. <?php
  6437. namespace Composer\Command;
  6438. use Composer\Factory;
  6439. use Composer\Package\Loader\ValidatingArrayLoader;
  6440. use Composer\Plugin\CommandEvent;
  6441. use Composer\Plugin\PluginEvents;
  6442. use Composer\Util\ConfigValidator;
  6443. use Symfony\Component\Console\Input\InputArgument;
  6444. use Symfony\Component\Console\Input\InputInterface;
  6445. use Symfony\Component\Console\Input\InputOption;
  6446. use Symfony\Component\Console\Output\OutputInterface;
  6447. class ValidateCommand extends BaseCommand
  6448. {
  6449. protected function configure()
  6450. {
  6451. $this
  6452. ->setName('validate')
  6453. ->setDescription('Validates a composer.json and composer.lock.')
  6454. ->setDefinition(array(
  6455. new InputOption('no-check-all', null, InputOption::VALUE_NONE, 'Do not validate requires for overly strict/loose constraints'),
  6456. new InputOption('no-check-lock', null, InputOption::VALUE_NONE, 'Do not check if lock file is up to date'),
  6457. new InputOption('no-check-publish', null, InputOption::VALUE_NONE, 'Do not check for publish errors'),
  6458. new InputOption('with-dependencies', 'A', InputOption::VALUE_NONE, 'Also validate the composer.json of all installed dependencies'),
  6459. new InputOption('strict', null, InputOption::VALUE_NONE, 'Return a non-zero exit code for warnings as well as errors'),
  6460. new InputArgument('file', InputArgument::OPTIONAL, 'path to composer.json file'),
  6461. ))
  6462. ->setHelp(
  6463. <<<EOT
  6464. The validate command validates a given composer.json and composer.lock
  6465. Exit codes in case of errors are:
  6466. 1 validation warning(s), only when --strict is given
  6467. 2 validation error(s)
  6468. 3 file unreadable or missing
  6469. Read more at https://getcomposer.org/doc/03-cli.md#validate
  6470. EOT
  6471. );
  6472. }
  6473. protected function execute(InputInterface $input, OutputInterface $output)
  6474. {
  6475. $file = $input->getArgument('file') ?: Factory::getComposerFile();
  6476. $io = $this->getIO();
  6477. if (!file_exists($file)) {
  6478. $io->writeError('<error>' . $file . ' not found.</error>');
  6479. return 3;
  6480. }
  6481. if (!is_readable($file)) {
  6482. $io->writeError('<error>' . $file . ' is not readable.</error>');
  6483. return 3;
  6484. }
  6485. $validator = new ConfigValidator($io);
  6486. $checkAll = $input->getOption('no-check-all') ? 0 : ValidatingArrayLoader::CHECK_ALL;
  6487. $checkPublish = !$input->getOption('no-check-publish');
  6488. $checkLock = !$input->getOption('no-check-lock');
  6489. $isStrict = $input->getOption('strict');
  6490. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6491. $lockErrors = array();
  6492. $composer = Factory::create($io, $file, $input->hasParameterOption('--no-plugins'));
  6493. $locker = $composer->getLocker();
  6494. if ($locker->isLocked() && !$locker->isFresh()) {
  6495. $lockErrors[] = 'The lock file is not up to date with the latest changes in composer.json, it is recommended that you run `composer update`.';
  6496. }
  6497. $this->outputResult($io, $file, $errors, $warnings, $checkPublish, $publishErrors, $checkLock, $lockErrors, true, $isStrict);
  6498. $exitCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6499. if ($input->getOption('with-dependencies')) {
  6500. $localRepo = $composer->getRepositoryManager()->getLocalRepository();
  6501. foreach ($localRepo->getPackages() as $package) {
  6502. $path = $composer->getInstallationManager()->getInstallPath($package);
  6503. $file = $path . '/composer.json';
  6504. if (is_dir($path) && file_exists($file)) {
  6505. list($errors, $publishErrors, $warnings) = $validator->validate($file, $checkAll);
  6506. $this->outputResult($io, $package->getPrettyName(), $errors, $warnings, $checkPublish, $publishErrors);
  6507. $depCode = $errors ? 2 : ($isStrict && $warnings ? 1 : 0);
  6508. $exitCode = max($depCode, $exitCode);
  6509. }
  6510. }
  6511. }
  6512. $commandEvent = new CommandEvent(PluginEvents::COMMAND, 'validate', $input, $output);
  6513. $eventCode = $composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
  6514. $exitCode = max($eventCode, $exitCode);
  6515. return $exitCode;
  6516. }
  6517. private function outputResult($io, $name, &$errors, &$warnings, $checkPublish = false, $publishErrors = array(), $checkLock = false, $lockErrors = array(), $printSchemaUrl = false, $isStrict = false)
  6518. {
  6519. if (!$errors && !$publishErrors && !$warnings) {
  6520. $io->write('<info>' . $name . ' is valid</info>');
  6521. } elseif (!$errors && !$publishErrors) {
  6522. $io->writeError('<info>' . $name . ' is valid, but with a few warnings</info>');
  6523. if ($printSchemaUrl) {
  6524. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6525. }
  6526. } elseif (!$errors) {
  6527. $io->writeError('<info>' . $name . ' is valid for simple usage with composer but has</info>');
  6528. $io->writeError('<info>strict errors that make it unable to be published as a package:</info>');
  6529. if ($printSchemaUrl) {
  6530. $io->writeError('<warning>See https://getcomposer.org/doc/04-schema.md for details on the schema</warning>');
  6531. }
  6532. } else {
  6533. $io->writeError('<error>' . $name . ' is invalid, the following errors/warnings were found:</error>');
  6534. }
  6535. if ($checkPublish) {
  6536. $errors = array_merge($errors, $publishErrors);
  6537. } elseif (!$isStrict) {
  6538. $warnings = array_merge($warnings, $publishErrors);
  6539. }
  6540. if ($checkLock) {
  6541. $errors = array_merge($errors, $lockErrors);
  6542. } elseif (!$isStrict) {
  6543. $warnings = array_merge($warnings, $lockErrors);
  6544. }
  6545. $messages = array(
  6546. 'error' => $errors,
  6547. 'warning' => $warnings,
  6548. );
  6549. foreach ($messages as $style => $msgs) {
  6550. foreach ($msgs as $msg) {
  6551. $io->writeError('<' . $style . '>' . $msg . '</' . $style . '>');
  6552. }
  6553. }
  6554. }
  6555. }
  6556. <?php
  6557. namespace Composer;
  6558. use Composer\Package\RootPackageInterface;
  6559. use Composer\Package\Locker;
  6560. use Composer\Repository\RepositoryManager;
  6561. use Composer\Installer\InstallationManager;
  6562. use Composer\Plugin\PluginManager;
  6563. use Composer\Downloader\DownloadManager;
  6564. use Composer\EventDispatcher\EventDispatcher;
  6565. use Composer\Autoload\AutoloadGenerator;
  6566. use Composer\Package\Archiver\ArchiveManager;
  6567. class Composer
  6568. {
  6569. const VERSION = '1.9.1';
  6570. const BRANCH_ALIAS_VERSION = '';
  6571. const RELEASE_DATE = '2019-11-01 17:20:17';
  6572. const SOURCE_VERSION = '';
  6573. public static function getVersion()
  6574. {
  6575. if (self::VERSION === '@package_version'.'@') {
  6576. return self::SOURCE_VERSION;
  6577. }
  6578. if (self::BRANCH_ALIAS_VERSION !== '' && preg_match('{^[a-f0-9]{40}$}', self::VERSION)) {
  6579. return self::BRANCH_ALIAS_VERSION.'+'.self::VERSION;
  6580. }
  6581. return self::VERSION;
  6582. }
  6583. private $package;
  6584. private $locker;
  6585. private $repositoryManager;
  6586. private $downloadManager;
  6587. private $installationManager;
  6588. private $pluginManager;
  6589. private $config;
  6590. private $eventDispatcher;
  6591. private $autoloadGenerator;
  6592. private $archiveManager;
  6593. public function setPackage(RootPackageInterface $package)
  6594. {
  6595. $this->package = $package;
  6596. }
  6597. public function getPackage()
  6598. {
  6599. return $this->package;
  6600. }
  6601. public function setConfig(Config $config)
  6602. {
  6603. $this->config = $config;
  6604. }
  6605. public function getConfig()
  6606. {
  6607. return $this->config;
  6608. }
  6609. public function setLocker(Locker $locker)
  6610. {
  6611. $this->locker = $locker;
  6612. }
  6613. public function getLocker()
  6614. {
  6615. return $this->locker;
  6616. }
  6617. public function setRepositoryManager(RepositoryManager $manager)
  6618. {
  6619. $this->repositoryManager = $manager;
  6620. }
  6621. public function getRepositoryManager()
  6622. {
  6623. return $this->repositoryManager;
  6624. }
  6625. public function setDownloadManager(DownloadManager $manager)
  6626. {
  6627. $this->downloadManager = $manager;
  6628. }
  6629. public function getDownloadManager()
  6630. {
  6631. return $this->downloadManager;
  6632. }
  6633. public function setArchiveManager(ArchiveManager $manager)
  6634. {
  6635. $this->archiveManager = $manager;
  6636. }
  6637. public function getArchiveManager()
  6638. {
  6639. return $this->archiveManager;
  6640. }
  6641. public function setInstallationManager(InstallationManager $manager)
  6642. {
  6643. $this->installationManager = $manager;
  6644. }
  6645. public function getInstallationManager()
  6646. {
  6647. return $this->installationManager;
  6648. }
  6649. public function setPluginManager(PluginManager $manager)
  6650. {
  6651. $this->pluginManager = $manager;
  6652. }
  6653. public function getPluginManager()
  6654. {
  6655. return $this->pluginManager;
  6656. }
  6657. public function setEventDispatcher(EventDispatcher $eventDispatcher)
  6658. {
  6659. $this->eventDispatcher = $eventDispatcher;
  6660. }
  6661. public function getEventDispatcher()
  6662. {
  6663. return $this->eventDispatcher;
  6664. }
  6665. public function setAutoloadGenerator(AutoloadGenerator $autoloadGenerator)
  6666. {
  6667. $this->autoloadGenerator = $autoloadGenerator;
  6668. }
  6669. public function getAutoloadGenerator()
  6670. {
  6671. return $this->autoloadGenerator;
  6672. }
  6673. }
  6674. <?php
  6675. namespace Composer;
  6676. use Composer\Config\ConfigSourceInterface;
  6677. use Composer\Downloader\TransportException;
  6678. use Composer\IO\IOInterface;
  6679. use Composer\Util\Platform;
  6680. use Composer\Util\ProcessExecutor;
  6681. class Config
  6682. {
  6683. const RELATIVE_PATHS = 1;
  6684. public static $defaultConfig = array(
  6685. 'process-timeout' => 300,
  6686. 'use-include-path' => false,
  6687. 'preferred-install' => 'auto',
  6688. 'notify-on-install' => true,
  6689. 'github-protocols' => array('https', 'ssh', 'git'),
  6690. 'vendor-dir' => 'vendor',
  6691. 'bin-dir' => '{$vendor-dir}/bin',
  6692. 'cache-dir' => '{$home}/cache',
  6693. 'data-dir' => '{$home}',
  6694. 'cache-files-dir' => '{$cache-dir}/files',
  6695. 'cache-repo-dir' => '{$cache-dir}/repo',
  6696. 'cache-vcs-dir' => '{$cache-dir}/vcs',
  6697. 'cache-ttl' => 15552000,
  6698. 'cache-files-ttl' => null,
  6699. 'cache-files-maxsize' => '300MiB',
  6700. 'bin-compat' => 'auto',
  6701. 'discard-changes' => false,
  6702. 'autoloader-suffix' => null,
  6703. 'sort-packages' => false,
  6704. 'optimize-autoloader' => false,
  6705. 'classmap-authoritative' => false,
  6706. 'apcu-autoloader' => false,
  6707. 'prepend-autoloader' => true,
  6708. 'github-domains' => array('github.com'),
  6709. 'bitbucket-expose-hostname' => true,
  6710. 'disable-tls' => false,
  6711. 'secure-http' => true,
  6712. 'cafile' => null,
  6713. 'capath' => null,
  6714. 'github-expose-hostname' => true,
  6715. 'gitlab-domains' => array('gitlab.com'),
  6716. 'store-auths' => 'prompt',
  6717. 'platform' => array(),
  6718. 'archive-format' => 'tar',
  6719. 'archive-dir' => '.',
  6720. 'htaccess-protect' => true,
  6721. 'use-github-api' => true,
  6722. );
  6723. public static $defaultRepositories = array(
  6724. 'packagist.org' => array(
  6725. 'type' => 'composer',
  6726. 'url' => 'https?://repo.packagist.org',
  6727. 'allow_ssl_downgrade' => true,
  6728. ),
  6729. );
  6730. private $config;
  6731. private $baseDir;
  6732. private $repositories;
  6733. private $configSource;
  6734. private $authConfigSource;
  6735. private $useEnvironment;
  6736. private $warnedHosts = array();
  6737. public function __construct($useEnvironment = true, $baseDir = null)
  6738. {
  6739. $this->config = static::$defaultConfig;
  6740. $this->repositories = static::$defaultRepositories;
  6741. $this->useEnvironment = (bool) $useEnvironment;
  6742. $this->baseDir = $baseDir;
  6743. }
  6744. public function setConfigSource(ConfigSourceInterface $source)
  6745. {
  6746. $this->configSource = $source;
  6747. }
  6748. public function getConfigSource()
  6749. {
  6750. return $this->configSource;
  6751. }
  6752. public function setAuthConfigSource(ConfigSourceInterface $source)
  6753. {
  6754. $this->authConfigSource = $source;
  6755. }
  6756. public function getAuthConfigSource()
  6757. {
  6758. return $this->authConfigSource;
  6759. }
  6760. public function merge($config)
  6761. {
  6762. if (!empty($config['config']) && is_array($config['config'])) {
  6763. foreach ($config['config'] as $key => $val) {
  6764. if (in_array($key, array('bitbucket-oauth', 'github-oauth', 'gitlab-oauth', 'gitlab-token', 'http-basic')) && isset($this->config[$key])) {
  6765. $this->config[$key] = array_merge($this->config[$key], $val);
  6766. } elseif ('preferred-install' === $key && isset($this->config[$key])) {
  6767. if (is_array($val) || is_array($this->config[$key])) {
  6768. if (is_string($val)) {
  6769. $val = array('*' => $val);
  6770. }
  6771. if (is_string($this->config[$key])) {
  6772. $this->config[$key] = array('*' => $this->config[$key]);
  6773. }
  6774. $this->config[$key] = array_merge($this->config[$key], $val);
  6775. if (isset($this->config[$key]['*'])) {
  6776. $wildcard = $this->config[$key]['*'];
  6777. unset($this->config[$key]['*']);
  6778. $this->config[$key]['*'] = $wildcard;
  6779. }
  6780. } else {
  6781. $this->config[$key] = $val;
  6782. }
  6783. } else {
  6784. $this->config[$key] = $val;
  6785. }
  6786. }
  6787. }
  6788. if (!empty($config['repositories']) && is_array($config['repositories'])) {
  6789. $this->repositories = array_reverse($this->repositories, true);
  6790. $newRepos = array_reverse($config['repositories'], true);
  6791. foreach ($newRepos as $name => $repository) {
  6792. if (false === $repository) {
  6793. $this->disableRepoByName($name);
  6794. continue;
  6795. }
  6796. if (is_array($repository) && 1 === count($repository) && false === current($repository)) {
  6797. $this->disableRepoByName(key($repository));
  6798. continue;
  6799. }
  6800. if (is_int($name)) {
  6801. $this->repositories[] = $repository;
  6802. } else {
  6803. if ($name === 'packagist') {
  6804. $this->repositories[$name . '.org'] = $repository;
  6805. } else {
  6806. $this->repositories[$name] = $repository;
  6807. }
  6808. }
  6809. }
  6810. $this->repositories = array_reverse($this->repositories, true);
  6811. }
  6812. }
  6813. public function getRepositories()
  6814. {
  6815. return $this->repositories;
  6816. }
  6817. public function get($key, $flags = 0)
  6818. {
  6819. switch ($key) {
  6820. case 'vendor-dir':
  6821. case 'bin-dir':
  6822. case 'process-timeout':
  6823. case 'data-dir':
  6824. case 'cache-dir':
  6825. case 'cache-files-dir':
  6826. case 'cache-repo-dir':
  6827. case 'cache-vcs-dir':
  6828. case 'cafile':
  6829. case 'capath':
  6830. $env = 'COMPOSER_' . strtoupper(strtr($key, '-', '_'));
  6831. $val = $this->getComposerEnv($env);
  6832. $val = rtrim((string) $this->process(false !== $val ? $val : $this->config[$key], $flags), '/\\');
  6833. $val = Platform::expandPath($val);
  6834. if (substr($key, -4) !== '-dir') {
  6835. return $val;
  6836. }
  6837. return (($flags & self::RELATIVE_PATHS) == self::RELATIVE_PATHS) ? $val : $this->realpath($val);
  6838. case 'htaccess-protect':
  6839. $value = $this->getComposerEnv('COMPOSER_HTACCESS_PROTECT');
  6840. if (false === $value) {
  6841. $value = $this->config[$key];
  6842. }
  6843. return $value !== 'false' && (bool) $value;
  6844. case 'cache-ttl':
  6845. return (int) $this->config[$key];
  6846. case 'cache-files-maxsize':
  6847. if (!preg_match('/^\s*([0-9.]+)\s*(?:([kmg])(?:i?b)?)?\s*$/i', $this->config[$key], $matches)) {
  6848. throw new \RuntimeException(
  6849. "Could not parse the value of 'cache-files-maxsize': {$this->config[$key]}"
  6850. );
  6851. }
  6852. $size = $matches[1];
  6853. if (isset($matches[2])) {
  6854. switch (strtolower($matches[2])) {
  6855. case 'g':
  6856. $size *= 1024;
  6857. case 'm':
  6858. $size *= 1024;
  6859. case 'k':
  6860. $size *= 1024;
  6861. break;
  6862. }
  6863. }
  6864. return $size;
  6865. case 'cache-files-ttl':
  6866. if (isset($this->config[$key])) {
  6867. return (int) $this->config[$key];
  6868. }
  6869. return (int) $this->config['cache-ttl'];
  6870. case 'home':
  6871. $val = preg_replace('#^(\$HOME|~)(/|$)#', rtrim(getenv('HOME') ?: getenv('USERPROFILE'), '/\\') . '/', $this->config[$key]);
  6872. return rtrim($this->process($val, $flags), '/\\');
  6873. case 'bin-compat':
  6874. $value = $this->getComposerEnv('COMPOSER_BIN_COMPAT') ?: $this->config[$key];
  6875. if (!in_array($value, array('auto', 'full'))) {
  6876. throw new \RuntimeException(
  6877. "Invalid value for 'bin-compat': {$value}. Expected auto, full"
  6878. );
  6879. }
  6880. return $value;
  6881. case 'discard-changes':
  6882. if ($env = $this->getComposerEnv('COMPOSER_DISCARD_CHANGES')) {
  6883. if (!in_array($env, array('stash', 'true', 'false', '1', '0'), true)) {
  6884. throw new \RuntimeException(
  6885. "Invalid value for COMPOSER_DISCARD_CHANGES: {$env}. Expected 1, 0, true, false or stash"
  6886. );
  6887. }
  6888. if ('stash' === $env) {
  6889. return 'stash';
  6890. }
  6891. return $env !== 'false' && (bool) $env;
  6892. }
  6893. if (!in_array($this->config[$key], array(true, false, 'stash'), true)) {
  6894. throw new \RuntimeException(
  6895. "Invalid value for 'discard-changes': {$this->config[$key]}. Expected true, false or stash"
  6896. );
  6897. }
  6898. return $this->config[$key];
  6899. case 'github-protocols':
  6900. $protos = $this->config['github-protocols'];
  6901. if ($this->config['secure-http'] && false !== ($index = array_search('git', $protos))) {
  6902. unset($protos[$index]);
  6903. }
  6904. if (reset($protos) === 'http') {
  6905. throw new \RuntimeException('The http protocol for github is not available anymore, update your config\'s github-protocols to use "https", "git" or "ssh"');
  6906. }
  6907. return $protos;
  6908. case 'disable-tls':
  6909. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6910. case 'secure-http':
  6911. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6912. case 'use-github-api':
  6913. return $this->config[$key] !== 'false' && (bool) $this->config[$key];
  6914. default:
  6915. if (!isset($this->config[$key])) {
  6916. return null;
  6917. }
  6918. return $this->process($this->config[$key], $flags);
  6919. }
  6920. }
  6921. public function all($flags = 0)
  6922. {
  6923. $all = array(
  6924. 'repositories' => $this->getRepositories(),
  6925. );
  6926. foreach (array_keys($this->config) as $key) {
  6927. $all['config'][$key] = $this->get($key, $flags);
  6928. }
  6929. return $all;
  6930. }
  6931. public function raw()
  6932. {
  6933. return array(
  6934. 'repositories' => $this->getRepositories(),
  6935. 'config' => $this->config,
  6936. );
  6937. }
  6938. public function has($key)
  6939. {
  6940. return array_key_exists($key, $this->config);
  6941. }
  6942. private function process($value, $flags)
  6943. {
  6944. $config = $this;
  6945. if (!is_string($value)) {
  6946. return $value;
  6947. }
  6948. return preg_replace_callback('#\{\$(.+)\}#', function ($match) use ($config, $flags) {
  6949. return $config->get($match[1], $flags);
  6950. }, $value);
  6951. }
  6952. private function realpath($path)
  6953. {
  6954. if (preg_match('{^(?:/|[a-z]:|[a-z0-9.]+://)}i', $path)) {
  6955. return $path;
  6956. }
  6957. return $this->baseDir . '/' . $path;
  6958. }
  6959. private function getComposerEnv($var)
  6960. {
  6961. if ($this->useEnvironment) {
  6962. return getenv($var);
  6963. }
  6964. return false;
  6965. }
  6966. private function disableRepoByName($name)
  6967. {
  6968. if (isset($this->repositories[$name])) {
  6969. unset($this->repositories[$name]);
  6970. } elseif ($name === 'packagist') {
  6971. unset($this->repositories['packagist.org']);
  6972. }
  6973. }
  6974. public function prohibitUrlByConfig($url, IOInterface $io = null)
  6975. {
  6976. if (false === filter_var($url, FILTER_VALIDATE_URL)) {
  6977. return;
  6978. }
  6979. $scheme = parse_url($url, PHP_URL_SCHEME);
  6980. if (in_array($scheme, array('http', 'git', 'ftp', 'svn'))) {
  6981. if ($this->get('secure-http')) {
  6982. throw new TransportException("Your configuration does not allow connections to $url. See https://getcomposer.org/doc/06-config.md#secure-http for details.");
  6983. } elseif ($io) {
  6984. $host = parse_url($url, PHP_URL_HOST);
  6985. if (!isset($this->warnedHosts[$host])) {
  6986. $io->writeError("<warning>Warning: Accessing $host over $scheme which is an insecure protocol.</warning>");
  6987. }
  6988. $this->warnedHosts[$host] = true;
  6989. }
  6990. }
  6991. }
  6992. public static function disableProcessTimeout()
  6993. {
  6994. ProcessExecutor::setTimeout(0);
  6995. }
  6996. }
  6997. <?php
  6998. namespace Composer\Config;
  6999. interface ConfigSourceInterface
  7000. {
  7001. public function addRepository($name, $config);
  7002. public function removeRepository($name);
  7003. public function addConfigSetting($name, $value);
  7004. public function removeConfigSetting($name);
  7005. public function addProperty($name, $value);
  7006. public function removeProperty($name);
  7007. public function addLink($type, $name, $value);
  7008. public function removeLink($type, $name);
  7009. public function getName();
  7010. }
  7011. <?php
  7012. namespace Composer\Config;
  7013. use Composer\Json\JsonFile;
  7014. use Composer\Json\JsonManipulator;
  7015. use Composer\Util\Silencer;
  7016. class JsonConfigSource implements ConfigSourceInterface
  7017. {
  7018. private $file;
  7019. private $authConfig;
  7020. public function __construct(JsonFile $file, $authConfig = false)
  7021. {
  7022. $this->file = $file;
  7023. $this->authConfig = $authConfig;
  7024. }
  7025. public function getName()
  7026. {
  7027. return $this->file->getPath();
  7028. }
  7029. public function addRepository($name, $config)
  7030. {
  7031. $this->manipulateJson('addRepository', $name, $config, function (&$config, $repo, $repoConfig) {
  7032. if (isset($config['repositories'])) {
  7033. foreach ($config['repositories'] as $index => $val) {
  7034. if ($index === $repo) {
  7035. continue;
  7036. }
  7037. if (is_numeric($index) && ($val === array('packagist' => false) || $val === array('packagist.org' => false))) {
  7038. unset($config['repositories'][$index]);
  7039. $config['repositories']['packagist.org'] = false;
  7040. break;
  7041. }
  7042. }
  7043. }
  7044. $config['repositories'][$repo] = $repoConfig;
  7045. });
  7046. }
  7047. public function removeRepository($name)
  7048. {
  7049. $this->manipulateJson('removeRepository', $name, function (&$config, $repo) {
  7050. unset($config['repositories'][$repo]);
  7051. });
  7052. }
  7053. public function addConfigSetting($name, $value)
  7054. {
  7055. $authConfig = $this->authConfig;
  7056. $this->manipulateJson('addConfigSetting', $name, $value, function (&$config, $key, $val) use ($authConfig) {
  7057. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7058. list($key, $host) = explode('.', $key, 2);
  7059. if ($authConfig) {
  7060. $config[$key][$host] = $val;
  7061. } else {
  7062. $config['config'][$key][$host] = $val;
  7063. }
  7064. } else {
  7065. $config['config'][$key] = $val;
  7066. }
  7067. });
  7068. }
  7069. public function removeConfigSetting($name)
  7070. {
  7071. $authConfig = $this->authConfig;
  7072. $this->manipulateJson('removeConfigSetting', $name, function (&$config, $key) use ($authConfig) {
  7073. if (preg_match('{^(bitbucket-oauth|github-oauth|gitlab-oauth|gitlab-token|http-basic|platform)\.}', $key)) {
  7074. list($key, $host) = explode('.', $key, 2);
  7075. if ($authConfig) {
  7076. unset($config[$key][$host]);
  7077. } else {
  7078. unset($config['config'][$key][$host]);
  7079. }
  7080. } else {
  7081. unset($config['config'][$key]);
  7082. }
  7083. });
  7084. }
  7085. public function addProperty($name, $value)
  7086. {
  7087. $this->manipulateJson('addProperty', $name, $value, function (&$config, $key, $val) {
  7088. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7089. $bits = explode('.', $key);
  7090. $last = array_pop($bits);
  7091. $arr = &$config[reset($bits)];
  7092. foreach ($bits as $bit) {
  7093. if (!isset($arr[$bit])) {
  7094. $arr[$bit] = array();
  7095. }
  7096. $arr = &$arr[$bit];
  7097. }
  7098. $arr[$last] = $val;
  7099. } else {
  7100. $config[$key] = $val;
  7101. }
  7102. });
  7103. }
  7104. public function removeProperty($name)
  7105. {
  7106. $authConfig = $this->authConfig;
  7107. $this->manipulateJson('removeProperty', $name, function (&$config, $key) {
  7108. if (substr($key, 0, 6) === 'extra.' || substr($key, 0, 8) === 'scripts.') {
  7109. $bits = explode('.', $key);
  7110. $last = array_pop($bits);
  7111. $arr = &$config[reset($bits)];
  7112. foreach ($bits as $bit) {
  7113. if (!isset($arr[$bit])) {
  7114. return;
  7115. }
  7116. $arr = &$arr[$bit];
  7117. }
  7118. unset($arr[$last]);
  7119. } else {
  7120. unset($config[$key]);
  7121. }
  7122. });
  7123. }
  7124. public function addLink($type, $name, $value)
  7125. {
  7126. $this->manipulateJson('addLink', $type, $name, $value, function (&$config, $type, $name, $value) {
  7127. $config[$type][$name] = $value;
  7128. });
  7129. }
  7130. public function removeLink($type, $name)
  7131. {
  7132. $this->manipulateJson('removeSubNode', $type, $name, function (&$config, $type, $name) {
  7133. unset($config[$type][$name]);
  7134. if (0 === count($config[$type])) {
  7135. unset($config[$type]);
  7136. }
  7137. });
  7138. }
  7139. protected function manipulateJson($method, $args, $fallback)
  7140. {
  7141. $args = func_get_args();
  7142. array_shift($args);
  7143. $fallback = array_pop($args);
  7144. if ($this->file->exists()) {
  7145. if (!is_writable($this->file->getPath())) {
  7146. throw new \RuntimeException(sprintf('The file "%s" is not writable.', $this->file->getPath()));
  7147. }
  7148. if (!is_readable($this->file->getPath())) {
  7149. throw new \RuntimeException(sprintf('The file "%s" is not readable.', $this->file->getPath()));
  7150. }
  7151. $contents = file_get_contents($this->file->getPath());
  7152. } elseif ($this->authConfig) {
  7153. $contents = "{\n}\n";
  7154. } else {
  7155. $contents = "{\n \"config\": {\n }\n}\n";
  7156. }
  7157. $manipulator = new JsonManipulator($contents);
  7158. $newFile = !$this->file->exists();
  7159. if ($this->authConfig && $method === 'addConfigSetting') {
  7160. $method = 'addSubNode';
  7161. list($mainNode, $name) = explode('.', $args[0], 2);
  7162. $args = array($mainNode, $name, $args[1]);
  7163. } elseif ($this->authConfig && $method === 'removeConfigSetting') {
  7164. $method = 'removeSubNode';
  7165. list($mainNode, $name) = explode('.', $args[0], 2);
  7166. $args = array($mainNode, $name);
  7167. }
  7168. if (call_user_func_array(array($manipulator, $method), $args)) {
  7169. file_put_contents($this->file->getPath(), $manipulator->getContents());
  7170. } else {
  7171. $config = $this->file->read();
  7172. $this->arrayUnshiftRef($args, $config);
  7173. call_user_func_array($fallback, $args);
  7174. $this->file->write($config);
  7175. }
  7176. if ($newFile) {
  7177. Silencer::call('chmod', $this->file->getPath(), 0600);
  7178. }
  7179. }
  7180. private function arrayUnshiftRef(&$array, &$value)
  7181. {
  7182. $return = array_unshift($array, '');
  7183. $array[0] = &$value;
  7184. return $return;
  7185. }
  7186. }
  7187. <?php
  7188. namespace Composer\Console;
  7189. use Composer\IO\NullIO;
  7190. use Composer\Util\Platform;
  7191. use Composer\Util\Silencer;
  7192. use Symfony\Component\Console\Application as BaseApplication;
  7193. use Symfony\Component\Console\Exception\CommandNotFoundException;
  7194. use Symfony\Component\Console\Helper\HelperSet;
  7195. use Symfony\Component\Console\Helper\QuestionHelper;
  7196. use Symfony\Component\Console\Input\InputInterface;
  7197. use Symfony\Component\Console\Input\InputOption;
  7198. use Symfony\Component\Console\Output\OutputInterface;
  7199. use Composer\Command;
  7200. use Composer\Composer;
  7201. use Composer\Factory;
  7202. use Composer\IO\IOInterface;
  7203. use Composer\IO\ConsoleIO;
  7204. use Composer\Json\JsonValidationException;
  7205. use Composer\Util\ErrorHandler;
  7206. use Composer\EventDispatcher\ScriptExecutionException;
  7207. use Composer\Exception\NoSslException;
  7208. class Application extends BaseApplication
  7209. {
  7210. protected $composer;
  7211. protected $io;
  7212. private static $logo = ' ______
  7213. / ____/___ ____ ___ ____ ____ ________ _____
  7214. / / / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
  7215. / /___/ /_/ / / / / / / /_/ / /_/ (__ ) __/ /
  7216. \____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
  7217. /_/
  7218. ';
  7219. private $hasPluginCommands = false;
  7220. private $disablePluginsByDefault = false;
  7221. public function __construct()
  7222. {
  7223. static $shutdownRegistered = false;
  7224. if (function_exists('ini_set') && extension_loaded('xdebug')) {
  7225. ini_set('xdebug.show_exception_trace', false);
  7226. ini_set('xdebug.scream', false);
  7227. }
  7228. if (function_exists('date_default_timezone_set') && function_exists('date_default_timezone_get')) {
  7229. date_default_timezone_set(Silencer::call('date_default_timezone_get'));
  7230. }
  7231. if (!$shutdownRegistered) {
  7232. $shutdownRegistered = true;
  7233. register_shutdown_function(function () {
  7234. $lastError = error_get_last();
  7235. if ($lastError && $lastError['message'] &&
  7236. (strpos($lastError['message'], 'Allowed memory') !== false ||
  7237. strpos($lastError['message'], 'exceeded memory') !== false )) {
  7238. echo "\n". 'Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.';
  7239. }
  7240. });
  7241. }
  7242. $this->io = new NullIO();
  7243. parent::__construct('Composer', Composer::getVersion());
  7244. }
  7245. public function run(InputInterface $input = null, OutputInterface $output = null)
  7246. {
  7247. if (null === $output) {
  7248. $output = Factory::createOutput();
  7249. }
  7250. return parent::run($input, $output);
  7251. }
  7252. public function doRun(InputInterface $input, OutputInterface $output)
  7253. {
  7254. $this->disablePluginsByDefault = $input->hasParameterOption('--no-plugins');
  7255. if (getenv('COMPOSER_NO_INTERACTION')) {
  7256. $input->setInteractive(false);
  7257. }
  7258. $io = $this->io = new ConsoleIO($input, $output, new HelperSet(array(
  7259. new QuestionHelper(),
  7260. )));
  7261. ErrorHandler::register($io);
  7262. if ($input->hasParameterOption('--no-cache')) {
  7263. $io->writeError('Disabling cache usage', true, IOInterface::DEBUG);
  7264. putenv('COMPOSER_CACHE_DIR='.(Platform::isWindows() ? 'nul' : '/dev/null'));
  7265. }
  7266. if ($newWorkDir = $this->getNewWorkingDir($input)) {
  7267. $oldWorkingDir = getcwd();
  7268. chdir($newWorkDir);
  7269. $io->writeError('Changed CWD to ' . getcwd(), true, IOInterface::DEBUG);
  7270. }
  7271. $commandName = '';
  7272. if ($name = $this->getCommandName($input)) {
  7273. try {
  7274. $commandName = $this->find($name)->getName();
  7275. } catch (CommandNotFoundException $e) {
  7276. $commandName = false;
  7277. } catch (\InvalidArgumentException $e) {
  7278. }
  7279. }
  7280. if ($io->isInteractive() && !$newWorkDir && !in_array($commandName, array('', 'list', 'init', 'about', 'help', 'diagnose', 'self-update', 'global', 'create-project'), true) && !file_exists(Factory::getComposerFile())) {
  7281. $dir = dirname(getcwd());
  7282. $home = realpath(getenv('HOME') ?: getenv('USERPROFILE') ?: '/');
  7283. while (dirname($dir) !== $dir && $dir !== $home) {
  7284. if (file_exists($dir.'/'.Factory::getComposerFile())) {
  7285. 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)) {
  7286. $oldWorkingDir = getcwd();
  7287. chdir($dir);
  7288. }
  7289. break;
  7290. }
  7291. $dir = dirname($dir);
  7292. }
  7293. }
  7294. if (!$this->disablePluginsByDefault && !$this->hasPluginCommands && 'global' !== $commandName) {
  7295. try {
  7296. foreach ($this->getPluginCommands() as $command) {
  7297. if ($this->has($command->getName())) {
  7298. $io->writeError('<warning>Plugin command '.$command->getName().' ('.get_class($command).') would override a Composer command and has been skipped</warning>');
  7299. } else {
  7300. $this->add($command);
  7301. }
  7302. }
  7303. } catch (NoSslException $e) {
  7304. }
  7305. $this->hasPluginCommands = true;
  7306. }
  7307. $isProxyCommand = false;
  7308. if ($name = $this->getCommandName($input)) {
  7309. try {
  7310. $command = $this->find($name);
  7311. $commandName = $command->getName();
  7312. $isProxyCommand = ($command instanceof Command\BaseCommand && $command->isProxyCommand());
  7313. } catch (\InvalidArgumentException $e) {
  7314. }
  7315. }
  7316. if (!$isProxyCommand) {
  7317. $io->writeError(sprintf(
  7318. 'Running %s (%s) with %s on %s',
  7319. Composer::getVersion(),
  7320. Composer::RELEASE_DATE,
  7321. defined('HHVM_VERSION') ? 'HHVM '.HHVM_VERSION : 'PHP '.PHP_VERSION,
  7322. function_exists('php_uname') ? php_uname('s') . ' / ' . php_uname('r') : 'Unknown OS'
  7323. ), true, IOInterface::DEBUG);
  7324. if (PHP_VERSION_ID < 50302) {
  7325. $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>');
  7326. }
  7327. if (extension_loaded('xdebug') && !getenv('COMPOSER_DISABLE_XDEBUG_WARN')) {
  7328. $io->writeError('<warning>You are running composer with xdebug enabled. This has a major impact on runtime performance. See https://getcomposer.org/xdebug</warning>');
  7329. }
  7330. if (defined('COMPOSER_DEV_WARNING_TIME') && $commandName !== 'self-update' && $commandName !== 'selfupdate' && time() > COMPOSER_DEV_WARNING_TIME) {
  7331. $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']));
  7332. }
  7333. if (!Platform::isWindows() && function_exists('exec') && !getenv('COMPOSER_ALLOW_SUPERUSER') && !file_exists('/.dockerenv')) {
  7334. if (function_exists('posix_getuid') && posix_getuid() === 0) {
  7335. if ($commandName !== 'self-update' && $commandName !== 'selfupdate') {
  7336. $io->writeError('<warning>Do not run Composer as root/super user! See https://getcomposer.org/root for details</warning>');
  7337. }
  7338. if ($uid = (int) getenv('SUDO_UID')) {
  7339. Silencer::call('exec', "sudo -u \\#{$uid} sudo -K > /dev/null 2>&1");
  7340. }
  7341. }
  7342. Silencer::call('exec', 'sudo -K > /dev/null 2>&1');
  7343. }
  7344. Silencer::call(function () use ($io) {
  7345. $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime());
  7346. if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) {
  7347. $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()));
  7348. }
  7349. });
  7350. $file = Factory::getComposerFile();
  7351. if (is_file($file) && is_readable($file) && is_array($composer = json_decode(file_get_contents($file), true))) {
  7352. if (isset($composer['scripts']) && is_array($composer['scripts'])) {
  7353. foreach ($composer['scripts'] as $script => $dummy) {
  7354. if (!defined('Composer\Script\ScriptEvents::'.str_replace('-', '_', strtoupper($script)))) {
  7355. if ($this->has($script)) {
  7356. $io->writeError('<warning>A script named '.$script.' would override a Composer command and has been skipped</warning>');
  7357. } else {
  7358. $description = null;
  7359. if (isset($composer['scripts-descriptions'][$script])) {
  7360. $description = $composer['scripts-descriptions'][$script];
  7361. }
  7362. $this->add(new Command\ScriptAliasCommand($script, $description));
  7363. }
  7364. }
  7365. }
  7366. }
  7367. }
  7368. }
  7369. try {
  7370. if ($input->hasParameterOption('--profile')) {
  7371. $startTime = microtime(true);
  7372. $this->io->enableDebugging($startTime);
  7373. }
  7374. $result = parent::doRun($input, $output);
  7375. if (isset($oldWorkingDir)) {
  7376. chdir($oldWorkingDir);
  7377. }
  7378. if (isset($startTime)) {
  7379. $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');
  7380. }
  7381. restore_error_handler();
  7382. return $result;
  7383. } catch (ScriptExecutionException $e) {
  7384. return $e->getCode();
  7385. } catch (\Exception $e) {
  7386. $this->hintCommonErrors($e);
  7387. restore_error_handler();
  7388. throw $e;
  7389. }
  7390. }
  7391. private function getNewWorkingDir(InputInterface $input)
  7392. {
  7393. $workingDir = $input->getParameterOption(array('--working-dir', '-d'));
  7394. if (false !== $workingDir && !is_dir($workingDir)) {
  7395. throw new \RuntimeException('Invalid working directory specified, '.$workingDir.' does not exist.');
  7396. }
  7397. return $workingDir;
  7398. }
  7399. private function hintCommonErrors($exception)
  7400. {
  7401. $io = $this->getIO();
  7402. Silencer::suppress();
  7403. try {
  7404. $composer = $this->getComposer(false, true);
  7405. if ($composer) {
  7406. $config = $composer->getConfig();
  7407. $minSpaceFree = 1024 * 1024;
  7408. if ((($df = disk_free_space($dir = $config->get('home'))) !== false && $df < $minSpaceFree)
  7409. || (($df = disk_free_space($dir = $config->get('vendor-dir'))) !== false && $df < $minSpaceFree)
  7410. || (($df = disk_free_space($dir = sys_get_temp_dir())) !== false && $df < $minSpaceFree)
  7411. ) {
  7412. $io->writeError('<error>The disk hosting '.$dir.' is full, this may be the cause of the following exception</error>', true, IOInterface::QUIET);
  7413. }
  7414. }
  7415. } catch (\Exception $e) {
  7416. }
  7417. Silencer::restore();
  7418. if (Platform::isWindows() && false !== strpos($exception->getMessage(), 'The system cannot find the path specified')) {
  7419. $io->writeError('<error>The following exception may be caused by a stale entry in your cmd.exe AutoRun</error>', true, IOInterface::QUIET);
  7420. $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);
  7421. }
  7422. if (false !== strpos($exception->getMessage(), 'fork failed - Cannot allocate memory')) {
  7423. $io->writeError('<error>The following exception is caused by a lack of memory or swap, or not having swap configured</error>', true, IOInterface::QUIET);
  7424. $io->writeError('<error>Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details</error>', true, IOInterface::QUIET);
  7425. }
  7426. }
  7427. public function getComposer($required = true, $disablePlugins = null)
  7428. {
  7429. if (null === $disablePlugins) {
  7430. $disablePlugins = $this->disablePluginsByDefault;
  7431. }
  7432. if (null === $this->composer) {
  7433. try {
  7434. $this->composer = Factory::create($this->io, null, $disablePlugins);
  7435. } catch (\InvalidArgumentException $e) {
  7436. if ($required) {
  7437. $this->io->writeError($e->getMessage());
  7438. exit(1);
  7439. }
  7440. } catch (JsonValidationException $e) {
  7441. $errors = ' - ' . implode(PHP_EOL . ' - ', $e->getErrors());
  7442. $message = $e->getMessage() . ':' . PHP_EOL . $errors;
  7443. throw new JsonValidationException($message);
  7444. }
  7445. }
  7446. return $this->composer;
  7447. }
  7448. public function resetComposer()
  7449. {
  7450. $this->composer = null;
  7451. if ($this->getIO() && method_exists($this->getIO(), 'resetAuthentications')) {
  7452. $this->getIO()->resetAuthentications();
  7453. }
  7454. }
  7455. public function getIO()
  7456. {
  7457. return $this->io;
  7458. }
  7459. public function getHelp()
  7460. {
  7461. return self::$logo . parent::getHelp();
  7462. }
  7463. protected function getDefaultCommands()
  7464. {
  7465. $commands = array_merge(parent::getDefaultCommands(), array(
  7466. new Command\AboutCommand(),
  7467. new Command\ConfigCommand(),
  7468. new Command\DependsCommand(),
  7469. new Command\ProhibitsCommand(),
  7470. new Command\InitCommand(),
  7471. new Command\InstallCommand(),
  7472. new Command\CreateProjectCommand(),
  7473. new Command\UpdateCommand(),
  7474. new Command\SearchCommand(),
  7475. new Command\ValidateCommand(),
  7476. new Command\ShowCommand(),
  7477. new Command\SuggestsCommand(),
  7478. new Command\RequireCommand(),
  7479. new Command\DumpAutoloadCommand(),
  7480. new Command\StatusCommand(),
  7481. new Command\ArchiveCommand(),
  7482. new Command\DiagnoseCommand(),
  7483. new Command\RunScriptCommand(),
  7484. new Command\LicensesCommand(),
  7485. new Command\GlobalCommand(),
  7486. new Command\ClearCacheCommand(),
  7487. new Command\RemoveCommand(),
  7488. new Command\HomeCommand(),
  7489. new Command\ExecCommand(),
  7490. new Command\OutdatedCommand(),
  7491. new Command\CheckPlatformReqsCommand(),
  7492. ));
  7493. if ('phar:' === substr(__FILE__, 0, 5)) {
  7494. $commands[] = new Command\SelfUpdateCommand();
  7495. }
  7496. return $commands;
  7497. }
  7498. public function getLongVersion()
  7499. {
  7500. if (Composer::BRANCH_ALIAS_VERSION && Composer::BRANCH_ALIAS_VERSION !== '@package_branch_alias_version'.'@') {
  7501. return sprintf(
  7502. '<info>%s</info> version <comment>%s (%s)</comment> %s',
  7503. $this->getName(),
  7504. Composer::BRANCH_ALIAS_VERSION,
  7505. $this->getVersion(),
  7506. Composer::RELEASE_DATE
  7507. );
  7508. }
  7509. return parent::getLongVersion() . ' ' . Composer::RELEASE_DATE;
  7510. }
  7511. protected function getDefaultInputDefinition()
  7512. {
  7513. $definition = parent::getDefaultInputDefinition();
  7514. $definition->addOption(new InputOption('--profile', null, InputOption::VALUE_NONE, 'Display timing and memory usage information'));
  7515. $definition->addOption(new InputOption('--no-plugins', null, InputOption::VALUE_NONE, 'Whether to disable plugins.'));
  7516. $definition->addOption(new InputOption('--working-dir', '-d', InputOption::VALUE_REQUIRED, 'If specified, use the given directory as working directory.'));
  7517. $definition->addOption(new InputOption('--no-cache', null, InputOption::VALUE_NONE, 'Prevent use of the cache'));
  7518. return $definition;
  7519. }
  7520. private function getPluginCommands()
  7521. {
  7522. $commands = array();
  7523. $composer = $this->getComposer(false, false);
  7524. if (null === $composer) {
  7525. $composer = Factory::createGlobal($this->io, false);
  7526. }
  7527. if (null !== $composer) {
  7528. $pm = $composer->getPluginManager();
  7529. foreach ($pm->getPluginCapabilities('Composer\Plugin\Capability\CommandProvider', array('composer' => $composer, 'io' => $this->io)) as $capability) {
  7530. $newCommands = $capability->getCommands();
  7531. if (!is_array($newCommands)) {
  7532. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' failed to return an array from getCommands');
  7533. }
  7534. foreach ($newCommands as $command) {
  7535. if (!$command instanceof Command\BaseCommand) {
  7536. throw new \UnexpectedValueException('Plugin capability '.get_class($capability).' returned an invalid value, we expected an array of Composer\Command\BaseCommand objects');
  7537. }
  7538. }
  7539. $commands = array_merge($commands, $newCommands);
  7540. }
  7541. }
  7542. return $commands;
  7543. }
  7544. }
  7545. <?php
  7546. namespace Composer\Console;
  7547. use Symfony\Component\Console\Formatter\OutputFormatter;
  7548. class HtmlOutputFormatter extends OutputFormatter
  7549. {
  7550. private static $availableForegroundColors = array(
  7551. 30 => 'black',
  7552. 31 => 'red',
  7553. 32 => 'green',
  7554. 33 => 'yellow',
  7555. 34 => 'blue',
  7556. 35 => 'magenta',
  7557. 36 => 'cyan',
  7558. 37 => 'white',
  7559. );
  7560. private static $availableBackgroundColors = array(
  7561. 40 => 'black',
  7562. 41 => 'red',
  7563. 42 => 'green',
  7564. 43 => 'yellow',
  7565. 44 => 'blue',
  7566. 45 => 'magenta',
  7567. 46 => 'cyan',
  7568. 47 => 'white',
  7569. );
  7570. private static $availableOptions = array(
  7571. 1 => 'bold',
  7572. 4 => 'underscore',
  7573. );
  7574. public function __construct(array $styles = array())
  7575. {
  7576. parent::__construct(true, $styles);
  7577. }
  7578. public function format($message)
  7579. {
  7580. $formatted = parent::format($message);
  7581. $clearEscapeCodes = '(?:39|49|0|22|24|25|27|28)';
  7582. return preg_replace_callback("{\033\[([0-9;]+)m(.*?)\033\[(?:".$clearEscapeCodes.";)*?".$clearEscapeCodes."m}s", array($this, 'formatHtml'), $formatted);
  7583. }
  7584. private function formatHtml($matches)
  7585. {
  7586. $out = '<span style="';
  7587. foreach (explode(';', $matches[1]) as $code) {
  7588. if (isset(self::$availableForegroundColors[$code])) {
  7589. $out .= 'color:'.self::$availableForegroundColors[$code].';';
  7590. } elseif (isset(self::$availableBackgroundColors[$code])) {
  7591. $out .= 'background-color:'.self::$availableBackgroundColors[$code].';';
  7592. } elseif (isset(self::$availableOptions[$code])) {
  7593. switch (self::$availableOptions[$code]) {
  7594. case 'bold':
  7595. $out .= 'font-weight:bold;';
  7596. break;
  7597. case 'underscore':
  7598. $out .= 'text-decoration:underline;';
  7599. break;
  7600. }
  7601. }
  7602. }
  7603. return $out.'">'.$matches[2].'</span>';
  7604. }
  7605. }
  7606. <?php
  7607. namespace Composer\DependencyResolver;
  7608. class Decisions implements \Iterator, \Countable
  7609. {
  7610. const DECISION_LITERAL = 0;
  7611. const DECISION_REASON = 1;
  7612. protected $pool;
  7613. protected $decisionMap;
  7614. protected $decisionQueue = array();
  7615. public function __construct($pool)
  7616. {
  7617. $this->pool = $pool;
  7618. $this->decisionMap = array();
  7619. }
  7620. public function decide($literal, $level, $why)
  7621. {
  7622. $this->addDecision($literal, $level);
  7623. $this->decisionQueue[] = array(
  7624. self::DECISION_LITERAL => $literal,
  7625. self::DECISION_REASON => $why,
  7626. );
  7627. }
  7628. public function satisfy($literal)
  7629. {
  7630. $packageId = abs($literal);
  7631. return (
  7632. $literal > 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 ||
  7633. $literal < 0 && isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0
  7634. );
  7635. }
  7636. public function conflict($literal)
  7637. {
  7638. $packageId = abs($literal);
  7639. return (
  7640. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0 && $literal < 0) ||
  7641. (isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] < 0 && $literal > 0)
  7642. );
  7643. }
  7644. public function decided($literalOrPackageId)
  7645. {
  7646. return !empty($this->decisionMap[abs($literalOrPackageId)]);
  7647. }
  7648. public function undecided($literalOrPackageId)
  7649. {
  7650. return empty($this->decisionMap[abs($literalOrPackageId)]);
  7651. }
  7652. public function decidedInstall($literalOrPackageId)
  7653. {
  7654. $packageId = abs($literalOrPackageId);
  7655. return isset($this->decisionMap[$packageId]) && $this->decisionMap[$packageId] > 0;
  7656. }
  7657. public function decisionLevel($literalOrPackageId)
  7658. {
  7659. $packageId = abs($literalOrPackageId);
  7660. if (isset($this->decisionMap[$packageId])) {
  7661. return abs($this->decisionMap[$packageId]);
  7662. }
  7663. return 0;
  7664. }
  7665. public function decisionRule($literalOrPackageId)
  7666. {
  7667. $packageId = abs($literalOrPackageId);
  7668. foreach ($this->decisionQueue as $i => $decision) {
  7669. if ($packageId === abs($decision[self::DECISION_LITERAL])) {
  7670. return $decision[self::DECISION_REASON];
  7671. }
  7672. }
  7673. return null;
  7674. }
  7675. public function atOffset($queueOffset)
  7676. {
  7677. return $this->decisionQueue[$queueOffset];
  7678. }
  7679. public function validOffset($queueOffset)
  7680. {
  7681. return $queueOffset >= 0 && $queueOffset < count($this->decisionQueue);
  7682. }
  7683. public function lastReason()
  7684. {
  7685. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_REASON];
  7686. }
  7687. public function lastLiteral()
  7688. {
  7689. return $this->decisionQueue[count($this->decisionQueue) - 1][self::DECISION_LITERAL];
  7690. }
  7691. public function reset()
  7692. {
  7693. while ($decision = array_pop($this->decisionQueue)) {
  7694. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7695. }
  7696. }
  7697. public function resetToOffset($offset)
  7698. {
  7699. while (count($this->decisionQueue) > $offset + 1) {
  7700. $decision = array_pop($this->decisionQueue);
  7701. $this->decisionMap[abs($decision[self::DECISION_LITERAL])] = 0;
  7702. }
  7703. }
  7704. public function revertLast()
  7705. {
  7706. $this->decisionMap[abs($this->lastLiteral())] = 0;
  7707. array_pop($this->decisionQueue);
  7708. }
  7709. public function count()
  7710. {
  7711. return count($this->decisionQueue);
  7712. }
  7713. public function rewind()
  7714. {
  7715. end($this->decisionQueue);
  7716. }
  7717. public function current()
  7718. {
  7719. return current($this->decisionQueue);
  7720. }
  7721. public function key()
  7722. {
  7723. return key($this->decisionQueue);
  7724. }
  7725. public function next()
  7726. {
  7727. return prev($this->decisionQueue);
  7728. }
  7729. public function valid()
  7730. {
  7731. return false !== current($this->decisionQueue);
  7732. }
  7733. public function isEmpty()
  7734. {
  7735. return count($this->decisionQueue) === 0;
  7736. }
  7737. protected function addDecision($literal, $level)
  7738. {
  7739. $packageId = abs($literal);
  7740. $previousDecision = isset($this->decisionMap[$packageId]) ? $this->decisionMap[$packageId] : null;
  7741. if ($previousDecision != 0) {
  7742. $literalString = $this->pool->literalToString($literal);
  7743. $package = $this->pool->literalToPackage($literal);
  7744. throw new SolverBugException(
  7745. "Trying to decide $literalString on level $level, even though $package was previously decided as ".(int) $previousDecision."."
  7746. );
  7747. }
  7748. if ($literal > 0) {
  7749. $this->decisionMap[$packageId] = $level;
  7750. } else {
  7751. $this->decisionMap[$packageId] = -$level;
  7752. }
  7753. }
  7754. public function __toString()
  7755. {
  7756. $decisionMap = $this->decisionMap;
  7757. ksort($decisionMap);
  7758. $str = '[';
  7759. foreach ($decisionMap as $packageId => $level) {
  7760. $str .= $packageId.':'.$level.',';
  7761. }
  7762. $str .= ']';
  7763. return $str;
  7764. }
  7765. }
  7766. <?php
  7767. namespace Composer\DependencyResolver;
  7768. use Composer\Package\PackageInterface;
  7769. use Composer\Package\AliasPackage;
  7770. use Composer\Package\BasePackage;
  7771. use Composer\Semver\Constraint\Constraint;
  7772. class DefaultPolicy implements PolicyInterface
  7773. {
  7774. private $preferStable;
  7775. private $preferLowest;
  7776. public function __construct($preferStable = false, $preferLowest = false)
  7777. {
  7778. $this->preferStable = $preferStable;
  7779. $this->preferLowest = $preferLowest;
  7780. }
  7781. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator)
  7782. {
  7783. if ($this->preferStable && ($stabA = $a->getStability()) !== ($stabB = $b->getStability())) {
  7784. return BasePackage::$stabilities[$stabA] < BasePackage::$stabilities[$stabB];
  7785. }
  7786. $constraint = new Constraint($operator, $b->getVersion());
  7787. $version = new Constraint('==', $a->getVersion());
  7788. return $constraint->matchSpecific($version, true);
  7789. }
  7790. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package, $mustMatchName = false)
  7791. {
  7792. $packages = array();
  7793. foreach ($pool->whatProvides($package->getName(), null, $mustMatchName) as $candidate) {
  7794. if ($candidate !== $package) {
  7795. $packages[] = $candidate;
  7796. }
  7797. }
  7798. return $packages;
  7799. }
  7800. public function getPriority(Pool $pool, PackageInterface $package)
  7801. {
  7802. return $pool->getPriority($package->getRepository());
  7803. }
  7804. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null)
  7805. {
  7806. $packages = $this->groupLiteralsByNamePreferInstalled($pool, $installedMap, $literals);
  7807. foreach ($packages as &$literals) {
  7808. $policy = $this;
  7809. usort($literals, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7810. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage, true);
  7811. });
  7812. }
  7813. foreach ($packages as &$literals) {
  7814. $literals = $this->pruneToHighestPriorityOrInstalled($pool, $installedMap, $literals);
  7815. $literals = $this->pruneToBestVersion($pool, $literals);
  7816. $literals = $this->pruneRemoteAliases($pool, $literals);
  7817. }
  7818. $selected = call_user_func_array('array_merge', $packages);
  7819. usort($selected, function ($a, $b) use ($policy, $pool, $installedMap, $requiredPackage) {
  7820. return $policy->compareByPriorityPreferInstalled($pool, $installedMap, $pool->literalToPackage($a), $pool->literalToPackage($b), $requiredPackage);
  7821. });
  7822. return $selected;
  7823. }
  7824. protected function groupLiteralsByNamePreferInstalled(Pool $pool, array $installedMap, $literals)
  7825. {
  7826. $packages = array();
  7827. foreach ($literals as $literal) {
  7828. $packageName = $pool->literalToPackage($literal)->getName();
  7829. if (!isset($packages[$packageName])) {
  7830. $packages[$packageName] = array();
  7831. }
  7832. if (isset($installedMap[abs($literal)])) {
  7833. array_unshift($packages[$packageName], $literal);
  7834. } else {
  7835. $packages[$packageName][] = $literal;
  7836. }
  7837. }
  7838. return $packages;
  7839. }
  7840. public function compareByPriorityPreferInstalled(Pool $pool, array $installedMap, PackageInterface $a, PackageInterface $b, $requiredPackage = null, $ignoreReplace = false)
  7841. {
  7842. if ($a->getRepository() === $b->getRepository()) {
  7843. if ($a->getName() === $b->getName()) {
  7844. $aAliased = $a instanceof AliasPackage;
  7845. $bAliased = $b instanceof AliasPackage;
  7846. if ($aAliased && !$bAliased) {
  7847. return -1;
  7848. }
  7849. if (!$aAliased && $bAliased) {
  7850. return 1;
  7851. }
  7852. }
  7853. if (!$ignoreReplace) {
  7854. if ($this->replaces($a, $b)) {
  7855. return 1;
  7856. }
  7857. if ($this->replaces($b, $a)) {
  7858. return -1;
  7859. }
  7860. if ($requiredPackage && false !== ($pos = strpos($requiredPackage, '/'))) {
  7861. $requiredVendor = substr($requiredPackage, 0, $pos);
  7862. $aIsSameVendor = substr($a->getName(), 0, $pos) === $requiredVendor;
  7863. $bIsSameVendor = substr($b->getName(), 0, $pos) === $requiredVendor;
  7864. if ($bIsSameVendor !== $aIsSameVendor) {
  7865. return $aIsSameVendor ? -1 : 1;
  7866. }
  7867. }
  7868. }
  7869. if ($a->id === $b->id) {
  7870. return 0;
  7871. }
  7872. return ($a->id < $b->id) ? -1 : 1;
  7873. }
  7874. if (isset($installedMap[$a->id])) {
  7875. return -1;
  7876. }
  7877. if (isset($installedMap[$b->id])) {
  7878. return 1;
  7879. }
  7880. return ($this->getPriority($pool, $a) > $this->getPriority($pool, $b)) ? -1 : 1;
  7881. }
  7882. protected function replaces(PackageInterface $source, PackageInterface $target)
  7883. {
  7884. foreach ($source->getReplaces() as $link) {
  7885. if ($link->getTarget() === $target->getName()
  7886. ) {
  7887. return true;
  7888. }
  7889. }
  7890. return false;
  7891. }
  7892. protected function pruneToBestVersion(Pool $pool, $literals)
  7893. {
  7894. $operator = $this->preferLowest ? '<' : '>';
  7895. $bestLiterals = array($literals[0]);
  7896. $bestPackage = $pool->literalToPackage($literals[0]);
  7897. foreach ($literals as $i => $literal) {
  7898. if (0 === $i) {
  7899. continue;
  7900. }
  7901. $package = $pool->literalToPackage($literal);
  7902. if ($this->versionCompare($package, $bestPackage, $operator)) {
  7903. $bestPackage = $package;
  7904. $bestLiterals = array($literal);
  7905. } elseif ($this->versionCompare($package, $bestPackage, '==')) {
  7906. $bestLiterals[] = $literal;
  7907. }
  7908. }
  7909. return $bestLiterals;
  7910. }
  7911. protected function pruneToHighestPriorityOrInstalled(Pool $pool, array $installedMap, array $literals)
  7912. {
  7913. $selected = array();
  7914. $priority = null;
  7915. foreach ($literals as $literal) {
  7916. $package = $pool->literalToPackage($literal);
  7917. if (isset($installedMap[$package->id])) {
  7918. $selected[] = $literal;
  7919. continue;
  7920. }
  7921. if (null === $priority) {
  7922. $priority = $this->getPriority($pool, $package);
  7923. }
  7924. if ($this->getPriority($pool, $package) != $priority) {
  7925. break;
  7926. }
  7927. $selected[] = $literal;
  7928. }
  7929. return $selected;
  7930. }
  7931. protected function pruneRemoteAliases(Pool $pool, array $literals)
  7932. {
  7933. $hasLocalAlias = false;
  7934. foreach ($literals as $literal) {
  7935. $package = $pool->literalToPackage($literal);
  7936. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7937. $hasLocalAlias = true;
  7938. break;
  7939. }
  7940. }
  7941. if (!$hasLocalAlias) {
  7942. return $literals;
  7943. }
  7944. $selected = array();
  7945. foreach ($literals as $literal) {
  7946. $package = $pool->literalToPackage($literal);
  7947. if ($package instanceof AliasPackage && $package->isRootPackageAlias()) {
  7948. $selected[] = $literal;
  7949. }
  7950. }
  7951. return $selected;
  7952. }
  7953. }
  7954. <?php
  7955. namespace Composer\DependencyResolver;
  7956. use Composer\Package\PackageInterface;
  7957. use Composer\Package\Link;
  7958. class GenericRule extends Rule
  7959. {
  7960. protected $literals;
  7961. public function __construct(array $literals, $reason, $reasonData, $job = null)
  7962. {
  7963. parent::__construct($reason, $reasonData, $job);
  7964. sort($literals);
  7965. $this->literals = $literals;
  7966. }
  7967. public function getLiterals()
  7968. {
  7969. return $this->literals;
  7970. }
  7971. public function getHash()
  7972. {
  7973. $data = unpack('ihash', md5(implode(',', $this->literals), true));
  7974. return $data['hash'];
  7975. }
  7976. public function equals(Rule $rule)
  7977. {
  7978. return $this->literals === $rule->getLiterals();
  7979. }
  7980. public function isAssertion()
  7981. {
  7982. return 1 === count($this->literals);
  7983. }
  7984. public function __toString()
  7985. {
  7986. $result = $this->isDisabled() ? 'disabled(' : '(';
  7987. foreach ($this->literals as $i => $literal) {
  7988. if ($i != 0) {
  7989. $result .= '|';
  7990. }
  7991. $result .= $literal;
  7992. }
  7993. $result .= ')';
  7994. return $result;
  7995. }
  7996. }
  7997. <?php
  7998. namespace Composer\DependencyResolver\Operation;
  7999. use Composer\Package\PackageInterface;
  8000. class InstallOperation extends SolverOperation
  8001. {
  8002. protected $package;
  8003. public function __construct(PackageInterface $package, $reason = null)
  8004. {
  8005. parent::__construct($reason);
  8006. $this->package = $package;
  8007. }
  8008. public function getPackage()
  8009. {
  8010. return $this->package;
  8011. }
  8012. public function getJobType()
  8013. {
  8014. return 'install';
  8015. }
  8016. public function __toString()
  8017. {
  8018. return 'Installing '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8019. }
  8020. }
  8021. <?php
  8022. namespace Composer\DependencyResolver\Operation;
  8023. use Composer\Package\AliasPackage;
  8024. use Composer\Package\PackageInterface;
  8025. class MarkAliasInstalledOperation extends SolverOperation
  8026. {
  8027. protected $package;
  8028. public function __construct(AliasPackage $package, $reason = null)
  8029. {
  8030. parent::__construct($reason);
  8031. $this->package = $package;
  8032. }
  8033. public function getPackage()
  8034. {
  8035. return $this->package;
  8036. }
  8037. public function getJobType()
  8038. {
  8039. return 'markAliasInstalled';
  8040. }
  8041. public function __toString()
  8042. {
  8043. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as installed, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8044. }
  8045. }
  8046. <?php
  8047. namespace Composer\DependencyResolver\Operation;
  8048. use Composer\Package\AliasPackage;
  8049. use Composer\Package\PackageInterface;
  8050. class MarkAliasUninstalledOperation extends SolverOperation
  8051. {
  8052. protected $package;
  8053. public function __construct(AliasPackage $package, $reason = null)
  8054. {
  8055. parent::__construct($reason);
  8056. $this->package = $package;
  8057. }
  8058. public function getPackage()
  8059. {
  8060. return $this->package;
  8061. }
  8062. public function getJobType()
  8063. {
  8064. return 'markAliasUninstalled';
  8065. }
  8066. public function __toString()
  8067. {
  8068. return 'Marking '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).') as uninstalled, alias of '.$this->package->getAliasOf()->getPrettyName().' ('.$this->formatVersion($this->package->getAliasOf()).')';
  8069. }
  8070. }
  8071. <?php
  8072. namespace Composer\DependencyResolver\Operation;
  8073. interface OperationInterface
  8074. {
  8075. public function getJobType();
  8076. public function getReason();
  8077. public function __toString();
  8078. }
  8079. <?php
  8080. namespace Composer\DependencyResolver\Operation;
  8081. use Composer\Package\PackageInterface;
  8082. abstract class SolverOperation implements OperationInterface
  8083. {
  8084. protected $reason;
  8085. public function __construct($reason = null)
  8086. {
  8087. $this->reason = $reason;
  8088. }
  8089. public function getReason()
  8090. {
  8091. return $this->reason;
  8092. }
  8093. protected function formatVersion(PackageInterface $package)
  8094. {
  8095. return $package->getFullPrettyVersion();
  8096. }
  8097. }
  8098. <?php
  8099. namespace Composer\DependencyResolver\Operation;
  8100. use Composer\Package\PackageInterface;
  8101. class UninstallOperation extends SolverOperation
  8102. {
  8103. protected $package;
  8104. public function __construct(PackageInterface $package, $reason = null)
  8105. {
  8106. parent::__construct($reason);
  8107. $this->package = $package;
  8108. }
  8109. public function getPackage()
  8110. {
  8111. return $this->package;
  8112. }
  8113. public function getJobType()
  8114. {
  8115. return 'uninstall';
  8116. }
  8117. public function __toString()
  8118. {
  8119. return 'Uninstalling '.$this->package->getPrettyName().' ('.$this->formatVersion($this->package).')';
  8120. }
  8121. }
  8122. <?php
  8123. namespace Composer\DependencyResolver\Operation;
  8124. use Composer\Package\PackageInterface;
  8125. class UpdateOperation extends SolverOperation
  8126. {
  8127. protected $initialPackage;
  8128. protected $targetPackage;
  8129. public function __construct(PackageInterface $initial, PackageInterface $target, $reason = null)
  8130. {
  8131. parent::__construct($reason);
  8132. $this->initialPackage = $initial;
  8133. $this->targetPackage = $target;
  8134. }
  8135. public function getInitialPackage()
  8136. {
  8137. return $this->initialPackage;
  8138. }
  8139. public function getTargetPackage()
  8140. {
  8141. return $this->targetPackage;
  8142. }
  8143. public function getJobType()
  8144. {
  8145. return 'update';
  8146. }
  8147. public function __toString()
  8148. {
  8149. return 'Updating '.$this->initialPackage->getPrettyName().' ('.$this->formatVersion($this->initialPackage).') to '.
  8150. $this->targetPackage->getPrettyName(). ' ('.$this->formatVersion($this->targetPackage).')';
  8151. }
  8152. }
  8153. <?php
  8154. namespace Composer\DependencyResolver;
  8155. use Composer\Package\PackageInterface;
  8156. interface PolicyInterface
  8157. {
  8158. public function versionCompare(PackageInterface $a, PackageInterface $b, $operator);
  8159. public function findUpdatePackages(Pool $pool, array $installedMap, PackageInterface $package);
  8160. public function selectPreferredPackages(Pool $pool, array $installedMap, array $literals, $requiredPackage = null);
  8161. }
  8162. <?php
  8163. namespace Composer\DependencyResolver;
  8164. use Composer\Package\BasePackage;
  8165. use Composer\Package\AliasPackage;
  8166. use Composer\Package\Version\VersionParser;
  8167. use Composer\Semver\Constraint\ConstraintInterface;
  8168. use Composer\Semver\Constraint\Constraint;
  8169. use Composer\Semver\Constraint\EmptyConstraint;
  8170. use Composer\Repository\RepositoryInterface;
  8171. use Composer\Repository\CompositeRepository;
  8172. use Composer\Repository\ComposerRepository;
  8173. use Composer\Repository\InstalledRepositoryInterface;
  8174. use Composer\Repository\PlatformRepository;
  8175. use Composer\Package\PackageInterface;
  8176. class Pool implements \Countable
  8177. {
  8178. const MATCH_NAME = -1;
  8179. const MATCH_NONE = 0;
  8180. const MATCH = 1;
  8181. const MATCH_PROVIDE = 2;
  8182. const MATCH_REPLACE = 3;
  8183. const MATCH_FILTERED = 4;
  8184. protected $repositories = array();
  8185. protected $providerRepos = array();
  8186. protected $packages = array();
  8187. protected $packageByName = array();
  8188. protected $packageByExactName = array();
  8189. protected $acceptableStabilities;
  8190. protected $stabilityFlags;
  8191. protected $versionParser;
  8192. protected $providerCache = array();
  8193. protected $filterRequires;
  8194. protected $whitelist = null;
  8195. protected $id = 1;
  8196. public function __construct($minimumStability = 'stable', array $stabilityFlags = array(), array $filterRequires = array())
  8197. {
  8198. $this->versionParser = new VersionParser;
  8199. $this->acceptableStabilities = array();
  8200. foreach (BasePackage::$stabilities as $stability => $value) {
  8201. if ($value <= BasePackage::$stabilities[$minimumStability]) {
  8202. $this->acceptableStabilities[$stability] = $value;
  8203. }
  8204. }
  8205. $this->stabilityFlags = $stabilityFlags;
  8206. $this->filterRequires = $filterRequires;
  8207. foreach ($filterRequires as $name => $constraint) {
  8208. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  8209. unset($this->filterRequires[$name]);
  8210. }
  8211. }
  8212. }
  8213. public function setWhitelist($whitelist)
  8214. {
  8215. $this->whitelist = $whitelist;
  8216. $this->providerCache = array();
  8217. }
  8218. public function addRepository(RepositoryInterface $repo, $rootAliases = array())
  8219. {
  8220. if ($repo instanceof CompositeRepository) {
  8221. $repos = $repo->getRepositories();
  8222. } else {
  8223. $repos = array($repo);
  8224. }
  8225. foreach ($repos as $repo) {
  8226. $this->repositories[] = $repo;
  8227. $exempt = $repo instanceof PlatformRepository || $repo instanceof InstalledRepositoryInterface;
  8228. if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
  8229. $this->providerRepos[] = $repo;
  8230. $repo->setRootAliases($rootAliases);
  8231. $repo->resetPackageIds();
  8232. } else {
  8233. foreach ($repo->getPackages() as $package) {
  8234. $names = $package->getNames();
  8235. $stability = $package->getStability();
  8236. if ($exempt || $this->isPackageAcceptable($names, $stability)) {
  8237. $package->setId($this->id++);
  8238. $this->packages[] = $package;
  8239. $this->packageByExactName[$package->getName()][$package->id] = $package;
  8240. foreach ($names as $provided) {
  8241. $this->packageByName[$provided][] = $package;
  8242. }
  8243. $name = $package->getName();
  8244. if (isset($rootAliases[$name][$package->getVersion()])) {
  8245. $alias = $rootAliases[$name][$package->getVersion()];
  8246. if ($package instanceof AliasPackage) {
  8247. $package = $package->getAliasOf();
  8248. }
  8249. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  8250. $aliasPackage->setRootPackageAlias(true);
  8251. $aliasPackage->setId($this->id++);
  8252. $package->getRepository()->addPackage($aliasPackage);
  8253. $this->packages[] = $aliasPackage;
  8254. $this->packageByExactName[$aliasPackage->getName()][$aliasPackage->id] = $aliasPackage;
  8255. foreach ($aliasPackage->getNames() as $name) {
  8256. $this->packageByName[$name][] = $aliasPackage;
  8257. }
  8258. }
  8259. }
  8260. }
  8261. }
  8262. }
  8263. }
  8264. public function getPriority(RepositoryInterface $repo)
  8265. {
  8266. $priority = array_search($repo, $this->repositories, true);
  8267. if (false === $priority) {
  8268. throw new \RuntimeException("Could not determine repository priority. The repository was not registered in the pool.");
  8269. }
  8270. return -$priority;
  8271. }
  8272. public function packageById($id)
  8273. {
  8274. return $this->packages[$id - 1];
  8275. }
  8276. public function count()
  8277. {
  8278. return count($this->packages);
  8279. }
  8280. public function whatProvides($name, ConstraintInterface $constraint = null, $mustMatchName = false, $bypassFilters = false)
  8281. {
  8282. if ($bypassFilters) {
  8283. return $this->computeWhatProvides($name, $constraint, $mustMatchName, true);
  8284. }
  8285. $key = ((int) $mustMatchName).$constraint;
  8286. if (isset($this->providerCache[$name][$key])) {
  8287. return $this->providerCache[$name][$key];
  8288. }
  8289. return $this->providerCache[$name][$key] = $this->computeWhatProvides($name, $constraint, $mustMatchName, $bypassFilters);
  8290. }
  8291. private function computeWhatProvides($name, $constraint, $mustMatchName = false, $bypassFilters = false)
  8292. {
  8293. $candidates = array();
  8294. foreach ($this->providerRepos as $repo) {
  8295. foreach ($repo->whatProvides($this, $name, $bypassFilters) as $candidate) {
  8296. $candidates[] = $candidate;
  8297. if ($candidate->id < 1) {
  8298. $candidate->setId($this->id++);
  8299. $this->packages[$this->id - 2] = $candidate;
  8300. }
  8301. }
  8302. }
  8303. if ($mustMatchName) {
  8304. $candidates = array_filter($candidates, function ($candidate) use ($name) {
  8305. return $candidate->getName() == $name;
  8306. });
  8307. if (isset($this->packageByExactName[$name])) {
  8308. $candidates = array_merge($candidates, $this->packageByExactName[$name]);
  8309. }
  8310. } elseif (isset($this->packageByName[$name])) {
  8311. $candidates = array_merge($candidates, $this->packageByName[$name]);
  8312. }
  8313. $matches = $provideMatches = array();
  8314. $nameMatch = false;
  8315. foreach ($candidates as $candidate) {
  8316. $aliasOfCandidate = null;
  8317. if ($candidate instanceof AliasPackage) {
  8318. $aliasOfCandidate = $candidate->getAliasOf();
  8319. }
  8320. if ($this->whitelist !== null && !$bypassFilters && (
  8321. (!($candidate instanceof AliasPackage) && !isset($this->whitelist[$candidate->id])) ||
  8322. ($candidate instanceof AliasPackage && !isset($this->whitelist[$aliasOfCandidate->id]))
  8323. )) {
  8324. continue;
  8325. }
  8326. switch ($this->match($candidate, $name, $constraint, $bypassFilters)) {
  8327. case self::MATCH_NONE:
  8328. break;
  8329. case self::MATCH_NAME:
  8330. $nameMatch = true;
  8331. break;
  8332. case self::MATCH:
  8333. $nameMatch = true;
  8334. $matches[] = $candidate;
  8335. break;
  8336. case self::MATCH_PROVIDE:
  8337. $provideMatches[] = $candidate;
  8338. break;
  8339. case self::MATCH_REPLACE:
  8340. $matches[] = $candidate;
  8341. break;
  8342. case self::MATCH_FILTERED:
  8343. break;
  8344. default:
  8345. throw new \UnexpectedValueException('Unexpected match type');
  8346. }
  8347. }
  8348. if ($nameMatch) {
  8349. return $matches;
  8350. }
  8351. return array_merge($matches, $provideMatches);
  8352. }
  8353. public function literalToPackage($literal)
  8354. {
  8355. $packageId = abs($literal);
  8356. return $this->packageById($packageId);
  8357. }
  8358. public function literalToPrettyString($literal, $installedMap)
  8359. {
  8360. $package = $this->literalToPackage($literal);
  8361. if (isset($installedMap[$package->id])) {
  8362. $prefix = ($literal > 0 ? 'keep' : 'remove');
  8363. } else {
  8364. $prefix = ($literal > 0 ? 'install' : 'don\'t install');
  8365. }
  8366. return $prefix.' '.$package->getPrettyString();
  8367. }
  8368. public function isPackageAcceptable($name, $stability)
  8369. {
  8370. foreach ((array) $name as $n) {
  8371. if (!isset($this->stabilityFlags[$n]) && isset($this->acceptableStabilities[$stability])) {
  8372. return true;
  8373. }
  8374. if (isset($this->stabilityFlags[$n]) && BasePackage::$stabilities[$stability] <= $this->stabilityFlags[$n]) {
  8375. return true;
  8376. }
  8377. }
  8378. return false;
  8379. }
  8380. public function match($candidate, $name, ConstraintInterface $constraint = null, $bypassFilters)
  8381. {
  8382. $candidateName = $candidate->getName();
  8383. $candidateVersion = $candidate->getVersion();
  8384. $isDev = $candidate->getStability() === 'dev';
  8385. $isAlias = $candidate instanceof AliasPackage;
  8386. if (!$bypassFilters && !$isDev && !$isAlias && isset($this->filterRequires[$name])) {
  8387. $requireFilter = $this->filterRequires[$name];
  8388. } else {
  8389. $requireFilter = new EmptyConstraint;
  8390. }
  8391. if ($candidateName === $name) {
  8392. $pkgConstraint = new Constraint('==', $candidateVersion);
  8393. if ($constraint === null || $constraint->matches($pkgConstraint)) {
  8394. return $requireFilter->matches($pkgConstraint) ? self::MATCH : self::MATCH_FILTERED;
  8395. }
  8396. return self::MATCH_NAME;
  8397. }
  8398. $provides = $candidate->getProvides();
  8399. $replaces = $candidate->getReplaces();
  8400. if (isset($replaces[0]) || isset($provides[0])) {
  8401. foreach ($provides as $link) {
  8402. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8403. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8404. }
  8405. }
  8406. foreach ($replaces as $link) {
  8407. if ($link->getTarget() === $name && ($constraint === null || $constraint->matches($link->getConstraint()))) {
  8408. return $requireFilter->matches($link->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8409. }
  8410. }
  8411. return self::MATCH_NONE;
  8412. }
  8413. if (isset($provides[$name]) && ($constraint === null || $constraint->matches($provides[$name]->getConstraint()))) {
  8414. return $requireFilter->matches($provides[$name]->getConstraint()) ? self::MATCH_PROVIDE : self::MATCH_FILTERED;
  8415. }
  8416. if (isset($replaces[$name]) && ($constraint === null || $constraint->matches($replaces[$name]->getConstraint()))) {
  8417. return $requireFilter->matches($replaces[$name]->getConstraint()) ? self::MATCH_REPLACE : self::MATCH_FILTERED;
  8418. }
  8419. return self::MATCH_NONE;
  8420. }
  8421. }
  8422. <?php
  8423. namespace Composer\DependencyResolver;
  8424. use Composer\Package\CompletePackageInterface;
  8425. class Problem
  8426. {
  8427. protected $reasonSeen;
  8428. protected $reasons = array();
  8429. protected $section = 0;
  8430. protected $pool;
  8431. public function __construct(Pool $pool)
  8432. {
  8433. $this->pool = $pool;
  8434. }
  8435. public function addRule(Rule $rule)
  8436. {
  8437. $this->addReason(spl_object_hash($rule), array(
  8438. 'rule' => $rule,
  8439. 'job' => $rule->getJob(),
  8440. ));
  8441. }
  8442. public function getReasons()
  8443. {
  8444. return $this->reasons;
  8445. }
  8446. public function getPrettyString(array $installedMap = array())
  8447. {
  8448. $reasons = call_user_func_array('array_merge', array_reverse($this->reasons));
  8449. if (count($reasons) === 1) {
  8450. reset($reasons);
  8451. $reason = current($reasons);
  8452. $job = $reason['job'];
  8453. $packageName = $job['packageName'];
  8454. $constraint = $job['constraint'];
  8455. if (isset($constraint)) {
  8456. $packages = $this->pool->whatProvides($packageName, $constraint);
  8457. } else {
  8458. $packages = array();
  8459. }
  8460. if ($job && $job['cmd'] === 'install' && empty($packages)) {
  8461. if ($packageName === 'php' || $packageName === 'php-64bit' || $packageName === 'hhvm') {
  8462. $version = phpversion();
  8463. $available = $this->pool->whatProvides($packageName);
  8464. if (count($available)) {
  8465. $firstAvailable = reset($available);
  8466. $version = $firstAvailable->getPrettyVersion();
  8467. $extra = $firstAvailable->getExtra();
  8468. if ($firstAvailable instanceof CompletePackageInterface && isset($extra['config.platform']) && $extra['config.platform'] === true) {
  8469. $version .= '; ' . $firstAvailable->getDescription();
  8470. }
  8471. }
  8472. $msg = "\n - This package requires ".$packageName.$this->constraintToText($constraint).' but ';
  8473. if (defined('HHVM_VERSION') || (count($available) && $packageName === 'hhvm')) {
  8474. return $msg . 'your HHVM version does not satisfy that requirement.';
  8475. }
  8476. if ($packageName === 'hhvm') {
  8477. return $msg . 'you are running this with PHP and not HHVM.';
  8478. }
  8479. return $msg . 'your PHP version ('. $version .') does not satisfy that requirement.';
  8480. }
  8481. if (0 === stripos($packageName, 'ext-')) {
  8482. if (false !== strpos($packageName, ' ')) {
  8483. return "\n - The requested PHP extension ".$packageName.' should be required as '.str_replace(' ', '-', $packageName).'.';
  8484. }
  8485. $ext = substr($packageName, 4);
  8486. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8487. return "\n - The requested PHP extension ".$packageName.$this->constraintToText($constraint).' '.$error.'. Install or enable PHP\'s '.$ext.' extension.';
  8488. }
  8489. if (0 === stripos($packageName, 'lib-')) {
  8490. if (strtolower($packageName) === 'lib-icu') {
  8491. $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.';
  8492. return "\n - The requested linked library ".$packageName.$this->constraintToText($constraint).' '.$error;
  8493. }
  8494. 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.';
  8495. }
  8496. if (!preg_match('{^[A-Za-z0-9_./-]+$}', $packageName)) {
  8497. $illegalChars = preg_replace('{[A-Za-z0-9_./-]+}', '', $packageName);
  8498. return "\n - The requested package ".$packageName.' could not be found, it looks like its name is invalid, "'.$illegalChars.'" is not allowed in package names.';
  8499. }
  8500. if ($providers = $this->pool->whatProvides($packageName, $constraint, true, true)) {
  8501. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' is satisfiable by '.$this->getPackageList($providers).' but these conflict with your requirements or minimum-stability.';
  8502. }
  8503. if ($providers = $this->pool->whatProvides($packageName, null, true, true)) {
  8504. return "\n - The requested package ".$packageName.$this->constraintToText($constraint).' exists as '.$this->getPackageList($providers).' but these are rejected by your constraint.';
  8505. }
  8506. return "\n - The requested package ".$packageName.' could not be found in any version, there may be a typo in the package name.';
  8507. }
  8508. }
  8509. $messages = array();
  8510. foreach ($reasons as $reason) {
  8511. $rule = $reason['rule'];
  8512. $job = $reason['job'];
  8513. if ($job) {
  8514. $messages[] = $this->jobToText($job);
  8515. } elseif ($rule) {
  8516. if ($rule instanceof Rule) {
  8517. $messages[] = $rule->getPrettyString($this->pool, $installedMap);
  8518. }
  8519. }
  8520. }
  8521. return "\n - ".implode("\n - ", $messages);
  8522. }
  8523. protected function addReason($id, $reason)
  8524. {
  8525. if (!isset($this->reasonSeen[$id])) {
  8526. $this->reasonSeen[$id] = true;
  8527. $this->reasons[$this->section][] = $reason;
  8528. }
  8529. }
  8530. public function nextSection()
  8531. {
  8532. $this->section++;
  8533. }
  8534. protected function jobToText($job)
  8535. {
  8536. $packageName = $job['packageName'];
  8537. $constraint = $job['constraint'];
  8538. switch ($job['cmd']) {
  8539. case 'install':
  8540. $packages = $this->pool->whatProvides($packageName, $constraint);
  8541. if (!$packages) {
  8542. return 'No package found to satisfy install request for '.$packageName.$this->constraintToText($constraint);
  8543. }
  8544. return 'Installation request for '.$packageName.$this->constraintToText($constraint).' -> satisfiable by '.$this->getPackageList($packages).'.';
  8545. case 'update':
  8546. return 'Update request for '.$packageName.$this->constraintToText($constraint).'.';
  8547. case 'remove':
  8548. return 'Removal request for '.$packageName.$this->constraintToText($constraint).'';
  8549. }
  8550. if (isset($constraint)) {
  8551. $packages = $this->pool->whatProvides($packageName, $constraint);
  8552. } else {
  8553. $packages = array();
  8554. }
  8555. return 'Job(cmd='.$job['cmd'].', target='.$packageName.', packages=['.$this->getPackageList($packages).'])';
  8556. }
  8557. protected function getPackageList($packages)
  8558. {
  8559. $prepared = array();
  8560. foreach ($packages as $package) {
  8561. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8562. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8563. }
  8564. foreach ($prepared as $name => $package) {
  8565. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8566. }
  8567. return implode(', ', $prepared);
  8568. }
  8569. protected function constraintToText($constraint)
  8570. {
  8571. return $constraint ? ' '.$constraint->getPrettyString() : '';
  8572. }
  8573. }
  8574. <?php
  8575. namespace Composer\DependencyResolver;
  8576. use Composer\Semver\Constraint\ConstraintInterface;
  8577. class Request
  8578. {
  8579. protected $jobs;
  8580. public function __construct()
  8581. {
  8582. $this->jobs = array();
  8583. }
  8584. public function install($packageName, ConstraintInterface $constraint = null)
  8585. {
  8586. $this->addJob($packageName, 'install', $constraint);
  8587. }
  8588. public function update($packageName, ConstraintInterface $constraint = null)
  8589. {
  8590. $this->addJob($packageName, 'update', $constraint);
  8591. }
  8592. public function remove($packageName, ConstraintInterface $constraint = null)
  8593. {
  8594. $this->addJob($packageName, 'remove', $constraint);
  8595. }
  8596. public function fix($packageName, ConstraintInterface $constraint = null)
  8597. {
  8598. $this->addJob($packageName, 'install', $constraint, true);
  8599. }
  8600. protected function addJob($packageName, $cmd, ConstraintInterface $constraint = null, $fixed = false)
  8601. {
  8602. $packageName = strtolower($packageName);
  8603. $this->jobs[] = array(
  8604. 'cmd' => $cmd,
  8605. 'packageName' => $packageName,
  8606. 'constraint' => $constraint,
  8607. 'fixed' => $fixed,
  8608. );
  8609. }
  8610. public function updateAll()
  8611. {
  8612. $this->jobs[] = array('cmd' => 'update-all');
  8613. }
  8614. public function getJobs()
  8615. {
  8616. return $this->jobs;
  8617. }
  8618. }
  8619. <?php
  8620. namespace Composer\DependencyResolver;
  8621. use Composer\Package\CompletePackage;
  8622. use Composer\Package\Link;
  8623. use Composer\Package\PackageInterface;
  8624. abstract class Rule
  8625. {
  8626. const RULE_INTERNAL_ALLOW_UPDATE = 1;
  8627. const RULE_JOB_INSTALL = 2;
  8628. const RULE_JOB_REMOVE = 3;
  8629. const RULE_PACKAGE_CONFLICT = 6;
  8630. const RULE_PACKAGE_REQUIRES = 7;
  8631. const RULE_PACKAGE_OBSOLETES = 8;
  8632. const RULE_INSTALLED_PACKAGE_OBSOLETES = 9;
  8633. const RULE_PACKAGE_SAME_NAME = 10;
  8634. const RULE_PACKAGE_IMPLICIT_OBSOLETES = 11;
  8635. const RULE_LEARNED = 12;
  8636. const RULE_PACKAGE_ALIAS = 13;
  8637. const BITFIELD_TYPE = 0;
  8638. const BITFIELD_REASON = 8;
  8639. const BITFIELD_DISABLED = 16;
  8640. protected $bitfield;
  8641. protected $job;
  8642. protected $reasonData;
  8643. public function __construct($reason, $reasonData, $job = null)
  8644. {
  8645. $this->reasonData = $reasonData;
  8646. if ($job) {
  8647. $this->job = $job;
  8648. }
  8649. $this->bitfield = (0 << self::BITFIELD_DISABLED) |
  8650. ($reason << self::BITFIELD_REASON) |
  8651. (255 << self::BITFIELD_TYPE);
  8652. }
  8653. abstract public function getLiterals();
  8654. abstract public function getHash();
  8655. public function getJob()
  8656. {
  8657. return $this->job;
  8658. }
  8659. abstract public function equals(Rule $rule);
  8660. public function getReason()
  8661. {
  8662. return ($this->bitfield & (255 << self::BITFIELD_REASON)) >> self::BITFIELD_REASON;
  8663. }
  8664. public function getReasonData()
  8665. {
  8666. return $this->reasonData;
  8667. }
  8668. public function getRequiredPackage()
  8669. {
  8670. if ($this->getReason() === self::RULE_JOB_INSTALL) {
  8671. return $this->reasonData;
  8672. }
  8673. if ($this->getReason() === self::RULE_PACKAGE_REQUIRES) {
  8674. return $this->reasonData->getTarget();
  8675. }
  8676. }
  8677. public function setType($type)
  8678. {
  8679. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_TYPE)) | ((255 & $type) << self::BITFIELD_TYPE);
  8680. }
  8681. public function getType()
  8682. {
  8683. return ($this->bitfield & (255 << self::BITFIELD_TYPE)) >> self::BITFIELD_TYPE;
  8684. }
  8685. public function disable()
  8686. {
  8687. $this->bitfield = ($this->bitfield & ~(255 << self::BITFIELD_DISABLED)) | (1 << self::BITFIELD_DISABLED);
  8688. }
  8689. public function enable()
  8690. {
  8691. $this->bitfield &= ~(255 << self::BITFIELD_DISABLED);
  8692. }
  8693. public function isDisabled()
  8694. {
  8695. return (bool) (($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8696. }
  8697. public function isEnabled()
  8698. {
  8699. return !(($this->bitfield & (255 << self::BITFIELD_DISABLED)) >> self::BITFIELD_DISABLED);
  8700. }
  8701. abstract public function isAssertion();
  8702. public function getPrettyString(Pool $pool, array $installedMap = array())
  8703. {
  8704. $literals = $this->getLiterals();
  8705. $ruleText = '';
  8706. foreach ($literals as $i => $literal) {
  8707. if ($i != 0) {
  8708. $ruleText .= '|';
  8709. }
  8710. $ruleText .= $pool->literalToPrettyString($literal, $installedMap);
  8711. }
  8712. switch ($this->getReason()) {
  8713. case self::RULE_INTERNAL_ALLOW_UPDATE:
  8714. return $ruleText;
  8715. case self::RULE_JOB_INSTALL:
  8716. return "Install command rule ($ruleText)";
  8717. case self::RULE_JOB_REMOVE:
  8718. return "Remove command rule ($ruleText)";
  8719. case self::RULE_PACKAGE_CONFLICT:
  8720. $package1 = $pool->literalToPackage($literals[0]);
  8721. $package2 = $pool->literalToPackage($literals[1]);
  8722. return $package1->getPrettyString().' conflicts with '.$this->formatPackagesUnique($pool, array($package2)).'.';
  8723. case self::RULE_PACKAGE_REQUIRES:
  8724. $sourceLiteral = array_shift($literals);
  8725. $sourcePackage = $pool->literalToPackage($sourceLiteral);
  8726. $requires = array();
  8727. foreach ($literals as $literal) {
  8728. $requires[] = $pool->literalToPackage($literal);
  8729. }
  8730. $text = $this->reasonData->getPrettyString($sourcePackage);
  8731. if ($requires) {
  8732. $text .= ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $requires) . '.';
  8733. } else {
  8734. $targetName = $this->reasonData->getTarget();
  8735. if ($targetName === 'php' || $targetName === 'php-64bit' || $targetName === 'hhvm') {
  8736. if (defined('HHVM_VERSION')) {
  8737. return $text . ' -> your HHVM version does not satisfy that requirement.';
  8738. }
  8739. $packages = $pool->whatProvides($targetName);
  8740. $package = count($packages) ? current($packages) : phpversion();
  8741. if ($targetName === 'hhvm') {
  8742. if ($package instanceof CompletePackage) {
  8743. return $text . ' -> your HHVM version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8744. } else {
  8745. return $text . ' -> you are running this with PHP and not HHVM.';
  8746. }
  8747. }
  8748. if (!($package instanceof CompletePackage)) {
  8749. return $text . ' -> your PHP version ('.phpversion().') does not satisfy that requirement.';
  8750. }
  8751. $extra = $package->getExtra();
  8752. if (!empty($extra['config.platform'])) {
  8753. $text .= ' -> your PHP version ('.phpversion().') overridden by "config.platform.php" version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8754. } else {
  8755. $text .= ' -> your PHP version ('.$package->getPrettyVersion().') does not satisfy that requirement.';
  8756. }
  8757. return $text;
  8758. }
  8759. if (0 === strpos($targetName, 'ext-')) {
  8760. $ext = substr($targetName, 4);
  8761. $error = extension_loaded($ext) ? 'has the wrong version ('.(phpversion($ext) ?: '0').') installed' : 'is missing from your system';
  8762. return $text . ' -> the requested PHP extension '.$ext.' '.$error.'.';
  8763. }
  8764. if (0 === strpos($targetName, 'lib-')) {
  8765. $lib = substr($targetName, 4);
  8766. 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.';
  8767. }
  8768. if ($providers = $pool->whatProvides($targetName, $this->reasonData->getConstraint(), true, true)) {
  8769. return $text . ' -> satisfiable by ' . $this->formatPackagesUnique($pool, $providers) .' but these conflict with your requirements or minimum-stability.';
  8770. }
  8771. return $text . ' -> no matching package found.';
  8772. }
  8773. return $text;
  8774. case self::RULE_PACKAGE_OBSOLETES:
  8775. return $ruleText;
  8776. case self::RULE_INSTALLED_PACKAGE_OBSOLETES:
  8777. return $ruleText;
  8778. case self::RULE_PACKAGE_SAME_NAME:
  8779. return 'Can only install one of: ' . $this->formatPackagesUnique($pool, $literals) . '.';
  8780. case self::RULE_PACKAGE_IMPLICIT_OBSOLETES:
  8781. return $ruleText;
  8782. case self::RULE_LEARNED:
  8783. return 'Conclusion: '.$ruleText;
  8784. case self::RULE_PACKAGE_ALIAS:
  8785. return $ruleText;
  8786. default:
  8787. return '('.$ruleText.')';
  8788. }
  8789. }
  8790. protected function formatPackagesUnique($pool, array $packages)
  8791. {
  8792. $prepared = array();
  8793. foreach ($packages as $package) {
  8794. if (!is_object($package)) {
  8795. $package = $pool->literalToPackage($package);
  8796. }
  8797. $prepared[$package->getName()]['name'] = $package->getPrettyName();
  8798. $prepared[$package->getName()]['versions'][$package->getVersion()] = $package->getPrettyVersion();
  8799. }
  8800. foreach ($prepared as $name => $package) {
  8801. $prepared[$name] = $package['name'].'['.implode(', ', $package['versions']).']';
  8802. }
  8803. return implode(', ', $prepared);
  8804. }
  8805. }
  8806. <?php
  8807. namespace Composer\DependencyResolver;
  8808. use Composer\Package\PackageInterface;
  8809. use Composer\Package\Link;
  8810. class Rule2Literals extends Rule
  8811. {
  8812. protected $literal1;
  8813. protected $literal2;
  8814. public function __construct($literal1, $literal2, $reason, $reasonData, $job = null)
  8815. {
  8816. parent::__construct($reason, $reasonData, $job);
  8817. if ($literal1 < $literal2) {
  8818. $this->literal1 = $literal1;
  8819. $this->literal2 = $literal2;
  8820. } else {
  8821. $this->literal1 = $literal2;
  8822. $this->literal2 = $literal1;
  8823. }
  8824. }
  8825. public function getLiterals()
  8826. {
  8827. return array($this->literal1, $this->literal2);
  8828. }
  8829. public function getHash()
  8830. {
  8831. return $this->literal1.','.$this->literal2;
  8832. }
  8833. public function equals(Rule $rule)
  8834. {
  8835. if ($rule instanceof self) {
  8836. if ($this->literal1 !== $rule->literal1) {
  8837. return false;
  8838. }
  8839. if ($this->literal2 !== $rule->literal2) {
  8840. return false;
  8841. }
  8842. return true;
  8843. }
  8844. $literals = $rule->getLiterals();
  8845. if (2 != count($literals)) {
  8846. return false;
  8847. }
  8848. if ($this->literal1 !== $literals[0]) {
  8849. return false;
  8850. }
  8851. if ($this->literal2 !== $literals[1]) {
  8852. return false;
  8853. }
  8854. return true;
  8855. }
  8856. public function isAssertion()
  8857. {
  8858. return false;
  8859. }
  8860. public function __toString()
  8861. {
  8862. $result = $this->isDisabled() ? 'disabled(' : '(';
  8863. $result .= $this->literal1 . '|' . $this->literal2 . ')';
  8864. return $result;
  8865. }
  8866. }
  8867. <?php
  8868. namespace Composer\DependencyResolver;
  8869. class RuleSet implements \IteratorAggregate, \Countable
  8870. {
  8871. const TYPE_PACKAGE = 0;
  8872. const TYPE_JOB = 1;
  8873. const TYPE_LEARNED = 4;
  8874. public $ruleById;
  8875. protected static $types = array(
  8876. 255 => 'UNKNOWN',
  8877. self::TYPE_PACKAGE => 'PACKAGE',
  8878. self::TYPE_JOB => 'JOB',
  8879. self::TYPE_LEARNED => 'LEARNED',
  8880. );
  8881. protected $rules;
  8882. protected $nextRuleId;
  8883. protected $rulesByHash;
  8884. public function __construct()
  8885. {
  8886. $this->nextRuleId = 0;
  8887. foreach ($this->getTypes() as $type) {
  8888. $this->rules[$type] = array();
  8889. }
  8890. $this->rulesByHash = array();
  8891. }
  8892. public function add(Rule $rule, $type)
  8893. {
  8894. if (!isset(self::$types[$type])) {
  8895. throw new \OutOfBoundsException('Unknown rule type: ' . $type);
  8896. }
  8897. $hash = $rule->getHash();
  8898. if (isset($this->rulesByHash[$hash])) {
  8899. $potentialDuplicates = $this->rulesByHash[$hash];
  8900. if (is_array($potentialDuplicates)) {
  8901. foreach ($potentialDuplicates as $potentialDuplicate) {
  8902. if ($rule->equals($potentialDuplicate)) {
  8903. return;
  8904. }
  8905. }
  8906. } else {
  8907. if ($rule->equals($potentialDuplicates)) {
  8908. return;
  8909. }
  8910. }
  8911. }
  8912. if (!isset($this->rules[$type])) {
  8913. $this->rules[$type] = array();
  8914. }
  8915. $this->rules[$type][] = $rule;
  8916. $this->ruleById[$this->nextRuleId] = $rule;
  8917. $rule->setType($type);
  8918. $this->nextRuleId++;
  8919. if (!isset($this->rulesByHash[$hash])) {
  8920. $this->rulesByHash[$hash] = $rule;
  8921. } elseif (is_array($this->rulesByHash[$hash])) {
  8922. $this->rulesByHash[$hash][] = $rule;
  8923. } else {
  8924. $originalRule = $this->rulesByHash[$hash];
  8925. $this->rulesByHash[$hash] = array($originalRule, $rule);
  8926. }
  8927. }
  8928. public function count()
  8929. {
  8930. return $this->nextRuleId;
  8931. }
  8932. public function ruleById($id)
  8933. {
  8934. return $this->ruleById[$id];
  8935. }
  8936. public function getRules()
  8937. {
  8938. return $this->rules;
  8939. }
  8940. public function getIterator()
  8941. {
  8942. return new RuleSetIterator($this->getRules());
  8943. }
  8944. public function getIteratorFor($types)
  8945. {
  8946. if (!is_array($types)) {
  8947. $types = array($types);
  8948. }
  8949. $allRules = $this->getRules();
  8950. $rules = array();
  8951. foreach ($types as $type) {
  8952. $rules[$type] = $allRules[$type];
  8953. }
  8954. return new RuleSetIterator($rules);
  8955. }
  8956. public function getIteratorWithout($types)
  8957. {
  8958. if (!is_array($types)) {
  8959. $types = array($types);
  8960. }
  8961. $rules = $this->getRules();
  8962. foreach ($types as $type) {
  8963. unset($rules[$type]);
  8964. }
  8965. return new RuleSetIterator($rules);
  8966. }
  8967. public function getTypes()
  8968. {
  8969. $types = self::$types;
  8970. unset($types[255]);
  8971. return array_keys($types);
  8972. }
  8973. public function getPrettyString(Pool $pool = null)
  8974. {
  8975. $string = "\n";
  8976. foreach ($this->rules as $type => $rules) {
  8977. $string .= str_pad(self::$types[$type], 8, ' ') . ": ";
  8978. foreach ($rules as $rule) {
  8979. $string .= ($pool ? $rule->getPrettyString($pool) : $rule)."\n";
  8980. }
  8981. $string .= "\n\n";
  8982. }
  8983. return $string;
  8984. }
  8985. public function __toString()
  8986. {
  8987. return $this->getPrettyString(null);
  8988. }
  8989. }
  8990. <?php
  8991. namespace Composer\DependencyResolver;
  8992. use Composer\Package\PackageInterface;
  8993. use Composer\Package\AliasPackage;
  8994. use Composer\Repository\PlatformRepository;
  8995. class RuleSetGenerator
  8996. {
  8997. protected $policy;
  8998. protected $pool;
  8999. protected $rules;
  9000. protected $jobs;
  9001. protected $installedMap;
  9002. protected $whitelistedMap;
  9003. protected $addedMap;
  9004. protected $conflictAddedMap;
  9005. protected $addedPackages;
  9006. protected $addedPackagesByNames;
  9007. public function __construct(PolicyInterface $policy, Pool $pool)
  9008. {
  9009. $this->policy = $policy;
  9010. $this->pool = $pool;
  9011. }
  9012. protected function createRequireRule(PackageInterface $package, array $providers, $reason, $reasonData = null)
  9013. {
  9014. $literals = array(-$package->id);
  9015. foreach ($providers as $provider) {
  9016. if ($provider === $package) {
  9017. return null;
  9018. }
  9019. $literals[] = $provider->id;
  9020. }
  9021. return new GenericRule($literals, $reason, $reasonData);
  9022. }
  9023. protected function createInstallOneOfRule(array $packages, $reason, $job)
  9024. {
  9025. $literals = array();
  9026. foreach ($packages as $package) {
  9027. $literals[] = $package->id;
  9028. }
  9029. return new GenericRule($literals, $reason, $job['packageName'], $job);
  9030. }
  9031. protected function createRemoveRule(PackageInterface $package, $reason, $job)
  9032. {
  9033. return new GenericRule(array(-$package->id), $reason, $job['packageName'], $job);
  9034. }
  9035. protected function createRule2Literals(PackageInterface $issuer, PackageInterface $provider, $reason, $reasonData = null)
  9036. {
  9037. if ($issuer === $provider) {
  9038. return null;
  9039. }
  9040. return new Rule2Literals(-$issuer->id, -$provider->id, $reason, $reasonData);
  9041. }
  9042. private function addRule($type, Rule $newRule = null)
  9043. {
  9044. if (!$newRule) {
  9045. return;
  9046. }
  9047. $this->rules->add($newRule, $type);
  9048. }
  9049. protected function whitelistFromPackage(PackageInterface $package)
  9050. {
  9051. $workQueue = new \SplQueue;
  9052. $workQueue->enqueue($package);
  9053. while (!$workQueue->isEmpty()) {
  9054. $package = $workQueue->dequeue();
  9055. if (isset($this->whitelistedMap[$package->id])) {
  9056. continue;
  9057. }
  9058. $this->whitelistedMap[$package->id] = true;
  9059. foreach ($package->getRequires() as $link) {
  9060. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint(), true);
  9061. foreach ($possibleRequires as $require) {
  9062. $workQueue->enqueue($require);
  9063. }
  9064. }
  9065. $obsoleteProviders = $this->pool->whatProvides($package->getName(), null, true);
  9066. foreach ($obsoleteProviders as $provider) {
  9067. if ($provider === $package) {
  9068. continue;
  9069. }
  9070. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9071. $workQueue->enqueue($provider);
  9072. }
  9073. }
  9074. }
  9075. }
  9076. protected function addRulesForPackage(PackageInterface $package, $ignorePlatformReqs)
  9077. {
  9078. $workQueue = new \SplQueue;
  9079. $workQueue->enqueue($package);
  9080. while (!$workQueue->isEmpty()) {
  9081. $package = $workQueue->dequeue();
  9082. if (isset($this->addedMap[$package->id])) {
  9083. continue;
  9084. }
  9085. $this->addedMap[$package->id] = true;
  9086. $this->addedPackages[] = $package;
  9087. foreach ($package->getNames() as $name) {
  9088. $this->addedPackagesByNames[$name][] = $package;
  9089. }
  9090. foreach ($package->getRequires() as $link) {
  9091. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9092. continue;
  9093. }
  9094. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  9095. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, $possibleRequires, Rule::RULE_PACKAGE_REQUIRES, $link));
  9096. foreach ($possibleRequires as $require) {
  9097. $workQueue->enqueue($require);
  9098. }
  9099. }
  9100. $packageName = $package->getName();
  9101. $obsoleteProviders = $this->pool->whatProvides($packageName, null);
  9102. foreach ($obsoleteProviders as $provider) {
  9103. if ($provider === $package) {
  9104. continue;
  9105. }
  9106. if (($package instanceof AliasPackage) && $package->getAliasOf() === $provider) {
  9107. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRequireRule($package, array($provider), Rule::RULE_PACKAGE_ALIAS, $package));
  9108. } elseif (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9109. $reason = ($packageName == $provider->getName()) ? Rule::RULE_PACKAGE_SAME_NAME : Rule::RULE_PACKAGE_IMPLICIT_OBSOLETES;
  9110. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $package));
  9111. }
  9112. }
  9113. }
  9114. }
  9115. protected function addConflictRules($ignorePlatformReqs = false)
  9116. {
  9117. foreach ($this->addedPackages as $package) {
  9118. foreach ($package->getConflicts() as $link) {
  9119. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9120. continue;
  9121. }
  9122. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  9123. continue;
  9124. }
  9125. foreach ($this->addedPackagesByNames[$link->getTarget()] as $possibleConflict) {
  9126. $conflictMatch = $this->pool->match($possibleConflict, $link->getTarget(), $link->getConstraint(), true);
  9127. if ($conflictMatch === Pool::MATCH || $conflictMatch === Pool::MATCH_REPLACE) {
  9128. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $possibleConflict, Rule::RULE_PACKAGE_CONFLICT, $link));
  9129. }
  9130. }
  9131. }
  9132. $isInstalled = isset($this->installedMap[$package->id]);
  9133. foreach ($package->getReplaces() as $link) {
  9134. if (!isset($this->addedPackagesByNames[$link->getTarget()])) {
  9135. continue;
  9136. }
  9137. foreach ($this->addedPackagesByNames[$link->getTarget()] as $provider) {
  9138. if ($provider === $package) {
  9139. continue;
  9140. }
  9141. if (!$this->obsoleteImpossibleForAlias($package, $provider)) {
  9142. $reason = $isInstalled ? Rule::RULE_INSTALLED_PACKAGE_OBSOLETES : Rule::RULE_PACKAGE_OBSOLETES;
  9143. $this->addRule(RuleSet::TYPE_PACKAGE, $this->createRule2Literals($package, $provider, $reason, $link));
  9144. }
  9145. }
  9146. }
  9147. }
  9148. }
  9149. protected function obsoleteImpossibleForAlias($package, $provider)
  9150. {
  9151. $packageIsAlias = $package instanceof AliasPackage;
  9152. $providerIsAlias = $provider instanceof AliasPackage;
  9153. $impossible = (
  9154. ($packageIsAlias && $package->getAliasOf() === $provider) ||
  9155. ($providerIsAlias && $provider->getAliasOf() === $package) ||
  9156. ($packageIsAlias && $providerIsAlias && $provider->getAliasOf() === $package->getAliasOf())
  9157. );
  9158. return $impossible;
  9159. }
  9160. protected function whitelistFromJobs()
  9161. {
  9162. foreach ($this->jobs as $job) {
  9163. switch ($job['cmd']) {
  9164. case 'install':
  9165. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint'], true);
  9166. foreach ($packages as $package) {
  9167. $this->whitelistFromPackage($package);
  9168. }
  9169. break;
  9170. }
  9171. }
  9172. }
  9173. protected function addRulesForJobs($ignorePlatformReqs)
  9174. {
  9175. foreach ($this->jobs as $job) {
  9176. switch ($job['cmd']) {
  9177. case 'install':
  9178. if (!$job['fixed'] && $ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9179. break;
  9180. }
  9181. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9182. if ($packages) {
  9183. foreach ($packages as $package) {
  9184. if (!isset($this->installedMap[$package->id])) {
  9185. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9186. }
  9187. }
  9188. $rule = $this->createInstallOneOfRule($packages, Rule::RULE_JOB_INSTALL, $job);
  9189. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9190. }
  9191. break;
  9192. case 'remove':
  9193. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9194. foreach ($packages as $package) {
  9195. $rule = $this->createRemoveRule($package, Rule::RULE_JOB_REMOVE, $job);
  9196. $this->addRule(RuleSet::TYPE_JOB, $rule);
  9197. }
  9198. break;
  9199. }
  9200. }
  9201. }
  9202. public function getRulesFor($jobs, $installedMap, $ignorePlatformReqs = false)
  9203. {
  9204. $this->jobs = $jobs;
  9205. $this->rules = new RuleSet;
  9206. $this->installedMap = $installedMap;
  9207. $this->whitelistedMap = array();
  9208. foreach ($this->installedMap as $package) {
  9209. $this->whitelistFromPackage($package);
  9210. }
  9211. $this->whitelistFromJobs();
  9212. $this->pool->setWhitelist($this->whitelistedMap);
  9213. $this->addedMap = array();
  9214. $this->conflictAddedMap = array();
  9215. $this->addedPackages = array();
  9216. $this->addedPackagesByNames = array();
  9217. foreach ($this->installedMap as $package) {
  9218. $this->addRulesForPackage($package, $ignorePlatformReqs);
  9219. }
  9220. $this->addRulesForJobs($ignorePlatformReqs);
  9221. $this->addConflictRules($ignorePlatformReqs);
  9222. $this->addedPackages = $this->addedPackagesByNames = null;
  9223. return $this->rules;
  9224. }
  9225. }
  9226. <?php
  9227. namespace Composer\DependencyResolver;
  9228. class RuleSetIterator implements \Iterator
  9229. {
  9230. protected $rules;
  9231. protected $types;
  9232. protected $currentOffset;
  9233. protected $currentType;
  9234. protected $currentTypeOffset;
  9235. public function __construct(array $rules)
  9236. {
  9237. $this->rules = $rules;
  9238. $this->types = array_keys($rules);
  9239. sort($this->types);
  9240. $this->rewind();
  9241. }
  9242. public function current()
  9243. {
  9244. return $this->rules[$this->currentType][$this->currentOffset];
  9245. }
  9246. public function key()
  9247. {
  9248. return $this->currentType;
  9249. }
  9250. public function next()
  9251. {
  9252. $this->currentOffset++;
  9253. if (!isset($this->rules[$this->currentType])) {
  9254. return;
  9255. }
  9256. if ($this->currentOffset >= count($this->rules[$this->currentType])) {
  9257. $this->currentOffset = 0;
  9258. do {
  9259. $this->currentTypeOffset++;
  9260. if (!isset($this->types[$this->currentTypeOffset])) {
  9261. $this->currentType = -1;
  9262. break;
  9263. }
  9264. $this->currentType = $this->types[$this->currentTypeOffset];
  9265. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9266. }
  9267. }
  9268. public function rewind()
  9269. {
  9270. $this->currentOffset = 0;
  9271. $this->currentTypeOffset = -1;
  9272. $this->currentType = -1;
  9273. do {
  9274. $this->currentTypeOffset++;
  9275. if (!isset($this->types[$this->currentTypeOffset])) {
  9276. $this->currentType = -1;
  9277. break;
  9278. }
  9279. $this->currentType = $this->types[$this->currentTypeOffset];
  9280. } while (isset($this->types[$this->currentTypeOffset]) && !count($this->rules[$this->currentType]));
  9281. }
  9282. public function valid()
  9283. {
  9284. return isset($this->rules[$this->currentType])
  9285. && isset($this->rules[$this->currentType][$this->currentOffset]);
  9286. }
  9287. }
  9288. <?php
  9289. namespace Composer\DependencyResolver;
  9290. class RuleWatchChain extends \SplDoublyLinkedList
  9291. {
  9292. protected $offset = 0;
  9293. public function seek($offset)
  9294. {
  9295. $this->rewind();
  9296. for ($i = 0; $i < $offset; $i++, $this->next());
  9297. }
  9298. public function remove()
  9299. {
  9300. $offset = $this->key();
  9301. $this->offsetUnset($offset);
  9302. $this->seek($offset);
  9303. }
  9304. }
  9305. <?php
  9306. namespace Composer\DependencyResolver;
  9307. class RuleWatchGraph
  9308. {
  9309. protected $watchChains = array();
  9310. public function insert(RuleWatchNode $node)
  9311. {
  9312. if ($node->getRule()->isAssertion()) {
  9313. return;
  9314. }
  9315. foreach (array($node->watch1, $node->watch2) as $literal) {
  9316. if (!isset($this->watchChains[$literal])) {
  9317. $this->watchChains[$literal] = new RuleWatchChain;
  9318. }
  9319. $this->watchChains[$literal]->unshift($node);
  9320. }
  9321. }
  9322. public function propagateLiteral($decidedLiteral, $level, $decisions)
  9323. {
  9324. $literal = -$decidedLiteral;
  9325. if (!isset($this->watchChains[$literal])) {
  9326. return null;
  9327. }
  9328. $chain = $this->watchChains[$literal];
  9329. $chain->rewind();
  9330. while ($chain->valid()) {
  9331. $node = $chain->current();
  9332. $otherWatch = $node->getOtherWatch($literal);
  9333. if (!$node->getRule()->isDisabled() && !$decisions->satisfy($otherWatch)) {
  9334. $ruleLiterals = $node->getRule()->getLiterals();
  9335. $alternativeLiterals = array_filter($ruleLiterals, function ($ruleLiteral) use ($literal, $otherWatch, $decisions) {
  9336. return $literal !== $ruleLiteral &&
  9337. $otherWatch !== $ruleLiteral &&
  9338. !$decisions->conflict($ruleLiteral);
  9339. });
  9340. if ($alternativeLiterals) {
  9341. reset($alternativeLiterals);
  9342. $this->moveWatch($literal, current($alternativeLiterals), $node);
  9343. continue;
  9344. }
  9345. if ($decisions->conflict($otherWatch)) {
  9346. return $node->getRule();
  9347. }
  9348. $decisions->decide($otherWatch, $level, $node->getRule());
  9349. }
  9350. $chain->next();
  9351. }
  9352. return null;
  9353. }
  9354. protected function moveWatch($fromLiteral, $toLiteral, $node)
  9355. {
  9356. if (!isset($this->watchChains[$toLiteral])) {
  9357. $this->watchChains[$toLiteral] = new RuleWatchChain;
  9358. }
  9359. $node->moveWatch($fromLiteral, $toLiteral);
  9360. $this->watchChains[$fromLiteral]->remove();
  9361. $this->watchChains[$toLiteral]->unshift($node);
  9362. }
  9363. }
  9364. <?php
  9365. namespace Composer\DependencyResolver;
  9366. class RuleWatchNode
  9367. {
  9368. public $watch1;
  9369. public $watch2;
  9370. protected $rule;
  9371. public function __construct($rule)
  9372. {
  9373. $this->rule = $rule;
  9374. $literals = $rule->getLiterals();
  9375. $literalCount = count($literals);
  9376. $this->watch1 = $literalCount > 0 ? $literals[0] : 0;
  9377. $this->watch2 = $literalCount > 1 ? $literals[1] : 0;
  9378. }
  9379. public function watch2OnHighest(Decisions $decisions)
  9380. {
  9381. $literals = $this->rule->getLiterals();
  9382. if (count($literals) < 3) {
  9383. return;
  9384. }
  9385. $watchLevel = 0;
  9386. foreach ($literals as $literal) {
  9387. $level = $decisions->decisionLevel($literal);
  9388. if ($level > $watchLevel) {
  9389. $this->watch2 = $literal;
  9390. $watchLevel = $level;
  9391. }
  9392. }
  9393. }
  9394. public function getRule()
  9395. {
  9396. return $this->rule;
  9397. }
  9398. public function getOtherWatch($literal)
  9399. {
  9400. if ($this->watch1 == $literal) {
  9401. return $this->watch2;
  9402. }
  9403. return $this->watch1;
  9404. }
  9405. public function moveWatch($from, $to)
  9406. {
  9407. if ($this->watch1 == $from) {
  9408. $this->watch1 = $to;
  9409. } else {
  9410. $this->watch2 = $to;
  9411. }
  9412. }
  9413. }
  9414. <?php
  9415. namespace Composer\DependencyResolver;
  9416. use Composer\IO\IOInterface;
  9417. use Composer\Repository\RepositoryInterface;
  9418. use Composer\Repository\PlatformRepository;
  9419. class Solver
  9420. {
  9421. const BRANCH_LITERALS = 0;
  9422. const BRANCH_LEVEL = 1;
  9423. protected $policy;
  9424. protected $pool;
  9425. protected $installed;
  9426. protected $rules;
  9427. protected $ruleSetGenerator;
  9428. protected $jobs;
  9429. protected $updateMap = array();
  9430. protected $watchGraph;
  9431. protected $decisions;
  9432. protected $installedMap;
  9433. protected $propagateIndex;
  9434. protected $branches = array();
  9435. protected $problems = array();
  9436. protected $learnedPool = array();
  9437. protected $learnedWhy = array();
  9438. public $testFlagLearnedPositiveLiteral = false;
  9439. protected $io;
  9440. public function __construct(PolicyInterface $policy, Pool $pool, RepositoryInterface $installed, IOInterface $io)
  9441. {
  9442. $this->io = $io;
  9443. $this->policy = $policy;
  9444. $this->pool = $pool;
  9445. $this->installed = $installed;
  9446. $this->ruleSetGenerator = new RuleSetGenerator($policy, $pool);
  9447. }
  9448. public function getRuleSetSize()
  9449. {
  9450. return count($this->rules);
  9451. }
  9452. private function makeAssertionRuleDecisions()
  9453. {
  9454. $decisionStart = count($this->decisions) - 1;
  9455. $rulesCount = count($this->rules);
  9456. for ($ruleIndex = 0; $ruleIndex < $rulesCount; $ruleIndex++) {
  9457. $rule = $this->rules->ruleById[$ruleIndex];
  9458. if (!$rule->isAssertion() || $rule->isDisabled()) {
  9459. continue;
  9460. }
  9461. $literals = $rule->getLiterals();
  9462. $literal = $literals[0];
  9463. if (!$this->decisions->decided($literal)) {
  9464. $this->decisions->decide($literal, 1, $rule);
  9465. continue;
  9466. }
  9467. if ($this->decisions->satisfy($literal)) {
  9468. continue;
  9469. }
  9470. if (RuleSet::TYPE_LEARNED === $rule->getType()) {
  9471. $rule->disable();
  9472. continue;
  9473. }
  9474. $conflict = $this->decisions->decisionRule($literal);
  9475. if ($conflict && RuleSet::TYPE_PACKAGE === $conflict->getType()) {
  9476. $problem = new Problem($this->pool);
  9477. $problem->addRule($rule);
  9478. $problem->addRule($conflict);
  9479. $this->disableProblem($rule);
  9480. $this->problems[] = $problem;
  9481. continue;
  9482. }
  9483. $problem = new Problem($this->pool);
  9484. $problem->addRule($rule);
  9485. $problem->addRule($conflict);
  9486. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_JOB) as $assertRule) {
  9487. if ($assertRule->isDisabled() || !$assertRule->isAssertion()) {
  9488. continue;
  9489. }
  9490. $assertRuleLiterals = $assertRule->getLiterals();
  9491. $assertRuleLiteral = $assertRuleLiterals[0];
  9492. if (abs($literal) !== abs($assertRuleLiteral)) {
  9493. continue;
  9494. }
  9495. $problem->addRule($assertRule);
  9496. $this->disableProblem($assertRule);
  9497. }
  9498. $this->problems[] = $problem;
  9499. $this->decisions->resetToOffset($decisionStart);
  9500. $ruleIndex = -1;
  9501. }
  9502. }
  9503. protected function setupInstalledMap()
  9504. {
  9505. $this->installedMap = array();
  9506. foreach ($this->installed->getPackages() as $package) {
  9507. $this->installedMap[$package->id] = $package;
  9508. }
  9509. }
  9510. protected function checkForRootRequireProblems($ignorePlatformReqs)
  9511. {
  9512. foreach ($this->jobs as $job) {
  9513. switch ($job['cmd']) {
  9514. case 'update':
  9515. $packages = $this->pool->whatProvides($job['packageName'], $job['constraint']);
  9516. foreach ($packages as $package) {
  9517. if (isset($this->installedMap[$package->id])) {
  9518. $this->updateMap[$package->id] = true;
  9519. }
  9520. }
  9521. break;
  9522. case 'update-all':
  9523. foreach ($this->installedMap as $package) {
  9524. $this->updateMap[$package->id] = true;
  9525. }
  9526. break;
  9527. case 'install':
  9528. if ($ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $job['packageName'])) {
  9529. break;
  9530. }
  9531. if (!$this->pool->whatProvides($job['packageName'], $job['constraint'])) {
  9532. $problem = new Problem($this->pool);
  9533. $problem->addRule(new GenericRule(array(), null, null, $job));
  9534. $this->problems[] = $problem;
  9535. }
  9536. break;
  9537. }
  9538. }
  9539. }
  9540. public function solve(Request $request, $ignorePlatformReqs = false)
  9541. {
  9542. $this->jobs = $request->getJobs();
  9543. $this->setupInstalledMap();
  9544. $this->rules = $this->ruleSetGenerator->getRulesFor($this->jobs, $this->installedMap, $ignorePlatformReqs);
  9545. $this->checkForRootRequireProblems($ignorePlatformReqs);
  9546. $this->decisions = new Decisions($this->pool);
  9547. $this->watchGraph = new RuleWatchGraph;
  9548. foreach ($this->rules as $rule) {
  9549. $this->watchGraph->insert(new RuleWatchNode($rule));
  9550. }
  9551. $this->makeAssertionRuleDecisions();
  9552. $this->io->writeError('Resolving dependencies through SAT', true, IOInterface::DEBUG);
  9553. $before = microtime(true);
  9554. $this->runSat(true);
  9555. $this->io->writeError('', true, IOInterface::DEBUG);
  9556. $this->io->writeError(sprintf('Dependency resolution completed in %.3f seconds', microtime(true) - $before), true, IOInterface::VERBOSE);
  9557. foreach ($this->installedMap as $packageId => $void) {
  9558. if ($this->decisions->undecided($packageId)) {
  9559. $this->decisions->decide(-$packageId, 1, null);
  9560. }
  9561. }
  9562. if ($this->problems) {
  9563. throw new SolverProblemsException($this->problems, $this->installedMap);
  9564. }
  9565. $transaction = new Transaction($this->policy, $this->pool, $this->installedMap, $this->decisions);
  9566. return $transaction->getOperations();
  9567. }
  9568. protected function propagate($level)
  9569. {
  9570. while ($this->decisions->validOffset($this->propagateIndex)) {
  9571. $decision = $this->decisions->atOffset($this->propagateIndex);
  9572. $conflict = $this->watchGraph->propagateLiteral(
  9573. $decision[Decisions::DECISION_LITERAL],
  9574. $level,
  9575. $this->decisions
  9576. );
  9577. $this->propagateIndex++;
  9578. if ($conflict) {
  9579. return $conflict;
  9580. }
  9581. }
  9582. return null;
  9583. }
  9584. private function revert($level)
  9585. {
  9586. while (!$this->decisions->isEmpty()) {
  9587. $literal = $this->decisions->lastLiteral();
  9588. if ($this->decisions->undecided($literal)) {
  9589. break;
  9590. }
  9591. $decisionLevel = $this->decisions->decisionLevel($literal);
  9592. if ($decisionLevel <= $level) {
  9593. break;
  9594. }
  9595. $this->decisions->revertLast();
  9596. $this->propagateIndex = count($this->decisions);
  9597. }
  9598. while (!empty($this->branches) && $this->branches[count($this->branches) - 1][self::BRANCH_LEVEL] >= $level) {
  9599. array_pop($this->branches);
  9600. }
  9601. }
  9602. private function setPropagateLearn($level, $literal, $disableRules, Rule $rule)
  9603. {
  9604. $level++;
  9605. $this->decisions->decide($literal, $level, $rule);
  9606. while (true) {
  9607. $rule = $this->propagate($level);
  9608. if (!$rule) {
  9609. break;
  9610. }
  9611. if ($level == 1) {
  9612. return $this->analyzeUnsolvable($rule, $disableRules);
  9613. }
  9614. list($learnLiteral, $newLevel, $newRule, $why) = $this->analyze($level, $rule);
  9615. if ($newLevel <= 0 || $newLevel >= $level) {
  9616. throw new SolverBugException(
  9617. "Trying to revert to invalid level ".(int) $newLevel." from level ".(int) $level."."
  9618. );
  9619. } elseif (!$newRule) {
  9620. throw new SolverBugException(
  9621. "No rule was learned from analyzing $rule at level $level."
  9622. );
  9623. }
  9624. $level = $newLevel;
  9625. $this->revert($level);
  9626. $this->rules->add($newRule, RuleSet::TYPE_LEARNED);
  9627. $this->learnedWhy[spl_object_hash($newRule)] = $why;
  9628. $ruleNode = new RuleWatchNode($newRule);
  9629. $ruleNode->watch2OnHighest($this->decisions);
  9630. $this->watchGraph->insert($ruleNode);
  9631. $this->decisions->decide($learnLiteral, $level, $newRule);
  9632. }
  9633. return $level;
  9634. }
  9635. private function selectAndInstall($level, array $decisionQueue, $disableRules, Rule $rule)
  9636. {
  9637. $literals = $this->policy->selectPreferredPackages($this->pool, $this->installedMap, $decisionQueue, $rule->getRequiredPackage());
  9638. $selectedLiteral = array_shift($literals);
  9639. if (count($literals)) {
  9640. $this->branches[] = array($literals, $level);
  9641. }
  9642. return $this->setPropagateLearn($level, $selectedLiteral, $disableRules, $rule);
  9643. }
  9644. protected function analyze($level, Rule $rule)
  9645. {
  9646. $analyzedRule = $rule;
  9647. $ruleLevel = 1;
  9648. $num = 0;
  9649. $l1num = 0;
  9650. $seen = array();
  9651. $learnedLiterals = array(null);
  9652. $decisionId = count($this->decisions);
  9653. $this->learnedPool[] = array();
  9654. while (true) {
  9655. $this->learnedPool[count($this->learnedPool) - 1][] = $rule;
  9656. foreach ($rule->getLiterals() as $literal) {
  9657. if ($this->decisions->satisfy($literal)) {
  9658. continue;
  9659. }
  9660. if (isset($seen[abs($literal)])) {
  9661. continue;
  9662. }
  9663. $seen[abs($literal)] = true;
  9664. $l = $this->decisions->decisionLevel($literal);
  9665. if (1 === $l) {
  9666. $l1num++;
  9667. } elseif ($level === $l) {
  9668. $num++;
  9669. } else {
  9670. $learnedLiterals[] = $literal;
  9671. if ($l > $ruleLevel) {
  9672. $ruleLevel = $l;
  9673. }
  9674. }
  9675. }
  9676. $l1retry = true;
  9677. while ($l1retry) {
  9678. $l1retry = false;
  9679. if (!$num && !--$l1num) {
  9680. break 2;
  9681. }
  9682. while (true) {
  9683. if ($decisionId <= 0) {
  9684. throw new SolverBugException(
  9685. "Reached invalid decision id $decisionId while looking through $rule for a literal present in the analyzed rule $analyzedRule."
  9686. );
  9687. }
  9688. $decisionId--;
  9689. $decision = $this->decisions->atOffset($decisionId);
  9690. $literal = $decision[Decisions::DECISION_LITERAL];
  9691. if (isset($seen[abs($literal)])) {
  9692. break;
  9693. }
  9694. }
  9695. unset($seen[abs($literal)]);
  9696. if ($num && 0 === --$num) {
  9697. if ($literal < 0) {
  9698. $this->testFlagLearnedPositiveLiteral = true;
  9699. }
  9700. $learnedLiterals[0] = -$literal;
  9701. if (!$l1num) {
  9702. break 2;
  9703. }
  9704. foreach ($learnedLiterals as $i => $learnedLiteral) {
  9705. if ($i !== 0) {
  9706. unset($seen[abs($learnedLiteral)]);
  9707. }
  9708. }
  9709. $l1num++;
  9710. $l1retry = true;
  9711. }
  9712. }
  9713. $decision = $this->decisions->atOffset($decisionId);
  9714. $rule = $decision[Decisions::DECISION_REASON];
  9715. }
  9716. $why = count($this->learnedPool) - 1;
  9717. if (!$learnedLiterals[0]) {
  9718. throw new SolverBugException(
  9719. "Did not find a learnable literal in analyzed rule $analyzedRule."
  9720. );
  9721. }
  9722. $newRule = new GenericRule($learnedLiterals, Rule::RULE_LEARNED, $why);
  9723. return array($learnedLiterals[0], $ruleLevel, $newRule, $why);
  9724. }
  9725. private function analyzeUnsolvableRule(Problem $problem, Rule $conflictRule)
  9726. {
  9727. if ($conflictRule->getType() == RuleSet::TYPE_LEARNED) {
  9728. $why = spl_object_hash($conflictRule);
  9729. $learnedWhy = $this->learnedWhy[$why];
  9730. $problemRules = $this->learnedPool[$learnedWhy];
  9731. foreach ($problemRules as $problemRule) {
  9732. $this->analyzeUnsolvableRule($problem, $problemRule);
  9733. }
  9734. return;
  9735. }
  9736. if ($conflictRule->getType() == RuleSet::TYPE_PACKAGE) {
  9737. return;
  9738. }
  9739. $problem->nextSection();
  9740. $problem->addRule($conflictRule);
  9741. }
  9742. private function analyzeUnsolvable(Rule $conflictRule, $disableRules)
  9743. {
  9744. $problem = new Problem($this->pool);
  9745. $problem->addRule($conflictRule);
  9746. $this->analyzeUnsolvableRule($problem, $conflictRule);
  9747. $this->problems[] = $problem;
  9748. $seen = array();
  9749. $literals = $conflictRule->getLiterals();
  9750. foreach ($literals as $literal) {
  9751. if ($this->decisions->satisfy($literal)) {
  9752. continue;
  9753. }
  9754. $seen[abs($literal)] = true;
  9755. }
  9756. foreach ($this->decisions as $decision) {
  9757. $literal = $decision[Decisions::DECISION_LITERAL];
  9758. if (!isset($seen[abs($literal)])) {
  9759. continue;
  9760. }
  9761. $why = $decision[Decisions::DECISION_REASON];
  9762. $problem->addRule($why);
  9763. $this->analyzeUnsolvableRule($problem, $why);
  9764. $literals = $why->getLiterals();
  9765. foreach ($literals as $literal) {
  9766. if ($this->decisions->satisfy($literal)) {
  9767. continue;
  9768. }
  9769. $seen[abs($literal)] = true;
  9770. }
  9771. }
  9772. if ($disableRules) {
  9773. foreach ($this->problems[count($this->problems) - 1] as $reason) {
  9774. $this->disableProblem($reason['rule']);
  9775. }
  9776. $this->resetSolver();
  9777. return 1;
  9778. }
  9779. return 0;
  9780. }
  9781. private function disableProblem(Rule $why)
  9782. {
  9783. $job = $why->getJob();
  9784. if (!$job) {
  9785. $why->disable();
  9786. return;
  9787. }
  9788. foreach ($this->rules as $rule) {
  9789. if ($job === $rule->getJob()) {
  9790. $rule->disable();
  9791. }
  9792. }
  9793. }
  9794. private function resetSolver()
  9795. {
  9796. $this->decisions->reset();
  9797. $this->propagateIndex = 0;
  9798. $this->branches = array();
  9799. $this->enableDisableLearnedRules();
  9800. $this->makeAssertionRuleDecisions();
  9801. }
  9802. private function enableDisableLearnedRules()
  9803. {
  9804. foreach ($this->rules->getIteratorFor(RuleSet::TYPE_LEARNED) as $rule) {
  9805. $why = $this->learnedWhy[spl_object_hash($rule)];
  9806. $problemRules = $this->learnedPool[$why];
  9807. $foundDisabled = false;
  9808. foreach ($problemRules as $problemRule) {
  9809. if ($problemRule->isDisabled()) {
  9810. $foundDisabled = true;
  9811. break;
  9812. }
  9813. }
  9814. if ($foundDisabled && $rule->isEnabled()) {
  9815. $rule->disable();
  9816. } elseif (!$foundDisabled && $rule->isDisabled()) {
  9817. $rule->enable();
  9818. }
  9819. }
  9820. }
  9821. private function runSat($disableRules = true)
  9822. {
  9823. $this->propagateIndex = 0;
  9824. $decisionQueue = array();
  9825. $decisionSupplementQueue = array();
  9826. $disableRules = array();
  9827. $level = 1;
  9828. $systemLevel = $level + 1;
  9829. $installedPos = 0;
  9830. while (true) {
  9831. if (1 === $level) {
  9832. $conflictRule = $this->propagate($level);
  9833. if (null !== $conflictRule) {
  9834. if ($this->analyzeUnsolvable($conflictRule, $disableRules)) {
  9835. continue;
  9836. }
  9837. return;
  9838. }
  9839. }
  9840. if ($level < $systemLevel) {
  9841. $iterator = $this->rules->getIteratorFor(RuleSet::TYPE_JOB);
  9842. foreach ($iterator as $rule) {
  9843. if ($rule->isEnabled()) {
  9844. $decisionQueue = array();
  9845. $noneSatisfied = true;
  9846. foreach ($rule->getLiterals() as $literal) {
  9847. if ($this->decisions->satisfy($literal)) {
  9848. $noneSatisfied = false;
  9849. break;
  9850. }
  9851. if ($literal > 0 && $this->decisions->undecided($literal)) {
  9852. $decisionQueue[] = $literal;
  9853. }
  9854. }
  9855. if ($noneSatisfied && count($decisionQueue)) {
  9856. if (count($this->installed) != count($this->updateMap)) {
  9857. $prunedQueue = array();
  9858. foreach ($decisionQueue as $literal) {
  9859. if (isset($this->installedMap[abs($literal)])) {
  9860. $prunedQueue[] = $literal;
  9861. if (isset($this->updateMap[abs($literal)])) {
  9862. $prunedQueue = $decisionQueue;
  9863. break;
  9864. }
  9865. }
  9866. }
  9867. $decisionQueue = $prunedQueue;
  9868. }
  9869. }
  9870. if ($noneSatisfied && count($decisionQueue)) {
  9871. $oLevel = $level;
  9872. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9873. if (0 === $level) {
  9874. return;
  9875. }
  9876. if ($level <= $oLevel) {
  9877. break;
  9878. }
  9879. }
  9880. }
  9881. }
  9882. $systemLevel = $level + 1;
  9883. $iterator->next();
  9884. if ($iterator->valid()) {
  9885. continue;
  9886. }
  9887. }
  9888. if ($level < $systemLevel) {
  9889. $systemLevel = $level;
  9890. }
  9891. $rulesCount = count($this->rules);
  9892. $pass = 1;
  9893. $this->io->writeError('Looking at all rules.', true, IOInterface::DEBUG);
  9894. for ($i = 0, $n = 0; $n < $rulesCount; $i++, $n++) {
  9895. if ($i == $rulesCount) {
  9896. if (1 === $pass) {
  9897. $this->io->writeError("Something's changed, looking at all rules again (pass #$pass)", false, IOInterface::DEBUG);
  9898. } else {
  9899. $this->io->overwriteError("Something's changed, looking at all rules again (pass #$pass)", false, null, IOInterface::DEBUG);
  9900. }
  9901. $i = 0;
  9902. $pass++;
  9903. }
  9904. $rule = $this->rules->ruleById[$i];
  9905. $literals = $rule->getLiterals();
  9906. if ($rule->isDisabled()) {
  9907. continue;
  9908. }
  9909. $decisionQueue = array();
  9910. foreach ($literals as $literal) {
  9911. if ($literal <= 0) {
  9912. if (!$this->decisions->decidedInstall($literal)) {
  9913. continue 2;
  9914. }
  9915. } else {
  9916. if ($this->decisions->decidedInstall($literal)) {
  9917. continue 2;
  9918. }
  9919. if ($this->decisions->undecided($literal)) {
  9920. $decisionQueue[] = $literal;
  9921. }
  9922. }
  9923. }
  9924. if (count($decisionQueue) < 2) {
  9925. continue;
  9926. }
  9927. $level = $this->selectAndInstall($level, $decisionQueue, $disableRules, $rule);
  9928. if (0 === $level) {
  9929. return;
  9930. }
  9931. $rulesCount = count($this->rules);
  9932. $n = -1;
  9933. }
  9934. if ($level < $systemLevel) {
  9935. continue;
  9936. }
  9937. if (count($this->branches)) {
  9938. $lastLiteral = null;
  9939. $lastLevel = null;
  9940. $lastBranchIndex = 0;
  9941. $lastBranchOffset = 0;
  9942. for ($i = count($this->branches) - 1; $i >= 0; $i--) {
  9943. list($literals, $l) = $this->branches[$i];
  9944. foreach ($literals as $offset => $literal) {
  9945. if ($literal && $literal > 0 && $this->decisions->decisionLevel($literal) > $l + 1) {
  9946. $lastLiteral = $literal;
  9947. $lastBranchIndex = $i;
  9948. $lastBranchOffset = $offset;
  9949. $lastLevel = $l;
  9950. }
  9951. }
  9952. }
  9953. if ($lastLiteral) {
  9954. unset($this->branches[$lastBranchIndex][self::BRANCH_LITERALS][$lastBranchOffset]);
  9955. $level = $lastLevel;
  9956. $this->revert($level);
  9957. $why = $this->decisions->lastReason();
  9958. $level = $this->setPropagateLearn($level, $lastLiteral, $disableRules, $why);
  9959. if ($level == 0) {
  9960. return;
  9961. }
  9962. continue;
  9963. }
  9964. }
  9965. break;
  9966. }
  9967. }
  9968. }
  9969. <?php
  9970. namespace Composer\DependencyResolver;
  9971. class SolverBugException extends \RuntimeException
  9972. {
  9973. public function __construct($message)
  9974. {
  9975. parent::__construct(
  9976. $message."\nThis exception was most likely caused by a bug in Composer.\n".
  9977. "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"
  9978. );
  9979. }
  9980. }
  9981. <?php
  9982. namespace Composer\DependencyResolver;
  9983. use Composer\Util\IniHelper;
  9984. class SolverProblemsException extends \RuntimeException
  9985. {
  9986. protected $problems;
  9987. protected $installedMap;
  9988. public function __construct(array $problems, array $installedMap)
  9989. {
  9990. $this->problems = $problems;
  9991. $this->installedMap = $installedMap;
  9992. parent::__construct($this->createMessage(), 2);
  9993. }
  9994. protected function createMessage()
  9995. {
  9996. $text = "\n";
  9997. $hasExtensionProblems = false;
  9998. foreach ($this->problems as $i => $problem) {
  9999. $text .= " Problem ".($i + 1).$problem->getPrettyString($this->installedMap)."\n";
  10000. if (!$hasExtensionProblems && $this->hasExtensionProblems($problem->getReasons())) {
  10001. $hasExtensionProblems = true;
  10002. }
  10003. }
  10004. if (strpos($text, 'could not be found') || strpos($text, 'no matching package found')) {
  10005. $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.";
  10006. }
  10007. if ($hasExtensionProblems) {
  10008. $text .= $this->createExtensionHint();
  10009. }
  10010. return $text;
  10011. }
  10012. public function getProblems()
  10013. {
  10014. return $this->problems;
  10015. }
  10016. private function createExtensionHint()
  10017. {
  10018. $paths = IniHelper::getAll();
  10019. if (count($paths) === 1 && empty($paths[0])) {
  10020. return '';
  10021. }
  10022. $text = "\n To enable extensions, verify that they are enabled in your .ini files:\n - ";
  10023. $text .= implode("\n - ", $paths);
  10024. $text .= "\n You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.";
  10025. return $text;
  10026. }
  10027. private function hasExtensionProblems(array $reasonSets)
  10028. {
  10029. foreach ($reasonSets as $reasonSet) {
  10030. foreach ($reasonSet as $reason) {
  10031. if (isset($reason["rule"]) && 0 === strpos($reason["rule"]->getRequiredPackage(), 'ext-')) {
  10032. return true;
  10033. }
  10034. }
  10035. }
  10036. return false;
  10037. }
  10038. }
  10039. <?php
  10040. namespace Composer\DependencyResolver;
  10041. use Composer\Package\AliasPackage;
  10042. class Transaction
  10043. {
  10044. protected $policy;
  10045. protected $pool;
  10046. protected $installedMap;
  10047. protected $decisions;
  10048. protected $transaction;
  10049. public function __construct($policy, $pool, $installedMap, $decisions)
  10050. {
  10051. $this->policy = $policy;
  10052. $this->pool = $pool;
  10053. $this->installedMap = $installedMap;
  10054. $this->decisions = $decisions;
  10055. $this->transaction = array();
  10056. }
  10057. public function getOperations()
  10058. {
  10059. $installMeansUpdateMap = $this->findUpdates();
  10060. $updateMap = array();
  10061. $installMap = array();
  10062. $uninstallMap = array();
  10063. foreach ($this->decisions as $i => $decision) {
  10064. $literal = $decision[Decisions::DECISION_LITERAL];
  10065. $reason = $decision[Decisions::DECISION_REASON];
  10066. $package = $this->pool->literalToPackage($literal);
  10067. if (($literal > 0) == isset($this->installedMap[$package->id])) {
  10068. continue;
  10069. }
  10070. if ($literal > 0) {
  10071. if (isset($installMeansUpdateMap[abs($literal)]) && !$package instanceof AliasPackage) {
  10072. $source = $installMeansUpdateMap[abs($literal)];
  10073. $updateMap[$package->id] = array(
  10074. 'package' => $package,
  10075. 'source' => $source,
  10076. 'reason' => $reason,
  10077. );
  10078. unset($installMeansUpdateMap[abs($literal)]);
  10079. $ignoreRemove[$source->id] = true;
  10080. } else {
  10081. $installMap[$package->id] = array(
  10082. 'package' => $package,
  10083. 'reason' => $reason,
  10084. );
  10085. }
  10086. }
  10087. }
  10088. foreach ($this->decisions as $i => $decision) {
  10089. $literal = $decision[Decisions::DECISION_LITERAL];
  10090. $reason = $decision[Decisions::DECISION_REASON];
  10091. $package = $this->pool->literalToPackage($literal);
  10092. if ($literal <= 0 &&
  10093. isset($this->installedMap[$package->id]) &&
  10094. !isset($ignoreRemove[$package->id])) {
  10095. $uninstallMap[$package->id] = array(
  10096. 'package' => $package,
  10097. 'reason' => $reason,
  10098. );
  10099. }
  10100. }
  10101. $this->transactionFromMaps($installMap, $updateMap, $uninstallMap);
  10102. return $this->transaction;
  10103. }
  10104. protected function transactionFromMaps($installMap, $updateMap, $uninstallMap)
  10105. {
  10106. $queue = array_map(
  10107. function ($operation) {
  10108. return $operation['package'];
  10109. },
  10110. $this->findRootPackages($installMap, $updateMap)
  10111. );
  10112. $visited = array();
  10113. while (!empty($queue)) {
  10114. $package = array_pop($queue);
  10115. $packageId = $package->id;
  10116. if (!isset($visited[$packageId])) {
  10117. $queue[] = $package;
  10118. if ($package instanceof AliasPackage) {
  10119. $queue[] = $package->getAliasOf();
  10120. } else {
  10121. foreach ($package->getRequires() as $link) {
  10122. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10123. foreach ($possibleRequires as $require) {
  10124. $queue[] = $require;
  10125. }
  10126. }
  10127. }
  10128. $visited[$package->id] = true;
  10129. } else {
  10130. if (isset($installMap[$packageId])) {
  10131. $this->install(
  10132. $installMap[$packageId]['package'],
  10133. $installMap[$packageId]['reason']
  10134. );
  10135. unset($installMap[$packageId]);
  10136. }
  10137. if (isset($updateMap[$packageId])) {
  10138. $this->update(
  10139. $updateMap[$packageId]['source'],
  10140. $updateMap[$packageId]['package'],
  10141. $updateMap[$packageId]['reason']
  10142. );
  10143. unset($updateMap[$packageId]);
  10144. }
  10145. }
  10146. }
  10147. foreach ($uninstallMap as $uninstall) {
  10148. $this->uninstall($uninstall['package'], $uninstall['reason']);
  10149. }
  10150. }
  10151. protected function findRootPackages($installMap, $updateMap)
  10152. {
  10153. $packages = $installMap + $updateMap;
  10154. $roots = $packages;
  10155. foreach ($packages as $packageId => $operation) {
  10156. $package = $operation['package'];
  10157. if (!isset($roots[$packageId])) {
  10158. continue;
  10159. }
  10160. foreach ($package->getRequires() as $link) {
  10161. $possibleRequires = $this->pool->whatProvides($link->getTarget(), $link->getConstraint());
  10162. foreach ($possibleRequires as $require) {
  10163. if ($require !== $package) {
  10164. unset($roots[$require->id]);
  10165. }
  10166. }
  10167. }
  10168. }
  10169. return $roots;
  10170. }
  10171. protected function findUpdates()
  10172. {
  10173. $installMeansUpdateMap = array();
  10174. foreach ($this->decisions as $i => $decision) {
  10175. $literal = $decision[Decisions::DECISION_LITERAL];
  10176. $package = $this->pool->literalToPackage($literal);
  10177. if ($package instanceof AliasPackage) {
  10178. continue;
  10179. }
  10180. if ($literal <= 0 && isset($this->installedMap[$package->id])) {
  10181. $updates = $this->policy->findUpdatePackages($this->pool, $this->installedMap, $package);
  10182. $literals = array($package->id);
  10183. foreach ($updates as $update) {
  10184. $literals[] = $update->id;
  10185. }
  10186. foreach ($literals as $updateLiteral) {
  10187. if ($updateLiteral !== $literal) {
  10188. $installMeansUpdateMap[abs($updateLiteral)] = $package;
  10189. }
  10190. }
  10191. }
  10192. }
  10193. return $installMeansUpdateMap;
  10194. }
  10195. protected function install($package, $reason)
  10196. {
  10197. if ($package instanceof AliasPackage) {
  10198. return $this->markAliasInstalled($package, $reason);
  10199. }
  10200. $this->transaction[] = new Operation\InstallOperation($package, $reason);
  10201. }
  10202. protected function update($from, $to, $reason)
  10203. {
  10204. $this->transaction[] = new Operation\UpdateOperation($from, $to, $reason);
  10205. }
  10206. protected function uninstall($package, $reason)
  10207. {
  10208. if ($package instanceof AliasPackage) {
  10209. return $this->markAliasUninstalled($package, $reason);
  10210. }
  10211. $this->transaction[] = new Operation\UninstallOperation($package, $reason);
  10212. }
  10213. protected function markAliasInstalled($package, $reason)
  10214. {
  10215. $this->transaction[] = new Operation\MarkAliasInstalledOperation($package, $reason);
  10216. }
  10217. protected function markAliasUninstalled($package, $reason)
  10218. {
  10219. $this->transaction[] = new Operation\MarkAliasUninstalledOperation($package, $reason);
  10220. }
  10221. }
  10222. <?php
  10223. namespace Composer\Downloader;
  10224. use Composer\Package\PackageInterface;
  10225. use Symfony\Component\Finder\Finder;
  10226. use Composer\IO\IOInterface;
  10227. abstract class ArchiveDownloader extends FileDownloader
  10228. {
  10229. public function download(PackageInterface $package, $path, $output = true)
  10230. {
  10231. $temporaryDir = $this->config->get('vendor-dir').'/composer/'.substr(md5(uniqid('', true)), 0, 8);
  10232. $retries = 3;
  10233. while ($retries--) {
  10234. $fileName = parent::download($package, $path, $output);
  10235. if ($output) {
  10236. $this->io->writeError(' Extracting archive', false, IOInterface::VERBOSE);
  10237. }
  10238. try {
  10239. $this->filesystem->ensureDirectoryExists($temporaryDir);
  10240. try {
  10241. $this->extract($fileName, $temporaryDir);
  10242. } catch (\Exception $e) {
  10243. parent::clearLastCacheWrite($package);
  10244. throw $e;
  10245. }
  10246. $this->filesystem->unlink($fileName);
  10247. $contentDir = $this->getFolderContent($temporaryDir);
  10248. if (1 === count($contentDir) && is_dir(reset($contentDir))) {
  10249. $contentDir = $this->getFolderContent((string) reset($contentDir));
  10250. }
  10251. foreach ($contentDir as $file) {
  10252. $file = (string) $file;
  10253. $this->filesystem->rename($file, $path . '/' . basename($file));
  10254. }
  10255. $this->filesystem->removeDirectory($temporaryDir);
  10256. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir').'/composer/')) {
  10257. $this->filesystem->removeDirectory($this->config->get('vendor-dir').'/composer/');
  10258. }
  10259. if ($this->filesystem->isDirEmpty($this->config->get('vendor-dir'))) {
  10260. $this->filesystem->removeDirectory($this->config->get('vendor-dir'));
  10261. }
  10262. } catch (\Exception $e) {
  10263. $this->filesystem->removeDirectory($path);
  10264. $this->filesystem->removeDirectory($temporaryDir);
  10265. if ($retries && $e instanceof \UnexpectedValueException && class_exists('ZipArchive') && $e->getCode() === \ZipArchive::ER_NOZIP) {
  10266. $this->io->writeError('');
  10267. if ($this->io->isDebug()) {
  10268. $this->io->writeError(' Invalid zip file ('.$e->getMessage().'), retrying...');
  10269. } else {
  10270. $this->io->writeError(' Invalid zip file, retrying...');
  10271. }
  10272. usleep(500000);
  10273. continue;
  10274. }
  10275. throw $e;
  10276. }
  10277. break;
  10278. }
  10279. }
  10280. protected function getFileName(PackageInterface $package, $path)
  10281. {
  10282. return rtrim($path.'/'.md5($path.spl_object_hash($package)).'.'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_EXTENSION), '.');
  10283. }
  10284. abstract protected function extract($file, $path);
  10285. private function getFolderContent($dir)
  10286. {
  10287. $finder = Finder::create()
  10288. ->ignoreVCS(false)
  10289. ->ignoreDotFiles(false)
  10290. ->notName('.DS_Store')
  10291. ->depth(0)
  10292. ->in($dir);
  10293. return iterator_to_array($finder);
  10294. }
  10295. }
  10296. <?php
  10297. namespace Composer\Downloader;
  10298. use Composer\Package\PackageInterface;
  10299. interface ChangeReportInterface
  10300. {
  10301. public function getLocalChanges(PackageInterface $package, $path);
  10302. }
  10303. <?php
  10304. namespace Composer\Downloader;
  10305. use Composer\Package\PackageInterface;
  10306. use Composer\IO\IOInterface;
  10307. use Composer\Util\Filesystem;
  10308. class DownloadManager
  10309. {
  10310. private $io;
  10311. private $preferDist = false;
  10312. private $preferSource = false;
  10313. private $packagePreferences = array();
  10314. private $filesystem;
  10315. private $downloaders = array();
  10316. public function __construct(IOInterface $io, $preferSource = false, Filesystem $filesystem = null)
  10317. {
  10318. $this->io = $io;
  10319. $this->preferSource = $preferSource;
  10320. $this->filesystem = $filesystem ?: new Filesystem();
  10321. }
  10322. public function setPreferSource($preferSource)
  10323. {
  10324. $this->preferSource = $preferSource;
  10325. return $this;
  10326. }
  10327. public function setPreferDist($preferDist)
  10328. {
  10329. $this->preferDist = $preferDist;
  10330. return $this;
  10331. }
  10332. public function setPreferences(array $preferences)
  10333. {
  10334. $this->packagePreferences = $preferences;
  10335. return $this;
  10336. }
  10337. public function setOutputProgress($outputProgress)
  10338. {
  10339. foreach ($this->downloaders as $downloader) {
  10340. $downloader->setOutputProgress($outputProgress);
  10341. }
  10342. return $this;
  10343. }
  10344. public function setDownloader($type, DownloaderInterface $downloader)
  10345. {
  10346. $type = strtolower($type);
  10347. $this->downloaders[$type] = $downloader;
  10348. return $this;
  10349. }
  10350. public function getDownloader($type)
  10351. {
  10352. $type = strtolower($type);
  10353. if (!isset($this->downloaders[$type])) {
  10354. throw new \InvalidArgumentException(sprintf('Unknown downloader type: %s. Available types: %s.', $type, implode(', ', array_keys($this->downloaders))));
  10355. }
  10356. return $this->downloaders[$type];
  10357. }
  10358. public function getDownloaderForInstalledPackage(PackageInterface $package)
  10359. {
  10360. $installationSource = $package->getInstallationSource();
  10361. if ('metapackage' === $package->getType()) {
  10362. return;
  10363. }
  10364. if ('dist' === $installationSource) {
  10365. $downloader = $this->getDownloader($package->getDistType());
  10366. } elseif ('source' === $installationSource) {
  10367. $downloader = $this->getDownloader($package->getSourceType());
  10368. } else {
  10369. throw new \InvalidArgumentException(
  10370. 'Package '.$package.' seems not been installed properly'
  10371. );
  10372. }
  10373. if ($installationSource !== $downloader->getInstallationSource()) {
  10374. throw new \LogicException(sprintf(
  10375. 'Downloader "%s" is a %s type downloader and can not be used to download %s for package %s',
  10376. get_class($downloader),
  10377. $downloader->getInstallationSource(),
  10378. $installationSource,
  10379. $package
  10380. ));
  10381. }
  10382. return $downloader;
  10383. }
  10384. public function download(PackageInterface $package, $targetDir, $preferSource = null)
  10385. {
  10386. $preferSource = null !== $preferSource ? $preferSource : $this->preferSource;
  10387. $sourceType = $package->getSourceType();
  10388. $distType = $package->getDistType();
  10389. $sources = array();
  10390. if ($sourceType) {
  10391. $sources[] = 'source';
  10392. }
  10393. if ($distType) {
  10394. $sources[] = 'dist';
  10395. }
  10396. if (empty($sources)) {
  10397. throw new \InvalidArgumentException('Package '.$package.' must have a source or dist specified');
  10398. }
  10399. if (!$preferSource && ($this->preferDist || 'dist' === $this->resolvePackageInstallPreference($package))) {
  10400. $sources = array_reverse($sources);
  10401. }
  10402. $this->filesystem->ensureDirectoryExists($targetDir);
  10403. foreach ($sources as $i => $source) {
  10404. if (isset($e)) {
  10405. $this->io->writeError(' <warning>Now trying to download from ' . $source . '</warning>');
  10406. }
  10407. $package->setInstallationSource($source);
  10408. try {
  10409. $downloader = $this->getDownloaderForInstalledPackage($package);
  10410. if ($downloader) {
  10411. $downloader->download($package, $targetDir);
  10412. }
  10413. break;
  10414. } catch (\RuntimeException $e) {
  10415. if ($i === count($sources) - 1) {
  10416. throw $e;
  10417. }
  10418. $this->io->writeError(
  10419. ' <warning>Failed to download '.
  10420. $package->getPrettyName().
  10421. ' from ' . $source . ': '.
  10422. $e->getMessage().'</warning>'
  10423. );
  10424. }
  10425. }
  10426. }
  10427. public function update(PackageInterface $initial, PackageInterface $target, $targetDir)
  10428. {
  10429. $downloader = $this->getDownloaderForInstalledPackage($initial);
  10430. if (!$downloader) {
  10431. return;
  10432. }
  10433. $installationSource = $initial->getInstallationSource();
  10434. if ('dist' === $installationSource) {
  10435. $initialType = $initial->getDistType();
  10436. $targetType = $target->getDistType();
  10437. } else {
  10438. $initialType = $initial->getSourceType();
  10439. $targetType = $target->getSourceType();
  10440. }
  10441. if ($target->isDev() && 'dist' === $installationSource) {
  10442. $downloader->remove($initial, $targetDir);
  10443. $this->download($target, $targetDir);
  10444. return;
  10445. }
  10446. if ($initialType === $targetType) {
  10447. $target->setInstallationSource($installationSource);
  10448. try {
  10449. $downloader->update($initial, $target, $targetDir);
  10450. return;
  10451. } catch (\RuntimeException $e) {
  10452. if (!$this->io->isInteractive()) {
  10453. throw $e;
  10454. }
  10455. $this->io->writeError('<error> Update failed ('.$e->getMessage().')</error>');
  10456. if (!$this->io->askConfirmation(' Would you like to try reinstalling the package instead [<comment>yes</comment>]? ', true)) {
  10457. throw $e;
  10458. }
  10459. }
  10460. }
  10461. $downloader->remove($initial, $targetDir);
  10462. $this->download($target, $targetDir, 'source' === $installationSource);
  10463. }
  10464. public function remove(PackageInterface $package, $targetDir)
  10465. {
  10466. $downloader = $this->getDownloaderForInstalledPackage($package);
  10467. if ($downloader) {
  10468. $downloader->remove($package, $targetDir);
  10469. }
  10470. }
  10471. protected function resolvePackageInstallPreference(PackageInterface $package)
  10472. {
  10473. foreach ($this->packagePreferences as $pattern => $preference) {
  10474. $pattern = '{^'.str_replace('\\*', '.*', preg_quote($pattern)).'$}i';
  10475. if (preg_match($pattern, $package->getName())) {
  10476. if ('dist' === $preference || (!$package->isDev() && 'auto' === $preference)) {
  10477. return 'dist';
  10478. }
  10479. return 'source';
  10480. }
  10481. }
  10482. return $package->isDev() ? 'source' : 'dist';
  10483. }
  10484. }
  10485. <?php
  10486. namespace Composer\Downloader;
  10487. use Composer\Package\PackageInterface;
  10488. interface DownloaderInterface
  10489. {
  10490. public function getInstallationSource();
  10491. public function download(PackageInterface $package, $path);
  10492. public function update(PackageInterface $initial, PackageInterface $target, $path);
  10493. public function remove(PackageInterface $package, $path);
  10494. public function setOutputProgress($outputProgress);
  10495. }
  10496. <?php
  10497. namespace Composer\Downloader;
  10498. use Composer\Package\PackageInterface;
  10499. interface DvcsDownloaderInterface
  10500. {
  10501. public function getUnpushedChanges(PackageInterface $package, $path);
  10502. }
  10503. <?php
  10504. namespace Composer\Downloader;
  10505. use Composer\Config;
  10506. use Composer\Cache;
  10507. use Composer\Factory;
  10508. use Composer\IO\IOInterface;
  10509. use Composer\IO\NullIO;
  10510. use Composer\Package\Comparer\Comparer;
  10511. use Composer\Package\PackageInterface;
  10512. use Composer\Package\Version\VersionParser;
  10513. use Composer\Plugin\PluginEvents;
  10514. use Composer\Plugin\PreFileDownloadEvent;
  10515. use Composer\EventDispatcher\EventDispatcher;
  10516. use Composer\Util\Filesystem;
  10517. use Composer\Util\RemoteFilesystem;
  10518. use Composer\Util\Url as UrlUtil;
  10519. class FileDownloader implements DownloaderInterface, ChangeReportInterface
  10520. {
  10521. protected $io;
  10522. protected $config;
  10523. protected $rfs;
  10524. protected $filesystem;
  10525. protected $cache;
  10526. protected $outputProgress = true;
  10527. private $lastCacheWrites = array();
  10528. private $eventDispatcher;
  10529. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, RemoteFilesystem $rfs = null, Filesystem $filesystem = null)
  10530. {
  10531. $this->io = $io;
  10532. $this->config = $config;
  10533. $this->eventDispatcher = $eventDispatcher;
  10534. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  10535. $this->filesystem = $filesystem ?: new Filesystem();
  10536. $this->cache = $cache;
  10537. if ($this->cache && $this->cache->gcIsNecessary()) {
  10538. $this->cache->gc($config->get('cache-files-ttl'), $config->get('cache-files-maxsize'));
  10539. }
  10540. }
  10541. public function getInstallationSource()
  10542. {
  10543. return 'dist';
  10544. }
  10545. public function download(PackageInterface $package, $path, $output = true)
  10546. {
  10547. if (!$package->getDistUrl()) {
  10548. throw new \InvalidArgumentException('The given package is missing url information');
  10549. }
  10550. if ($output) {
  10551. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  10552. }
  10553. $urls = $package->getDistUrls();
  10554. while ($url = array_shift($urls)) {
  10555. try {
  10556. $fileName = $this->doDownload($package, $path, $url);
  10557. break;
  10558. } catch (\Exception $e) {
  10559. if ($this->io->isDebug()) {
  10560. $this->io->writeError('');
  10561. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getCode().': '.$e->getMessage());
  10562. } elseif (count($urls)) {
  10563. $this->io->writeError('');
  10564. $this->io->writeError(' Failed, trying the next URL ('.$e->getCode().': '.$e->getMessage().')', false);
  10565. }
  10566. if (!count($urls)) {
  10567. throw $e;
  10568. }
  10569. }
  10570. }
  10571. if ($output) {
  10572. $this->io->writeError('');
  10573. }
  10574. return $fileName;
  10575. }
  10576. protected function doDownload(PackageInterface $package, $path, $url)
  10577. {
  10578. $this->filesystem->emptyDirectory($path);
  10579. $fileName = $this->getFileName($package, $path);
  10580. $processedUrl = $this->processUrl($package, $url);
  10581. $origin = RemoteFilesystem::getOrigin($processedUrl);
  10582. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $processedUrl);
  10583. if ($this->eventDispatcher) {
  10584. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  10585. }
  10586. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  10587. try {
  10588. $checksum = $package->getDistSha1Checksum();
  10589. $cacheKey = $this->getCacheKey($package, $processedUrl);
  10590. if ($this->cache && (!$checksum || $checksum === $this->cache->sha1($cacheKey)) && $this->cache->copyTo($cacheKey, $fileName)) {
  10591. $this->io->writeError('Loading from cache', false);
  10592. } else {
  10593. if (!$this->outputProgress) {
  10594. $this->io->writeError('Downloading', false);
  10595. }
  10596. $retries = 3;
  10597. while ($retries--) {
  10598. try {
  10599. $rfs->copy($origin, $processedUrl, $fileName, $this->outputProgress, $package->getTransportOptions());
  10600. break;
  10601. } catch (TransportException $e) {
  10602. if ((0 !== $e->getCode() && !in_array($e->getCode(), array(500, 502, 503, 504))) || !$retries) {
  10603. throw $e;
  10604. }
  10605. $this->io->writeError('');
  10606. $this->io->writeError(' Download failed, retrying...', true, IOInterface::VERBOSE);
  10607. usleep(500000);
  10608. }
  10609. }
  10610. if (!$this->outputProgress) {
  10611. $this->io->writeError(' (<comment>100%</comment>)', false);
  10612. }
  10613. if ($this->cache) {
  10614. $this->lastCacheWrites[$package->getName()] = $cacheKey;
  10615. $this->cache->copyFrom($cacheKey, $fileName);
  10616. }
  10617. }
  10618. if (!file_exists($fileName)) {
  10619. throw new \UnexpectedValueException($url.' could not be saved to '.$fileName.', make sure the'
  10620. .' directory is writable and you have internet connectivity');
  10621. }
  10622. if ($checksum && hash_file('sha1', $fileName) !== $checksum) {
  10623. throw new \UnexpectedValueException('The checksum verification of the file failed (downloaded from '.$url.')');
  10624. }
  10625. } catch (\Exception $e) {
  10626. $this->filesystem->removeDirectory($path);
  10627. $this->clearLastCacheWrite($package);
  10628. throw $e;
  10629. }
  10630. return $fileName;
  10631. }
  10632. public function setOutputProgress($outputProgress)
  10633. {
  10634. $this->outputProgress = $outputProgress;
  10635. return $this;
  10636. }
  10637. protected function clearLastCacheWrite(PackageInterface $package)
  10638. {
  10639. if ($this->cache && isset($this->lastCacheWrites[$package->getName()])) {
  10640. $this->cache->remove($this->lastCacheWrites[$package->getName()]);
  10641. unset($this->lastCacheWrites[$package->getName()]);
  10642. }
  10643. }
  10644. public function update(PackageInterface $initial, PackageInterface $target, $path)
  10645. {
  10646. $name = $target->getName();
  10647. $from = $initial->getFullPrettyVersion();
  10648. $to = $target->getFullPrettyVersion();
  10649. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  10650. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  10651. $this->remove($initial, $path, false);
  10652. $this->download($target, $path, false);
  10653. $this->io->writeError('');
  10654. }
  10655. public function remove(PackageInterface $package, $path, $output = true)
  10656. {
  10657. if ($output) {
  10658. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  10659. }
  10660. if (!$this->filesystem->removeDirectory($path)) {
  10661. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  10662. }
  10663. }
  10664. protected function getFileName(PackageInterface $package, $path)
  10665. {
  10666. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  10667. }
  10668. protected function processUrl(PackageInterface $package, $url)
  10669. {
  10670. if (!extension_loaded('openssl') && 0 === strpos($url, 'https:')) {
  10671. throw new \RuntimeException('You must enable the openssl extension to download files via https');
  10672. }
  10673. if ($package->getDistReference()) {
  10674. $url = UrlUtil::updateDistReference($this->config, $url, $package->getDistReference());
  10675. }
  10676. return $url;
  10677. }
  10678. private function getCacheKey(PackageInterface $package, $processedUrl)
  10679. {
  10680. $cacheKey = sha1($processedUrl);
  10681. return $package->getName().'/'.$cacheKey.'.'.$package->getDistType();
  10682. }
  10683. public function getLocalChanges(PackageInterface $package, $targetDir)
  10684. {
  10685. $prevIO = $this->io;
  10686. $prevProgress = $this->outputProgress;
  10687. $this->io = new NullIO;
  10688. $this->io->loadConfiguration($this->config);
  10689. $this->outputProgress = false;
  10690. $e = null;
  10691. try {
  10692. $this->download($package, $targetDir.'_compare', false);
  10693. $comparer = new Comparer();
  10694. $comparer->setSource($targetDir.'_compare');
  10695. $comparer->setUpdate($targetDir);
  10696. $comparer->doCompare();
  10697. $output = $comparer->getChanged(true, true);
  10698. $this->filesystem->removeDirectory($targetDir.'_compare');
  10699. } catch (\Exception $e) {
  10700. }
  10701. $this->io = $prevIO;
  10702. $this->outputProgress = $prevProgress;
  10703. if ($e) {
  10704. throw $e;
  10705. }
  10706. return trim($output);
  10707. }
  10708. }
  10709. <?php
  10710. namespace Composer\Downloader;
  10711. class FilesystemException extends \Exception
  10712. {
  10713. public function __construct($message = '', $code = 0, \Exception $previous = null)
  10714. {
  10715. parent::__construct("Filesystem exception: \n".$message, $code, $previous);
  10716. }
  10717. }
  10718. <?php
  10719. namespace Composer\Downloader;
  10720. use Composer\Package\PackageInterface;
  10721. use Composer\Util\ProcessExecutor;
  10722. class FossilDownloader extends VcsDownloader
  10723. {
  10724. public function doDownload(PackageInterface $package, $path, $url)
  10725. {
  10726. $this->config->prohibitUrlByConfig($url, $this->io);
  10727. $url = ProcessExecutor::escape($url);
  10728. $ref = ProcessExecutor::escape($package->getSourceReference());
  10729. $repoFile = $path . '.fossil';
  10730. $this->io->writeError("Cloning ".$package->getSourceReference());
  10731. $command = sprintf('fossil clone %s %s', $url, ProcessExecutor::escape($repoFile));
  10732. if (0 !== $this->process->execute($command, $ignoredOutput)) {
  10733. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10734. }
  10735. $command = sprintf('fossil open %s --nested', ProcessExecutor::escape($repoFile));
  10736. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10737. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10738. }
  10739. $command = sprintf('fossil update %s', $ref);
  10740. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10741. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10742. }
  10743. }
  10744. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10745. {
  10746. $this->config->prohibitUrlByConfig($url, $this->io);
  10747. $url = ProcessExecutor::escape($url);
  10748. $ref = ProcessExecutor::escape($target->getSourceReference());
  10749. $this->io->writeError(" Updating to ".$target->getSourceReference());
  10750. if (!$this->hasMetadataRepository($path)) {
  10751. throw new \RuntimeException('The .fslckout file is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10752. }
  10753. $command = sprintf('fossil pull && fossil up %s', $ref);
  10754. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  10755. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10756. }
  10757. }
  10758. public function getLocalChanges(PackageInterface $package, $path)
  10759. {
  10760. if (!$this->hasMetadataRepository($path)) {
  10761. return null;
  10762. }
  10763. $this->process->execute('fossil changes', $output, realpath($path));
  10764. return trim($output) ?: null;
  10765. }
  10766. protected function getCommitLogs($fromReference, $toReference, $path)
  10767. {
  10768. $command = sprintf('fossil timeline -t ci -W 0 -n 0 before %s', ProcessExecutor::escape($toReference));
  10769. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  10770. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10771. }
  10772. $log = '';
  10773. $match = '/\d\d:\d\d:\d\d\s+\[' . $toReference . '\]/';
  10774. foreach ($this->process->splitLines($output) as $line) {
  10775. if (preg_match($match, $line)) {
  10776. break;
  10777. }
  10778. $log .= $line;
  10779. }
  10780. return $log;
  10781. }
  10782. protected function hasMetadataRepository($path)
  10783. {
  10784. return is_file($path . '/.fslckout') || is_file($path . '/_FOSSIL_');
  10785. }
  10786. }
  10787. <?php
  10788. namespace Composer\Downloader;
  10789. use Composer\Config;
  10790. use Composer\IO\IOInterface;
  10791. use Composer\Package\PackageInterface;
  10792. use Composer\Util\Filesystem;
  10793. use Composer\Util\Git as GitUtil;
  10794. use Composer\Util\Platform;
  10795. use Composer\Util\ProcessExecutor;
  10796. use Composer\Cache;
  10797. class GitDownloader extends VcsDownloader implements DvcsDownloaderInterface
  10798. {
  10799. private $hasStashedChanges = false;
  10800. private $hasDiscardedChanges = false;
  10801. private $gitUtil;
  10802. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  10803. {
  10804. parent::__construct($io, $config, $process, $fs);
  10805. $this->gitUtil = new GitUtil($this->io, $this->config, $this->process, $this->filesystem);
  10806. }
  10807. public function doDownload(PackageInterface $package, $path, $url)
  10808. {
  10809. GitUtil::cleanEnv();
  10810. $path = $this->normalizePath($path);
  10811. $cachePath = $this->config->get('cache-vcs-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $url).'/';
  10812. $ref = $package->getSourceReference();
  10813. $flag = Platform::isWindows() ? '/D ' : '';
  10814. $gitVersion = $this->gitUtil->getVersion();
  10815. $msg = "Cloning ".$this->getShortHash($ref);
  10816. $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%';
  10817. if ($gitVersion && version_compare($gitVersion, '2.3.0-rc0', '>=') && Cache::isUsable($cachePath)) {
  10818. $this->io->writeError('', true, IOInterface::DEBUG);
  10819. $this->io->writeError(sprintf(' Cloning to cache at %s', ProcessExecutor::escape($cachePath)), true, IOInterface::DEBUG);
  10820. try {
  10821. if (!$this->gitUtil->fetchRefOrSyncMirror($url, $cachePath, $ref)) {
  10822. $this->io->writeError('<error>Failed to update '.$url.' in cache, package installation for '.$package->getPrettyName().' might fail.</error>');
  10823. }
  10824. if (is_dir($cachePath)) {
  10825. $command =
  10826. 'git clone --no-checkout %cachePath% %path% --dissociate --reference %cachePath% '
  10827. . '&& cd '.$flag.'%path% '
  10828. . '&& git remote set-url origin %sanitizedUrl% && git remote add composer %sanitizedUrl%';
  10829. $msg = "Cloning ".$this->getShortHash($ref).' from cache';
  10830. }
  10831. } catch (\RuntimeException $e) {
  10832. if (0 === strpos(get_class($e), 'PHPUnit')) {
  10833. throw $e;
  10834. }
  10835. }
  10836. }
  10837. $this->io->writeError($msg);
  10838. $commandCallable = function ($url) use ($path, $command, $cachePath) {
  10839. return str_replace(
  10840. array('%url%', '%path%', '%cachePath%', '%sanitizedUrl%'),
  10841. array(
  10842. ProcessExecutor::escape($url),
  10843. ProcessExecutor::escape($path),
  10844. ProcessExecutor::escape($cachePath),
  10845. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url)),
  10846. ),
  10847. $command
  10848. );
  10849. };
  10850. $this->gitUtil->runCommand($commandCallable, $url, $path, true);
  10851. if ($url !== $package->getSourceUrl()) {
  10852. $this->updateOriginUrl($path, $package->getSourceUrl());
  10853. } else {
  10854. $this->setPushUrl($path, $url);
  10855. }
  10856. if ($newRef = $this->updateToCommit($path, $ref, $package->getPrettyVersion(), $package->getReleaseDate())) {
  10857. if ($package->getDistReference() === $package->getSourceReference()) {
  10858. $package->setDistReference($newRef);
  10859. }
  10860. $package->setSourceReference($newRef);
  10861. }
  10862. }
  10863. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  10864. {
  10865. GitUtil::cleanEnv();
  10866. if (!$this->hasMetadataRepository($path)) {
  10867. throw new \RuntimeException('The .git directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  10868. }
  10869. $updateOriginUrl = false;
  10870. if (
  10871. 0 === $this->process->execute('git remote -v', $output, $path)
  10872. && preg_match('{^origin\s+(?P<url>\S+)}m', $output, $originMatch)
  10873. && preg_match('{^composer\s+(?P<url>\S+)}m', $output, $composerMatch)
  10874. ) {
  10875. if ($originMatch['url'] === $composerMatch['url'] && $composerMatch['url'] !== $target->getSourceUrl()) {
  10876. $updateOriginUrl = true;
  10877. }
  10878. }
  10879. $ref = $target->getSourceReference();
  10880. $this->io->writeError(" Checking out ".$this->getShortHash($ref));
  10881. $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';
  10882. $commandCallable = function ($url) use ($command, $ref) {
  10883. return sprintf(
  10884. $command,
  10885. ProcessExecutor::escape($url),
  10886. ProcessExecutor::escape($ref.'^{commit}'),
  10887. ProcessExecutor::escape(preg_replace('{://([^@]+?):(.+?)@}', '://', $url))
  10888. );
  10889. };
  10890. $this->gitUtil->runCommand($commandCallable, $url, $path);
  10891. if ($newRef = $this->updateToCommit($path, $ref, $target->getPrettyVersion(), $target->getReleaseDate())) {
  10892. if ($target->getDistReference() === $target->getSourceReference()) {
  10893. $target->setDistReference($newRef);
  10894. }
  10895. $target->setSourceReference($newRef);
  10896. }
  10897. if ($updateOriginUrl) {
  10898. $this->updateOriginUrl($path, $target->getSourceUrl());
  10899. }
  10900. }
  10901. public function getLocalChanges(PackageInterface $package, $path)
  10902. {
  10903. GitUtil::cleanEnv();
  10904. if (!$this->hasMetadataRepository($path)) {
  10905. return;
  10906. }
  10907. $command = 'git status --porcelain --untracked-files=no';
  10908. if (0 !== $this->process->execute($command, $output, $path)) {
  10909. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10910. }
  10911. return trim($output) ?: null;
  10912. }
  10913. public function getUnpushedChanges(PackageInterface $package, $path)
  10914. {
  10915. GitUtil::cleanEnv();
  10916. $path = $this->normalizePath($path);
  10917. if (!$this->hasMetadataRepository($path)) {
  10918. return;
  10919. }
  10920. $command = 'git show-ref --head -d';
  10921. if (0 !== $this->process->execute($command, $output, $path)) {
  10922. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10923. }
  10924. $refs = trim($output);
  10925. if (!preg_match('{^([a-f0-9]+) HEAD$}mi', $refs, $match)) {
  10926. return;
  10927. }
  10928. $headRef = $match[1];
  10929. if (!preg_match_all('{^'.$headRef.' refs/heads/(.+)$}mi', $refs, $matches)) {
  10930. return;
  10931. }
  10932. $branch = $matches[1][0];
  10933. $unpushedChanges = null;
  10934. for ($i = 0; $i <= 1; $i++) {
  10935. foreach ($matches[1] as $candidate) {
  10936. if (preg_match('{^[a-f0-9]+ refs/remotes/((?:composer|origin)/'.preg_quote($candidate).')$}mi', $refs, $match)) {
  10937. $branch = $candidate;
  10938. $remoteBranch = $match[1];
  10939. break;
  10940. }
  10941. }
  10942. if (!isset($remoteBranch)) {
  10943. $unpushedChanges = 'Branch ' . $branch . ' could not be found on the origin remote and appears to be unpushed';
  10944. } else {
  10945. $command = sprintf('git diff --name-status %s...%s --', $remoteBranch, $branch);
  10946. if (0 !== $this->process->execute($command, $output, $path)) {
  10947. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  10948. }
  10949. $unpushedChanges = trim($output) ?: null;
  10950. }
  10951. if ($unpushedChanges && $i === 0) {
  10952. $this->process->execute('git fetch composer && git fetch origin', $output, $path);
  10953. }
  10954. if (!$unpushedChanges) {
  10955. break;
  10956. }
  10957. }
  10958. return $unpushedChanges;
  10959. }
  10960. protected function cleanChanges(PackageInterface $package, $path, $update)
  10961. {
  10962. GitUtil::cleanEnv();
  10963. $path = $this->normalizePath($path);
  10964. $unpushed = $this->getUnpushedChanges($package, $path);
  10965. if ($unpushed && ($this->io->isInteractive() || $this->config->get('discard-changes') !== true)) {
  10966. throw new \RuntimeException('Source directory ' . $path . ' has unpushed changes on the current branch: '."\n".$unpushed);
  10967. }
  10968. if (!$changes = $this->getLocalChanges($package, $path)) {
  10969. return;
  10970. }
  10971. if (!$this->io->isInteractive()) {
  10972. $discardChanges = $this->config->get('discard-changes');
  10973. if (true === $discardChanges) {
  10974. return $this->discardChanges($path);
  10975. }
  10976. if ('stash' === $discardChanges) {
  10977. if (!$update) {
  10978. return parent::cleanChanges($package, $path, $update);
  10979. }
  10980. return $this->stashChanges($path);
  10981. }
  10982. return parent::cleanChanges($package, $path, $update);
  10983. }
  10984. $changes = array_map(function ($elem) {
  10985. return ' '.$elem;
  10986. }, preg_split('{\s*\r?\n\s*}', $changes));
  10987. $this->io->writeError(' <error>The package has modified files:</error>');
  10988. $this->io->writeError(array_slice($changes, 0, 10));
  10989. if (count($changes) > 10) {
  10990. $this->io->writeError(' <info>' . (count($changes) - 10) . ' more files modified, choose "v" to view the full list</info>');
  10991. }
  10992. while (true) {
  10993. switch ($this->io->ask(' <info>Discard changes [y,n,v,d,'.($update ? 's,' : '').'?]?</info> ', '?')) {
  10994. case 'y':
  10995. $this->discardChanges($path);
  10996. break 2;
  10997. case 's':
  10998. if (!$update) {
  10999. goto help;
  11000. }
  11001. $this->stashChanges($path);
  11002. break 2;
  11003. case 'n':
  11004. throw new \RuntimeException('Update aborted');
  11005. case 'v':
  11006. $this->io->writeError($changes);
  11007. break;
  11008. case 'd':
  11009. $this->viewDiff($path);
  11010. break;
  11011. case '?':
  11012. default:
  11013. help:
  11014. $this->io->writeError(array(
  11015. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11016. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11017. ' v - view modified files',
  11018. ' d - view local modifications (diff)',
  11019. ));
  11020. if ($update) {
  11021. $this->io->writeError(' s - stash changes and try to reapply them after the update');
  11022. }
  11023. $this->io->writeError(' ? - print help');
  11024. break;
  11025. }
  11026. }
  11027. }
  11028. protected function reapplyChanges($path)
  11029. {
  11030. $path = $this->normalizePath($path);
  11031. if ($this->hasStashedChanges) {
  11032. $this->hasStashedChanges = false;
  11033. $this->io->writeError(' <info>Re-applying stashed changes</info>');
  11034. if (0 !== $this->process->execute('git stash pop', $output, $path)) {
  11035. throw new \RuntimeException("Failed to apply stashed changes:\n\n".$this->process->getErrorOutput());
  11036. }
  11037. }
  11038. $this->hasDiscardedChanges = false;
  11039. }
  11040. protected function updateToCommit($path, $reference, $branch, $date)
  11041. {
  11042. $force = $this->hasDiscardedChanges || $this->hasStashedChanges ? '-f ' : '';
  11043. $template = 'git checkout '.$force.'%s -- && git reset --hard %1$s --';
  11044. $branch = preg_replace('{(?:^dev-|(?:\.x)?-dev$)}i', '', $branch);
  11045. $branches = null;
  11046. if (0 === $this->process->execute('git branch -r', $output, $path)) {
  11047. $branches = $output;
  11048. }
  11049. $gitRef = $reference;
  11050. if (!preg_match('{^[a-f0-9]{40}$}', $reference)
  11051. && $branches
  11052. && preg_match('{^\s+composer/'.preg_quote($reference).'$}m', $branches)
  11053. ) {
  11054. $command = sprintf('git checkout '.$force.'-B %s %s -- && git reset --hard %2$s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$reference));
  11055. if (0 === $this->process->execute($command, $output, $path)) {
  11056. return;
  11057. }
  11058. }
  11059. if (preg_match('{^[a-f0-9]{40}$}', $reference)) {
  11060. if (!preg_match('{^\s+composer/'.preg_quote($branch).'$}m', $branches) && preg_match('{^\s+composer/v'.preg_quote($branch).'$}m', $branches)) {
  11061. $branch = 'v' . $branch;
  11062. }
  11063. $command = sprintf('git checkout %s --', ProcessExecutor::escape($branch));
  11064. $fallbackCommand = sprintf('git checkout '.$force.'-B %s %s --', ProcessExecutor::escape($branch), ProcessExecutor::escape('composer/'.$branch));
  11065. if (0 === $this->process->execute($command, $output, $path)
  11066. || 0 === $this->process->execute($fallbackCommand, $output, $path)
  11067. ) {
  11068. $command = sprintf('git reset --hard %s --', ProcessExecutor::escape($reference));
  11069. if (0 === $this->process->execute($command, $output, $path)) {
  11070. return;
  11071. }
  11072. }
  11073. }
  11074. $command = sprintf($template, ProcessExecutor::escape($gitRef));
  11075. if (0 === $this->process->execute($command, $output, $path)) {
  11076. return;
  11077. }
  11078. if (false !== strpos($this->process->getErrorOutput(), $reference)) {
  11079. $this->io->writeError(' <warning>'.$reference.' is gone (history was rewritten?)</warning>');
  11080. }
  11081. throw new \RuntimeException(GitUtil::sanitizeUrl('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()));
  11082. }
  11083. protected function updateOriginUrl($path, $url)
  11084. {
  11085. $this->process->execute(sprintf('git remote set-url origin %s', ProcessExecutor::escape($url)), $output, $path);
  11086. $this->setPushUrl($path, $url);
  11087. }
  11088. protected function setPushUrl($path, $url)
  11089. {
  11090. if (preg_match('{^(?:https?|git)://'.GitUtil::getGitHubDomainsRegex($this->config).'/([^/]+)/([^/]+?)(?:\.git)?$}', $url, $match)) {
  11091. $protocols = $this->config->get('github-protocols');
  11092. $pushUrl = 'git@'.$match[1].':'.$match[2].'/'.$match[3].'.git';
  11093. if (!in_array('ssh', $protocols, true)) {
  11094. $pushUrl = 'https://' . $match[1] . '/'.$match[2].'/'.$match[3].'.git';
  11095. }
  11096. $cmd = sprintf('git remote set-url --push origin %s', ProcessExecutor::escape($pushUrl));
  11097. $this->process->execute($cmd, $ignoredOutput, $path);
  11098. }
  11099. }
  11100. protected function getCommitLogs($fromReference, $toReference, $path)
  11101. {
  11102. $path = $this->normalizePath($path);
  11103. $command = sprintf('git log %s..%s --pretty=format:"%%h - %%an: %%s"', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11104. if (0 !== $this->process->execute($command, $output, $path)) {
  11105. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11106. }
  11107. return $output;
  11108. }
  11109. protected function discardChanges($path)
  11110. {
  11111. $path = $this->normalizePath($path);
  11112. if (0 !== $this->process->execute('git reset --hard', $output, $path)) {
  11113. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11114. }
  11115. $this->hasDiscardedChanges = true;
  11116. }
  11117. protected function stashChanges($path)
  11118. {
  11119. $path = $this->normalizePath($path);
  11120. if (0 !== $this->process->execute('git stash --include-untracked', $output, $path)) {
  11121. throw new \RuntimeException("Could not stash changes\n\n:".$this->process->getErrorOutput());
  11122. }
  11123. $this->hasStashedChanges = true;
  11124. }
  11125. protected function viewDiff($path)
  11126. {
  11127. $path = $this->normalizePath($path);
  11128. if (0 !== $this->process->execute('git diff HEAD', $output, $path)) {
  11129. throw new \RuntimeException("Could not view diff\n\n:".$this->process->getErrorOutput());
  11130. }
  11131. $this->io->writeError($output);
  11132. }
  11133. protected function normalizePath($path)
  11134. {
  11135. if (Platform::isWindows() && strlen($path) > 0) {
  11136. $basePath = $path;
  11137. $removed = array();
  11138. while (!is_dir($basePath) && $basePath !== '\\') {
  11139. array_unshift($removed, basename($basePath));
  11140. $basePath = dirname($basePath);
  11141. }
  11142. if ($basePath === '\\') {
  11143. return $path;
  11144. }
  11145. $path = rtrim(realpath($basePath) . '/' . implode('/', $removed), '/');
  11146. }
  11147. return $path;
  11148. }
  11149. protected function hasMetadataRepository($path)
  11150. {
  11151. $path = $this->normalizePath($path);
  11152. return is_dir($path.'/.git');
  11153. }
  11154. protected function getShortHash($reference)
  11155. {
  11156. if (!$this->io->isVerbose() && preg_match('{^[0-9a-f]{40}$}', $reference)) {
  11157. return substr($reference, 0, 10);
  11158. }
  11159. return $reference;
  11160. }
  11161. }
  11162. <?php
  11163. namespace Composer\Downloader;
  11164. use Composer\Config;
  11165. use Composer\Cache;
  11166. use Composer\EventDispatcher\EventDispatcher;
  11167. use Composer\Package\PackageInterface;
  11168. use Composer\Util\Platform;
  11169. use Composer\Util\ProcessExecutor;
  11170. use Composer\Util\RemoteFilesystem;
  11171. use Composer\IO\IOInterface;
  11172. class GzipDownloader extends ArchiveDownloader
  11173. {
  11174. protected $process;
  11175. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11176. {
  11177. $this->process = $process ?: new ProcessExecutor($io);
  11178. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11179. }
  11180. protected function extract($file, $path)
  11181. {
  11182. $targetFilepath = $path . DIRECTORY_SEPARATOR . basename(substr($file, 0, -3));
  11183. if (!Platform::isWindows()) {
  11184. $command = 'gzip -cd ' . ProcessExecutor::escape($file) . ' > ' . ProcessExecutor::escape($targetFilepath);
  11185. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11186. return;
  11187. }
  11188. if (extension_loaded('zlib')) {
  11189. $this->extractUsingExt($file, $targetFilepath);
  11190. return;
  11191. }
  11192. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11193. throw new \RuntimeException($processError);
  11194. }
  11195. $this->extractUsingExt($file, $targetFilepath);
  11196. }
  11197. protected function getFileName(PackageInterface $package, $path)
  11198. {
  11199. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  11200. }
  11201. private function extractUsingExt($file, $targetFilepath)
  11202. {
  11203. $archiveFile = gzopen($file, 'rb');
  11204. $targetFile = fopen($targetFilepath, 'wb');
  11205. while ($string = gzread($archiveFile, 4096)) {
  11206. fwrite($targetFile, $string, Platform::strlen($string));
  11207. }
  11208. gzclose($archiveFile);
  11209. fclose($targetFile);
  11210. }
  11211. }
  11212. <?php
  11213. namespace Composer\Downloader;
  11214. use Composer\Package\PackageInterface;
  11215. use Composer\Util\ProcessExecutor;
  11216. use Composer\Util\Hg as HgUtils;
  11217. class HgDownloader extends VcsDownloader
  11218. {
  11219. public function doDownload(PackageInterface $package, $path, $url)
  11220. {
  11221. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11222. $cloneCommand = function ($url) use ($path) {
  11223. return sprintf('hg clone %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($path));
  11224. };
  11225. $hgUtils->runCommand($cloneCommand, $url, $path);
  11226. $ref = ProcessExecutor::escape($package->getSourceReference());
  11227. $command = sprintf('hg up %s', $ref);
  11228. if (0 !== $this->process->execute($command, $ignoredOutput, realpath($path))) {
  11229. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11230. }
  11231. }
  11232. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11233. {
  11234. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  11235. $ref = $target->getSourceReference();
  11236. $this->io->writeError(" Updating to ".$target->getSourceReference());
  11237. if (!$this->hasMetadataRepository($path)) {
  11238. throw new \RuntimeException('The .hg directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11239. }
  11240. $command = function ($url) use ($ref) {
  11241. return sprintf('hg pull %s && hg up %s', ProcessExecutor::escape($url), ProcessExecutor::escape($ref));
  11242. };
  11243. $hgUtils->runCommand($command, $url, $path);
  11244. }
  11245. public function getLocalChanges(PackageInterface $package, $path)
  11246. {
  11247. if (!is_dir($path.'/.hg')) {
  11248. return null;
  11249. }
  11250. $this->process->execute('hg st', $output, realpath($path));
  11251. return trim($output) ?: null;
  11252. }
  11253. protected function getCommitLogs($fromReference, $toReference, $path)
  11254. {
  11255. $command = sprintf('hg log -r %s:%s --style compact', ProcessExecutor::escape($fromReference), ProcessExecutor::escape($toReference));
  11256. if (0 !== $this->process->execute($command, $output, realpath($path))) {
  11257. throw new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  11258. }
  11259. return $output;
  11260. }
  11261. protected function hasMetadataRepository($path)
  11262. {
  11263. return is_dir($path . '/.hg');
  11264. }
  11265. }
  11266. <?php
  11267. namespace Composer\Downloader;
  11268. use Composer\Package\Archiver\ArchivableFilesFinder;
  11269. use Composer\Package\Dumper\ArrayDumper;
  11270. use Composer\Package\PackageInterface;
  11271. use Composer\Package\Version\VersionGuesser;
  11272. use Composer\Package\Version\VersionParser;
  11273. use Composer\Util\Platform;
  11274. use Composer\Util\ProcessExecutor;
  11275. use Composer\Util\Filesystem as ComposerFilesystem;
  11276. use Symfony\Component\Filesystem\Exception\IOException;
  11277. use Symfony\Component\Filesystem\Filesystem;
  11278. class PathDownloader extends FileDownloader implements VcsCapableDownloaderInterface
  11279. {
  11280. const STRATEGY_SYMLINK = 10;
  11281. const STRATEGY_MIRROR = 20;
  11282. public function download(PackageInterface $package, $path, $output = true)
  11283. {
  11284. $url = $package->getDistUrl();
  11285. $realUrl = realpath($url);
  11286. if (false === $realUrl || !file_exists($realUrl) || !is_dir($realUrl)) {
  11287. throw new \RuntimeException(sprintf(
  11288. 'Source path "%s" is not found for package %s',
  11289. $url,
  11290. $package->getName()
  11291. ));
  11292. }
  11293. if (realpath($path) === $realUrl) {
  11294. if ($output) {
  11295. $this->io->writeError(sprintf(
  11296. ' - Installing <info>%s</info> (<comment>%s</comment>): Source already present',
  11297. $package->getName(),
  11298. $package->getFullPrettyVersion()
  11299. ));
  11300. }
  11301. return;
  11302. }
  11303. if (strpos(realpath($path) . DIRECTORY_SEPARATOR, $realUrl . DIRECTORY_SEPARATOR) === 0) {
  11304. throw new \RuntimeException(sprintf(
  11305. 'Package %s cannot install to "%s" inside its source at "%s"',
  11306. $package->getName(),
  11307. realpath($path),
  11308. $realUrl
  11309. ));
  11310. }
  11311. $transportOptions = $package->getTransportOptions() + array('symlink' => null);
  11312. $currentStrategy = self::STRATEGY_SYMLINK;
  11313. $allowedStrategies = array(self::STRATEGY_SYMLINK, self::STRATEGY_MIRROR);
  11314. $mirrorPathRepos = getenv('COMPOSER_MIRROR_PATH_REPOS');
  11315. if ($mirrorPathRepos) {
  11316. $currentStrategy = self::STRATEGY_MIRROR;
  11317. }
  11318. if (true === $transportOptions['symlink']) {
  11319. $currentStrategy = self::STRATEGY_SYMLINK;
  11320. $allowedStrategies = array(self::STRATEGY_SYMLINK);
  11321. } elseif (false === $transportOptions['symlink']) {
  11322. $currentStrategy = self::STRATEGY_MIRROR;
  11323. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11324. }
  11325. if (Platform::isWindows() && self::STRATEGY_SYMLINK === $currentStrategy && !$this->safeJunctions()) {
  11326. $currentStrategy = self::STRATEGY_MIRROR;
  11327. $allowedStrategies = array(self::STRATEGY_MIRROR);
  11328. }
  11329. $fileSystem = new Filesystem();
  11330. $this->filesystem->removeDirectory($path);
  11331. if ($output) {
  11332. $this->io->writeError(sprintf(
  11333. ' - Installing <info>%s</info> (<comment>%s</comment>): ',
  11334. $package->getName(),
  11335. $package->getFullPrettyVersion()
  11336. ), false);
  11337. }
  11338. $isFallback = false;
  11339. if (self::STRATEGY_SYMLINK == $currentStrategy) {
  11340. try {
  11341. if (Platform::isWindows()) {
  11342. $this->io->writeError(sprintf('Junctioning from %s', $url), false);
  11343. $this->filesystem->junction($realUrl, $path);
  11344. } else {
  11345. $absolutePath = $path;
  11346. if (!$this->filesystem->isAbsolutePath($absolutePath)) {
  11347. $absolutePath = getcwd() . DIRECTORY_SEPARATOR . $path;
  11348. }
  11349. $shortestPath = $this->filesystem->findShortestPath($absolutePath, $realUrl);
  11350. $path = rtrim($path, "/");
  11351. $this->io->writeError(sprintf('Symlinking from %s', $url), false);
  11352. $fileSystem->symlink($shortestPath, $path);
  11353. }
  11354. } catch (IOException $e) {
  11355. if (in_array(self::STRATEGY_MIRROR, $allowedStrategies)) {
  11356. $this->io->writeError('');
  11357. $this->io->writeError(' <error>Symlink failed, fallback to use mirroring!</error>');
  11358. $currentStrategy = self::STRATEGY_MIRROR;
  11359. $isFallback = true;
  11360. } else {
  11361. throw new \RuntimeException(sprintf('Symlink from "%s" to "%s" failed!', $realUrl, $path));
  11362. }
  11363. }
  11364. }
  11365. if (self::STRATEGY_MIRROR == $currentStrategy) {
  11366. $fs = new ComposerFilesystem();
  11367. $realUrl = $fs->normalizePath($realUrl);
  11368. $this->io->writeError(sprintf('%sMirroring from %s', $isFallback ? ' ' : '', $url), false);
  11369. $iterator = new ArchivableFilesFinder($realUrl, array());
  11370. $fileSystem->mirror($realUrl, $path, $iterator);
  11371. }
  11372. $this->io->writeError('');
  11373. }
  11374. public function remove(PackageInterface $package, $path, $output = true)
  11375. {
  11376. $realUrl = realpath($package->getDistUrl());
  11377. if (realpath($path) === $realUrl) {
  11378. if ($output) {
  11379. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>), source is still present in $path");
  11380. }
  11381. return;
  11382. }
  11383. if (Platform::isWindows() && $this->filesystem->isJunction($path)) {
  11384. if ($output) {
  11385. $this->io->writeError(" - Removing junction for <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  11386. }
  11387. if (!$this->filesystem->removeJunction($path)) {
  11388. $this->io->writeError(" <warning>Could not remove junction at " . $path . " - is another process locking it?</warning>");
  11389. throw new \RuntimeException('Could not reliably remove junction for package ' . $package->getName());
  11390. }
  11391. } else {
  11392. parent::remove($package, $path, $output);
  11393. }
  11394. }
  11395. public function getVcsReference(PackageInterface $package, $path)
  11396. {
  11397. $parser = new VersionParser;
  11398. $guesser = new VersionGuesser($this->config, new ProcessExecutor($this->io), $parser);
  11399. $dumper = new ArrayDumper;
  11400. $packageConfig = $dumper->dump($package);
  11401. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  11402. return $packageVersion['commit'];
  11403. }
  11404. }
  11405. private function safeJunctions()
  11406. {
  11407. return function_exists('proc_open') &&
  11408. (PHP_WINDOWS_VERSION_MAJOR > 6 ||
  11409. (PHP_WINDOWS_VERSION_MAJOR === 6 && PHP_WINDOWS_VERSION_MINOR >= 1));
  11410. }
  11411. }
  11412. <?php
  11413. namespace Composer\Downloader;
  11414. use Composer\Util\Filesystem;
  11415. class PearPackageExtractor
  11416. {
  11417. private static $rolesWithoutPackageNamePrefix = array('php', 'script', 'www');
  11418. private $filesystem;
  11419. private $file;
  11420. public function __construct($file)
  11421. {
  11422. if (!is_file($file)) {
  11423. throw new \UnexpectedValueException('PEAR package file is not found at '.$file);
  11424. }
  11425. $this->filesystem = new Filesystem();
  11426. $this->file = $file;
  11427. }
  11428. public function extractTo($target, array $roles = array('php' => '/', 'script' => '/bin'), $vars = array())
  11429. {
  11430. $extractionPath = $target.'/tarball';
  11431. try {
  11432. $archive = new \PharData($this->file);
  11433. $archive->extractTo($extractionPath, null, true);
  11434. if (!is_file($this->combine($extractionPath, '/package.xml'))) {
  11435. throw new \RuntimeException('Invalid PEAR package. It must contain package.xml file.');
  11436. }
  11437. $fileCopyActions = $this->buildCopyActions($extractionPath, $roles, $vars);
  11438. $this->copyFiles($fileCopyActions, $extractionPath, $target, $roles, $vars);
  11439. $this->filesystem->removeDirectory($extractionPath);
  11440. } catch (\Exception $exception) {
  11441. throw new \UnexpectedValueException(sprintf('Failed to extract PEAR package %s to %s. Reason: %s', $this->file, $target, $exception->getMessage()), 0, $exception);
  11442. }
  11443. }
  11444. private function copyFiles($files, $source, $target, $roles, $vars)
  11445. {
  11446. foreach ($files as $file) {
  11447. $from = $this->combine($source, $file['from']);
  11448. $to = $this->combine($target, $roles[$file['role']]);
  11449. $to = $this->combine($to, $file['to']);
  11450. $tasks = $file['tasks'];
  11451. $this->copyFile($from, $to, $tasks, $vars);
  11452. }
  11453. }
  11454. private function copyFile($from, $to, $tasks, $vars)
  11455. {
  11456. if (!is_file($from)) {
  11457. throw new \RuntimeException('Invalid PEAR package. package.xml defines file that is not located inside tarball.');
  11458. }
  11459. $this->filesystem->ensureDirectoryExists(dirname($to));
  11460. if (0 == count($tasks)) {
  11461. $copied = copy($from, $to);
  11462. } else {
  11463. $content = file_get_contents($from);
  11464. $replacements = array();
  11465. foreach ($tasks as $task) {
  11466. $pattern = $task['from'];
  11467. $varName = $task['to'];
  11468. if (isset($vars[$varName])) {
  11469. if ($varName === 'php_bin' && false === strpos($to, '.bat')) {
  11470. $replacements[$pattern] = preg_replace('{\.bat$}', '', $vars[$varName]);
  11471. } else {
  11472. $replacements[$pattern] = $vars[$varName];
  11473. }
  11474. }
  11475. }
  11476. $content = strtr($content, $replacements);
  11477. $copied = file_put_contents($to, $content);
  11478. }
  11479. if (false === $copied) {
  11480. throw new \RuntimeException(sprintf('Failed to copy %s to %s', $from, $to));
  11481. }
  11482. }
  11483. private function buildCopyActions($source, array $roles, $vars)
  11484. {
  11485. $package = simplexml_load_string(file_get_contents($this->combine($source, 'package.xml')));
  11486. if (false === $package) {
  11487. throw new \RuntimeException('Package definition file is not valid.');
  11488. }
  11489. $packageSchemaVersion = $package['version'];
  11490. if ('1.0' == $packageSchemaVersion) {
  11491. $children = $package->release->filelist->children();
  11492. $packageName = (string) $package->name;
  11493. $packageVersion = (string) $package->release->version;
  11494. $sourceDir = $packageName . '-' . $packageVersion;
  11495. $result = $this->buildSourceList10($children, $roles, $sourceDir, '', null, $packageName);
  11496. } elseif ('2.0' == $packageSchemaVersion || '2.1' == $packageSchemaVersion) {
  11497. $children = $package->contents->children();
  11498. $packageName = (string) $package->name;
  11499. $packageVersion = (string) $package->version->release;
  11500. $sourceDir = $packageName . '-' . $packageVersion;
  11501. $result = $this->buildSourceList20($children, $roles, $sourceDir, '', null, $packageName);
  11502. $namespaces = $package->getNamespaces();
  11503. $package->registerXPathNamespace('ns', $namespaces['']);
  11504. $releaseNodes = $package->xpath('ns:phprelease');
  11505. $this->applyRelease($result, $releaseNodes, $vars);
  11506. } else {
  11507. throw new \RuntimeException('Unsupported schema version of package definition file.');
  11508. }
  11509. return $result;
  11510. }
  11511. private function applyRelease(&$actions, $releaseNodes, $vars)
  11512. {
  11513. foreach ($releaseNodes as $releaseNode) {
  11514. $requiredOs = $releaseNode->installconditions && $releaseNode->installconditions->os && $releaseNode->installconditions->os->name ? (string) $releaseNode->installconditions->os->name : '';
  11515. if ($requiredOs && $vars['os'] != $requiredOs) {
  11516. continue;
  11517. }
  11518. if ($releaseNode->filelist) {
  11519. foreach ($releaseNode->filelist->children() as $action) {
  11520. if ('install' == $action->getName()) {
  11521. $name = (string) $action['name'];
  11522. $as = (string) $action['as'];
  11523. if (isset($actions[$name])) {
  11524. $actions[$name]['to'] = $as;
  11525. }
  11526. } elseif ('ignore' == $action->getName()) {
  11527. $name = (string) $action['name'];
  11528. unset($actions[$name]);
  11529. } else {
  11530. }
  11531. }
  11532. }
  11533. break;
  11534. }
  11535. }
  11536. private function buildSourceList10($children, $targetRoles, $source, $target, $role, $packageName)
  11537. {
  11538. $result = array();
  11539. foreach ($children as $child) {
  11540. if ($child->getName() == 'dir') {
  11541. $dirSource = $this->combine($source, (string) $child['name']);
  11542. $dirTarget = $child['baseinstalldir'] ?: $target;
  11543. $dirRole = $child['role'] ?: $role;
  11544. $dirFiles = $this->buildSourceList10($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11545. $result = array_merge($result, $dirFiles);
  11546. } elseif ($child->getName() == 'file') {
  11547. $fileRole = (string) $child['role'] ?: $role;
  11548. if (isset($targetRoles[$fileRole])) {
  11549. $fileName = (string) ($child['name'] ?: $child[0]);
  11550. $fileSource = $this->combine($source, $fileName);
  11551. $fileTarget = $this->combine((string) $child['baseinstalldir'] ?: $target, $fileName);
  11552. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11553. $fileTarget = $packageName . '/' . $fileTarget;
  11554. }
  11555. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => array());
  11556. }
  11557. }
  11558. }
  11559. return $result;
  11560. }
  11561. private function buildSourceList20($children, $targetRoles, $source, $target, $role, $packageName)
  11562. {
  11563. $result = array();
  11564. foreach ($children as $child) {
  11565. if ('dir' == $child->getName()) {
  11566. $dirSource = $this->combine($source, $child['name']);
  11567. $dirTarget = $child['baseinstalldir'] ?: $target;
  11568. $dirRole = $child['role'] ?: $role;
  11569. $dirFiles = $this->buildSourceList20($child->children(), $targetRoles, $dirSource, $dirTarget, $dirRole, $packageName);
  11570. $result = array_merge($result, $dirFiles);
  11571. } elseif ('file' == $child->getName()) {
  11572. $fileRole = (string) $child['role'] ?: $role;
  11573. if (isset($targetRoles[$fileRole])) {
  11574. $fileSource = $this->combine($source, (string) $child['name']);
  11575. $fileTarget = $this->combine((string) ($child['baseinstalldir'] ?: $target), (string) $child['name']);
  11576. $fileTasks = array();
  11577. foreach ($child->children('http://pear.php.net/dtd/tasks-1.0') as $taskNode) {
  11578. if ('replace' == $taskNode->getName()) {
  11579. $fileTasks[] = array('from' => (string) $taskNode->attributes()->from, 'to' => (string) $taskNode->attributes()->to);
  11580. }
  11581. }
  11582. if (!in_array($fileRole, self::$rolesWithoutPackageNamePrefix)) {
  11583. $fileTarget = $packageName . '/' . $fileTarget;
  11584. }
  11585. $result[(string) $child['name']] = array('from' => $fileSource, 'to' => $fileTarget, 'role' => $fileRole, 'tasks' => $fileTasks);
  11586. }
  11587. }
  11588. }
  11589. return $result;
  11590. }
  11591. private function combine($left, $right)
  11592. {
  11593. return rtrim($left, '/') . '/' . ltrim($right, '/');
  11594. }
  11595. }
  11596. <?php
  11597. namespace Composer\Downloader;
  11598. use Composer\Package\PackageInterface;
  11599. use Composer\Repository\VcsRepository;
  11600. use Composer\Util\Perforce;
  11601. class PerforceDownloader extends VcsDownloader
  11602. {
  11603. protected $perforce;
  11604. public function doDownload(PackageInterface $package, $path, $url)
  11605. {
  11606. $ref = $package->getSourceReference();
  11607. $label = $this->getLabelFromSourceReference($ref);
  11608. $this->io->writeError('Cloning ' . $ref);
  11609. $this->initPerforce($package, $path, $url);
  11610. $this->perforce->setStream($ref);
  11611. $this->perforce->p4Login();
  11612. $this->perforce->writeP4ClientSpec();
  11613. $this->perforce->connectClient();
  11614. $this->perforce->syncCodeBase($label);
  11615. $this->perforce->cleanupClientSpec();
  11616. }
  11617. private function getLabelFromSourceReference($ref)
  11618. {
  11619. $pos = strpos($ref, '@');
  11620. if (false !== $pos) {
  11621. return substr($ref, $pos + 1);
  11622. }
  11623. return null;
  11624. }
  11625. public function initPerforce(PackageInterface $package, $path, $url)
  11626. {
  11627. if (!empty($this->perforce)) {
  11628. $this->perforce->initializePath($path);
  11629. return;
  11630. }
  11631. $repository = $package->getRepository();
  11632. $repoConfig = null;
  11633. if ($repository instanceof VcsRepository) {
  11634. $repoConfig = $this->getRepoConfig($repository);
  11635. }
  11636. $this->perforce = Perforce::create($repoConfig, $url, $path, $this->process, $this->io);
  11637. }
  11638. private function getRepoConfig(VcsRepository $repository)
  11639. {
  11640. return $repository->getRepoConfig();
  11641. }
  11642. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11643. {
  11644. $this->doDownload($target, $path, $url);
  11645. }
  11646. public function getLocalChanges(PackageInterface $package, $path)
  11647. {
  11648. $this->io->writeError('Perforce driver does not check for local changes before overriding', true);
  11649. }
  11650. protected function getCommitLogs($fromReference, $toReference, $path)
  11651. {
  11652. return $this->perforce->getCommitLogs($fromReference, $toReference);
  11653. }
  11654. public function setPerforce($perforce)
  11655. {
  11656. $this->perforce = $perforce;
  11657. }
  11658. protected function hasMetadataRepository($path)
  11659. {
  11660. return true;
  11661. }
  11662. }
  11663. <?php
  11664. namespace Composer\Downloader;
  11665. class PharDownloader extends ArchiveDownloader
  11666. {
  11667. protected function extract($file, $path)
  11668. {
  11669. $archive = new \Phar($file);
  11670. $archive->extractTo($path, null, true);
  11671. }
  11672. }
  11673. <?php
  11674. namespace Composer\Downloader;
  11675. use Composer\Config;
  11676. use Composer\Cache;
  11677. use Composer\EventDispatcher\EventDispatcher;
  11678. use Composer\Util\IniHelper;
  11679. use Composer\Util\Platform;
  11680. use Composer\Util\ProcessExecutor;
  11681. use Composer\Util\RemoteFilesystem;
  11682. use Composer\IO\IOInterface;
  11683. use RarArchive;
  11684. class RarDownloader extends ArchiveDownloader
  11685. {
  11686. protected $process;
  11687. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  11688. {
  11689. $this->process = $process ?: new ProcessExecutor($io);
  11690. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  11691. }
  11692. protected function extract($file, $path)
  11693. {
  11694. $processError = null;
  11695. if (!Platform::isWindows()) {
  11696. $command = 'unrar x ' . ProcessExecutor::escape($file) . ' ' . ProcessExecutor::escape($path) . ' >/dev/null && chmod -R u+w ' . ProcessExecutor::escape($path);
  11697. if (0 === $this->process->execute($command, $ignoredOutput)) {
  11698. return;
  11699. }
  11700. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  11701. }
  11702. if (!class_exists('RarArchive')) {
  11703. $iniMessage = IniHelper::getMessage();
  11704. $error = "Could not decompress the archive, enable the PHP rar extension or install unrar.\n"
  11705. . $iniMessage . "\n" . $processError;
  11706. if (!Platform::isWindows()) {
  11707. $error = "Could not decompress the archive, enable the PHP rar extension.\n" . $iniMessage;
  11708. }
  11709. throw new \RuntimeException($error);
  11710. }
  11711. $rarArchive = RarArchive::open($file);
  11712. if (false === $rarArchive) {
  11713. throw new \UnexpectedValueException('Could not open RAR archive: ' . $file);
  11714. }
  11715. $entries = $rarArchive->getEntries();
  11716. if (false === $entries) {
  11717. throw new \RuntimeException('Could not retrieve RAR archive entries');
  11718. }
  11719. foreach ($entries as $entry) {
  11720. if (false === $entry->extract($path)) {
  11721. throw new \RuntimeException('Could not extract entry');
  11722. }
  11723. }
  11724. $rarArchive->close();
  11725. }
  11726. }
  11727. <?php
  11728. namespace Composer\Downloader;
  11729. use Composer\Package\PackageInterface;
  11730. use Composer\Util\Svn as SvnUtil;
  11731. use Composer\Repository\VcsRepository;
  11732. use Composer\Util\ProcessExecutor;
  11733. class SvnDownloader extends VcsDownloader
  11734. {
  11735. protected $cacheCredentials = true;
  11736. public function doDownload(PackageInterface $package, $path, $url)
  11737. {
  11738. SvnUtil::cleanEnv();
  11739. $ref = $package->getSourceReference();
  11740. $repo = $package->getRepository();
  11741. if ($repo instanceof VcsRepository) {
  11742. $repoConfig = $repo->getRepoConfig();
  11743. if (array_key_exists('svn-cache-credentials', $repoConfig)) {
  11744. $this->cacheCredentials = (bool) $repoConfig['svn-cache-credentials'];
  11745. }
  11746. }
  11747. $this->io->writeError(" Checking out ".$package->getSourceReference());
  11748. $this->execute($url, "svn co", sprintf("%s/%s", $url, $ref), null, $path);
  11749. }
  11750. public function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url)
  11751. {
  11752. SvnUtil::cleanEnv();
  11753. $ref = $target->getSourceReference();
  11754. if (!$this->hasMetadataRepository($path)) {
  11755. throw new \RuntimeException('The .svn directory is missing from '.$path.', see https://getcomposer.org/commit-deps for more information');
  11756. }
  11757. $util = new SvnUtil($url, $this->io, $this->config);
  11758. $flags = "";
  11759. if (version_compare($util->binaryVersion(), '1.7.0', '>=')) {
  11760. $flags .= ' --ignore-ancestry';
  11761. }
  11762. $this->io->writeError(" Checking out " . $ref);
  11763. $this->execute($url, "svn switch" . $flags, sprintf("%s/%s", $url, $ref), $path);
  11764. }
  11765. public function getLocalChanges(PackageInterface $package, $path)
  11766. {
  11767. if (!$this->hasMetadataRepository($path)) {
  11768. return null;
  11769. }
  11770. $this->process->execute('svn status --ignore-externals', $output, $path);
  11771. return preg_match('{^ *[^X ] +}m', $output) ? $output : null;
  11772. }
  11773. protected function execute($baseUrl, $command, $url, $cwd = null, $path = null)
  11774. {
  11775. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11776. $util->setCacheCredentials($this->cacheCredentials);
  11777. try {
  11778. return $util->execute($command, $url, $cwd, $path, $this->io->isVerbose());
  11779. } catch (\RuntimeException $e) {
  11780. throw new \RuntimeException(
  11781. 'Package could not be downloaded, '.$e->getMessage()
  11782. );
  11783. }
  11784. }
  11785. protected function cleanChanges(PackageInterface $package, $path, $update)
  11786. {
  11787. if (!$changes = $this->getLocalChanges($package, $path)) {
  11788. return;
  11789. }
  11790. if (!$this->io->isInteractive()) {
  11791. if (true === $this->config->get('discard-changes')) {
  11792. return $this->discardChanges($path);
  11793. }
  11794. return parent::cleanChanges($package, $path, $update);
  11795. }
  11796. $changes = array_map(function ($elem) {
  11797. return ' '.$elem;
  11798. }, preg_split('{\s*\r?\n\s*}', $changes));
  11799. $countChanges = count($changes);
  11800. $this->io->writeError(sprintf(' <error>The package has modified file%s:</error>', $countChanges === 1 ? '' : 's'));
  11801. $this->io->writeError(array_slice($changes, 0, 10));
  11802. if ($countChanges > 10) {
  11803. $remaingChanges = $countChanges - 10;
  11804. $this->io->writeError(
  11805. sprintf(
  11806. ' <info>'.$remaingChanges.' more file%s modified, choose "v" to view the full list</info>',
  11807. $remaingChanges === 1 ? '' : 's'
  11808. )
  11809. );
  11810. }
  11811. while (true) {
  11812. switch ($this->io->ask(' <info>Discard changes [y,n,v,?]?</info> ', '?')) {
  11813. case 'y':
  11814. $this->discardChanges($path);
  11815. break 2;
  11816. case 'n':
  11817. throw new \RuntimeException('Update aborted');
  11818. case 'v':
  11819. $this->io->writeError($changes);
  11820. break;
  11821. case '?':
  11822. default:
  11823. $this->io->writeError(array(
  11824. ' y - discard changes and apply the '.($update ? 'update' : 'uninstall'),
  11825. ' n - abort the '.($update ? 'update' : 'uninstall').' and let you manually clean things up',
  11826. ' v - view modified files',
  11827. ' ? - print help',
  11828. ));
  11829. break;
  11830. }
  11831. }
  11832. }
  11833. protected function getCommitLogs($fromReference, $toReference, $path)
  11834. {
  11835. if (preg_match('{.*@(\d+)$}', $fromReference) && preg_match('{.*@(\d+)$}', $toReference)) {
  11836. $command = sprintf('svn info --non-interactive --xml %s', ProcessExecutor::escape($path));
  11837. if (0 !== $this->process->execute($command, $output, $path)) {
  11838. throw new \RuntimeException(
  11839. 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput()
  11840. );
  11841. }
  11842. $urlPattern = '#<url>(.*)</url>#';
  11843. if (preg_match($urlPattern, $output, $matches)) {
  11844. $baseUrl = $matches[1];
  11845. } else {
  11846. throw new \RuntimeException(
  11847. 'Unable to determine svn url for path '. $path
  11848. );
  11849. }
  11850. $fromRevision = preg_replace('{.*@(\d+)$}', '$1', $fromReference);
  11851. $toRevision = preg_replace('{.*@(\d+)$}', '$1', $toReference);
  11852. $command = sprintf('svn log -r%s:%s --incremental', ProcessExecutor::escape($fromRevision), ProcessExecutor::escape($toRevision));
  11853. $util = new SvnUtil($baseUrl, $this->io, $this->config);
  11854. $util->setCacheCredentials($this->cacheCredentials);
  11855. try {
  11856. return $util->executeLocal($command, $path, null, $this->io->isVerbose());
  11857. } catch (\RuntimeException $e) {
  11858. throw new \RuntimeException(
  11859. 'Failed to execute ' . $command . "\n\n".$e->getMessage()
  11860. );
  11861. }
  11862. }
  11863. return "Could not retrieve changes between $fromReference and $toReference due to missing revision information";
  11864. }
  11865. protected function discardChanges($path)
  11866. {
  11867. if (0 !== $this->process->execute('svn revert -R .', $output, $path)) {
  11868. throw new \RuntimeException("Could not reset changes\n\n:".$this->process->getErrorOutput());
  11869. }
  11870. }
  11871. protected function hasMetadataRepository($path)
  11872. {
  11873. return is_dir($path.'/.svn');
  11874. }
  11875. }
  11876. <?php
  11877. namespace Composer\Downloader;
  11878. class TarDownloader extends ArchiveDownloader
  11879. {
  11880. protected function extract($file, $path)
  11881. {
  11882. $archive = new \PharData($file);
  11883. $archive->extractTo($path, null, true);
  11884. }
  11885. }
  11886. <?php
  11887. namespace Composer\Downloader;
  11888. class TransportException extends \RuntimeException
  11889. {
  11890. protected $headers;
  11891. protected $response;
  11892. protected $statusCode;
  11893. public function setHeaders($headers)
  11894. {
  11895. $this->headers = $headers;
  11896. }
  11897. public function getHeaders()
  11898. {
  11899. return $this->headers;
  11900. }
  11901. public function setResponse($response)
  11902. {
  11903. $this->response = $response;
  11904. }
  11905. public function getResponse()
  11906. {
  11907. return $this->response;
  11908. }
  11909. public function setStatusCode($statusCode)
  11910. {
  11911. $this->statusCode = $statusCode;
  11912. }
  11913. public function getStatusCode()
  11914. {
  11915. return $this->statusCode;
  11916. }
  11917. }
  11918. <?php
  11919. namespace Composer\Downloader;
  11920. use Composer\Package\PackageInterface;
  11921. interface VcsCapableDownloaderInterface
  11922. {
  11923. public function getVcsReference(PackageInterface $package, $path);
  11924. }
  11925. <?php
  11926. namespace Composer\Downloader;
  11927. use Composer\Config;
  11928. use Composer\Package\Dumper\ArrayDumper;
  11929. use Composer\Package\PackageInterface;
  11930. use Composer\Package\Version\VersionGuesser;
  11931. use Composer\Package\Version\VersionParser;
  11932. use Composer\Util\ProcessExecutor;
  11933. use Composer\IO\IOInterface;
  11934. use Composer\Util\Filesystem;
  11935. abstract class VcsDownloader implements DownloaderInterface, ChangeReportInterface, VcsCapableDownloaderInterface
  11936. {
  11937. protected $io;
  11938. protected $config;
  11939. protected $process;
  11940. protected $filesystem;
  11941. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, Filesystem $fs = null)
  11942. {
  11943. $this->io = $io;
  11944. $this->config = $config;
  11945. $this->process = $process ?: new ProcessExecutor($io);
  11946. $this->filesystem = $fs ?: new Filesystem($this->process);
  11947. }
  11948. public function getInstallationSource()
  11949. {
  11950. return 'source';
  11951. }
  11952. public function download(PackageInterface $package, $path)
  11953. {
  11954. if (!$package->getSourceReference()) {
  11955. throw new \InvalidArgumentException('Package '.$package->getPrettyName().' is missing reference information');
  11956. }
  11957. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>): ", false);
  11958. $this->filesystem->emptyDirectory($path);
  11959. $urls = $package->getSourceUrls();
  11960. while ($url = array_shift($urls)) {
  11961. try {
  11962. if (Filesystem::isLocalPath($url)) {
  11963. $needle = 'file://';
  11964. $isFileProtocol = false;
  11965. if (0 === strpos($url, $needle)) {
  11966. $url = substr($url, strlen($needle));
  11967. $isFileProtocol = true;
  11968. }
  11969. if (false !== strpos($url, '%')) {
  11970. $url = rawurldecode($url);
  11971. }
  11972. $url = realpath($url);
  11973. if ($isFileProtocol) {
  11974. $url = $needle . $url;
  11975. }
  11976. }
  11977. $this->doDownload($package, $path, $url);
  11978. break;
  11979. } catch (\Exception $e) {
  11980. if ($e instanceof \PHPUnit_Framework_Exception) {
  11981. throw $e;
  11982. }
  11983. if ($this->io->isDebug()) {
  11984. $this->io->writeError('Failed: ['.get_class($e).'] '.$e->getMessage());
  11985. } elseif (count($urls)) {
  11986. $this->io->writeError(' Failed, trying the next URL');
  11987. }
  11988. if (!count($urls)) {
  11989. throw $e;
  11990. }
  11991. }
  11992. }
  11993. }
  11994. public function update(PackageInterface $initial, PackageInterface $target, $path)
  11995. {
  11996. if (!$target->getSourceReference()) {
  11997. throw new \InvalidArgumentException('Package '.$target->getPrettyName().' is missing reference information');
  11998. }
  11999. $name = $target->getName();
  12000. if ($initial->getPrettyVersion() == $target->getPrettyVersion()) {
  12001. if ($target->getSourceType() === 'svn') {
  12002. $from = $initial->getSourceReference();
  12003. $to = $target->getSourceReference();
  12004. } else {
  12005. $from = substr($initial->getSourceReference(), 0, 7);
  12006. $to = substr($target->getSourceReference(), 0, 7);
  12007. }
  12008. $name .= ' '.$initial->getPrettyVersion();
  12009. } else {
  12010. $from = $initial->getFullPrettyVersion();
  12011. $to = $target->getFullPrettyVersion();
  12012. }
  12013. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  12014. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>): ", false);
  12015. $this->cleanChanges($initial, $path, true);
  12016. $urls = $target->getSourceUrls();
  12017. $exception = null;
  12018. while ($url = array_shift($urls)) {
  12019. try {
  12020. if (Filesystem::isLocalPath($url)) {
  12021. $url = realpath($url);
  12022. }
  12023. $this->doUpdate($initial, $target, $path, $url);
  12024. $exception = null;
  12025. break;
  12026. } catch (\Exception $exception) {
  12027. if ($exception instanceof \PHPUnit_Framework_Exception) {
  12028. throw $exception;
  12029. }
  12030. if ($this->io->isDebug()) {
  12031. $this->io->writeError('Failed: ['.get_class($exception).'] '.$exception->getMessage());
  12032. } elseif (count($urls)) {
  12033. $this->io->writeError(' Failed, trying the next URL');
  12034. }
  12035. }
  12036. }
  12037. $this->reapplyChanges($path);
  12038. if (!$exception && $this->io->isVerbose() && $this->hasMetadataRepository($path)) {
  12039. $message = 'Pulling in changes:';
  12040. $logs = $this->getCommitLogs($initial->getSourceReference(), $target->getSourceReference(), $path);
  12041. if (!trim($logs)) {
  12042. $message = 'Rolling back changes:';
  12043. $logs = $this->getCommitLogs($target->getSourceReference(), $initial->getSourceReference(), $path);
  12044. }
  12045. if (trim($logs)) {
  12046. $logs = implode("\n", array_map(function ($line) {
  12047. return ' ' . $line;
  12048. }, explode("\n", $logs)));
  12049. $logs = str_replace('<', '\<', $logs);
  12050. $this->io->writeError(' '.$message);
  12051. $this->io->writeError($logs);
  12052. }
  12053. }
  12054. if (!$urls && $exception) {
  12055. throw $exception;
  12056. }
  12057. }
  12058. public function remove(PackageInterface $package, $path)
  12059. {
  12060. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getPrettyVersion() . "</comment>)");
  12061. $this->cleanChanges($package, $path, false);
  12062. if (!$this->filesystem->removeDirectory($path)) {
  12063. throw new \RuntimeException('Could not completely delete '.$path.', aborting.');
  12064. }
  12065. }
  12066. public function setOutputProgress($outputProgress)
  12067. {
  12068. return $this;
  12069. }
  12070. public function getVcsReference(PackageInterface $package, $path)
  12071. {
  12072. $parser = new VersionParser;
  12073. $guesser = new VersionGuesser($this->config, $this->process, $parser);
  12074. $dumper = new ArrayDumper;
  12075. $packageConfig = $dumper->dump($package);
  12076. if ($packageVersion = $guesser->guessVersion($packageConfig, $path)) {
  12077. return $packageVersion['commit'];
  12078. }
  12079. }
  12080. protected function cleanChanges(PackageInterface $package, $path, $update)
  12081. {
  12082. if (null !== $this->getLocalChanges($package, $path)) {
  12083. throw new \RuntimeException('Source directory ' . $path . ' has uncommitted changes.');
  12084. }
  12085. }
  12086. protected function reapplyChanges($path)
  12087. {
  12088. }
  12089. abstract protected function doDownload(PackageInterface $package, $path, $url);
  12090. abstract protected function doUpdate(PackageInterface $initial, PackageInterface $target, $path, $url);
  12091. abstract protected function getCommitLogs($fromReference, $toReference, $path);
  12092. abstract protected function hasMetadataRepository($path);
  12093. }
  12094. <?php
  12095. namespace Composer\Downloader;
  12096. use Composer\Config;
  12097. use Composer\Cache;
  12098. use Composer\EventDispatcher\EventDispatcher;
  12099. use Composer\Package\PackageInterface;
  12100. use Composer\Util\ProcessExecutor;
  12101. use Composer\Util\RemoteFilesystem;
  12102. use Composer\IO\IOInterface;
  12103. class XzDownloader extends ArchiveDownloader
  12104. {
  12105. protected $process;
  12106. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12107. {
  12108. $this->process = $process ?: new ProcessExecutor($io);
  12109. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12110. }
  12111. protected function extract($file, $path)
  12112. {
  12113. $command = 'tar -xJf ' . ProcessExecutor::escape($file) . ' -C ' . ProcessExecutor::escape($path);
  12114. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12115. return;
  12116. }
  12117. $processError = 'Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput();
  12118. throw new \RuntimeException($processError);
  12119. }
  12120. protected function getFileName(PackageInterface $package, $path)
  12121. {
  12122. return $path.'/'.pathinfo(parse_url($package->getDistUrl(), PHP_URL_PATH), PATHINFO_BASENAME);
  12123. }
  12124. }
  12125. <?php
  12126. namespace Composer\Downloader;
  12127. use Composer\Config;
  12128. use Composer\Cache;
  12129. use Composer\EventDispatcher\EventDispatcher;
  12130. use Composer\Package\PackageInterface;
  12131. use Composer\Util\IniHelper;
  12132. use Composer\Util\Platform;
  12133. use Composer\Util\ProcessExecutor;
  12134. use Composer\Util\RemoteFilesystem;
  12135. use Composer\IO\IOInterface;
  12136. use Symfony\Component\Process\ExecutableFinder;
  12137. use ZipArchive;
  12138. class ZipDownloader extends ArchiveDownloader
  12139. {
  12140. protected static $hasSystemUnzip;
  12141. private static $hasZipArchive;
  12142. private static $isWindows;
  12143. protected $process;
  12144. private $zipArchiveObject;
  12145. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, Cache $cache = null, ProcessExecutor $process = null, RemoteFilesystem $rfs = null)
  12146. {
  12147. $this->process = $process ?: new ProcessExecutor($io);
  12148. parent::__construct($io, $config, $eventDispatcher, $cache, $rfs);
  12149. }
  12150. public function download(PackageInterface $package, $path, $output = true)
  12151. {
  12152. if (null === self::$hasSystemUnzip) {
  12153. $finder = new ExecutableFinder;
  12154. self::$hasSystemUnzip = (bool) $finder->find('unzip');
  12155. }
  12156. if (null === self::$hasZipArchive) {
  12157. self::$hasZipArchive = class_exists('ZipArchive');
  12158. }
  12159. if (!self::$hasZipArchive && !self::$hasSystemUnzip) {
  12160. $iniMessage = IniHelper::getMessage();
  12161. $error = "The zip extension and unzip command are both missing, skipping.\n" . $iniMessage;
  12162. throw new \RuntimeException($error);
  12163. }
  12164. if (null === self::$isWindows) {
  12165. self::$isWindows = Platform::isWindows();
  12166. if (!self::$isWindows && !self::$hasSystemUnzip) {
  12167. $this->io->writeError("<warning>As there is no 'unzip' command installed zip files are being unpacked using the PHP zip extension.</warning>");
  12168. $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>");
  12169. $this->io->writeError("<warning>Installing 'unzip' may remediate them.</warning>");
  12170. }
  12171. }
  12172. return parent::download($package, $path, $output);
  12173. }
  12174. protected function extractWithSystemUnzip($file, $path, $isLastChance)
  12175. {
  12176. if (!self::$hasZipArchive) {
  12177. $isLastChance = true;
  12178. }
  12179. if (!self::$hasSystemUnzip && !$isLastChance) {
  12180. return $this->extractWithZipArchive($file, $path, true);
  12181. }
  12182. $processError = null;
  12183. $overwrite = $isLastChance ? '-o' : '';
  12184. $command = 'unzip -qq '.$overwrite.' '.ProcessExecutor::escape($file).' -d '.ProcessExecutor::escape($path);
  12185. try {
  12186. if (0 === $this->process->execute($command, $ignoredOutput)) {
  12187. return true;
  12188. }
  12189. $processError = new \RuntimeException('Failed to execute ' . $command . "\n\n" . $this->process->getErrorOutput());
  12190. } catch (\Exception $e) {
  12191. $processError = $e;
  12192. }
  12193. if ($isLastChance) {
  12194. throw $processError;
  12195. }
  12196. $this->io->writeError(' '.$processError->getMessage());
  12197. $this->io->writeError(' The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems)');
  12198. $this->io->writeError(' Unzip with unzip command failed, falling back to ZipArchive class');
  12199. return $this->extractWithZipArchive($file, $path, true);
  12200. }
  12201. protected function extractWithZipArchive($file, $path, $isLastChance)
  12202. {
  12203. if (!self::$hasSystemUnzip) {
  12204. $isLastChance = true;
  12205. }
  12206. if (!self::$hasZipArchive && !$isLastChance) {
  12207. return $this->extractWithSystemUnzip($file, $path, true);
  12208. }
  12209. $processError = null;
  12210. $zipArchive = $this->zipArchiveObject ?: new ZipArchive();
  12211. try {
  12212. if (true === ($retval = $zipArchive->open($file))) {
  12213. $extractResult = $zipArchive->extractTo($path);
  12214. if (true === $extractResult) {
  12215. $zipArchive->close();
  12216. return true;
  12217. }
  12218. $processError = new \RuntimeException(rtrim("There was an error extracting the ZIP file, it is either corrupted or using an invalid format.\n"));
  12219. } else {
  12220. $processError = new \UnexpectedValueException(rtrim($this->getErrorMessage($retval, $file)."\n"), $retval);
  12221. }
  12222. } catch (\ErrorException $e) {
  12223. $processError = new \RuntimeException('The archive may contain identical file names with different capitalization (which fails on case insensitive filesystems): '.$e->getMessage(), 0, $e);
  12224. } catch (\Exception $e) {
  12225. $processError = $e;
  12226. }
  12227. if ($isLastChance) {
  12228. throw $processError;
  12229. }
  12230. $this->io->writeError(' '.$processError->getMessage());
  12231. $this->io->writeError(' Unzip with ZipArchive class failed, falling back to unzip command');
  12232. return $this->extractWithSystemUnzip($file, $path, true);
  12233. }
  12234. public function extract($file, $path)
  12235. {
  12236. if (self::$isWindows) {
  12237. $this->extractWithZipArchive($file, $path, false);
  12238. } else {
  12239. $this->extractWithSystemUnzip($file, $path, false);
  12240. }
  12241. }
  12242. protected function getErrorMessage($retval, $file)
  12243. {
  12244. switch ($retval) {
  12245. case ZipArchive::ER_EXISTS:
  12246. return sprintf("File '%s' already exists.", $file);
  12247. case ZipArchive::ER_INCONS:
  12248. return sprintf("Zip archive '%s' is inconsistent.", $file);
  12249. case ZipArchive::ER_INVAL:
  12250. return sprintf("Invalid argument (%s)", $file);
  12251. case ZipArchive::ER_MEMORY:
  12252. return sprintf("Malloc failure (%s)", $file);
  12253. case ZipArchive::ER_NOENT:
  12254. return sprintf("No such zip file: '%s'", $file);
  12255. case ZipArchive::ER_NOZIP:
  12256. return sprintf("'%s' is not a zip archive.", $file);
  12257. case ZipArchive::ER_OPEN:
  12258. return sprintf("Can't open zip file: %s", $file);
  12259. case ZipArchive::ER_READ:
  12260. return sprintf("Zip read error (%s)", $file);
  12261. case ZipArchive::ER_SEEK:
  12262. return sprintf("Zip seek error (%s)", $file);
  12263. default:
  12264. return sprintf("'%s' is not a valid zip archive, got error code: %s", $file, $retval);
  12265. }
  12266. }
  12267. }
  12268. <?php
  12269. namespace Composer\EventDispatcher;
  12270. class Event
  12271. {
  12272. protected $name;
  12273. protected $args;
  12274. protected $flags;
  12275. private $propagationStopped = false;
  12276. public function __construct($name, array $args = array(), array $flags = array())
  12277. {
  12278. $this->name = $name;
  12279. $this->args = $args;
  12280. $this->flags = $flags;
  12281. }
  12282. public function getName()
  12283. {
  12284. return $this->name;
  12285. }
  12286. public function getArguments()
  12287. {
  12288. return $this->args;
  12289. }
  12290. public function getFlags()
  12291. {
  12292. return $this->flags;
  12293. }
  12294. public function isPropagationStopped()
  12295. {
  12296. return $this->propagationStopped;
  12297. }
  12298. public function stopPropagation()
  12299. {
  12300. $this->propagationStopped = true;
  12301. }
  12302. }
  12303. <?php
  12304. namespace Composer\EventDispatcher;
  12305. use Composer\DependencyResolver\PolicyInterface;
  12306. use Composer\DependencyResolver\Pool;
  12307. use Composer\DependencyResolver\Request;
  12308. use Composer\Installer\InstallerEvent;
  12309. use Composer\IO\IOInterface;
  12310. use Composer\Composer;
  12311. use Composer\DependencyResolver\Operation\OperationInterface;
  12312. use Composer\Repository\CompositeRepository;
  12313. use Composer\Script;
  12314. use Composer\Installer\PackageEvent;
  12315. use Composer\Installer\BinaryInstaller;
  12316. use Composer\Util\ProcessExecutor;
  12317. use Composer\Script\Event as ScriptEvent;
  12318. use Symfony\Component\Process\PhpExecutableFinder;
  12319. class EventDispatcher
  12320. {
  12321. protected $composer;
  12322. protected $io;
  12323. protected $loader;
  12324. protected $process;
  12325. protected $listeners;
  12326. private $eventStack;
  12327. public function __construct(Composer $composer, IOInterface $io, ProcessExecutor $process = null)
  12328. {
  12329. $this->composer = $composer;
  12330. $this->io = $io;
  12331. $this->process = $process ?: new ProcessExecutor($io);
  12332. $this->eventStack = array();
  12333. }
  12334. public function dispatch($eventName, Event $event = null)
  12335. {
  12336. if (null === $event) {
  12337. $event = new Event($eventName);
  12338. }
  12339. return $this->doDispatch($event);
  12340. }
  12341. public function dispatchScript($eventName, $devMode = false, $additionalArgs = array(), $flags = array())
  12342. {
  12343. return $this->doDispatch(new Script\Event($eventName, $this->composer, $this->io, $devMode, $additionalArgs, $flags));
  12344. }
  12345. public function dispatchPackageEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  12346. {
  12347. return $this->doDispatch(new PackageEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations, $operation));
  12348. }
  12349. public function dispatchInstallerEvent($eventName, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  12350. {
  12351. return $this->doDispatch(new InstallerEvent($eventName, $this->composer, $this->io, $devMode, $policy, $pool, $installedRepo, $request, $operations));
  12352. }
  12353. protected function doDispatch(Event $event)
  12354. {
  12355. $pathStr = 'PATH';
  12356. if (!isset($_SERVER[$pathStr]) && isset($_SERVER['Path'])) {
  12357. $pathStr = 'Path';
  12358. }
  12359. $binDir = $this->composer->getConfig()->get('bin-dir');
  12360. if (is_dir($binDir)) {
  12361. $binDir = realpath($binDir);
  12362. if (isset($_SERVER[$pathStr]) && !preg_match('{(^|'.PATH_SEPARATOR.')'.preg_quote($binDir).'($|'.PATH_SEPARATOR.')}', $_SERVER[$pathStr])) {
  12363. $_SERVER[$pathStr] = $binDir.PATH_SEPARATOR.getenv($pathStr);
  12364. putenv($pathStr.'='.$_SERVER[$pathStr]);
  12365. }
  12366. }
  12367. $listeners = $this->getListeners($event);
  12368. $this->pushEvent($event);
  12369. $return = 0;
  12370. foreach ($listeners as $callable) {
  12371. if (!is_string($callable)) {
  12372. if (!is_callable($callable)) {
  12373. $className = is_object($callable[0]) ? get_class($callable[0]) : $callable[0];
  12374. throw new \RuntimeException('Subscriber '.$className.'::'.$callable[1].' for event '.$event->getName().' is not callable, make sure the function is defined and public');
  12375. }
  12376. $event = $this->checkListenerExpectedEvent($callable, $event);
  12377. $return = false === call_user_func($callable, $event) ? 1 : 0;
  12378. } elseif ($this->isComposerScript($callable)) {
  12379. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $callable), true, IOInterface::VERBOSE);
  12380. $script = explode(' ', substr($callable, 1));
  12381. $scriptName = $script[0];
  12382. unset($script[0]);
  12383. $args = array_merge($script, $event->getArguments());
  12384. $flags = $event->getFlags();
  12385. if (substr($callable, 0, 10) === '@composer ') {
  12386. $exec = $this->getPhpExecCommand() . ' ' . ProcessExecutor::escape(getenv('COMPOSER_BINARY')) . substr($callable, 9);
  12387. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12388. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12389. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12390. }
  12391. } else {
  12392. if (!$this->getListeners(new Event($scriptName))) {
  12393. $this->io->writeError(sprintf('<warning>You made a reference to a non-existent script %s</warning>', $callable), true, IOInterface::QUIET);
  12394. }
  12395. try {
  12396. $scriptEvent = new Script\Event($scriptName, $event->getComposer(), $event->getIO(), $event->isDevMode(), $args, $flags);
  12397. $scriptEvent->setOriginatingEvent($event);
  12398. $return = $this->dispatch($scriptName, $scriptEvent);
  12399. } catch (ScriptExecutionException $e) {
  12400. $this->io->writeError(sprintf('<error>Script %s was called via %s</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12401. throw $e;
  12402. }
  12403. }
  12404. } elseif ($this->isPhpScript($callable)) {
  12405. $className = substr($callable, 0, strpos($callable, '::'));
  12406. $methodName = substr($callable, strpos($callable, '::') + 2);
  12407. if (!class_exists($className)) {
  12408. $this->io->writeError('<warning>Class '.$className.' is not autoloadable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12409. continue;
  12410. }
  12411. if (!is_callable($callable)) {
  12412. $this->io->writeError('<warning>Method '.$callable.' is not callable, can not call '.$event->getName().' script</warning>', true, IOInterface::QUIET);
  12413. continue;
  12414. }
  12415. try {
  12416. $return = false === $this->executeEventPhpScript($className, $methodName, $event) ? 1 : 0;
  12417. } catch (\Exception $e) {
  12418. $message = "Script %s handling the %s event terminated with an exception";
  12419. $this->io->writeError('<error>'.sprintf($message, $callable, $event->getName()).'</error>', true, IOInterface::QUIET);
  12420. throw $e;
  12421. }
  12422. } else {
  12423. $args = implode(' ', array_map(array('Composer\Util\ProcessExecutor', 'escape'), $event->getArguments()));
  12424. $exec = $callable . ($args === '' ? '' : ' '.$args);
  12425. if ($this->io->isVerbose()) {
  12426. $this->io->writeError(sprintf('> %s: %s', $event->getName(), $exec));
  12427. } else {
  12428. $this->io->writeError(sprintf('> %s', $exec));
  12429. }
  12430. $possibleLocalBinaries = $this->composer->getPackage()->getBinaries();
  12431. if ($possibleLocalBinaries) {
  12432. foreach ($possibleLocalBinaries as $localExec) {
  12433. if (preg_match('{\b'.preg_quote($callable).'$}', $localExec)) {
  12434. $caller = BinaryInstaller::determineBinaryCaller($localExec);
  12435. $exec = preg_replace('{^'.preg_quote($callable).'}', $caller . ' ' . $localExec, $exec);
  12436. break;
  12437. }
  12438. }
  12439. }
  12440. if (substr($exec, 0, 5) === '@php ') {
  12441. $exec = $this->getPhpExecCommand() . ' ' . substr($exec, 5);
  12442. } else {
  12443. $finder = new PhpExecutableFinder();
  12444. $phpPath = $finder->find(false);
  12445. if ($phpPath) {
  12446. putenv('PHP_BINARY=' . $phpPath);
  12447. }
  12448. }
  12449. if (0 !== ($exitCode = $this->process->execute($exec))) {
  12450. $this->io->writeError(sprintf('<error>Script %s handling the %s event returned with error code '.$exitCode.'</error>', $callable, $event->getName()), true, IOInterface::QUIET);
  12451. throw new ScriptExecutionException('Error Output: '.$this->process->getErrorOutput(), $exitCode);
  12452. }
  12453. }
  12454. if ($event->isPropagationStopped()) {
  12455. break;
  12456. }
  12457. }
  12458. $this->popEvent();
  12459. return $return;
  12460. }
  12461. protected function getPhpExecCommand()
  12462. {
  12463. $finder = new PhpExecutableFinder();
  12464. $phpPath = $finder->find(false);
  12465. if (!$phpPath) {
  12466. throw new \RuntimeException('Failed to locate PHP binary to execute '.$phpPath);
  12467. }
  12468. $phpArgs = $finder->findArguments();
  12469. $phpArgs = $phpArgs ? ' ' . implode(' ', $phpArgs) : '';
  12470. $allowUrlFOpenFlag = ' -d allow_url_fopen=' . ProcessExecutor::escape(ini_get('allow_url_fopen'));
  12471. $disableFunctionsFlag = ' -d disable_functions=' . ProcessExecutor::escape(ini_get('disable_functions'));
  12472. $memoryLimitFlag = ' -d memory_limit=' . ProcessExecutor::escape(ini_get('memory_limit'));
  12473. return ProcessExecutor::escape($phpPath) . $phpArgs . $allowUrlFOpenFlag . $disableFunctionsFlag . $memoryLimitFlag;
  12474. }
  12475. protected function executeEventPhpScript($className, $methodName, Event $event)
  12476. {
  12477. $event = $this->checkListenerExpectedEvent(array($className, $methodName), $event);
  12478. if ($this->io->isVerbose()) {
  12479. $this->io->writeError(sprintf('> %s: %s::%s', $event->getName(), $className, $methodName));
  12480. } else {
  12481. $this->io->writeError(sprintf('> %s::%s', $className, $methodName));
  12482. }
  12483. return $className::$methodName($event);
  12484. }
  12485. protected function checkListenerExpectedEvent($target, Event $event)
  12486. {
  12487. if (in_array($event->getName(), array(
  12488. 'init',
  12489. 'command',
  12490. 'pre-file-download',
  12491. ), true)) {
  12492. return $event;
  12493. }
  12494. try {
  12495. $reflected = new \ReflectionParameter($target, 0);
  12496. } catch (\Exception $e) {
  12497. return $event;
  12498. }
  12499. $typehint = $reflected->getClass();
  12500. if (!$typehint instanceof \ReflectionClass) {
  12501. return $event;
  12502. }
  12503. $expected = $typehint->getName();
  12504. if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
  12505. 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);
  12506. $event = new \Composer\Script\CommandEvent(
  12507. $event->getName(),
  12508. $event->getComposer(),
  12509. $event->getIO(),
  12510. $event->isDevMode(),
  12511. $event->getArguments()
  12512. );
  12513. }
  12514. if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
  12515. 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);
  12516. $event = new \Composer\Script\PackageEvent(
  12517. $event->getName(),
  12518. $event->getComposer(),
  12519. $event->getIO(),
  12520. $event->isDevMode(),
  12521. $event->getPolicy(),
  12522. $event->getPool(),
  12523. $event->getInstalledRepo(),
  12524. $event->getRequest(),
  12525. $event->getOperations(),
  12526. $event->getOperation()
  12527. );
  12528. }
  12529. if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
  12530. 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);
  12531. $event = new \Composer\Script\Event(
  12532. $event->getName(),
  12533. $event->getComposer(),
  12534. $event->getIO(),
  12535. $event->isDevMode(),
  12536. $event->getArguments(),
  12537. $event->getFlags()
  12538. );
  12539. }
  12540. return $event;
  12541. }
  12542. private function serializeCallback($cb)
  12543. {
  12544. if (is_array($cb) && count($cb) === 2) {
  12545. if (is_object($cb[0])) {
  12546. $cb[0] = get_class($cb[0]);
  12547. }
  12548. if (is_string($cb[0]) && is_string($cb[1])) {
  12549. $cb = implode('::', $cb);
  12550. }
  12551. }
  12552. if (is_string($cb)) {
  12553. return $cb;
  12554. }
  12555. return var_export($cb, true);
  12556. }
  12557. public function addListener($eventName, $listener, $priority = 0)
  12558. {
  12559. $this->listeners[$eventName][$priority][] = $listener;
  12560. }
  12561. public function addSubscriber(EventSubscriberInterface $subscriber)
  12562. {
  12563. foreach ($subscriber->getSubscribedEvents() as $eventName => $params) {
  12564. if (is_string($params)) {
  12565. $this->addListener($eventName, array($subscriber, $params));
  12566. } elseif (is_string($params[0])) {
  12567. $this->addListener($eventName, array($subscriber, $params[0]), isset($params[1]) ? $params[1] : 0);
  12568. } else {
  12569. foreach ($params as $listener) {
  12570. $this->addListener($eventName, array($subscriber, $listener[0]), isset($listener[1]) ? $listener[1] : 0);
  12571. }
  12572. }
  12573. }
  12574. }
  12575. protected function getListeners(Event $event)
  12576. {
  12577. $scriptListeners = $this->getScriptListeners($event);
  12578. if (!isset($this->listeners[$event->getName()][0])) {
  12579. $this->listeners[$event->getName()][0] = array();
  12580. }
  12581. krsort($this->listeners[$event->getName()]);
  12582. $listeners = $this->listeners;
  12583. $listeners[$event->getName()][0] = array_merge($listeners[$event->getName()][0], $scriptListeners);
  12584. return call_user_func_array('array_merge', $listeners[$event->getName()]);
  12585. }
  12586. public function hasEventListeners(Event $event)
  12587. {
  12588. $listeners = $this->getListeners($event);
  12589. return count($listeners) > 0;
  12590. }
  12591. protected function getScriptListeners(Event $event)
  12592. {
  12593. $package = $this->composer->getPackage();
  12594. $scripts = $package->getScripts();
  12595. if (empty($scripts[$event->getName()])) {
  12596. return array();
  12597. }
  12598. if ($this->loader) {
  12599. $this->loader->unregister();
  12600. }
  12601. $generator = $this->composer->getAutoloadGenerator();
  12602. if ($event instanceof ScriptEvent) {
  12603. $generator->setDevMode($event->isDevMode());
  12604. }
  12605. $packages = $this->composer->getRepositoryManager()->getLocalRepository()->getCanonicalPackages();
  12606. $packageMap = $generator->buildPackageMap($this->composer->getInstallationManager(), $package, $packages);
  12607. $map = $generator->parseAutoloads($packageMap, $package);
  12608. $this->loader = $generator->createLoader($map);
  12609. $this->loader->register();
  12610. return $scripts[$event->getName()];
  12611. }
  12612. protected function isPhpScript($callable)
  12613. {
  12614. return false === strpos($callable, ' ') && false !== strpos($callable, '::');
  12615. }
  12616. protected function isComposerScript($callable)
  12617. {
  12618. return '@' === substr($callable, 0, 1) && '@php ' !== substr($callable, 0, 5);
  12619. }
  12620. protected function pushEvent(Event $event)
  12621. {
  12622. $eventName = $event->getName();
  12623. if (in_array($eventName, $this->eventStack)) {
  12624. throw new \RuntimeException(sprintf("Circular call to script handler '%s' detected", $eventName));
  12625. }
  12626. return array_push($this->eventStack, $eventName);
  12627. }
  12628. protected function popEvent()
  12629. {
  12630. return array_pop($this->eventStack);
  12631. }
  12632. }
  12633. <?php
  12634. namespace Composer\EventDispatcher;
  12635. interface EventSubscriberInterface
  12636. {
  12637. public static function getSubscribedEvents();
  12638. }
  12639. <?php
  12640. namespace Composer\EventDispatcher;
  12641. class ScriptExecutionException extends \RuntimeException
  12642. {
  12643. }
  12644. <?php
  12645. namespace Composer\Exception;
  12646. class NoSslException extends \RuntimeException
  12647. {
  12648. }
  12649. <?php
  12650. namespace Composer;
  12651. use Composer\Config\JsonConfigSource;
  12652. use Composer\Json\JsonFile;
  12653. use Composer\IO\IOInterface;
  12654. use Composer\Package\Archiver;
  12655. use Composer\Package\Version\VersionGuesser;
  12656. use Composer\Repository\RepositoryManager;
  12657. use Composer\Repository\RepositoryFactory;
  12658. use Composer\Repository\WritableRepositoryInterface;
  12659. use Composer\Util\Filesystem;
  12660. use Composer\Util\Platform;
  12661. use Composer\Util\ProcessExecutor;
  12662. use Composer\Util\RemoteFilesystem;
  12663. use Composer\Util\Silencer;
  12664. use Composer\Plugin\PluginEvents;
  12665. use Composer\EventDispatcher\Event;
  12666. use Seld\JsonLint\DuplicateKeyException;
  12667. use Symfony\Component\Console\Formatter\OutputFormatter;
  12668. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  12669. use Symfony\Component\Console\Output\ConsoleOutput;
  12670. use Composer\EventDispatcher\EventDispatcher;
  12671. use Composer\Autoload\AutoloadGenerator;
  12672. use Composer\Package\Version\VersionParser;
  12673. use Composer\Downloader\TransportException;
  12674. use Seld\JsonLint\JsonParser;
  12675. class Factory
  12676. {
  12677. protected static function getHomeDir()
  12678. {
  12679. $home = getenv('COMPOSER_HOME');
  12680. if ($home) {
  12681. return $home;
  12682. }
  12683. if (Platform::isWindows()) {
  12684. if (!getenv('APPDATA')) {
  12685. throw new \RuntimeException('The APPDATA or COMPOSER_HOME environment variable must be set for composer to run correctly');
  12686. }
  12687. return rtrim(strtr(getenv('APPDATA'), '\\', '/'), '/') . '/Composer';
  12688. }
  12689. $userDir = self::getUserDir();
  12690. if (is_dir($userDir . '/.composer')) {
  12691. return $userDir . '/.composer';
  12692. }
  12693. if (self::useXdg()) {
  12694. $xdgConfig = getenv('XDG_CONFIG_HOME') ?: $userDir . '/.config';
  12695. return $xdgConfig . '/composer';
  12696. }
  12697. return $userDir . '/.composer';
  12698. }
  12699. protected static function getCacheDir($home)
  12700. {
  12701. $cacheDir = getenv('COMPOSER_CACHE_DIR');
  12702. if ($cacheDir) {
  12703. return $cacheDir;
  12704. }
  12705. $homeEnv = getenv('COMPOSER_HOME');
  12706. if ($homeEnv) {
  12707. return $homeEnv . '/cache';
  12708. }
  12709. if (Platform::isWindows()) {
  12710. if ($cacheDir = getenv('LOCALAPPDATA')) {
  12711. $cacheDir .= '/Composer';
  12712. } else {
  12713. $cacheDir = $home . '/cache';
  12714. }
  12715. return rtrim(strtr($cacheDir, '\\', '/'), '/');
  12716. }
  12717. $userDir = self::getUserDir();
  12718. if ($home === $userDir . '/.composer' && is_dir($home . '/cache')) {
  12719. return $home . '/cache';
  12720. }
  12721. if (self::useXdg()) {
  12722. $xdgCache = getenv('XDG_CACHE_HOME') ?: $userDir . '/.cache';
  12723. return $xdgCache . '/composer';
  12724. }
  12725. return $home . '/cache';
  12726. }
  12727. protected static function getDataDir($home)
  12728. {
  12729. $homeEnv = getenv('COMPOSER_HOME');
  12730. if ($homeEnv) {
  12731. return $homeEnv;
  12732. }
  12733. if (Platform::isWindows()) {
  12734. return strtr($home, '\\', '/');
  12735. }
  12736. $userDir = self::getUserDir();
  12737. if ($home !== $userDir . '/.composer' && self::useXdg()) {
  12738. $xdgData = getenv('XDG_DATA_HOME') ?: $userDir . '/.local/share';
  12739. return $xdgData . '/composer';
  12740. }
  12741. return $home;
  12742. }
  12743. public static function createConfig(IOInterface $io = null, $cwd = null)
  12744. {
  12745. $cwd = $cwd ?: getcwd();
  12746. $config = new Config(true, $cwd);
  12747. $home = self::getHomeDir();
  12748. $config->merge(array('config' => array(
  12749. 'home' => $home,
  12750. 'cache-dir' => self::getCacheDir($home),
  12751. 'data-dir' => self::getDataDir($home),
  12752. )));
  12753. $file = new JsonFile($config->get('home').'/config.json');
  12754. if ($file->exists()) {
  12755. if ($io && $io->isDebug()) {
  12756. $io->writeError('Loading config file ' . $file->getPath());
  12757. }
  12758. $config->merge($file->read());
  12759. }
  12760. $config->setConfigSource(new JsonConfigSource($file));
  12761. $htaccessProtect = (bool) $config->get('htaccess-protect');
  12762. if ($htaccessProtect) {
  12763. $dirs = array($config->get('home'), $config->get('cache-dir'), $config->get('data-dir'));
  12764. foreach ($dirs as $dir) {
  12765. if (!file_exists($dir . '/.htaccess')) {
  12766. if (!is_dir($dir)) {
  12767. Silencer::call('mkdir', $dir, 0777, true);
  12768. }
  12769. Silencer::call('file_put_contents', $dir . '/.htaccess', 'Deny from all');
  12770. }
  12771. }
  12772. }
  12773. $file = new JsonFile($config->get('home').'/auth.json');
  12774. if ($file->exists()) {
  12775. if ($io && $io->isDebug()) {
  12776. $io->writeError('Loading config file ' . $file->getPath());
  12777. }
  12778. $config->merge(array('config' => $file->read()));
  12779. }
  12780. $config->setAuthConfigSource(new JsonConfigSource($file, true));
  12781. if ($composerAuthEnv = getenv('COMPOSER_AUTH')) {
  12782. $authData = json_decode($composerAuthEnv, true);
  12783. if (null === $authData) {
  12784. throw new \UnexpectedValueException('COMPOSER_AUTH environment variable is malformed, should be a valid JSON object');
  12785. }
  12786. if ($io && $io->isDebug()) {
  12787. $io->writeError('Loading auth config from COMPOSER_AUTH');
  12788. }
  12789. $config->merge(array('config' => $authData));
  12790. }
  12791. return $config;
  12792. }
  12793. public static function getComposerFile()
  12794. {
  12795. return trim(getenv('COMPOSER')) ?: './composer.json';
  12796. }
  12797. public static function createAdditionalStyles()
  12798. {
  12799. return array(
  12800. 'highlight' => new OutputFormatterStyle('red'),
  12801. 'warning' => new OutputFormatterStyle('black', 'yellow'),
  12802. );
  12803. }
  12804. public static function createOutput()
  12805. {
  12806. $styles = self::createAdditionalStyles();
  12807. $formatter = new OutputFormatter(false, $styles);
  12808. return new ConsoleOutput(ConsoleOutput::VERBOSITY_NORMAL, null, $formatter);
  12809. }
  12810. public static function createDefaultRepositories(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  12811. {
  12812. return RepositoryFactory::defaultRepos($io, $config, $rm);
  12813. }
  12814. public function createComposer(IOInterface $io, $localConfig = null, $disablePlugins = false, $cwd = null, $fullLoad = true)
  12815. {
  12816. $cwd = $cwd ?: getcwd();
  12817. if (null === $localConfig) {
  12818. $localConfig = static::getComposerFile();
  12819. }
  12820. if (is_string($localConfig)) {
  12821. $composerFile = $localConfig;
  12822. $file = new JsonFile($localConfig, null, $io);
  12823. if (!$file->exists()) {
  12824. if ($localConfig === './composer.json' || $localConfig === 'composer.json') {
  12825. $message = 'Composer could not find a composer.json file in '.$cwd;
  12826. } else {
  12827. $message = 'Composer could not find the config file: '.$localConfig;
  12828. }
  12829. $instructions = 'To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section';
  12830. throw new \InvalidArgumentException($message.PHP_EOL.$instructions);
  12831. }
  12832. $file->validateSchema(JsonFile::LAX_SCHEMA);
  12833. $jsonParser = new JsonParser;
  12834. try {
  12835. $jsonParser->parse(file_get_contents($localConfig), JsonParser::DETECT_KEY_CONFLICTS);
  12836. } catch (DuplicateKeyException $e) {
  12837. $details = $e->getDetails();
  12838. $io->writeError('<warning>Key '.$details['key'].' is a duplicate in '.$localConfig.' at line '.$details['line'].'</warning>');
  12839. }
  12840. $localConfig = $file->read();
  12841. }
  12842. $config = static::createConfig($io, $cwd);
  12843. $config->merge($localConfig);
  12844. if (isset($composerFile)) {
  12845. $io->writeError('Loading config file ' . $composerFile, true, IOInterface::DEBUG);
  12846. $config->setConfigSource(new JsonConfigSource(new JsonFile(realpath($composerFile), null, $io)));
  12847. $localAuthFile = new JsonFile(dirname(realpath($composerFile)) . '/auth.json', null, $io);
  12848. if ($localAuthFile->exists()) {
  12849. $io->writeError('Loading config file ' . $localAuthFile->getPath(), true, IOInterface::DEBUG);
  12850. $config->merge(array('config' => $localAuthFile->read()));
  12851. $config->setAuthConfigSource(new JsonConfigSource($localAuthFile, true));
  12852. }
  12853. }
  12854. $vendorDir = $config->get('vendor-dir');
  12855. $composer = new Composer();
  12856. $composer->setConfig($config);
  12857. if ($fullLoad) {
  12858. $io->loadConfiguration($config);
  12859. }
  12860. $rfs = self::createRemoteFilesystem($io, $config);
  12861. $dispatcher = new EventDispatcher($composer, $io);
  12862. $composer->setEventDispatcher($dispatcher);
  12863. $rm = RepositoryFactory::manager($io, $config, $dispatcher, $rfs);
  12864. $composer->setRepositoryManager($rm);
  12865. $this->addLocalRepository($io, $rm, $vendorDir);
  12866. if (!$fullLoad && !isset($localConfig['version'])) {
  12867. $localConfig['version'] = '1.0.0';
  12868. }
  12869. $parser = new VersionParser;
  12870. $guesser = new VersionGuesser($config, new ProcessExecutor($io), $parser);
  12871. $loader = new Package\Loader\RootPackageLoader($rm, $config, $parser, $guesser, $io);
  12872. $package = $loader->load($localConfig, 'Composer\Package\RootPackage', $cwd);
  12873. $composer->setPackage($package);
  12874. $im = $this->createInstallationManager();
  12875. $composer->setInstallationManager($im);
  12876. if ($fullLoad) {
  12877. $dm = $this->createDownloadManager($io, $config, $dispatcher, $rfs);
  12878. $composer->setDownloadManager($dm);
  12879. $generator = new AutoloadGenerator($dispatcher, $io);
  12880. $composer->setAutoloadGenerator($generator);
  12881. $am = $this->createArchiveManager($config, $dm);
  12882. $composer->setArchiveManager($am);
  12883. }
  12884. $this->createDefaultInstallers($im, $composer, $io);
  12885. if ($fullLoad) {
  12886. $globalComposer = null;
  12887. if (realpath($config->get('home')) !== $cwd) {
  12888. $globalComposer = $this->createGlobalComposer($io, $config, $disablePlugins);
  12889. }
  12890. $pm = $this->createPluginManager($io, $composer, $globalComposer, $disablePlugins);
  12891. $composer->setPluginManager($pm);
  12892. $pm->loadInstalledPlugins();
  12893. }
  12894. if ($fullLoad && isset($composerFile)) {
  12895. $lockFile = "json" === pathinfo($composerFile, PATHINFO_EXTENSION)
  12896. ? substr($composerFile, 0, -4).'lock'
  12897. : $composerFile . '.lock';
  12898. $locker = new Package\Locker($io, new JsonFile($lockFile, null, $io), $rm, $im, file_get_contents($composerFile));
  12899. $composer->setLocker($locker);
  12900. }
  12901. if ($fullLoad) {
  12902. $initEvent = new Event(PluginEvents::INIT);
  12903. $composer->getEventDispatcher()->dispatch($initEvent->getName(), $initEvent);
  12904. if ($rm->getLocalRepository()) {
  12905. $this->purgePackages($rm->getLocalRepository(), $im);
  12906. }
  12907. }
  12908. return $composer;
  12909. }
  12910. public static function createGlobal(IOInterface $io, $disablePlugins = false)
  12911. {
  12912. $factory = new static();
  12913. return $factory->createGlobalComposer($io, static::createConfig($io), $disablePlugins, true);
  12914. }
  12915. protected function addLocalRepository(IOInterface $io, RepositoryManager $rm, $vendorDir)
  12916. {
  12917. $rm->setLocalRepository(new Repository\InstalledFilesystemRepository(new JsonFile($vendorDir.'/composer/installed.json', null, $io)));
  12918. }
  12919. protected function createGlobalComposer(IOInterface $io, Config $config, $disablePlugins, $fullLoad = false)
  12920. {
  12921. $composer = null;
  12922. try {
  12923. $composer = $this->createComposer($io, $config->get('home') . '/composer.json', $disablePlugins, $config->get('home'), $fullLoad);
  12924. } catch (\Exception $e) {
  12925. $io->writeError('Failed to initialize global composer: '.$e->getMessage(), true, IOInterface::DEBUG);
  12926. }
  12927. return $composer;
  12928. }
  12929. public function createDownloadManager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  12930. {
  12931. $cache = null;
  12932. if ($config->get('cache-files-ttl') > 0) {
  12933. $cache = new Cache($io, $config->get('cache-files-dir'), 'a-z0-9_./');
  12934. }
  12935. $dm = new Downloader\DownloadManager($io);
  12936. switch ($preferred = $config->get('preferred-install')) {
  12937. case 'dist':
  12938. $dm->setPreferDist(true);
  12939. break;
  12940. case 'source':
  12941. $dm->setPreferSource(true);
  12942. break;
  12943. case 'auto':
  12944. default:
  12945. break;
  12946. }
  12947. if (is_array($preferred)) {
  12948. $dm->setPreferences($preferred);
  12949. }
  12950. $executor = new ProcessExecutor($io);
  12951. $fs = new Filesystem($executor);
  12952. $dm->setDownloader('git', new Downloader\GitDownloader($io, $config, $executor, $fs));
  12953. $dm->setDownloader('svn', new Downloader\SvnDownloader($io, $config, $executor, $fs));
  12954. $dm->setDownloader('fossil', new Downloader\FossilDownloader($io, $config, $executor, $fs));
  12955. $dm->setDownloader('hg', new Downloader\HgDownloader($io, $config, $executor, $fs));
  12956. $dm->setDownloader('perforce', new Downloader\PerforceDownloader($io, $config));
  12957. $dm->setDownloader('zip', new Downloader\ZipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12958. $dm->setDownloader('rar', new Downloader\RarDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12959. $dm->setDownloader('tar', new Downloader\TarDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12960. $dm->setDownloader('gzip', new Downloader\GzipDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12961. $dm->setDownloader('xz', new Downloader\XzDownloader($io, $config, $eventDispatcher, $cache, $executor, $rfs));
  12962. $dm->setDownloader('phar', new Downloader\PharDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12963. $dm->setDownloader('file', new Downloader\FileDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12964. $dm->setDownloader('path', new Downloader\PathDownloader($io, $config, $eventDispatcher, $cache, $rfs));
  12965. return $dm;
  12966. }
  12967. public function createArchiveManager(Config $config, Downloader\DownloadManager $dm = null)
  12968. {
  12969. if (null === $dm) {
  12970. $io = new IO\NullIO();
  12971. $io->loadConfiguration($config);
  12972. $dm = $this->createDownloadManager($io, $config);
  12973. }
  12974. $am = new Archiver\ArchiveManager($dm);
  12975. $am->addArchiver(new Archiver\ZipArchiver);
  12976. $am->addArchiver(new Archiver\PharArchiver);
  12977. return $am;
  12978. }
  12979. protected function createPluginManager(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  12980. {
  12981. return new Plugin\PluginManager($io, $composer, $globalComposer, $disablePlugins);
  12982. }
  12983. protected function createInstallationManager()
  12984. {
  12985. return new Installer\InstallationManager();
  12986. }
  12987. protected function createDefaultInstallers(Installer\InstallationManager $im, Composer $composer, IOInterface $io)
  12988. {
  12989. $im->addInstaller(new Installer\LibraryInstaller($io, $composer, null));
  12990. $im->addInstaller(new Installer\PearInstaller($io, $composer, 'pear-library'));
  12991. $im->addInstaller(new Installer\PluginInstaller($io, $composer));
  12992. $im->addInstaller(new Installer\MetapackageInstaller($io));
  12993. }
  12994. protected function purgePackages(WritableRepositoryInterface $repo, Installer\InstallationManager $im)
  12995. {
  12996. foreach ($repo->getPackages() as $package) {
  12997. if (!$im->isPackageInstalled($repo, $package)) {
  12998. $repo->removePackage($package);
  12999. }
  13000. }
  13001. }
  13002. public static function create(IOInterface $io, $config = null, $disablePlugins = false)
  13003. {
  13004. $factory = new static();
  13005. return $factory->createComposer($io, $config, $disablePlugins);
  13006. }
  13007. public static function createRemoteFilesystem(IOInterface $io, Config $config = null, $options = array())
  13008. {
  13009. static $warned = false;
  13010. $disableTls = false;
  13011. if ($config && $config->get('disable-tls') === true) {
  13012. if (!$warned) {
  13013. $io->writeError('<warning>You are running Composer with SSL/TLS protection disabled.</warning>');
  13014. }
  13015. $warned = true;
  13016. $disableTls = true;
  13017. } elseif (!extension_loaded('openssl')) {
  13018. throw new Exception\NoSslException('The openssl extension is required for SSL/TLS protection but is not available. '
  13019. . '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.');
  13020. }
  13021. $remoteFilesystemOptions = array();
  13022. if ($disableTls === false) {
  13023. if ($config && $config->get('cafile')) {
  13024. $remoteFilesystemOptions['ssl']['cafile'] = $config->get('cafile');
  13025. }
  13026. if ($config && $config->get('capath')) {
  13027. $remoteFilesystemOptions['ssl']['capath'] = $config->get('capath');
  13028. }
  13029. $remoteFilesystemOptions = array_replace_recursive($remoteFilesystemOptions, $options);
  13030. }
  13031. try {
  13032. $remoteFilesystem = new RemoteFilesystem($io, $config, $remoteFilesystemOptions, $disableTls);
  13033. } catch (TransportException $e) {
  13034. if (false !== strpos($e->getMessage(), 'cafile')) {
  13035. $io->write('<error>Unable to locate a valid CA certificate file. You must set a valid \'cafile\' option.</error>');
  13036. $io->write('<error>A valid CA certificate file is required for SSL/TLS protection.</error>');
  13037. if (PHP_VERSION_ID < 50600) {
  13038. $io->write('<error>It is recommended you upgrade to PHP 5.6+ which can detect your system CA file automatically.</error>');
  13039. }
  13040. $io->write('<error>You can disable this error, at your own risk, by setting the \'disable-tls\' option to true.</error>');
  13041. }
  13042. throw $e;
  13043. }
  13044. return $remoteFilesystem;
  13045. }
  13046. private static function useXdg()
  13047. {
  13048. foreach (array_keys($_SERVER) as $key) {
  13049. if (substr($key, 0, 4) === 'XDG_') {
  13050. return true;
  13051. }
  13052. }
  13053. return false;
  13054. }
  13055. private static function getUserDir()
  13056. {
  13057. $home = getenv('HOME');
  13058. if (!$home) {
  13059. throw new \RuntimeException('The HOME or COMPOSER_HOME environment variable must be set for composer to run correctly');
  13060. }
  13061. return rtrim(strtr($home, '\\', '/'), '/');
  13062. }
  13063. }
  13064. <?php
  13065. namespace Composer\IO;
  13066. use Composer\Config;
  13067. use Composer\Util\ProcessExecutor;
  13068. use Psr\Log\LoggerInterface;
  13069. use Psr\Log\LogLevel;
  13070. abstract class BaseIO implements IOInterface, LoggerInterface
  13071. {
  13072. protected $authentications = array();
  13073. public function getAuthentications()
  13074. {
  13075. return $this->authentications;
  13076. }
  13077. public function resetAuthentications()
  13078. {
  13079. $this->authentications = array();
  13080. }
  13081. public function hasAuthentication($repositoryName)
  13082. {
  13083. return isset($this->authentications[$repositoryName]);
  13084. }
  13085. public function getAuthentication($repositoryName)
  13086. {
  13087. if (isset($this->authentications[$repositoryName])) {
  13088. return $this->authentications[$repositoryName];
  13089. }
  13090. return array('username' => null, 'password' => null);
  13091. }
  13092. public function setAuthentication($repositoryName, $username, $password = null)
  13093. {
  13094. $this->authentications[$repositoryName] = array('username' => $username, 'password' => $password);
  13095. }
  13096. protected function checkAndSetAuthentication($repositoryName, $username, $password = null)
  13097. {
  13098. if ($this->hasAuthentication($repositoryName)) {
  13099. $auth = $this->getAuthentication($repositoryName);
  13100. if ($auth['username'] === $username && $auth['password'] === $password) {
  13101. return;
  13102. }
  13103. $this->writeError(
  13104. sprintf(
  13105. "<warning>Warning: You should avoid overwriting already defined auth settings for %s.</warning>",
  13106. $repositoryName
  13107. )
  13108. );
  13109. }
  13110. $this->setAuthentication($repositoryName, $username, $password);
  13111. }
  13112. public function loadConfiguration(Config $config)
  13113. {
  13114. $bitbucketOauth = $config->get('bitbucket-oauth') ?: array();
  13115. $githubOauth = $config->get('github-oauth') ?: array();
  13116. $gitlabOauth = $config->get('gitlab-oauth') ?: array();
  13117. $gitlabToken = $config->get('gitlab-token') ?: array();
  13118. $httpBasic = $config->get('http-basic') ?: array();
  13119. foreach ($bitbucketOauth as $domain => $cred) {
  13120. $this->checkAndSetAuthentication($domain, $cred['consumer-key'], $cred['consumer-secret']);
  13121. }
  13122. foreach ($githubOauth as $domain => $token) {
  13123. if (!preg_match('{^[.a-z0-9]+$}', $token)) {
  13124. throw new \UnexpectedValueException('Your github oauth token for '.$domain.' contains invalid characters: "'.$token.'"');
  13125. }
  13126. $this->checkAndSetAuthentication($domain, $token, 'x-oauth-basic');
  13127. }
  13128. foreach ($gitlabOauth as $domain => $token) {
  13129. $this->checkAndSetAuthentication($domain, $token, 'oauth2');
  13130. }
  13131. foreach ($gitlabToken as $domain => $token) {
  13132. $this->checkAndSetAuthentication($domain, $token, 'private-token');
  13133. }
  13134. foreach ($httpBasic as $domain => $cred) {
  13135. $this->checkAndSetAuthentication($domain, $cred['username'], $cred['password']);
  13136. }
  13137. ProcessExecutor::setTimeout((int) $config->get('process-timeout'));
  13138. }
  13139. public function emergency($message, array $context = array())
  13140. {
  13141. return $this->log(LogLevel::EMERGENCY, $message, $context);
  13142. }
  13143. public function alert($message, array $context = array())
  13144. {
  13145. return $this->log(LogLevel::ALERT, $message, $context);
  13146. }
  13147. public function critical($message, array $context = array())
  13148. {
  13149. return $this->log(LogLevel::CRITICAL, $message, $context);
  13150. }
  13151. public function error($message, array $context = array())
  13152. {
  13153. return $this->log(LogLevel::ERROR, $message, $context);
  13154. }
  13155. public function warning($message, array $context = array())
  13156. {
  13157. return $this->log(LogLevel::WARNING, $message, $context);
  13158. }
  13159. public function notice($message, array $context = array())
  13160. {
  13161. return $this->log(LogLevel::NOTICE, $message, $context);
  13162. }
  13163. public function info($message, array $context = array())
  13164. {
  13165. return $this->log(LogLevel::INFO, $message, $context);
  13166. }
  13167. public function debug($message, array $context = array())
  13168. {
  13169. return $this->log(LogLevel::DEBUG, $message, $context);
  13170. }
  13171. public function log($level, $message, array $context = array())
  13172. {
  13173. if (in_array($level, array(LogLevel::EMERGENCY, LogLevel::ALERT, LogLevel::CRITICAL, LogLevel::ERROR))) {
  13174. $this->writeError('<error>'.$message.'</error>', true, self::NORMAL);
  13175. } elseif ($level === LogLevel::WARNING) {
  13176. $this->writeError('<warning>'.$message.'</warning>', true, self::NORMAL);
  13177. } elseif ($level === LogLevel::NOTICE) {
  13178. $this->writeError('<info>'.$message.'</info>', true, self::VERBOSE);
  13179. } elseif ($level === LogLevel::INFO) {
  13180. $this->writeError('<info>'.$message.'</info>', true, self::VERY_VERBOSE);
  13181. } else {
  13182. $this->writeError($message, true, self::DEBUG);
  13183. }
  13184. }
  13185. }
  13186. <?php
  13187. namespace Composer\IO;
  13188. use Symfony\Component\Console\Helper\QuestionHelper;
  13189. use Symfony\Component\Console\Output\StreamOutput;
  13190. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  13191. use Symfony\Component\Console\Input\StreamableInputInterface;
  13192. use Symfony\Component\Console\Input\StringInput;
  13193. use Symfony\Component\Console\Helper\HelperSet;
  13194. class BufferIO extends ConsoleIO
  13195. {
  13196. public function __construct($input = '', $verbosity = StreamOutput::VERBOSITY_NORMAL, OutputFormatterInterface $formatter = null)
  13197. {
  13198. $input = new StringInput($input);
  13199. $input->setInteractive(false);
  13200. $output = new StreamOutput(fopen('php://memory', 'rw'), $verbosity, $formatter ? $formatter->isDecorated() : false, $formatter);
  13201. parent::__construct($input, $output, new HelperSet(array(
  13202. new QuestionHelper(),
  13203. )));
  13204. }
  13205. public function getOutput()
  13206. {
  13207. fseek($this->output->getStream(), 0);
  13208. $output = stream_get_contents($this->output->getStream());
  13209. $output = preg_replace_callback("{(?<=^|\n|\x08)(.+?)(\x08+)}", function ($matches) {
  13210. $pre = strip_tags($matches[1]);
  13211. if (strlen($pre) === strlen($matches[2])) {
  13212. return '';
  13213. }
  13214. return rtrim($matches[1])."\n";
  13215. }, $output);
  13216. return $output;
  13217. }
  13218. public function setUserInputs(array $inputs)
  13219. {
  13220. if (!$this->input instanceof StreamableInputInterface) {
  13221. throw new \RuntimeException('Setting the user inputs requires at least the version 3.2 of the symfony/console component.');
  13222. }
  13223. $this->input->setStream($this->createStream($inputs));
  13224. $this->input->setInteractive(true);
  13225. }
  13226. private function createStream(array $inputs)
  13227. {
  13228. $stream = fopen('php://memory', 'r+', false);
  13229. foreach ($inputs as $input) {
  13230. fwrite($stream, $input.PHP_EOL);
  13231. }
  13232. rewind($stream);
  13233. return $stream;
  13234. }
  13235. }
  13236. <?php
  13237. namespace Composer\IO;
  13238. use Composer\Question\StrictConfirmationQuestion;
  13239. use Symfony\Component\Console\Helper\HelperSet;
  13240. use Symfony\Component\Console\Input\InputInterface;
  13241. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  13242. use Symfony\Component\Console\Output\OutputInterface;
  13243. use Symfony\Component\Console\Question\ChoiceQuestion;
  13244. use Symfony\Component\Console\Question\Question;
  13245. class ConsoleIO extends BaseIO
  13246. {
  13247. protected $input;
  13248. protected $output;
  13249. protected $helperSet;
  13250. protected $lastMessage;
  13251. protected $lastMessageErr;
  13252. private $startTime;
  13253. private $verbosityMap;
  13254. public function __construct(InputInterface $input, OutputInterface $output, HelperSet $helperSet)
  13255. {
  13256. $this->input = $input;
  13257. $this->output = $output;
  13258. $this->helperSet = $helperSet;
  13259. $this->verbosityMap = array(
  13260. self::QUIET => OutputInterface::VERBOSITY_QUIET,
  13261. self::NORMAL => OutputInterface::VERBOSITY_NORMAL,
  13262. self::VERBOSE => OutputInterface::VERBOSITY_VERBOSE,
  13263. self::VERY_VERBOSE => OutputInterface::VERBOSITY_VERY_VERBOSE,
  13264. self::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  13265. );
  13266. }
  13267. public function enableDebugging($startTime)
  13268. {
  13269. $this->startTime = $startTime;
  13270. }
  13271. public function isInteractive()
  13272. {
  13273. return $this->input->isInteractive();
  13274. }
  13275. public function isDecorated()
  13276. {
  13277. return $this->output->isDecorated();
  13278. }
  13279. public function isVerbose()
  13280. {
  13281. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE;
  13282. }
  13283. public function isVeryVerbose()
  13284. {
  13285. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERY_VERBOSE;
  13286. }
  13287. public function isDebug()
  13288. {
  13289. return $this->output->getVerbosity() >= OutputInterface::VERBOSITY_DEBUG;
  13290. }
  13291. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13292. {
  13293. $this->doWrite($messages, $newline, false, $verbosity);
  13294. }
  13295. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13296. {
  13297. $this->doWrite($messages, $newline, true, $verbosity);
  13298. }
  13299. private function doWrite($messages, $newline, $stderr, $verbosity)
  13300. {
  13301. $sfVerbosity = $this->verbosityMap[$verbosity];
  13302. if ($sfVerbosity > $this->output->getVerbosity()) {
  13303. return;
  13304. }
  13305. if (OutputInterface::VERBOSITY_QUIET === 0) {
  13306. $sfVerbosity = OutputInterface::OUTPUT_NORMAL;
  13307. }
  13308. if (null !== $this->startTime) {
  13309. $memoryUsage = memory_get_usage() / 1024 / 1024;
  13310. $timeSpent = microtime(true) - $this->startTime;
  13311. $messages = array_map(function ($message) use ($memoryUsage, $timeSpent) {
  13312. return sprintf('[%.1fMiB/%.2fs] %s', $memoryUsage, $timeSpent, $message);
  13313. }, (array) $messages);
  13314. }
  13315. if (true === $stderr && $this->output instanceof ConsoleOutputInterface) {
  13316. $this->output->getErrorOutput()->write($messages, $newline, $sfVerbosity);
  13317. $this->lastMessageErr = implode($newline ? "\n" : '', (array) $messages);
  13318. return;
  13319. }
  13320. $this->output->write($messages, $newline, $sfVerbosity);
  13321. $this->lastMessage = implode($newline ? "\n" : '', (array) $messages);
  13322. }
  13323. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13324. {
  13325. $this->doOverwrite($messages, $newline, $size, false, $verbosity);
  13326. }
  13327. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL)
  13328. {
  13329. $this->doOverwrite($messages, $newline, $size, true, $verbosity);
  13330. }
  13331. private function doOverwrite($messages, $newline, $size, $stderr, $verbosity)
  13332. {
  13333. $messages = implode($newline ? "\n" : '', (array) $messages);
  13334. if (!isset($size)) {
  13335. $size = strlen(strip_tags($stderr ? $this->lastMessageErr : $this->lastMessage));
  13336. }
  13337. $this->doWrite(str_repeat("\x08", $size), false, $stderr, $verbosity);
  13338. $this->doWrite($messages, false, $stderr, $verbosity);
  13339. $fill = $size - strlen(strip_tags($messages));
  13340. if ($fill > 0) {
  13341. $this->doWrite(str_repeat(' ', $fill), false, $stderr, $verbosity);
  13342. $this->doWrite(str_repeat("\x08", $fill), false, $stderr, $verbosity);
  13343. }
  13344. if ($newline) {
  13345. $this->doWrite('', true, $stderr, $verbosity);
  13346. }
  13347. if ($stderr) {
  13348. $this->lastMessageErr = $messages;
  13349. } else {
  13350. $this->lastMessage = $messages;
  13351. }
  13352. }
  13353. public function ask($question, $default = null)
  13354. {
  13355. $helper = $this->helperSet->get('question');
  13356. $question = new Question($question, $default);
  13357. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13358. }
  13359. public function askConfirmation($question, $default = true)
  13360. {
  13361. $helper = $this->helperSet->get('question');
  13362. $question = new StrictConfirmationQuestion($question, $default);
  13363. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13364. }
  13365. public function askAndValidate($question, $validator, $attempts = null, $default = null)
  13366. {
  13367. $helper = $this->helperSet->get('question');
  13368. $question = new Question($question, $default);
  13369. $question->setValidator($validator);
  13370. $question->setMaxAttempts($attempts);
  13371. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13372. }
  13373. public function askAndHideAnswer($question)
  13374. {
  13375. $helper = $this->helperSet->get('question');
  13376. $question = new Question($question);
  13377. $question->setHidden(true);
  13378. return $helper->ask($this->input, $this->getErrorOutput(), $question);
  13379. }
  13380. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13381. {
  13382. $helper = $this->helperSet->get('question');
  13383. $question = new ChoiceQuestion($question, $choices, $default);
  13384. $question->setMaxAttempts($attempts ?: null);
  13385. $question->setErrorMessage($errorMessage);
  13386. $question->setMultiselect($multiselect);
  13387. $result = $helper->ask($this->input, $this->getErrorOutput(), $question);
  13388. if (!is_array($result)) {
  13389. return (string) array_search($result, $choices, true);
  13390. }
  13391. $results = array();
  13392. foreach ($choices as $index => $choice) {
  13393. if (in_array($choice, $result, true)) {
  13394. $results[] = (string) $index;
  13395. }
  13396. }
  13397. return $results;
  13398. }
  13399. private function getErrorOutput()
  13400. {
  13401. if ($this->output instanceof ConsoleOutputInterface) {
  13402. return $this->output->getErrorOutput();
  13403. }
  13404. return $this->output;
  13405. }
  13406. }
  13407. <?php
  13408. namespace Composer\IO;
  13409. use Composer\Config;
  13410. interface IOInterface
  13411. {
  13412. const QUIET = 1;
  13413. const NORMAL = 2;
  13414. const VERBOSE = 4;
  13415. const VERY_VERBOSE = 8;
  13416. const DEBUG = 16;
  13417. public function isInteractive();
  13418. public function isVerbose();
  13419. public function isVeryVerbose();
  13420. public function isDebug();
  13421. public function isDecorated();
  13422. public function write($messages, $newline = true, $verbosity = self::NORMAL);
  13423. public function writeError($messages, $newline = true, $verbosity = self::NORMAL);
  13424. public function overwrite($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13425. public function overwriteError($messages, $newline = true, $size = null, $verbosity = self::NORMAL);
  13426. public function ask($question, $default = null);
  13427. public function askConfirmation($question, $default = true);
  13428. public function askAndValidate($question, $validator, $attempts = null, $default = null);
  13429. public function askAndHideAnswer($question);
  13430. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false);
  13431. public function getAuthentications();
  13432. public function hasAuthentication($repositoryName);
  13433. public function getAuthentication($repositoryName);
  13434. public function setAuthentication($repositoryName, $username, $password = null);
  13435. public function loadConfiguration(Config $config);
  13436. }
  13437. <?php
  13438. namespace Composer\IO;
  13439. class NullIO extends BaseIO
  13440. {
  13441. public function isInteractive()
  13442. {
  13443. return false;
  13444. }
  13445. public function isVerbose()
  13446. {
  13447. return false;
  13448. }
  13449. public function isVeryVerbose()
  13450. {
  13451. return false;
  13452. }
  13453. public function isDebug()
  13454. {
  13455. return false;
  13456. }
  13457. public function isDecorated()
  13458. {
  13459. return false;
  13460. }
  13461. public function write($messages, $newline = true, $verbosity = self::NORMAL)
  13462. {
  13463. }
  13464. public function writeError($messages, $newline = true, $verbosity = self::NORMAL)
  13465. {
  13466. }
  13467. public function overwrite($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13468. {
  13469. }
  13470. public function overwriteError($messages, $newline = true, $size = 80, $verbosity = self::NORMAL)
  13471. {
  13472. }
  13473. public function ask($question, $default = null)
  13474. {
  13475. return $default;
  13476. }
  13477. public function askConfirmation($question, $default = true)
  13478. {
  13479. return $default;
  13480. }
  13481. public function askAndValidate($question, $validator, $attempts = false, $default = null)
  13482. {
  13483. return $default;
  13484. }
  13485. public function askAndHideAnswer($question)
  13486. {
  13487. return null;
  13488. }
  13489. public function select($question, $choices, $default, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  13490. {
  13491. return $default;
  13492. }
  13493. }
  13494. <?php
  13495. namespace Composer;
  13496. use Composer\Autoload\AutoloadGenerator;
  13497. use Composer\DependencyResolver\DefaultPolicy;
  13498. use Composer\DependencyResolver\Operation\UpdateOperation;
  13499. use Composer\DependencyResolver\Operation\InstallOperation;
  13500. use Composer\DependencyResolver\Operation\UninstallOperation;
  13501. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  13502. use Composer\DependencyResolver\Operation\OperationInterface;
  13503. use Composer\DependencyResolver\PolicyInterface;
  13504. use Composer\DependencyResolver\Pool;
  13505. use Composer\DependencyResolver\Request;
  13506. use Composer\DependencyResolver\Rule;
  13507. use Composer\DependencyResolver\Solver;
  13508. use Composer\DependencyResolver\SolverProblemsException;
  13509. use Composer\Downloader\DownloadManager;
  13510. use Composer\EventDispatcher\EventDispatcher;
  13511. use Composer\Installer\InstallationManager;
  13512. use Composer\Installer\InstallerEvents;
  13513. use Composer\Installer\NoopInstaller;
  13514. use Composer\Installer\SuggestedPackagesReporter;
  13515. use Composer\IO\IOInterface;
  13516. use Composer\Package\AliasPackage;
  13517. use Composer\Package\BasePackage;
  13518. use Composer\Package\CompletePackage;
  13519. use Composer\Package\Link;
  13520. use Composer\Package\Loader\ArrayLoader;
  13521. use Composer\Package\Dumper\ArrayDumper;
  13522. use Composer\Semver\Constraint\Constraint;
  13523. use Composer\Package\Locker;
  13524. use Composer\Package\PackageInterface;
  13525. use Composer\Package\RootPackageInterface;
  13526. use Composer\Repository\CompositeRepository;
  13527. use Composer\Repository\InstalledArrayRepository;
  13528. use Composer\Repository\PlatformRepository;
  13529. use Composer\Repository\RepositoryInterface;
  13530. use Composer\Repository\RepositoryManager;
  13531. use Composer\Repository\WritableRepositoryInterface;
  13532. use Composer\Script\ScriptEvents;
  13533. class Installer
  13534. {
  13535. protected $io;
  13536. protected $config;
  13537. protected $package;
  13538. protected $downloadManager;
  13539. protected $repositoryManager;
  13540. protected $locker;
  13541. protected $installationManager;
  13542. protected $eventDispatcher;
  13543. protected $autoloadGenerator;
  13544. protected $preferSource = false;
  13545. protected $preferDist = false;
  13546. protected $optimizeAutoloader = false;
  13547. protected $classMapAuthoritative = false;
  13548. protected $apcuAutoloader = false;
  13549. protected $devMode = false;
  13550. protected $dryRun = false;
  13551. protected $verbose = false;
  13552. protected $update = false;
  13553. protected $dumpAutoloader = true;
  13554. protected $runScripts = true;
  13555. protected $ignorePlatformReqs = false;
  13556. protected $preferStable = false;
  13557. protected $preferLowest = false;
  13558. protected $skipSuggest = false;
  13559. protected $writeLock = true;
  13560. protected $executeOperations = true;
  13561. protected $updateWhitelist = null;
  13562. protected $whitelistDependencies = false;
  13563. protected $whitelistAllDependencies = false;
  13564. protected $suggestedPackagesReporter;
  13565. protected $additionalInstalledRepository;
  13566. public function __construct(IOInterface $io, Config $config, RootPackageInterface $package, DownloadManager $downloadManager, RepositoryManager $repositoryManager, Locker $locker, InstallationManager $installationManager, EventDispatcher $eventDispatcher, AutoloadGenerator $autoloadGenerator)
  13567. {
  13568. $this->io = $io;
  13569. $this->config = $config;
  13570. $this->package = $package;
  13571. $this->downloadManager = $downloadManager;
  13572. $this->repositoryManager = $repositoryManager;
  13573. $this->locker = $locker;
  13574. $this->installationManager = $installationManager;
  13575. $this->eventDispatcher = $eventDispatcher;
  13576. $this->autoloadGenerator = $autoloadGenerator;
  13577. }
  13578. public function run()
  13579. {
  13580. gc_collect_cycles();
  13581. gc_disable();
  13582. if (!$this->update && !$this->locker->isLocked()) {
  13583. $this->update = true;
  13584. }
  13585. if ($this->dryRun) {
  13586. $this->verbose = true;
  13587. $this->runScripts = false;
  13588. $this->executeOperations = false;
  13589. $this->writeLock = false;
  13590. $this->dumpAutoloader = false;
  13591. $this->installationManager->addInstaller(new NoopInstaller);
  13592. $this->mockLocalRepositories($this->repositoryManager);
  13593. }
  13594. if ($this->runScripts) {
  13595. $devMode = (int) $this->devMode;
  13596. putenv("COMPOSER_DEV_MODE=$devMode");
  13597. $eventName = $this->update ? ScriptEvents::PRE_UPDATE_CMD : ScriptEvents::PRE_INSTALL_CMD;
  13598. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13599. }
  13600. $this->downloadManager->setPreferSource($this->preferSource);
  13601. $this->downloadManager->setPreferDist($this->preferDist);
  13602. $localRepo = $this->repositoryManager->getLocalRepository();
  13603. if ($this->update) {
  13604. $platformOverrides = $this->config->get('platform') ?: array();
  13605. } else {
  13606. $platformOverrides = $this->locker->getPlatformOverrides();
  13607. }
  13608. $platformRepo = new PlatformRepository(array(), $platformOverrides);
  13609. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13610. $aliases = $this->getRootAliases();
  13611. $this->aliasPlatformPackages($platformRepo, $aliases);
  13612. if (!$this->suggestedPackagesReporter) {
  13613. $this->suggestedPackagesReporter = new SuggestedPackagesReporter($this->io);
  13614. }
  13615. try {
  13616. list($res, $devPackages) = $this->doInstall($localRepo, $installedRepo, $platformRepo, $aliases);
  13617. if ($res !== 0) {
  13618. return $res;
  13619. }
  13620. } catch (\Exception $e) {
  13621. if ($this->executeOperations) {
  13622. $this->installationManager->notifyInstalls($this->io);
  13623. }
  13624. throw $e;
  13625. }
  13626. if ($this->executeOperations) {
  13627. $this->installationManager->notifyInstalls($this->io);
  13628. }
  13629. if ($this->devMode && !$this->skipSuggest) {
  13630. $this->suggestedPackagesReporter->output($installedRepo);
  13631. }
  13632. foreach ($localRepo->getPackages() as $package) {
  13633. if (!$package instanceof CompletePackage || !$package->isAbandoned()) {
  13634. continue;
  13635. }
  13636. $replacement = is_string($package->getReplacementPackage())
  13637. ? 'Use ' . $package->getReplacementPackage() . ' instead'
  13638. : 'No replacement was suggested';
  13639. $this->io->writeError(
  13640. sprintf(
  13641. "<warning>Package %s is abandoned, you should avoid using it. %s.</warning>",
  13642. $package->getPrettyName(),
  13643. $replacement
  13644. )
  13645. );
  13646. }
  13647. if ($this->update && $this->writeLock) {
  13648. $localRepo->reload();
  13649. $platformReqs = $this->extractPlatformRequirements($this->package->getRequires());
  13650. $platformDevReqs = $this->extractPlatformRequirements($this->package->getDevRequires());
  13651. $updatedLock = $this->locker->setLockData(
  13652. array_diff($localRepo->getCanonicalPackages(), $devPackages),
  13653. $devPackages,
  13654. $platformReqs,
  13655. $platformDevReqs,
  13656. $aliases,
  13657. $this->package->getMinimumStability(),
  13658. $this->package->getStabilityFlags(),
  13659. $this->preferStable || $this->package->getPreferStable(),
  13660. $this->preferLowest,
  13661. $this->config->get('platform') ?: array()
  13662. );
  13663. if ($updatedLock) {
  13664. $this->io->writeError('<info>Writing lock file</info>');
  13665. }
  13666. }
  13667. if ($this->dumpAutoloader) {
  13668. if ($this->optimizeAutoloader) {
  13669. $this->io->writeError('<info>Generating optimized autoload files</info>');
  13670. } else {
  13671. $this->io->writeError('<info>Generating autoload files</info>');
  13672. }
  13673. $this->autoloadGenerator->setDevMode($this->devMode);
  13674. $this->autoloadGenerator->setClassMapAuthoritative($this->classMapAuthoritative);
  13675. $this->autoloadGenerator->setApcu($this->apcuAutoloader);
  13676. $this->autoloadGenerator->setRunScripts($this->runScripts);
  13677. $this->autoloadGenerator->dump($this->config, $localRepo, $this->package, $this->installationManager, 'composer', $this->optimizeAutoloader);
  13678. }
  13679. if ($this->executeOperations) {
  13680. foreach ($localRepo->getPackages() as $package) {
  13681. $this->installationManager->ensureBinariesPresence($package);
  13682. }
  13683. $vendorDir = $this->config->get('vendor-dir');
  13684. if (is_dir($vendorDir)) {
  13685. @touch($vendorDir);
  13686. }
  13687. }
  13688. if ($this->runScripts) {
  13689. $eventName = $this->update ? ScriptEvents::POST_UPDATE_CMD : ScriptEvents::POST_INSTALL_CMD;
  13690. $this->eventDispatcher->dispatchScript($eventName, $this->devMode);
  13691. }
  13692. if (!defined('HHVM_VERSION')) {
  13693. gc_enable();
  13694. }
  13695. return 0;
  13696. }
  13697. protected function doInstall($localRepo, $installedRepo, $platformRepo, $aliases)
  13698. {
  13699. $lockedRepository = null;
  13700. $repositories = null;
  13701. if (!$this->update || (!empty($this->updateWhitelist) && $this->locker->isLocked())) {
  13702. try {
  13703. $lockedRepository = $this->locker->getLockedRepository($this->devMode);
  13704. } catch (\RuntimeException $e) {
  13705. if ($this->package->getDevRequires()) {
  13706. throw $e;
  13707. }
  13708. $lockedRepository = $this->locker->getLockedRepository();
  13709. }
  13710. }
  13711. $this->whitelistUpdateDependencies(
  13712. $lockedRepository ?: $localRepo,
  13713. $this->package->getRequires(),
  13714. $this->package->getDevRequires()
  13715. );
  13716. $this->io->writeError('<info>Loading composer repositories with package information</info>');
  13717. $policy = $this->createPolicy();
  13718. $pool = $this->createPool($this->update ? null : $lockedRepository);
  13719. $pool->addRepository($installedRepo, $aliases);
  13720. if ($this->update) {
  13721. $repositories = $this->repositoryManager->getRepositories();
  13722. foreach ($repositories as $repository) {
  13723. $pool->addRepository($repository, $aliases);
  13724. }
  13725. }
  13726. if ($lockedRepository) {
  13727. $pool->addRepository($lockedRepository, $aliases);
  13728. }
  13729. $request = $this->createRequest($this->package, $platformRepo);
  13730. if ($this->update) {
  13731. $removedUnstablePackages = array();
  13732. foreach ($localRepo->getPackages() as $package) {
  13733. if (
  13734. !$pool->isPackageAcceptable($package->getNames(), $package->getStability())
  13735. && $this->installationManager->isPackageInstalled($localRepo, $package)
  13736. ) {
  13737. $removedUnstablePackages[$package->getName()] = true;
  13738. $request->remove($package->getName(), new Constraint('=', $package->getVersion()));
  13739. }
  13740. }
  13741. $this->io->writeError('<info>Updating dependencies'.($this->devMode ? ' (including require-dev)' : '').'</info>');
  13742. $request->updateAll();
  13743. $links = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  13744. foreach ($links as $link) {
  13745. $request->install($link->getTarget(), $link->getConstraint());
  13746. }
  13747. if ($this->updateWhitelist) {
  13748. $currentPackages = $this->getCurrentPackages($installedRepo);
  13749. $candidates = array();
  13750. foreach ($links as $link) {
  13751. $candidates[$link->getTarget()] = true;
  13752. $rootRequires[$link->getTarget()] = $link;
  13753. }
  13754. foreach ($currentPackages as $package) {
  13755. $candidates[$package->getName()] = true;
  13756. }
  13757. foreach ($candidates as $candidate => $dummy) {
  13758. foreach ($currentPackages as $curPackage) {
  13759. if ($curPackage->getName() === $candidate) {
  13760. if (!$this->isUpdateable($curPackage) && !isset($removedUnstablePackages[$curPackage->getName()])) {
  13761. $constraint = new Constraint('=', $curPackage->getVersion());
  13762. $description = $this->locker->isLocked() ? '(locked at' : '(installed at';
  13763. $requiredAt = isset($rootRequires[$candidate]) ? ', required as ' . $rootRequires[$candidate]->getPrettyConstraint() : '';
  13764. $constraint->setPrettyString($description . ' ' . $curPackage->getPrettyVersion() . $requiredAt . ')');
  13765. $request->install($curPackage->getName(), $constraint);
  13766. }
  13767. break;
  13768. }
  13769. }
  13770. }
  13771. }
  13772. } else {
  13773. $this->io->writeError('<info>Installing dependencies'.($this->devMode ? ' (including require-dev)' : '').' from lock file</info>');
  13774. if (!$this->locker->isFresh()) {
  13775. $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. Run update to update them.</warning>', true, IOInterface::QUIET);
  13776. }
  13777. foreach ($lockedRepository->getPackages() as $package) {
  13778. $version = $package->getVersion();
  13779. if (isset($aliases[$package->getName()][$version])) {
  13780. $version = $aliases[$package->getName()][$version]['alias_normalized'];
  13781. }
  13782. $constraint = new Constraint('=', $version);
  13783. $constraint->setPrettyString($package->getPrettyVersion());
  13784. $request->install($package->getName(), $constraint);
  13785. }
  13786. foreach ($this->locker->getPlatformRequirements($this->devMode) as $link) {
  13787. $request->install($link->getTarget(), $link->getConstraint());
  13788. }
  13789. }
  13790. $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-links');
  13791. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request);
  13792. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13793. try {
  13794. $operations = $solver->solve($request, $this->ignorePlatformReqs);
  13795. $ruleSetSize = $solver->getRuleSetSize();
  13796. $solver = null;
  13797. } catch (SolverProblemsException $e) {
  13798. $this->io->writeError('<error>Your requirements could not be resolved to an installable set of packages.</error>', true, IOInterface::QUIET);
  13799. $this->io->writeError($e->getMessage());
  13800. if ($this->update && !$this->devMode) {
  13801. $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);
  13802. }
  13803. return array(max(1, $e->getCode()), array());
  13804. }
  13805. $operations = $this->processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, 'force-updates', $operations);
  13806. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, $this->devMode, $policy, $pool, $installedRepo, $request, $operations);
  13807. $this->io->writeError("Analyzed ".count($pool)." packages to resolve dependencies", true, IOInterface::VERBOSE);
  13808. $this->io->writeError("Analyzed ".$ruleSetSize." rules to resolve dependencies", true, IOInterface::VERBOSE);
  13809. if (!$operations) {
  13810. $this->io->writeError('Nothing to install or update');
  13811. }
  13812. $operations = $this->movePluginsToFront($operations);
  13813. $operations = $this->moveUninstallsToFront($operations);
  13814. if ($this->update) {
  13815. $devPackages = $this->extractDevPackages($operations, $localRepo, $platformRepo, $aliases);
  13816. if (!$this->devMode) {
  13817. $operations = $this->filterDevPackageOperations($devPackages, $operations, $localRepo);
  13818. }
  13819. } else {
  13820. $devPackages = null;
  13821. }
  13822. if ($operations) {
  13823. $installs = $updates = $uninstalls = array();
  13824. foreach ($operations as $operation) {
  13825. if ($operation instanceof InstallOperation) {
  13826. $installs[] = $operation->getPackage()->getPrettyName().':'.$operation->getPackage()->getFullPrettyVersion();
  13827. } elseif ($operation instanceof UpdateOperation) {
  13828. $updates[] = $operation->getTargetPackage()->getPrettyName().':'.$operation->getTargetPackage()->getFullPrettyVersion();
  13829. } elseif ($operation instanceof UninstallOperation) {
  13830. $uninstalls[] = $operation->getPackage()->getPrettyName();
  13831. }
  13832. }
  13833. $this->io->writeError(sprintf(
  13834. "<info>Package operations: %d install%s, %d update%s, %d removal%s</info>",
  13835. count($installs),
  13836. 1 === count($installs) ? '' : 's',
  13837. count($updates),
  13838. 1 === count($updates) ? '' : 's',
  13839. count($uninstalls),
  13840. 1 === count($uninstalls) ? '' : 's'
  13841. ));
  13842. if ($installs) {
  13843. $this->io->writeError("Installs: ".implode(', ', $installs), true, IOInterface::VERBOSE);
  13844. }
  13845. if ($updates) {
  13846. $this->io->writeError("Updates: ".implode(', ', $updates), true, IOInterface::VERBOSE);
  13847. }
  13848. if ($uninstalls) {
  13849. $this->io->writeError("Removals: ".implode(', ', $uninstalls), true, IOInterface::VERBOSE);
  13850. }
  13851. }
  13852. foreach ($operations as $operation) {
  13853. $jobType = $operation->getJobType();
  13854. if ('install' === $jobType) {
  13855. $this->suggestedPackagesReporter->addSuggestionsFromPackage($operation->getPackage());
  13856. }
  13857. if ($this->update) {
  13858. $package = null;
  13859. if ('update' === $jobType) {
  13860. $package = $operation->getTargetPackage();
  13861. } elseif ('install' === $jobType) {
  13862. $package = $operation->getPackage();
  13863. }
  13864. if ($package && $package->isDev()) {
  13865. $references = $this->package->getReferences();
  13866. if (isset($references[$package->getName()])) {
  13867. $this->updateInstallReferences($package, $references[$package->getName()]);
  13868. }
  13869. }
  13870. if ('update' === $jobType) {
  13871. $targetPackage = $operation->getTargetPackage();
  13872. if ($targetPackage->isDev()) {
  13873. $initialPackage = $operation->getInitialPackage();
  13874. if ($targetPackage->getVersion() === $initialPackage->getVersion()
  13875. && (!$targetPackage->getSourceReference() || $targetPackage->getSourceReference() === $initialPackage->getSourceReference())
  13876. && (!$targetPackage->getDistReference() || $targetPackage->getDistReference() === $initialPackage->getDistReference())
  13877. ) {
  13878. $this->io->writeError(' - Skipping update of ' . $targetPackage->getPrettyName() . ' to the same reference-locked version', true, IOInterface::DEBUG);
  13879. $this->io->writeError('', true, IOInterface::DEBUG);
  13880. continue;
  13881. }
  13882. }
  13883. }
  13884. }
  13885. $event = 'Composer\Installer\PackageEvents::PRE_PACKAGE_'.strtoupper($jobType);
  13886. if (defined($event) && $this->runScripts) {
  13887. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13888. }
  13889. if (!$this->executeOperations && false === strpos($operation->getJobType(), 'Alias')) {
  13890. $this->io->writeError(' - ' . $operation);
  13891. } elseif ($this->io->isDebug() && false !== strpos($operation->getJobType(), 'Alias')) {
  13892. $this->io->writeError(' - ' . $operation);
  13893. }
  13894. $this->installationManager->execute($localRepo, $operation);
  13895. if ($this->verbose && $this->io->isVeryVerbose() && in_array($jobType, array('install', 'update'))) {
  13896. $reason = $operation->getReason();
  13897. if ($reason instanceof Rule) {
  13898. switch ($reason->getReason()) {
  13899. case Rule::RULE_JOB_INSTALL:
  13900. $this->io->writeError(' REASON: Required by the root package: '.$reason->getPrettyString($pool));
  13901. $this->io->writeError('');
  13902. break;
  13903. case Rule::RULE_PACKAGE_REQUIRES:
  13904. $this->io->writeError(' REASON: '.$reason->getPrettyString($pool));
  13905. $this->io->writeError('');
  13906. break;
  13907. }
  13908. }
  13909. }
  13910. if ($this->executeOperations || $this->writeLock) {
  13911. $localRepo->write();
  13912. }
  13913. $event = 'Composer\Installer\PackageEvents::POST_PACKAGE_'.strtoupper($jobType);
  13914. if (defined($event) && $this->runScripts) {
  13915. $this->eventDispatcher->dispatchPackageEvent(constant($event), $this->devMode, $policy, $pool, $installedRepo, $request, $operations, $operation);
  13916. }
  13917. }
  13918. if ($this->executeOperations) {
  13919. $this->processPackageUrls($pool, $policy, $localRepo, $repositories);
  13920. $localRepo->write();
  13921. }
  13922. return array(0, $devPackages);
  13923. }
  13924. private function extractDevPackages(array $operations, RepositoryInterface $localRepo, PlatformRepository $platformRepo, array $aliases)
  13925. {
  13926. if (!$this->package->getDevRequires()) {
  13927. return array();
  13928. }
  13929. $tempLocalRepo = clone $localRepo;
  13930. foreach ($operations as $operation) {
  13931. switch ($operation->getJobType()) {
  13932. case 'install':
  13933. case 'markAliasInstalled':
  13934. if (!$tempLocalRepo->hasPackage($operation->getPackage())) {
  13935. $tempLocalRepo->addPackage(clone $operation->getPackage());
  13936. }
  13937. break;
  13938. case 'uninstall':
  13939. case 'markAliasUninstalled':
  13940. $tempLocalRepo->removePackage($operation->getPackage());
  13941. break;
  13942. case 'update':
  13943. $tempLocalRepo->removePackage($operation->getInitialPackage());
  13944. if (!$tempLocalRepo->hasPackage($operation->getTargetPackage())) {
  13945. $tempLocalRepo->addPackage(clone $operation->getTargetPackage());
  13946. }
  13947. break;
  13948. default:
  13949. throw new \LogicException('Unknown type: '.$operation->getJobType());
  13950. }
  13951. }
  13952. $localRepo = new InstalledArrayRepository(array());
  13953. $loader = new ArrayLoader(null, true);
  13954. $dumper = new ArrayDumper();
  13955. foreach ($tempLocalRepo->getCanonicalPackages() as $pkg) {
  13956. $localRepo->addPackage($loader->load($dumper->dump($pkg)));
  13957. }
  13958. unset($tempLocalRepo, $loader, $dumper);
  13959. $policy = $this->createPolicy();
  13960. $pool = $this->createPool();
  13961. $installedRepo = $this->createInstalledRepo($localRepo, $platformRepo);
  13962. $pool->addRepository($installedRepo, $aliases);
  13963. $request = $this->createRequest($this->package, $platformRepo);
  13964. $request->updateAll();
  13965. foreach ($this->package->getRequires() as $link) {
  13966. $request->install($link->getTarget(), $link->getConstraint());
  13967. }
  13968. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::PRE_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request);
  13969. $solver = new Solver($policy, $pool, $installedRepo, $this->io);
  13970. $ops = $solver->solve($request, $this->ignorePlatformReqs);
  13971. $this->eventDispatcher->dispatchInstallerEvent(InstallerEvents::POST_DEPENDENCIES_SOLVING, false, $policy, $pool, $installedRepo, $request, $ops);
  13972. $devPackages = array();
  13973. foreach ($ops as $op) {
  13974. if ($op->getJobType() === 'uninstall') {
  13975. $devPackages[] = $op->getPackage();
  13976. }
  13977. }
  13978. return $devPackages;
  13979. }
  13980. private function filterDevPackageOperations(array $devPackages, array $operations, RepositoryInterface $localRepo)
  13981. {
  13982. $finalOps = array();
  13983. $packagesToSkip = array();
  13984. foreach ($devPackages as $pkg) {
  13985. $packagesToSkip[$pkg->getName()] = true;
  13986. if ($installedDevPkg = $localRepo->findPackage($pkg->getName(), '*')) {
  13987. if ($installedDevPkg instanceof AliasPackage) {
  13988. $finalOps[] = new MarkAliasUninstalledOperation($installedDevPkg, 'non-dev install removing it');
  13989. $installedDevPkg = $installedDevPkg->getAliasOf();
  13990. }
  13991. $finalOps[] = new UninstallOperation($installedDevPkg, 'non-dev install removing it');
  13992. }
  13993. }
  13994. foreach ($operations as $op) {
  13995. $package = $op->getJobType() === 'update' ? $op->getTargetPackage() : $op->getPackage();
  13996. if (isset($packagesToSkip[$package->getName()])) {
  13997. continue;
  13998. }
  13999. $finalOps[] = $op;
  14000. }
  14001. return $finalOps;
  14002. }
  14003. private function movePluginsToFront(array $operations)
  14004. {
  14005. $pluginsNoDeps = array();
  14006. $pluginsWithDeps = array();
  14007. $pluginRequires = array();
  14008. foreach (array_reverse($operations, true) as $idx => $op) {
  14009. if ($op instanceof InstallOperation) {
  14010. $package = $op->getPackage();
  14011. } elseif ($op instanceof UpdateOperation) {
  14012. $package = $op->getTargetPackage();
  14013. } else {
  14014. continue;
  14015. }
  14016. $isPlugin = $package->getType() === 'composer-plugin' || $package->getType() === 'composer-installer';
  14017. if ($isPlugin || count(array_intersect($package->getNames(), $pluginRequires))) {
  14018. $requires = array_filter(array_keys($package->getRequires()), function ($req) {
  14019. return $req !== 'composer-plugin-api' && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req);
  14020. });
  14021. if ($isPlugin && !count($requires)) {
  14022. array_unshift($pluginsNoDeps, $op);
  14023. } else {
  14024. $pluginRequires = array_merge($pluginRequires, $requires);
  14025. array_unshift($pluginsWithDeps, $op);
  14026. }
  14027. unset($operations[$idx]);
  14028. }
  14029. }
  14030. return array_merge($pluginsNoDeps, $pluginsWithDeps, $operations);
  14031. }
  14032. private function moveUninstallsToFront(array $operations)
  14033. {
  14034. $uninstOps = array();
  14035. foreach ($operations as $idx => $op) {
  14036. if ($op instanceof UninstallOperation) {
  14037. $uninstOps[] = $op;
  14038. unset($operations[$idx]);
  14039. }
  14040. }
  14041. return array_merge($uninstOps, $operations);
  14042. }
  14043. private function createInstalledRepo(RepositoryInterface $localRepo, PlatformRepository $platformRepo)
  14044. {
  14045. $installedRootPackage = clone $this->package;
  14046. $installedRootPackage->setRequires(array());
  14047. $installedRootPackage->setDevRequires(array());
  14048. $repos = array(
  14049. $localRepo,
  14050. new InstalledArrayRepository(array($installedRootPackage)),
  14051. $platformRepo,
  14052. );
  14053. $installedRepo = new CompositeRepository($repos);
  14054. if ($this->additionalInstalledRepository) {
  14055. $installedRepo->addRepository($this->additionalInstalledRepository);
  14056. }
  14057. return $installedRepo;
  14058. }
  14059. private function createPool(RepositoryInterface $lockedRepository = null)
  14060. {
  14061. if ($this->update) {
  14062. $minimumStability = $this->package->getMinimumStability();
  14063. $stabilityFlags = $this->package->getStabilityFlags();
  14064. $requires = array_merge($this->package->getRequires(), $this->package->getDevRequires());
  14065. } else {
  14066. $minimumStability = $this->locker->getMinimumStability();
  14067. $stabilityFlags = $this->locker->getStabilityFlags();
  14068. $requires = array();
  14069. foreach ($lockedRepository->getPackages() as $package) {
  14070. $constraint = new Constraint('=', $package->getVersion());
  14071. $constraint->setPrettyString($package->getPrettyVersion());
  14072. $requires[$package->getName()] = $constraint;
  14073. }
  14074. }
  14075. $rootConstraints = array();
  14076. foreach ($requires as $req => $constraint) {
  14077. if ($this->ignorePlatformReqs && preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $req)) {
  14078. continue;
  14079. }
  14080. if ($constraint instanceof Link) {
  14081. $rootConstraints[$req] = $constraint->getConstraint();
  14082. } else {
  14083. $rootConstraints[$req] = $constraint;
  14084. }
  14085. }
  14086. return new Pool($minimumStability, $stabilityFlags, $rootConstraints);
  14087. }
  14088. private function createPolicy()
  14089. {
  14090. $preferStable = null;
  14091. $preferLowest = null;
  14092. if (!$this->update) {
  14093. $preferStable = $this->locker->getPreferStable();
  14094. $preferLowest = $this->locker->getPreferLowest();
  14095. }
  14096. if (null === $preferStable) {
  14097. $preferStable = $this->preferStable || $this->package->getPreferStable();
  14098. }
  14099. if (null === $preferLowest) {
  14100. $preferLowest = $this->preferLowest;
  14101. }
  14102. return new DefaultPolicy($preferStable, $preferLowest);
  14103. }
  14104. private function createRequest(RootPackageInterface $rootPackage, PlatformRepository $platformRepo)
  14105. {
  14106. $request = new Request();
  14107. $constraint = new Constraint('=', $rootPackage->getVersion());
  14108. $constraint->setPrettyString($rootPackage->getPrettyVersion());
  14109. $request->install($rootPackage->getName(), $constraint);
  14110. $fixedPackages = $platformRepo->getPackages();
  14111. if ($this->additionalInstalledRepository) {
  14112. $additionalFixedPackages = $this->additionalInstalledRepository->getPackages();
  14113. $fixedPackages = array_merge($fixedPackages, $additionalFixedPackages);
  14114. }
  14115. $provided = $rootPackage->getProvides();
  14116. foreach ($fixedPackages as $package) {
  14117. $constraint = new Constraint('=', $package->getVersion());
  14118. $constraint->setPrettyString($package->getPrettyVersion());
  14119. if ($package->getRepository() !== $platformRepo
  14120. || !isset($provided[$package->getName()])
  14121. || !$provided[$package->getName()]->getConstraint()->matches($constraint)
  14122. ) {
  14123. $request->fix($package->getName(), $constraint);
  14124. }
  14125. }
  14126. return $request;
  14127. }
  14128. private function processDevPackages($localRepo, $pool, $policy, $repositories, $installedRepo, $lockedRepository, $task, array $operations = null)
  14129. {
  14130. if ($task === 'force-updates' && null === $operations) {
  14131. throw new \InvalidArgumentException('Missing operations argument');
  14132. }
  14133. if ($task === 'force-links') {
  14134. $operations = array();
  14135. }
  14136. if ($this->update && $this->updateWhitelist) {
  14137. $currentPackages = $this->getCurrentPackages($installedRepo);
  14138. }
  14139. foreach ($localRepo->getCanonicalPackages() as $package) {
  14140. if (!$package->isDev()) {
  14141. continue;
  14142. }
  14143. foreach ($operations as $operation) {
  14144. if (('update' === $operation->getJobType() && $operation->getInitialPackage()->equals($package))
  14145. || ('uninstall' === $operation->getJobType() && $operation->getPackage()->equals($package))
  14146. ) {
  14147. continue 2;
  14148. }
  14149. }
  14150. if ($this->update) {
  14151. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14152. foreach ($currentPackages as $curPackage) {
  14153. if ($curPackage->isDev() && $curPackage->getName() === $package->getName() && $curPackage->getVersion() === $package->getVersion()) {
  14154. if ($task === 'force-links') {
  14155. $package->setRequires($curPackage->getRequires());
  14156. $package->setConflicts($curPackage->getConflicts());
  14157. $package->setProvides($curPackage->getProvides());
  14158. $package->setReplaces($curPackage->getReplaces());
  14159. } elseif ($task === 'force-updates') {
  14160. if (($curPackage->getSourceReference() && $curPackage->getSourceReference() !== $package->getSourceReference())
  14161. || ($curPackage->getDistReference() && $curPackage->getDistReference() !== $package->getDistReference())
  14162. ) {
  14163. $operations[] = new UpdateOperation($package, $curPackage);
  14164. }
  14165. }
  14166. break;
  14167. }
  14168. }
  14169. continue;
  14170. }
  14171. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14172. foreach ($matches as $index => $match) {
  14173. if (!in_array($match->getRepository(), $repositories, true)) {
  14174. unset($matches[$index]);
  14175. continue;
  14176. }
  14177. if ($match->getName() !== $package->getName()) {
  14178. unset($matches[$index]);
  14179. continue;
  14180. }
  14181. $matches[$index] = $match->getId();
  14182. }
  14183. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14184. $newPackage = $pool->literalToPackage($matches[0]);
  14185. if ($task === 'force-links' && $newPackage) {
  14186. $package->setRequires($newPackage->getRequires());
  14187. $package->setConflicts($newPackage->getConflicts());
  14188. $package->setProvides($newPackage->getProvides());
  14189. $package->setReplaces($newPackage->getReplaces());
  14190. }
  14191. if (
  14192. $task === 'force-updates'
  14193. && $newPackage
  14194. && (
  14195. ($newPackage->getSourceReference() && $newPackage->getSourceReference() !== $package->getSourceReference())
  14196. || ($newPackage->getDistReference() && $newPackage->getDistReference() !== $package->getDistReference())
  14197. )
  14198. ) {
  14199. $operations[] = new UpdateOperation($package, $newPackage);
  14200. continue;
  14201. }
  14202. }
  14203. if ($task === 'force-updates') {
  14204. $references = $this->package->getReferences();
  14205. if (isset($references[$package->getName()]) && $references[$package->getName()] !== $package->getSourceReference()) {
  14206. $operations[] = new UpdateOperation($package, clone $package);
  14207. }
  14208. }
  14209. } else {
  14210. foreach ($lockedRepository->findPackages($package->getName()) as $lockedPackage) {
  14211. if ($lockedPackage->isDev() && $lockedPackage->getVersion() === $package->getVersion()) {
  14212. if ($task === 'force-links') {
  14213. $package->setRequires($lockedPackage->getRequires());
  14214. $package->setConflicts($lockedPackage->getConflicts());
  14215. $package->setProvides($lockedPackage->getProvides());
  14216. $package->setReplaces($lockedPackage->getReplaces());
  14217. } elseif ($task === 'force-updates') {
  14218. if (($lockedPackage->getSourceReference() && $lockedPackage->getSourceReference() !== $package->getSourceReference())
  14219. || ($lockedPackage->getDistReference() && $lockedPackage->getDistReference() !== $package->getDistReference())
  14220. ) {
  14221. $operations[] = new UpdateOperation($package, $lockedPackage);
  14222. }
  14223. }
  14224. break;
  14225. }
  14226. }
  14227. }
  14228. }
  14229. return $operations;
  14230. }
  14231. private function getCurrentPackages($installedRepo)
  14232. {
  14233. if ($this->locker->isLocked()) {
  14234. try {
  14235. return $this->locker->getLockedRepository(true)->getPackages();
  14236. } catch (\RuntimeException $e) {
  14237. return $this->locker->getLockedRepository()->getPackages();
  14238. }
  14239. }
  14240. return $installedRepo->getPackages();
  14241. }
  14242. private function getRootAliases()
  14243. {
  14244. if ($this->update) {
  14245. $aliases = $this->package->getAliases();
  14246. } else {
  14247. $aliases = $this->locker->getAliases();
  14248. }
  14249. $normalizedAliases = array();
  14250. foreach ($aliases as $alias) {
  14251. $normalizedAliases[$alias['package']][$alias['version']] = array(
  14252. 'alias' => $alias['alias'],
  14253. 'alias_normalized' => $alias['alias_normalized'],
  14254. );
  14255. }
  14256. return $normalizedAliases;
  14257. }
  14258. private function processPackageUrls($pool, $policy, $localRepo, $repositories)
  14259. {
  14260. if (!$this->update) {
  14261. return;
  14262. }
  14263. $rootRefs = $this->package->getReferences();
  14264. foreach ($localRepo->getCanonicalPackages() as $package) {
  14265. $matches = $pool->whatProvides($package->getName(), new Constraint('=', $package->getVersion()));
  14266. foreach ($matches as $index => $match) {
  14267. if (!in_array($match->getRepository(), $repositories, true)) {
  14268. unset($matches[$index]);
  14269. continue;
  14270. }
  14271. if ($match->getName() !== $package->getName()) {
  14272. unset($matches[$index]);
  14273. continue;
  14274. }
  14275. $matches[$index] = $match->getId();
  14276. }
  14277. if ($matches && $matches = $policy->selectPreferredPackages($pool, array(), $matches)) {
  14278. $newPackage = $pool->literalToPackage($matches[0]);
  14279. $sourceUrl = $package->getSourceUrl();
  14280. $newSourceUrl = $newPackage->getSourceUrl();
  14281. $newReference = $newPackage->getSourceReference();
  14282. if ($package->isDev() && isset($rootRefs[$package->getName()]) && $package->getSourceReference() === $rootRefs[$package->getName()]) {
  14283. $newReference = $rootRefs[$package->getName()];
  14284. }
  14285. $this->updatePackageUrl($package, $newSourceUrl, $newPackage->getSourceType(), $newReference, $newPackage->getDistUrl(), $newPackage->getDistType(), $newPackage->getDistSha1Checksum());
  14286. if ($package instanceof CompletePackage && $newPackage instanceof CompletePackage) {
  14287. $package->setAbandoned($newPackage->getReplacementPackage() ?: $newPackage->isAbandoned());
  14288. }
  14289. $package->setDistMirrors($newPackage->getDistMirrors());
  14290. $package->setSourceMirrors($newPackage->getSourceMirrors());
  14291. $package->setTransportOptions($newPackage->getTransportOptions());
  14292. }
  14293. }
  14294. }
  14295. private function updatePackageUrl(PackageInterface $package, $sourceUrl, $sourceType, $sourceReference, $distUrl, $distType, $distShaSum)
  14296. {
  14297. $oldSourceRef = $package->getSourceReference();
  14298. if ($package->getSourceUrl() !== $sourceUrl) {
  14299. $package->setSourceType($sourceType);
  14300. $package->setSourceUrl($sourceUrl);
  14301. $package->setSourceReference($sourceReference);
  14302. }
  14303. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $distUrl)) {
  14304. $package->setDistUrl($distUrl);
  14305. $package->setDistType($distType);
  14306. $package->setDistSha1Checksum($distShaSum);
  14307. $this->updateInstallReferences($package, $sourceReference);
  14308. }
  14309. if ($this->updateWhitelist && !$this->isUpdateable($package)) {
  14310. $this->updateInstallReferences($package, $oldSourceRef);
  14311. }
  14312. }
  14313. private function updateInstallReferences(PackageInterface $package, $reference)
  14314. {
  14315. if (!$reference) {
  14316. return;
  14317. }
  14318. $package->setSourceReference($reference);
  14319. if (preg_match('{^https?://(?:(?:www\.)?bitbucket\.org|(api\.)?github\.com|(?:www\.)?gitlab\.com)/}i', $package->getDistUrl())) {
  14320. $package->setDistReference($reference);
  14321. $package->setDistUrl(preg_replace('{(?<=/|sha=)[a-f0-9]{40}(?=/|$)}i', $reference, $package->getDistUrl()));
  14322. } elseif ($package->getDistReference()) {
  14323. $package->setDistReference($reference);
  14324. }
  14325. }
  14326. private function aliasPlatformPackages(PlatformRepository $platformRepo, $aliases)
  14327. {
  14328. foreach ($aliases as $package => $versions) {
  14329. foreach ($versions as $version => $alias) {
  14330. $packages = $platformRepo->findPackages($package, $version);
  14331. foreach ($packages as $package) {
  14332. $aliasPackage = new AliasPackage($package, $alias['alias_normalized'], $alias['alias']);
  14333. $aliasPackage->setRootPackageAlias(true);
  14334. $platformRepo->addPackage($aliasPackage);
  14335. }
  14336. }
  14337. }
  14338. }
  14339. private function isUpdateable(PackageInterface $package)
  14340. {
  14341. if (!$this->updateWhitelist) {
  14342. throw new \LogicException('isUpdateable should only be called when a whitelist is present');
  14343. }
  14344. foreach ($this->updateWhitelist as $whiteListedPattern => $void) {
  14345. $patternRegexp = BasePackage::packageNameToRegexp($whiteListedPattern);
  14346. if (preg_match($patternRegexp, $package->getName())) {
  14347. return true;
  14348. }
  14349. }
  14350. return false;
  14351. }
  14352. private function extractPlatformRequirements($links)
  14353. {
  14354. $platformReqs = array();
  14355. foreach ($links as $link) {
  14356. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  14357. $platformReqs[$link->getTarget()] = $link->getPrettyConstraint();
  14358. }
  14359. }
  14360. return $platformReqs;
  14361. }
  14362. private function whitelistUpdateDependencies($localOrLockRepo, array $rootRequires, array $rootDevRequires)
  14363. {
  14364. if (!$this->updateWhitelist) {
  14365. return;
  14366. }
  14367. $rootRequires = array_merge($rootRequires, $rootDevRequires);
  14368. $skipPackages = array();
  14369. if (!$this->whitelistAllDependencies) {
  14370. foreach ($rootRequires as $require) {
  14371. $skipPackages[$require->getTarget()] = true;
  14372. }
  14373. }
  14374. $pool = new Pool('dev');
  14375. $pool->addRepository($localOrLockRepo);
  14376. $seen = array();
  14377. $rootRequiredPackageNames = array_keys($rootRequires);
  14378. foreach ($this->updateWhitelist as $packageName => $void) {
  14379. $packageQueue = new \SplQueue;
  14380. $nameMatchesRequiredPackage = false;
  14381. $depPackages = $pool->whatProvides($packageName);
  14382. $matchesByPattern = array();
  14383. if (empty($depPackages)) {
  14384. $whitelistPatternSearchRegexp = BasePackage::packageNameToRegexp($packageName, '^%s$');
  14385. foreach ($localOrLockRepo->search($whitelistPatternSearchRegexp) as $installedPackage) {
  14386. $matchesByPattern[] = $pool->whatProvides($installedPackage['name']);
  14387. }
  14388. $whitelistPatternRegexp = BasePackage::packageNameToRegexp($packageName);
  14389. foreach ($rootRequiredPackageNames as $rootRequiredPackageName) {
  14390. if (preg_match($whitelistPatternRegexp, $rootRequiredPackageName)) {
  14391. $nameMatchesRequiredPackage = true;
  14392. break;
  14393. }
  14394. }
  14395. }
  14396. if (!empty($matchesByPattern)) {
  14397. $depPackages = array_merge($depPackages, call_user_func_array('array_merge', $matchesByPattern));
  14398. }
  14399. if (count($depPackages) == 0 && !$nameMatchesRequiredPackage && !in_array($packageName, array('nothing', 'lock', 'mirrors'))) {
  14400. $this->io->writeError('<warning>Package "' . $packageName . '" listed for update is not installed. Ignoring.</warning>');
  14401. }
  14402. foreach ($depPackages as $depPackage) {
  14403. $packageQueue->enqueue($depPackage);
  14404. }
  14405. while (!$packageQueue->isEmpty()) {
  14406. $package = $packageQueue->dequeue();
  14407. if (isset($seen[$package->getId()])) {
  14408. continue;
  14409. }
  14410. $seen[$package->getId()] = true;
  14411. $this->updateWhitelist[$package->getName()] = true;
  14412. if (!$this->whitelistDependencies && !$this->whitelistAllDependencies) {
  14413. continue;
  14414. }
  14415. $requires = $package->getRequires();
  14416. foreach ($requires as $require) {
  14417. $requirePackages = $pool->whatProvides($require->getTarget());
  14418. foreach ($requirePackages as $requirePackage) {
  14419. if (isset($this->updateWhitelist[$requirePackage->getName()])) {
  14420. continue;
  14421. }
  14422. if (isset($skipPackages[$requirePackage->getName()]) && !preg_match(BasePackage::packageNameToRegexp($packageName), $requirePackage->getName())) {
  14423. $this->io->writeError('<warning>Dependency "' . $requirePackage->getName() . '" is also a root requirement, but is not explicitly whitelisted. Ignoring.</warning>');
  14424. continue;
  14425. }
  14426. $packageQueue->enqueue($requirePackage);
  14427. }
  14428. }
  14429. }
  14430. }
  14431. }
  14432. private function mockLocalRepositories(RepositoryManager $rm)
  14433. {
  14434. $packages = array();
  14435. foreach ($rm->getLocalRepository()->getPackages() as $package) {
  14436. $packages[(string) $package] = clone $package;
  14437. }
  14438. foreach ($packages as $key => $package) {
  14439. if ($package instanceof AliasPackage) {
  14440. $alias = (string) $package->getAliasOf();
  14441. $packages[$key] = new AliasPackage($packages[$alias], $package->getVersion(), $package->getPrettyVersion());
  14442. }
  14443. }
  14444. $rm->setLocalRepository(
  14445. new InstalledArrayRepository($packages)
  14446. );
  14447. }
  14448. public static function create(IOInterface $io, Composer $composer)
  14449. {
  14450. return new static(
  14451. $io,
  14452. $composer->getConfig(),
  14453. $composer->getPackage(),
  14454. $composer->getDownloadManager(),
  14455. $composer->getRepositoryManager(),
  14456. $composer->getLocker(),
  14457. $composer->getInstallationManager(),
  14458. $composer->getEventDispatcher(),
  14459. $composer->getAutoloadGenerator()
  14460. );
  14461. }
  14462. public function setAdditionalInstalledRepository(RepositoryInterface $additionalInstalledRepository)
  14463. {
  14464. $this->additionalInstalledRepository = $additionalInstalledRepository;
  14465. return $this;
  14466. }
  14467. public function setDryRun($dryRun = true)
  14468. {
  14469. $this->dryRun = (bool) $dryRun;
  14470. return $this;
  14471. }
  14472. public function isDryRun()
  14473. {
  14474. return $this->dryRun;
  14475. }
  14476. public function setPreferSource($preferSource = true)
  14477. {
  14478. $this->preferSource = (bool) $preferSource;
  14479. return $this;
  14480. }
  14481. public function setPreferDist($preferDist = true)
  14482. {
  14483. $this->preferDist = (bool) $preferDist;
  14484. return $this;
  14485. }
  14486. public function setOptimizeAutoloader($optimizeAutoloader = false)
  14487. {
  14488. $this->optimizeAutoloader = (bool) $optimizeAutoloader;
  14489. if (!$this->optimizeAutoloader) {
  14490. $this->setClassMapAuthoritative(false);
  14491. }
  14492. return $this;
  14493. }
  14494. public function setClassMapAuthoritative($classMapAuthoritative = false)
  14495. {
  14496. $this->classMapAuthoritative = (bool) $classMapAuthoritative;
  14497. if ($this->classMapAuthoritative) {
  14498. $this->setOptimizeAutoloader(true);
  14499. }
  14500. return $this;
  14501. }
  14502. public function setApcuAutoloader($apcuAutoloader = false)
  14503. {
  14504. $this->apcuAutoloader = (bool) $apcuAutoloader;
  14505. return $this;
  14506. }
  14507. public function setUpdate($update = true)
  14508. {
  14509. $this->update = (bool) $update;
  14510. return $this;
  14511. }
  14512. public function setDevMode($devMode = true)
  14513. {
  14514. $this->devMode = (bool) $devMode;
  14515. return $this;
  14516. }
  14517. public function setDumpAutoloader($dumpAutoloader = true)
  14518. {
  14519. $this->dumpAutoloader = (bool) $dumpAutoloader;
  14520. return $this;
  14521. }
  14522. public function setRunScripts($runScripts = true)
  14523. {
  14524. $this->runScripts = (bool) $runScripts;
  14525. return $this;
  14526. }
  14527. public function setConfig(Config $config)
  14528. {
  14529. $this->config = $config;
  14530. return $this;
  14531. }
  14532. public function setVerbose($verbose = true)
  14533. {
  14534. $this->verbose = (bool) $verbose;
  14535. return $this;
  14536. }
  14537. public function isVerbose()
  14538. {
  14539. return $this->verbose;
  14540. }
  14541. public function setIgnorePlatformRequirements($ignorePlatformReqs = false)
  14542. {
  14543. $this->ignorePlatformReqs = (bool) $ignorePlatformReqs;
  14544. return $this;
  14545. }
  14546. public function setUpdateWhitelist(array $packages)
  14547. {
  14548. $this->updateWhitelist = array_flip(array_map('strtolower', $packages));
  14549. return $this;
  14550. }
  14551. public function setWhitelistDependencies($updateDependencies = true)
  14552. {
  14553. return $this->setWhitelistTransitiveDependencies($updateDependencies);
  14554. }
  14555. public function setWhitelistTransitiveDependencies($updateTransitiveDependencies = true)
  14556. {
  14557. $this->whitelistDependencies = (bool) $updateTransitiveDependencies;
  14558. return $this;
  14559. }
  14560. public function setWhitelistAllDependencies($updateAllDependencies = true)
  14561. {
  14562. $this->whitelistAllDependencies = (bool) $updateAllDependencies;
  14563. return $this;
  14564. }
  14565. public function setPreferStable($preferStable = true)
  14566. {
  14567. $this->preferStable = (bool) $preferStable;
  14568. return $this;
  14569. }
  14570. public function setPreferLowest($preferLowest = true)
  14571. {
  14572. $this->preferLowest = (bool) $preferLowest;
  14573. return $this;
  14574. }
  14575. public function setWriteLock($writeLock = true)
  14576. {
  14577. $this->writeLock = (bool) $writeLock;
  14578. return $this;
  14579. }
  14580. public function setExecuteOperations($executeOperations = true)
  14581. {
  14582. $this->executeOperations = (bool) $executeOperations;
  14583. return $this;
  14584. }
  14585. public function setSkipSuggest($skipSuggest = true)
  14586. {
  14587. $this->skipSuggest = (bool) $skipSuggest;
  14588. return $this;
  14589. }
  14590. public function disablePlugins()
  14591. {
  14592. $this->installationManager->disablePlugins();
  14593. return $this;
  14594. }
  14595. public function setSuggestedPackagesReporter(SuggestedPackagesReporter $suggestedPackagesReporter)
  14596. {
  14597. $this->suggestedPackagesReporter = $suggestedPackagesReporter;
  14598. return $this;
  14599. }
  14600. }
  14601. <?php
  14602. namespace Composer\Installer;
  14603. use Composer\IO\IOInterface;
  14604. use Composer\Package\PackageInterface;
  14605. use Composer\Util\Filesystem;
  14606. use Composer\Util\Platform;
  14607. use Composer\Util\ProcessExecutor;
  14608. use Composer\Util\Silencer;
  14609. class BinaryInstaller
  14610. {
  14611. protected $binDir;
  14612. protected $binCompat;
  14613. protected $io;
  14614. protected $filesystem;
  14615. public function __construct(IOInterface $io, $binDir, $binCompat, Filesystem $filesystem = null)
  14616. {
  14617. $this->binDir = $binDir;
  14618. $this->binCompat = $binCompat;
  14619. $this->io = $io;
  14620. $this->filesystem = $filesystem ?: new Filesystem();
  14621. }
  14622. public function installBinaries(PackageInterface $package, $installPath, $warnOnOverwrite = true)
  14623. {
  14624. $binaries = $this->getBinaries($package);
  14625. if (!$binaries) {
  14626. return;
  14627. }
  14628. foreach ($binaries as $bin) {
  14629. $binPath = $installPath.'/'.$bin;
  14630. if (!file_exists($binPath)) {
  14631. $this->io->writeError(' <warning>Skipped installation of bin '.$bin.' for package '.$package->getName().': file not found in package</warning>');
  14632. continue;
  14633. }
  14634. $binPath = realpath($binPath);
  14635. $this->initializeBinDir();
  14636. $link = $this->binDir.'/'.basename($bin);
  14637. if (file_exists($link)) {
  14638. if (is_link($link)) {
  14639. Silencer::call('chmod', $link, 0777 & ~umask());
  14640. }
  14641. if ($warnOnOverwrite) {
  14642. $this->io->writeError(' Skipped installation of bin '.$bin.' for package '.$package->getName().': name conflicts with an existing file');
  14643. }
  14644. continue;
  14645. }
  14646. if ($this->binCompat === "auto") {
  14647. if (Platform::isWindows()) {
  14648. $this->installFullBinaries($binPath, $link, $bin, $package);
  14649. } else {
  14650. $this->installSymlinkBinaries($binPath, $link);
  14651. }
  14652. } elseif ($this->binCompat === "full") {
  14653. $this->installFullBinaries($binPath, $link, $bin, $package);
  14654. }
  14655. Silencer::call('chmod', $link, 0777 & ~umask());
  14656. }
  14657. }
  14658. public function removeBinaries(PackageInterface $package)
  14659. {
  14660. $this->initializeBinDir();
  14661. $binaries = $this->getBinaries($package);
  14662. if (!$binaries) {
  14663. return;
  14664. }
  14665. foreach ($binaries as $bin) {
  14666. $link = $this->binDir.'/'.basename($bin);
  14667. if (is_link($link) || file_exists($link)) {
  14668. $this->filesystem->unlink($link);
  14669. }
  14670. if (file_exists($link.'.bat')) {
  14671. $this->filesystem->unlink($link.'.bat');
  14672. }
  14673. }
  14674. if (is_dir($this->binDir) && $this->filesystem->isDirEmpty($this->binDir)) {
  14675. Silencer::call('rmdir', $this->binDir);
  14676. }
  14677. }
  14678. public static function determineBinaryCaller($bin)
  14679. {
  14680. if ('.bat' === substr($bin, -4) || '.exe' === substr($bin, -4)) {
  14681. return 'call';
  14682. }
  14683. $handle = fopen($bin, 'r');
  14684. $line = fgets($handle);
  14685. fclose($handle);
  14686. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  14687. return trim($match[1]);
  14688. }
  14689. return 'php';
  14690. }
  14691. protected function getBinaries(PackageInterface $package)
  14692. {
  14693. return $package->getBinaries();
  14694. }
  14695. protected function installFullBinaries($binPath, $link, $bin, PackageInterface $package)
  14696. {
  14697. if ('.bat' !== substr($binPath, -4)) {
  14698. $this->installUnixyProxyBinaries($binPath, $link);
  14699. @chmod($link, 0777 & ~umask());
  14700. $link .= '.bat';
  14701. if (file_exists($link)) {
  14702. $this->io->writeError(' Skipped installation of bin '.$bin.'.bat proxy for package '.$package->getName().': a .bat proxy was already installed');
  14703. }
  14704. }
  14705. if (!file_exists($link)) {
  14706. file_put_contents($link, $this->generateWindowsProxyCode($binPath, $link));
  14707. }
  14708. }
  14709. protected function installSymlinkBinaries($binPath, $link)
  14710. {
  14711. if (!$this->filesystem->relativeSymlink($binPath, $link)) {
  14712. $this->installUnixyProxyBinaries($binPath, $link);
  14713. }
  14714. }
  14715. protected function installUnixyProxyBinaries($binPath, $link)
  14716. {
  14717. file_put_contents($link, $this->generateUnixyProxyCode($binPath, $link));
  14718. }
  14719. protected function initializeBinDir()
  14720. {
  14721. $this->filesystem->ensureDirectoryExists($this->binDir);
  14722. $this->binDir = realpath($this->binDir);
  14723. }
  14724. protected function generateWindowsProxyCode($bin, $link)
  14725. {
  14726. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14727. $caller = self::determineBinaryCaller($bin);
  14728. return "@ECHO OFF\r\n".
  14729. "setlocal DISABLEDELAYEDEXPANSION\r\n".
  14730. "SET BIN_TARGET=%~dp0/".trim(ProcessExecutor::escape($binPath), '"\'')."\r\n".
  14731. "{$caller} \"%BIN_TARGET%\" %*\r\n";
  14732. }
  14733. protected function generateUnixyProxyCode($bin, $link)
  14734. {
  14735. $binPath = $this->filesystem->findShortestPath($link, $bin);
  14736. $binDir = ProcessExecutor::escape(dirname($binPath));
  14737. $binFile = basename($binPath);
  14738. $proxyCode = <<<PROXY
  14739. #!/usr/bin/env sh
  14740. dir=\$(cd "\${0%[/\\\\]*}" > /dev/null; cd $binDir && pwd)
  14741. if [ -d /proc/cygdrive ]; then
  14742. case \$(which php) in
  14743. \$(readlink -n /proc/cygdrive)/*)
  14744. # We are in Cygwin using Windows php, so the path must be translated
  14745. dir=\$(cygpath -m "\$dir");
  14746. ;;
  14747. esac
  14748. fi
  14749. "\${dir}/$binFile" "\$@"
  14750. PROXY;
  14751. return $proxyCode;
  14752. }
  14753. }
  14754. <?php
  14755. namespace Composer\Installer;
  14756. use Composer\Package\PackageInterface;
  14757. interface BinaryPresenceInterface
  14758. {
  14759. public function ensureBinariesPresence(PackageInterface $package);
  14760. }
  14761. <?php
  14762. namespace Composer\Installer;
  14763. use Composer\IO\IOInterface;
  14764. use Composer\Package\PackageInterface;
  14765. use Composer\Package\AliasPackage;
  14766. use Composer\Repository\RepositoryInterface;
  14767. use Composer\Repository\InstalledRepositoryInterface;
  14768. use Composer\DependencyResolver\Operation\OperationInterface;
  14769. use Composer\DependencyResolver\Operation\InstallOperation;
  14770. use Composer\DependencyResolver\Operation\UpdateOperation;
  14771. use Composer\DependencyResolver\Operation\UninstallOperation;
  14772. use Composer\DependencyResolver\Operation\MarkAliasInstalledOperation;
  14773. use Composer\DependencyResolver\Operation\MarkAliasUninstalledOperation;
  14774. use Composer\Util\StreamContextFactory;
  14775. class InstallationManager
  14776. {
  14777. private $installers = array();
  14778. private $cache = array();
  14779. private $notifiablePackages = array();
  14780. public function reset()
  14781. {
  14782. $this->notifiablePackages = array();
  14783. }
  14784. public function addInstaller(InstallerInterface $installer)
  14785. {
  14786. array_unshift($this->installers, $installer);
  14787. $this->cache = array();
  14788. }
  14789. public function removeInstaller(InstallerInterface $installer)
  14790. {
  14791. if (false !== ($key = array_search($installer, $this->installers, true))) {
  14792. array_splice($this->installers, $key, 1);
  14793. $this->cache = array();
  14794. }
  14795. }
  14796. public function disablePlugins()
  14797. {
  14798. foreach ($this->installers as $i => $installer) {
  14799. if (!$installer instanceof PluginInstaller) {
  14800. continue;
  14801. }
  14802. unset($this->installers[$i]);
  14803. }
  14804. }
  14805. public function getInstaller($type)
  14806. {
  14807. $type = strtolower($type);
  14808. if (isset($this->cache[$type])) {
  14809. return $this->cache[$type];
  14810. }
  14811. foreach ($this->installers as $installer) {
  14812. if ($installer->supports($type)) {
  14813. return $this->cache[$type] = $installer;
  14814. }
  14815. }
  14816. throw new \InvalidArgumentException('Unknown installer type: '.$type);
  14817. }
  14818. public function isPackageInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  14819. {
  14820. if ($package instanceof AliasPackage) {
  14821. return $repo->hasPackage($package) && $this->isPackageInstalled($repo, $package->getAliasOf());
  14822. }
  14823. return $this->getInstaller($package->getType())->isInstalled($repo, $package);
  14824. }
  14825. public function ensureBinariesPresence(PackageInterface $package)
  14826. {
  14827. try {
  14828. $installer = $this->getInstaller($package->getType());
  14829. } catch (\InvalidArgumentException $e) {
  14830. return;
  14831. }
  14832. if ($installer instanceof BinaryPresenceInterface) {
  14833. $installer->ensureBinariesPresence($package);
  14834. }
  14835. }
  14836. public function execute(RepositoryInterface $repo, OperationInterface $operation)
  14837. {
  14838. $method = $operation->getJobType();
  14839. $this->$method($repo, $operation);
  14840. }
  14841. public function install(RepositoryInterface $repo, InstallOperation $operation)
  14842. {
  14843. $package = $operation->getPackage();
  14844. $installer = $this->getInstaller($package->getType());
  14845. $installer->install($repo, $package);
  14846. $this->markForNotification($package);
  14847. }
  14848. public function update(RepositoryInterface $repo, UpdateOperation $operation)
  14849. {
  14850. $initial = $operation->getInitialPackage();
  14851. $target = $operation->getTargetPackage();
  14852. $initialType = $initial->getType();
  14853. $targetType = $target->getType();
  14854. if ($initialType === $targetType) {
  14855. $installer = $this->getInstaller($initialType);
  14856. $installer->update($repo, $initial, $target);
  14857. $this->markForNotification($target);
  14858. } else {
  14859. $this->getInstaller($initialType)->uninstall($repo, $initial);
  14860. $this->getInstaller($targetType)->install($repo, $target);
  14861. }
  14862. }
  14863. public function uninstall(RepositoryInterface $repo, UninstallOperation $operation)
  14864. {
  14865. $package = $operation->getPackage();
  14866. $installer = $this->getInstaller($package->getType());
  14867. $installer->uninstall($repo, $package);
  14868. }
  14869. public function markAliasInstalled(RepositoryInterface $repo, MarkAliasInstalledOperation $operation)
  14870. {
  14871. $package = $operation->getPackage();
  14872. if (!$repo->hasPackage($package)) {
  14873. $repo->addPackage(clone $package);
  14874. }
  14875. }
  14876. public function markAliasUninstalled(RepositoryInterface $repo, MarkAliasUninstalledOperation $operation)
  14877. {
  14878. $package = $operation->getPackage();
  14879. $repo->removePackage($package);
  14880. }
  14881. public function getInstallPath(PackageInterface $package)
  14882. {
  14883. $installer = $this->getInstaller($package->getType());
  14884. return $installer->getInstallPath($package);
  14885. }
  14886. public function notifyInstalls(IOInterface $io)
  14887. {
  14888. foreach ($this->notifiablePackages as $repoUrl => $packages) {
  14889. $repositoryName = parse_url($repoUrl, PHP_URL_HOST);
  14890. if ($io->hasAuthentication($repositoryName)) {
  14891. $auth = $io->getAuthentication($repositoryName);
  14892. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  14893. $authHeader = 'Authorization: Basic '.$authStr;
  14894. }
  14895. if (strpos($repoUrl, '%package%')) {
  14896. foreach ($packages as $package) {
  14897. $url = str_replace('%package%', $package->getPrettyName(), $repoUrl);
  14898. $params = array(
  14899. 'version' => $package->getPrettyVersion(),
  14900. 'version_normalized' => $package->getVersion(),
  14901. );
  14902. $opts = array('http' =>
  14903. array(
  14904. 'method' => 'POST',
  14905. 'header' => array('Content-type: application/x-www-form-urlencoded'),
  14906. 'content' => http_build_query($params, '', '&'),
  14907. 'timeout' => 3,
  14908. ),
  14909. );
  14910. if (isset($authHeader)) {
  14911. $opts['http']['header'][] = $authHeader;
  14912. }
  14913. $context = StreamContextFactory::getContext($url, $opts);
  14914. @file_get_contents($url, false, $context);
  14915. }
  14916. continue;
  14917. }
  14918. $postData = array('downloads' => array());
  14919. foreach ($packages as $package) {
  14920. $postData['downloads'][] = array(
  14921. 'name' => $package->getPrettyName(),
  14922. 'version' => $package->getVersion(),
  14923. );
  14924. }
  14925. $opts = array('http' =>
  14926. array(
  14927. 'method' => 'POST',
  14928. 'header' => array('Content-Type: application/json'),
  14929. 'content' => json_encode($postData),
  14930. 'timeout' => 6,
  14931. ),
  14932. );
  14933. if (isset($authHeader)) {
  14934. $opts['http']['header'][] = $authHeader;
  14935. }
  14936. $context = StreamContextFactory::getContext($repoUrl, $opts);
  14937. @file_get_contents($repoUrl, false, $context);
  14938. }
  14939. $this->reset();
  14940. }
  14941. private function markForNotification(PackageInterface $package)
  14942. {
  14943. if ($package->getNotificationUrl()) {
  14944. $this->notifiablePackages[$package->getNotificationUrl()][$package->getName()] = $package;
  14945. }
  14946. }
  14947. }
  14948. <?php
  14949. namespace Composer\Installer;
  14950. use Composer\Composer;
  14951. use Composer\DependencyResolver\PolicyInterface;
  14952. use Composer\DependencyResolver\Operation\OperationInterface;
  14953. use Composer\DependencyResolver\Pool;
  14954. use Composer\DependencyResolver\Request;
  14955. use Composer\EventDispatcher\Event;
  14956. use Composer\IO\IOInterface;
  14957. use Composer\Repository\CompositeRepository;
  14958. class InstallerEvent extends Event
  14959. {
  14960. private $composer;
  14961. private $io;
  14962. private $devMode;
  14963. private $policy;
  14964. private $pool;
  14965. private $installedRepo;
  14966. private $request;
  14967. private $operations;
  14968. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations = array())
  14969. {
  14970. parent::__construct($eventName);
  14971. $this->composer = $composer;
  14972. $this->io = $io;
  14973. $this->devMode = $devMode;
  14974. $this->policy = $policy;
  14975. $this->pool = $pool;
  14976. $this->installedRepo = $installedRepo;
  14977. $this->request = $request;
  14978. $this->operations = $operations;
  14979. }
  14980. public function getComposer()
  14981. {
  14982. return $this->composer;
  14983. }
  14984. public function getIO()
  14985. {
  14986. return $this->io;
  14987. }
  14988. public function isDevMode()
  14989. {
  14990. return $this->devMode;
  14991. }
  14992. public function getPolicy()
  14993. {
  14994. return $this->policy;
  14995. }
  14996. public function getPool()
  14997. {
  14998. return $this->pool;
  14999. }
  15000. public function getInstalledRepo()
  15001. {
  15002. return $this->installedRepo;
  15003. }
  15004. public function getRequest()
  15005. {
  15006. return $this->request;
  15007. }
  15008. public function getOperations()
  15009. {
  15010. return $this->operations;
  15011. }
  15012. }
  15013. <?php
  15014. namespace Composer\Installer;
  15015. class InstallerEvents
  15016. {
  15017. const PRE_DEPENDENCIES_SOLVING = 'pre-dependencies-solving';
  15018. const POST_DEPENDENCIES_SOLVING = 'post-dependencies-solving';
  15019. }
  15020. <?php
  15021. namespace Composer\Installer;
  15022. use Composer\Package\PackageInterface;
  15023. use Composer\Repository\InstalledRepositoryInterface;
  15024. use InvalidArgumentException;
  15025. interface InstallerInterface
  15026. {
  15027. public function supports($packageType);
  15028. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package);
  15029. public function install(InstalledRepositoryInterface $repo, PackageInterface $package);
  15030. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target);
  15031. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package);
  15032. public function getInstallPath(PackageInterface $package);
  15033. }
  15034. <?php
  15035. namespace Composer\Installer;
  15036. use Composer\Composer;
  15037. use Composer\IO\IOInterface;
  15038. use Composer\Repository\InstalledRepositoryInterface;
  15039. use Composer\Package\PackageInterface;
  15040. use Composer\Util\Filesystem;
  15041. use Composer\Util\Silencer;
  15042. use Composer\Util\Platform;
  15043. class LibraryInstaller implements InstallerInterface, BinaryPresenceInterface
  15044. {
  15045. protected $composer;
  15046. protected $vendorDir;
  15047. protected $binDir;
  15048. protected $downloadManager;
  15049. protected $io;
  15050. protected $type;
  15051. protected $filesystem;
  15052. protected $binCompat;
  15053. protected $binaryInstaller;
  15054. public function __construct(IOInterface $io, Composer $composer, $type = 'library', Filesystem $filesystem = null, BinaryInstaller $binaryInstaller = null)
  15055. {
  15056. $this->composer = $composer;
  15057. $this->downloadManager = $composer->getDownloadManager();
  15058. $this->io = $io;
  15059. $this->type = $type;
  15060. $this->filesystem = $filesystem ?: new Filesystem();
  15061. $this->vendorDir = rtrim($composer->getConfig()->get('vendor-dir'), '/');
  15062. $this->binaryInstaller = $binaryInstaller ?: new BinaryInstaller($this->io, rtrim($composer->getConfig()->get('bin-dir'), '/'), $composer->getConfig()->get('bin-compat'), $this->filesystem);
  15063. }
  15064. public function supports($packageType)
  15065. {
  15066. return $packageType === $this->type || null === $this->type;
  15067. }
  15068. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15069. {
  15070. if (!$repo->hasPackage($package)) {
  15071. return false;
  15072. }
  15073. $installPath = $this->getInstallPath($package);
  15074. if (is_readable($installPath)) {
  15075. return true;
  15076. }
  15077. return (Platform::isWindows() && $this->filesystem->isJunction($installPath)) || is_link($installPath);
  15078. }
  15079. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15080. {
  15081. $this->initializeVendorDir();
  15082. $downloadPath = $this->getInstallPath($package);
  15083. if (!is_readable($downloadPath) && $repo->hasPackage($package)) {
  15084. $this->binaryInstaller->removeBinaries($package);
  15085. }
  15086. $this->installCode($package);
  15087. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package));
  15088. if (!$repo->hasPackage($package)) {
  15089. $repo->addPackage(clone $package);
  15090. }
  15091. }
  15092. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15093. {
  15094. if (!$repo->hasPackage($initial)) {
  15095. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15096. }
  15097. $this->initializeVendorDir();
  15098. $this->binaryInstaller->removeBinaries($initial);
  15099. $this->updateCode($initial, $target);
  15100. $this->binaryInstaller->installBinaries($target, $this->getInstallPath($target));
  15101. $repo->removePackage($initial);
  15102. if (!$repo->hasPackage($target)) {
  15103. $repo->addPackage(clone $target);
  15104. }
  15105. }
  15106. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15107. {
  15108. if (!$repo->hasPackage($package)) {
  15109. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15110. }
  15111. $this->removeCode($package);
  15112. $this->binaryInstaller->removeBinaries($package);
  15113. $repo->removePackage($package);
  15114. $downloadPath = $this->getPackageBasePath($package);
  15115. if (strpos($package->getName(), '/')) {
  15116. $packageVendorDir = dirname($downloadPath);
  15117. if (is_dir($packageVendorDir) && $this->filesystem->isDirEmpty($packageVendorDir)) {
  15118. Silencer::call('rmdir', $packageVendorDir);
  15119. }
  15120. }
  15121. }
  15122. public function getInstallPath(PackageInterface $package)
  15123. {
  15124. $this->initializeVendorDir();
  15125. $basePath = ($this->vendorDir ? $this->vendorDir.'/' : '') . $package->getPrettyName();
  15126. $targetDir = $package->getTargetDir();
  15127. return $basePath . ($targetDir ? '/'.$targetDir : '');
  15128. }
  15129. public function ensureBinariesPresence(PackageInterface $package)
  15130. {
  15131. $this->binaryInstaller->installBinaries($package, $this->getInstallPath($package), false);
  15132. }
  15133. protected function getPackageBasePath(PackageInterface $package)
  15134. {
  15135. $installPath = $this->getInstallPath($package);
  15136. $targetDir = $package->getTargetDir();
  15137. if ($targetDir) {
  15138. return preg_replace('{/*'.str_replace('/', '/+', preg_quote($targetDir)).'/?$}', '', $installPath);
  15139. }
  15140. return $installPath;
  15141. }
  15142. protected function installCode(PackageInterface $package)
  15143. {
  15144. $downloadPath = $this->getInstallPath($package);
  15145. $this->downloadManager->download($package, $downloadPath);
  15146. }
  15147. protected function updateCode(PackageInterface $initial, PackageInterface $target)
  15148. {
  15149. $initialDownloadPath = $this->getInstallPath($initial);
  15150. $targetDownloadPath = $this->getInstallPath($target);
  15151. if ($targetDownloadPath !== $initialDownloadPath) {
  15152. if (substr($initialDownloadPath, 0, strlen($targetDownloadPath)) === $targetDownloadPath
  15153. || substr($targetDownloadPath, 0, strlen($initialDownloadPath)) === $initialDownloadPath
  15154. ) {
  15155. $this->removeCode($initial);
  15156. $this->installCode($target);
  15157. return;
  15158. }
  15159. $this->filesystem->rename($initialDownloadPath, $targetDownloadPath);
  15160. }
  15161. $this->downloadManager->update($initial, $target, $targetDownloadPath);
  15162. }
  15163. protected function removeCode(PackageInterface $package)
  15164. {
  15165. $downloadPath = $this->getPackageBasePath($package);
  15166. $this->downloadManager->remove($package, $downloadPath);
  15167. }
  15168. protected function initializeVendorDir()
  15169. {
  15170. $this->filesystem->ensureDirectoryExists($this->vendorDir);
  15171. $this->vendorDir = realpath($this->vendorDir);
  15172. }
  15173. }
  15174. <?php
  15175. namespace Composer\Installer;
  15176. use Composer\Repository\InstalledRepositoryInterface;
  15177. use Composer\Package\PackageInterface;
  15178. use Composer\Package\Version\VersionParser;
  15179. use Composer\IO\IOInterface;
  15180. class MetapackageInstaller implements InstallerInterface
  15181. {
  15182. private $io;
  15183. public function __construct(IOInterface $io)
  15184. {
  15185. $this->io = $io;
  15186. }
  15187. public function supports($packageType)
  15188. {
  15189. return $packageType === 'metapackage';
  15190. }
  15191. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15192. {
  15193. return $repo->hasPackage($package);
  15194. }
  15195. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15196. {
  15197. $this->io->writeError(" - Installing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15198. $repo->addPackage(clone $package);
  15199. }
  15200. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15201. {
  15202. if (!$repo->hasPackage($initial)) {
  15203. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15204. }
  15205. $name = $target->getName();
  15206. $from = $initial->getFullPrettyVersion();
  15207. $to = $target->getFullPrettyVersion();
  15208. $actionName = VersionParser::isUpgrade($initial->getVersion(), $target->getVersion()) ? 'Updating' : 'Downgrading';
  15209. $this->io->writeError(" - " . $actionName . " <info>" . $name . "</info> (<comment>" . $from . "</comment> => <comment>" . $to . "</comment>)");
  15210. $repo->removePackage($initial);
  15211. $repo->addPackage(clone $target);
  15212. }
  15213. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15214. {
  15215. if (!$repo->hasPackage($package)) {
  15216. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15217. }
  15218. $this->io->writeError(" - Removing <info>" . $package->getName() . "</info> (<comment>" . $package->getFullPrettyVersion() . "</comment>)");
  15219. $repo->removePackage($package);
  15220. }
  15221. public function getInstallPath(PackageInterface $package)
  15222. {
  15223. return '';
  15224. }
  15225. }
  15226. <?php
  15227. namespace Composer\Installer;
  15228. use Composer\Repository\InstalledRepositoryInterface;
  15229. use Composer\Package\PackageInterface;
  15230. class NoopInstaller implements InstallerInterface
  15231. {
  15232. public function supports($packageType)
  15233. {
  15234. return true;
  15235. }
  15236. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15237. {
  15238. return $repo->hasPackage($package);
  15239. }
  15240. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15241. {
  15242. if (!$repo->hasPackage($package)) {
  15243. $repo->addPackage(clone $package);
  15244. }
  15245. }
  15246. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15247. {
  15248. if (!$repo->hasPackage($initial)) {
  15249. throw new \InvalidArgumentException('Package is not installed: '.$initial);
  15250. }
  15251. $repo->removePackage($initial);
  15252. if (!$repo->hasPackage($target)) {
  15253. $repo->addPackage(clone $target);
  15254. }
  15255. }
  15256. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15257. {
  15258. if (!$repo->hasPackage($package)) {
  15259. throw new \InvalidArgumentException('Package is not installed: '.$package);
  15260. }
  15261. $repo->removePackage($package);
  15262. }
  15263. public function getInstallPath(PackageInterface $package)
  15264. {
  15265. $targetDir = $package->getTargetDir();
  15266. return $package->getPrettyName() . ($targetDir ? '/'.$targetDir : '');
  15267. }
  15268. }
  15269. <?php
  15270. namespace Composer\Installer;
  15271. use Composer\Composer;
  15272. use Composer\IO\IOInterface;
  15273. use Composer\DependencyResolver\Operation\OperationInterface;
  15274. use Composer\DependencyResolver\PolicyInterface;
  15275. use Composer\DependencyResolver\Pool;
  15276. use Composer\DependencyResolver\Request;
  15277. use Composer\Repository\CompositeRepository;
  15278. class PackageEvent extends InstallerEvent
  15279. {
  15280. private $operation;
  15281. public function __construct($eventName, Composer $composer, IOInterface $io, $devMode, PolicyInterface $policy, Pool $pool, CompositeRepository $installedRepo, Request $request, array $operations, OperationInterface $operation)
  15282. {
  15283. parent::__construct($eventName, $composer, $io, $devMode, $policy, $pool, $installedRepo, $request, $operations);
  15284. $this->operation = $operation;
  15285. }
  15286. public function getOperation()
  15287. {
  15288. return $this->operation;
  15289. }
  15290. }
  15291. <?php
  15292. namespace Composer\Installer;
  15293. class PackageEvents
  15294. {
  15295. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  15296. const POST_PACKAGE_INSTALL = 'post-package-install';
  15297. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  15298. const POST_PACKAGE_UPDATE = 'post-package-update';
  15299. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  15300. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  15301. }
  15302. <?php
  15303. namespace Composer\Installer;
  15304. use Composer\IO\IOInterface;
  15305. use Composer\Package\PackageInterface;
  15306. use Composer\Util\Filesystem;
  15307. use Composer\Util\ProcessExecutor;
  15308. class PearBinaryInstaller extends BinaryInstaller
  15309. {
  15310. private $installer;
  15311. private $vendorDir;
  15312. public function __construct(IOInterface $io, $binDir, $vendorDir, $binCompat, Filesystem $filesystem, PearInstaller $installer)
  15313. {
  15314. parent::__construct($io, $binDir, $binCompat, $filesystem);
  15315. $this->installer = $installer;
  15316. $this->vendorDir = $vendorDir;
  15317. }
  15318. protected function getBinaries(PackageInterface $package)
  15319. {
  15320. $binariesPath = $this->installer->getInstallPath($package) . '/bin/';
  15321. $binaries = array();
  15322. if (file_exists($binariesPath)) {
  15323. foreach (new \FilesystemIterator($binariesPath, \FilesystemIterator::KEY_AS_FILENAME | \FilesystemIterator::CURRENT_AS_FILEINFO) as $fileName => $value) {
  15324. if (!$value->isDir()) {
  15325. $binaries[] = 'bin/'.$fileName;
  15326. }
  15327. }
  15328. }
  15329. return $binaries;
  15330. }
  15331. protected function initializeBinDir()
  15332. {
  15333. parent::initializeBinDir();
  15334. file_put_contents($this->binDir.'/composer-php', $this->generateUnixyPhpProxyCode());
  15335. @chmod($this->binDir.'/composer-php', 0777 & ~umask());
  15336. file_put_contents($this->binDir.'/composer-php.bat', $this->generateWindowsPhpProxyCode());
  15337. @chmod($this->binDir.'/composer-php.bat', 0777 & ~umask());
  15338. }
  15339. protected function generateWindowsProxyCode($bin, $link)
  15340. {
  15341. $binPath = $this->filesystem->findShortestPath($link, $bin);
  15342. if ('.bat' === substr($bin, -4)) {
  15343. $caller = 'call';
  15344. } else {
  15345. $handle = fopen($bin, 'r');
  15346. $line = fgets($handle);
  15347. fclose($handle);
  15348. if (preg_match('{^#!/(?:usr/bin/env )?(?:[^/]+/)*(.+)$}m', $line, $match)) {
  15349. $caller = trim($match[1]);
  15350. } else {
  15351. $caller = 'php';
  15352. }
  15353. if ($caller === 'php') {
  15354. return "@echo off\r\n".
  15355. "pushd .\r\n".
  15356. "cd %~dp0\r\n".
  15357. "set PHP_PROXY=%CD%\\composer-php.bat\r\n".
  15358. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15359. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15360. "popd\r\n".
  15361. "%PHP_PROXY% \"%BIN_TARGET%\" %*\r\n";
  15362. }
  15363. }
  15364. return "@echo off\r\n".
  15365. "pushd .\r\n".
  15366. "cd %~dp0\r\n".
  15367. "cd ".ProcessExecutor::escape(dirname($binPath))."\r\n".
  15368. "set BIN_TARGET=%CD%\\".basename($binPath)."\r\n".
  15369. "popd\r\n".
  15370. $caller." \"%BIN_TARGET%\" %*\r\n";
  15371. }
  15372. private function generateWindowsPhpProxyCode()
  15373. {
  15374. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15375. return
  15376. "@echo off\r\n" .
  15377. "setlocal enabledelayedexpansion\r\n" .
  15378. "set BIN_DIR=%~dp0\r\n" .
  15379. "set VENDOR_DIR=%BIN_DIR%\\".$binToVendor."\r\n" .
  15380. "set DIRS=.\r\n" .
  15381. "FOR /D %%V IN (%VENDOR_DIR%\\*) DO (\r\n" .
  15382. " FOR /D %%P IN (%%V\\*) DO (\r\n" .
  15383. " set DIRS=!DIRS!;%%~fP\r\n" .
  15384. " )\r\n" .
  15385. ")\r\n" .
  15386. "php.exe -d include_path=!DIRS! %*\r\n";
  15387. }
  15388. private function generateUnixyPhpProxyCode()
  15389. {
  15390. $binToVendor = $this->filesystem->findShortestPath($this->binDir, $this->vendorDir, true);
  15391. return
  15392. "#!/usr/bin/env sh\n".
  15393. "SRC_DIR=`pwd`\n".
  15394. "BIN_DIR=`dirname $0`\n".
  15395. "VENDOR_DIR=\$BIN_DIR/".escapeshellarg($binToVendor)."\n".
  15396. "DIRS=\"\"\n".
  15397. "for vendor in \$VENDOR_DIR/*; do\n".
  15398. " if [ -d \"\$vendor\" ]; then\n".
  15399. " for package in \$vendor/*; do\n".
  15400. " if [ -d \"\$package\" ]; then\n".
  15401. " DIRS=\"\${DIRS}:\${package}\"\n".
  15402. " fi\n".
  15403. " done\n".
  15404. " fi\n".
  15405. "done\n".
  15406. "php -d include_path=\".\$DIRS\" $@\n";
  15407. }
  15408. }
  15409. <?php
  15410. namespace Composer\Installer;
  15411. use Composer\IO\IOInterface;
  15412. use Composer\Composer;
  15413. use Composer\Downloader\PearPackageExtractor;
  15414. use Composer\Repository\InstalledRepositoryInterface;
  15415. use Composer\Package\PackageInterface;
  15416. use Composer\Util\Platform;
  15417. use Composer\Util\Filesystem;
  15418. class PearInstaller extends LibraryInstaller
  15419. {
  15420. public function __construct(IOInterface $io, Composer $composer, $type = 'pear-library')
  15421. {
  15422. $filesystem = new Filesystem();
  15423. $binaryInstaller = new PearBinaryInstaller($io, rtrim($composer->getConfig()->get('bin-dir'), '/'), rtrim($composer->getConfig()->get('vendor-dir'), '/'), $composer->getConfig()->get('bin-compat'), $filesystem, $this);
  15424. parent::__construct($io, $composer, $type, $filesystem, $binaryInstaller);
  15425. }
  15426. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15427. {
  15428. $this->uninstall($repo, $initial);
  15429. $this->install($repo, $target);
  15430. }
  15431. protected function installCode(PackageInterface $package)
  15432. {
  15433. parent::installCode($package);
  15434. $isWindows = Platform::isWindows();
  15435. $php_bin = $this->binDir . ($isWindows ? '/composer-php.bat' : '/composer-php');
  15436. if (!$isWindows) {
  15437. $php_bin = '/usr/bin/env ' . $php_bin;
  15438. }
  15439. $installPath = $this->getInstallPath($package);
  15440. $vars = array(
  15441. 'os' => $isWindows ? 'windows' : 'linux',
  15442. 'php_bin' => $php_bin,
  15443. 'pear_php' => $installPath,
  15444. 'php_dir' => $installPath,
  15445. 'bin_dir' => $installPath . '/bin',
  15446. 'data_dir' => $installPath . '/data',
  15447. 'version' => $package->getPrettyVersion(),
  15448. );
  15449. $packageArchive = $this->getInstallPath($package).'/'.pathinfo($package->getDistUrl(), PATHINFO_BASENAME);
  15450. $pearExtractor = new PearPackageExtractor($packageArchive);
  15451. $pearExtractor->extractTo($this->getInstallPath($package), array('php' => '/', 'script' => '/bin', 'data' => '/data'), $vars);
  15452. $this->io->writeError(' Cleaning up', true, IOInterface::VERBOSE);
  15453. $this->filesystem->unlink($packageArchive);
  15454. }
  15455. }
  15456. <?php
  15457. namespace Composer\Installer;
  15458. use Composer\Composer;
  15459. use Composer\IO\IOInterface;
  15460. use Composer\Repository\InstalledRepositoryInterface;
  15461. use Composer\Package\PackageInterface;
  15462. class PluginInstaller extends LibraryInstaller
  15463. {
  15464. private $installationManager;
  15465. public function __construct(IOInterface $io, Composer $composer)
  15466. {
  15467. parent::__construct($io, $composer, 'composer-plugin');
  15468. $this->installationManager = $composer->getInstallationManager();
  15469. }
  15470. public function supports($packageType)
  15471. {
  15472. return $packageType === 'composer-plugin' || $packageType === 'composer-installer';
  15473. }
  15474. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15475. {
  15476. $extra = $package->getExtra();
  15477. if (empty($extra['class'])) {
  15478. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15479. }
  15480. parent::install($repo, $package);
  15481. try {
  15482. $this->composer->getPluginManager()->registerPackage($package, true);
  15483. } catch (\Exception $e) {
  15484. $this->io->writeError('Plugin installation failed, rolling back');
  15485. parent::uninstall($repo, $package);
  15486. throw $e;
  15487. }
  15488. }
  15489. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15490. {
  15491. $extra = $target->getExtra();
  15492. if (empty($extra['class'])) {
  15493. throw new \UnexpectedValueException('Error while installing '.$target->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  15494. }
  15495. parent::update($repo, $initial, $target);
  15496. $this->composer->getPluginManager()->registerPackage($target, true);
  15497. }
  15498. }
  15499. <?php
  15500. namespace Composer\Installer;
  15501. use Composer\Package\PackageInterface;
  15502. use Composer\Downloader\DownloadManager;
  15503. use Composer\Repository\InstalledRepositoryInterface;
  15504. use Composer\Util\Filesystem;
  15505. class ProjectInstaller implements InstallerInterface
  15506. {
  15507. private $installPath;
  15508. private $downloadManager;
  15509. private $filesystem;
  15510. public function __construct($installPath, DownloadManager $dm)
  15511. {
  15512. $this->installPath = rtrim(strtr($installPath, '\\', '/'), '/').'/';
  15513. $this->downloadManager = $dm;
  15514. $this->filesystem = new Filesystem;
  15515. }
  15516. public function supports($packageType)
  15517. {
  15518. return true;
  15519. }
  15520. public function isInstalled(InstalledRepositoryInterface $repo, PackageInterface $package)
  15521. {
  15522. return false;
  15523. }
  15524. public function install(InstalledRepositoryInterface $repo, PackageInterface $package)
  15525. {
  15526. $installPath = $this->installPath;
  15527. if (file_exists($installPath) && !$this->filesystem->isDirEmpty($installPath)) {
  15528. throw new \InvalidArgumentException("Project directory $installPath is not empty.");
  15529. }
  15530. if (!is_dir($installPath)) {
  15531. mkdir($installPath, 0777, true);
  15532. }
  15533. $this->downloadManager->download($package, $installPath);
  15534. }
  15535. public function update(InstalledRepositoryInterface $repo, PackageInterface $initial, PackageInterface $target)
  15536. {
  15537. throw new \InvalidArgumentException("not supported");
  15538. }
  15539. public function uninstall(InstalledRepositoryInterface $repo, PackageInterface $package)
  15540. {
  15541. throw new \InvalidArgumentException("not supported");
  15542. }
  15543. public function getInstallPath(PackageInterface $package)
  15544. {
  15545. return $this->installPath;
  15546. }
  15547. }
  15548. <?php
  15549. namespace Composer\Installer;
  15550. use Composer\IO\IOInterface;
  15551. use Composer\Package\PackageInterface;
  15552. use Composer\Repository\RepositoryInterface;
  15553. use Symfony\Component\Console\Formatter\OutputFormatter;
  15554. class SuggestedPackagesReporter
  15555. {
  15556. protected $suggestedPackages = array();
  15557. private $io;
  15558. public function __construct(IOInterface $io)
  15559. {
  15560. $this->io = $io;
  15561. }
  15562. public function getPackages()
  15563. {
  15564. return $this->suggestedPackages;
  15565. }
  15566. public function addPackage($source, $target, $reason)
  15567. {
  15568. $this->suggestedPackages[] = array(
  15569. 'source' => $source,
  15570. 'target' => $target,
  15571. 'reason' => $reason,
  15572. );
  15573. return $this;
  15574. }
  15575. public function addSuggestionsFromPackage(PackageInterface $package)
  15576. {
  15577. $source = $package->getPrettyName();
  15578. foreach ($package->getSuggests() as $target => $reason) {
  15579. $this->addPackage(
  15580. $source,
  15581. $target,
  15582. $reason
  15583. );
  15584. }
  15585. return $this;
  15586. }
  15587. public function output(RepositoryInterface $installedRepo = null)
  15588. {
  15589. $suggestedPackages = $this->getPackages();
  15590. $installedPackages = array();
  15591. if (null !== $installedRepo && ! empty($suggestedPackages)) {
  15592. foreach ($installedRepo->getPackages() as $package) {
  15593. $installedPackages = array_merge(
  15594. $installedPackages,
  15595. $package->getNames()
  15596. );
  15597. }
  15598. }
  15599. foreach ($suggestedPackages as $suggestion) {
  15600. if (in_array($suggestion['target'], $installedPackages)) {
  15601. continue;
  15602. }
  15603. $this->io->writeError(sprintf(
  15604. '%s suggests installing %s%s',
  15605. $suggestion['source'],
  15606. $this->escapeOutput($suggestion['target']),
  15607. $this->escapeOutput('' !== $suggestion['reason'] ? ' ('.$suggestion['reason'].')' : '')
  15608. ));
  15609. }
  15610. return $this;
  15611. }
  15612. private function escapeOutput($string)
  15613. {
  15614. return OutputFormatter::escape(
  15615. $this->removeControlCharacters($string)
  15616. );
  15617. }
  15618. private function removeControlCharacters($string)
  15619. {
  15620. return preg_replace(
  15621. '/[[:cntrl:]]/',
  15622. '',
  15623. str_replace("\n", ' ', $string)
  15624. );
  15625. }
  15626. }
  15627. <?php
  15628. namespace Composer\Json;
  15629. use JsonSchema\Validator;
  15630. use Seld\JsonLint\JsonParser;
  15631. use Seld\JsonLint\ParsingException;
  15632. use Composer\Util\RemoteFilesystem;
  15633. use Composer\IO\IOInterface;
  15634. use Composer\Downloader\TransportException;
  15635. class JsonFile
  15636. {
  15637. const LAX_SCHEMA = 1;
  15638. const STRICT_SCHEMA = 2;
  15639. const JSON_UNESCAPED_SLASHES = 64;
  15640. const JSON_PRETTY_PRINT = 128;
  15641. const JSON_UNESCAPED_UNICODE = 256;
  15642. const COMPOSER_SCHEMA_PATH = '/../../../res/composer-schema.json';
  15643. private $path;
  15644. private $rfs;
  15645. private $io;
  15646. public function __construct($path, RemoteFilesystem $rfs = null, IOInterface $io = null)
  15647. {
  15648. $this->path = $path;
  15649. if (null === $rfs && preg_match('{^https?://}i', $path)) {
  15650. throw new \InvalidArgumentException('http urls require a RemoteFilesystem instance to be passed');
  15651. }
  15652. $this->rfs = $rfs;
  15653. $this->io = $io;
  15654. }
  15655. public function getPath()
  15656. {
  15657. return $this->path;
  15658. }
  15659. public function exists()
  15660. {
  15661. return is_file($this->path);
  15662. }
  15663. public function read()
  15664. {
  15665. try {
  15666. if ($this->rfs) {
  15667. $json = $this->rfs->getContents($this->path, $this->path, false);
  15668. } else {
  15669. if ($this->io && $this->io->isDebug()) {
  15670. $this->io->writeError('Reading ' . $this->path);
  15671. }
  15672. $json = file_get_contents($this->path);
  15673. }
  15674. } catch (TransportException $e) {
  15675. throw new \RuntimeException($e->getMessage(), 0, $e);
  15676. } catch (\Exception $e) {
  15677. throw new \RuntimeException('Could not read '.$this->path."\n\n".$e->getMessage());
  15678. }
  15679. return static::parseJson($json, $this->path);
  15680. }
  15681. public function write(array $hash, $options = 448)
  15682. {
  15683. $dir = dirname($this->path);
  15684. if (!is_dir($dir)) {
  15685. if (file_exists($dir)) {
  15686. throw new \UnexpectedValueException(
  15687. $dir.' exists and is not a directory.'
  15688. );
  15689. }
  15690. if (!@mkdir($dir, 0777, true)) {
  15691. throw new \UnexpectedValueException(
  15692. $dir.' does not exist and could not be created.'
  15693. );
  15694. }
  15695. }
  15696. $retries = 3;
  15697. while ($retries--) {
  15698. try {
  15699. file_put_contents($this->path, static::encode($hash, $options). ($options & self::JSON_PRETTY_PRINT ? "\n" : ''));
  15700. break;
  15701. } catch (\Exception $e) {
  15702. if ($retries) {
  15703. usleep(500000);
  15704. continue;
  15705. }
  15706. throw $e;
  15707. }
  15708. }
  15709. }
  15710. public function validateSchema($schema = self::STRICT_SCHEMA, $schemaFile = null)
  15711. {
  15712. $content = file_get_contents($this->path);
  15713. $data = json_decode($content);
  15714. if (null === $data && 'null' !== $content) {
  15715. self::validateSyntax($content, $this->path);
  15716. }
  15717. if (null === $schemaFile) {
  15718. $schemaFile = __DIR__ . self::COMPOSER_SCHEMA_PATH;
  15719. }
  15720. if (false === strpos($schemaFile, '://')) {
  15721. $schemaFile = 'file://' . $schemaFile;
  15722. }
  15723. $schemaData = (object) array('$ref' => $schemaFile);
  15724. if ($schema === self::LAX_SCHEMA) {
  15725. $schemaData->additionalProperties = true;
  15726. $schemaData->required = array();
  15727. }
  15728. $validator = new Validator();
  15729. $validator->check($data, $schemaData);
  15730. if (!$validator->isValid()) {
  15731. $errors = array();
  15732. foreach ((array) $validator->getErrors() as $error) {
  15733. $errors[] = ($error['property'] ? $error['property'].' : ' : '').$error['message'];
  15734. }
  15735. throw new JsonValidationException('"'.$this->path.'" does not match the expected JSON schema', $errors);
  15736. }
  15737. return true;
  15738. }
  15739. public static function encode($data, $options = 448)
  15740. {
  15741. if (PHP_VERSION_ID >= 50400) {
  15742. $json = json_encode($data, $options);
  15743. if (false === $json) {
  15744. self::throwEncodeError(json_last_error());
  15745. }
  15746. if (PHP_VERSION_ID < 50428 || (PHP_VERSION_ID >= 50500 && PHP_VERSION_ID < 50512) || (defined('JSON_C_VERSION') && version_compare(phpversion('json'), '1.3.6', '<'))) {
  15747. $json = preg_replace('/\[\s+\]/', '[]', $json);
  15748. $json = preg_replace('/\{\s+\}/', '{}', $json);
  15749. }
  15750. return $json;
  15751. }
  15752. $json = json_encode($data);
  15753. if (false === $json) {
  15754. self::throwEncodeError(json_last_error());
  15755. }
  15756. $prettyPrint = (bool) ($options & self::JSON_PRETTY_PRINT);
  15757. $unescapeUnicode = (bool) ($options & self::JSON_UNESCAPED_UNICODE);
  15758. $unescapeSlashes = (bool) ($options & self::JSON_UNESCAPED_SLASHES);
  15759. if (!$prettyPrint && !$unescapeUnicode && !$unescapeSlashes) {
  15760. return $json;
  15761. }
  15762. return JsonFormatter::format($json, $unescapeUnicode, $unescapeSlashes);
  15763. }
  15764. private static function throwEncodeError($code)
  15765. {
  15766. switch ($code) {
  15767. case JSON_ERROR_DEPTH:
  15768. $msg = 'Maximum stack depth exceeded';
  15769. break;
  15770. case JSON_ERROR_STATE_MISMATCH:
  15771. $msg = 'Underflow or the modes mismatch';
  15772. break;
  15773. case JSON_ERROR_CTRL_CHAR:
  15774. $msg = 'Unexpected control character found';
  15775. break;
  15776. case JSON_ERROR_UTF8:
  15777. $msg = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  15778. break;
  15779. default:
  15780. $msg = 'Unknown error';
  15781. }
  15782. throw new \RuntimeException('JSON encoding failed: '.$msg);
  15783. }
  15784. public static function parseJson($json, $file = null)
  15785. {
  15786. if (null === $json) {
  15787. return;
  15788. }
  15789. $data = json_decode($json, true);
  15790. if (null === $data && JSON_ERROR_NONE !== json_last_error()) {
  15791. self::validateSyntax($json, $file);
  15792. }
  15793. return $data;
  15794. }
  15795. protected static function validateSyntax($json, $file = null)
  15796. {
  15797. $parser = new JsonParser();
  15798. $result = $parser->lint($json);
  15799. if (null === $result) {
  15800. if (defined('JSON_ERROR_UTF8') && JSON_ERROR_UTF8 === json_last_error()) {
  15801. throw new \UnexpectedValueException('"'.$file.'" is not UTF-8, could not parse as JSON');
  15802. }
  15803. return true;
  15804. }
  15805. throw new ParsingException('"'.$file.'" does not contain valid JSON'."\n".$result->getMessage(), $result->getDetails());
  15806. }
  15807. }
  15808. <?php
  15809. namespace Composer\Json;
  15810. class JsonFormatter
  15811. {
  15812. public static function format($json, $unescapeUnicode, $unescapeSlashes)
  15813. {
  15814. $result = '';
  15815. $pos = 0;
  15816. $strLen = strlen($json);
  15817. $indentStr = ' ';
  15818. $newLine = "\n";
  15819. $outOfQuotes = true;
  15820. $buffer = '';
  15821. $noescape = true;
  15822. for ($i = 0; $i < $strLen; $i++) {
  15823. $char = substr($json, $i, 1);
  15824. if ('"' === $char && $noescape) {
  15825. $outOfQuotes = !$outOfQuotes;
  15826. }
  15827. if (!$outOfQuotes) {
  15828. $buffer .= $char;
  15829. $noescape = '\\' === $char ? !$noescape : true;
  15830. continue;
  15831. } elseif ('' !== $buffer) {
  15832. if ($unescapeSlashes) {
  15833. $buffer = str_replace('\\/', '/', $buffer);
  15834. }
  15835. if ($unescapeUnicode && function_exists('mb_convert_encoding')) {
  15836. $buffer = preg_replace_callback('/(\\\\+)u([0-9a-f]{4})/i', function ($match) {
  15837. $l = strlen($match[1]);
  15838. if ($l % 2) {
  15839. $code = hexdec($match[2]);
  15840. if (0xD800 <= $code && 0xDFFF >= $code) {
  15841. return $match[0];
  15842. }
  15843. return str_repeat('\\', $l - 1) . mb_convert_encoding(
  15844. pack('H*', $match[2]),
  15845. 'UTF-8',
  15846. 'UCS-2BE'
  15847. );
  15848. }
  15849. return $match[0];
  15850. }, $buffer);
  15851. }
  15852. $result .= $buffer.$char;
  15853. $buffer = '';
  15854. continue;
  15855. }
  15856. if (':' === $char) {
  15857. $char .= ' ';
  15858. } elseif ('}' === $char || ']' === $char) {
  15859. $pos--;
  15860. $prevChar = substr($json, $i - 1, 1);
  15861. if ('{' !== $prevChar && '[' !== $prevChar) {
  15862. $result .= $newLine;
  15863. for ($j = 0; $j < $pos; $j++) {
  15864. $result .= $indentStr;
  15865. }
  15866. } else {
  15867. $result = rtrim($result);
  15868. }
  15869. }
  15870. $result .= $char;
  15871. if (',' === $char || '{' === $char || '[' === $char) {
  15872. $result .= $newLine;
  15873. if ('{' === $char || '[' === $char) {
  15874. $pos++;
  15875. }
  15876. for ($j = 0; $j < $pos; $j++) {
  15877. $result .= $indentStr;
  15878. }
  15879. }
  15880. }
  15881. return $result;
  15882. }
  15883. }
  15884. <?php
  15885. namespace Composer\Json;
  15886. use Composer\Repository\PlatformRepository;
  15887. class JsonManipulator
  15888. {
  15889. private static $DEFINES = '(?(DEFINE)
  15890. (?<number> -? (?= [1-9]|0(?!\d) ) \d+ (\.\d+)? ([eE] [+-]? \d+)? )
  15891. (?<boolean> true | false | null )
  15892. (?<string> " ([^"\\\\]* | \\\\ ["\\\\bfnrt\/] | \\\\ u [0-9A-Fa-f]{4} )* " )
  15893. (?<array> \[ (?: (?&json) \s* (?: , (?&json) \s* )* )? \s* \] )
  15894. (?<pair> \s* (?&string) \s* : (?&json) \s* )
  15895. (?<object> \{ (?: (?&pair) (?: , (?&pair) )* )? \s* \} )
  15896. (?<json> \s* (?: (?&number) | (?&boolean) | (?&string) | (?&array) | (?&object) ) )
  15897. )';
  15898. private $contents;
  15899. private $newline;
  15900. private $indent;
  15901. public function __construct($contents)
  15902. {
  15903. $contents = trim($contents);
  15904. if ($contents === '') {
  15905. $contents = '{}';
  15906. }
  15907. if (!$this->pregMatch('#^\{(.*)\}$#s', $contents)) {
  15908. throw new \InvalidArgumentException('The json file must be an object ({})');
  15909. }
  15910. $this->newline = false !== strpos($contents, "\r\n") ? "\r\n" : "\n";
  15911. $this->contents = $contents === '{}' ? '{' . $this->newline . '}' : $contents;
  15912. $this->detectIndenting();
  15913. }
  15914. public function getContents()
  15915. {
  15916. return $this->contents . $this->newline;
  15917. }
  15918. public function addLink($type, $package, $constraint, $sortPackages = false)
  15919. {
  15920. $decoded = JsonFile::parseJson($this->contents);
  15921. if (!isset($decoded[$type])) {
  15922. return $this->addMainKey($type, array($package => $constraint));
  15923. }
  15924. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  15925. '(?P<property>'.preg_quote(JsonFile::encode($type)).'\s*:\s*)(?P<value>(?&json))(?P<end>.*)}sx';
  15926. if (!$this->pregMatch($regex, $this->contents, $matches)) {
  15927. return false;
  15928. }
  15929. $links = $matches['value'];
  15930. $packageRegex = str_replace('/', '\\\\?/', preg_quote($package));
  15931. $regex = '{'.self::$DEFINES.'"(?P<package>'.$packageRegex.')"(\s*:\s*)(?&string)}ix';
  15932. if ($this->pregMatch($regex, $links, $packageMatches)) {
  15933. $existingPackage = $packageMatches['package'];
  15934. $packageRegex = str_replace('/', '\\\\?/', preg_quote($existingPackage));
  15935. $links = preg_replace_callback('{'.self::$DEFINES.'"'.$packageRegex.'"(?P<separator>\s*:\s*)(?&string)}ix', function ($m) use ($existingPackage, $constraint) {
  15936. return JsonFile::encode(str_replace('\\/', '/', $existingPackage)) . $m['separator'] . '"' . $constraint . '"';
  15937. }, $links);
  15938. } else {
  15939. if ($this->pregMatch('#^\s*\{\s*\S+.*?(\s*\}\s*)$#s', $links, $match)) {
  15940. $links = preg_replace(
  15941. '{'.preg_quote($match[1]).'$}',
  15942. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $match[1], '\\$'),
  15943. $links
  15944. );
  15945. } else {
  15946. $links = '{' . $this->newline .
  15947. $this->indent . $this->indent . JsonFile::encode($package).': '.JsonFile::encode($constraint) . $this->newline .
  15948. $this->indent . '}';
  15949. }
  15950. }
  15951. if (true === $sortPackages) {
  15952. $requirements = json_decode($links, true);
  15953. $this->sortPackages($requirements);
  15954. $links = $this->format($requirements);
  15955. }
  15956. $this->contents = $matches['start'] . $matches['property'] . $links . $matches['end'];
  15957. return true;
  15958. }
  15959. private function sortPackages(array &$packages = array())
  15960. {
  15961. $prefix = function ($requirement) {
  15962. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $requirement)) {
  15963. return preg_replace(
  15964. array(
  15965. '/^php/',
  15966. '/^hhvm/',
  15967. '/^ext/',
  15968. '/^lib/',
  15969. '/^\D/',
  15970. ),
  15971. array(
  15972. '0-$0',
  15973. '1-$0',
  15974. '2-$0',
  15975. '3-$0',
  15976. '4-$0',
  15977. ),
  15978. $requirement
  15979. );
  15980. }
  15981. return '5-'.$requirement;
  15982. };
  15983. uksort($packages, function ($a, $b) use ($prefix) {
  15984. return strnatcmp($prefix($a), $prefix($b));
  15985. });
  15986. }
  15987. public function addRepository($name, $config)
  15988. {
  15989. return $this->addSubNode('repositories', $name, $config);
  15990. }
  15991. public function removeRepository($name)
  15992. {
  15993. return $this->removeSubNode('repositories', $name);
  15994. }
  15995. public function addConfigSetting($name, $value)
  15996. {
  15997. return $this->addSubNode('config', $name, $value);
  15998. }
  15999. public function removeConfigSetting($name)
  16000. {
  16001. return $this->removeSubNode('config', $name);
  16002. }
  16003. public function addProperty($name, $value)
  16004. {
  16005. if (substr($name, 0, 6) === 'extra.') {
  16006. return $this->addSubNode('extra', substr($name, 6), $value);
  16007. }
  16008. if (substr($name, 0, 8) === 'scripts.') {
  16009. return $this->addSubNode('scripts', substr($name, 8), $value);
  16010. }
  16011. return $this->addMainKey($name, $value);
  16012. }
  16013. public function removeProperty($name)
  16014. {
  16015. if (substr($name, 0, 6) === 'extra.') {
  16016. return $this->removeSubNode('extra', substr($name, 6));
  16017. }
  16018. if (substr($name, 0, 8) === 'scripts.') {
  16019. return $this->removeSubNode('scripts', substr($name, 8));
  16020. }
  16021. return $this->removeMainKey($name);
  16022. }
  16023. public function addSubNode($mainNode, $name, $value)
  16024. {
  16025. $decoded = JsonFile::parseJson($this->contents);
  16026. $subName = null;
  16027. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16028. list($name, $subName) = explode('.', $name, 2);
  16029. }
  16030. if (!isset($decoded[$mainNode])) {
  16031. if ($subName !== null) {
  16032. $this->addMainKey($mainNode, array($name => array($subName => $value)));
  16033. } else {
  16034. $this->addMainKey($mainNode, array($name => $value));
  16035. }
  16036. return true;
  16037. }
  16038. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16039. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16040. try {
  16041. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16042. return false;
  16043. }
  16044. } catch (\RuntimeException $e) {
  16045. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16046. return false;
  16047. }
  16048. throw $e;
  16049. }
  16050. $children = $match['content'];
  16051. if (!@json_decode($children)) {
  16052. return false;
  16053. }
  16054. $that = $this;
  16055. $childRegex = '{'.self::$DEFINES.'(?P<start>"'.preg_quote($name).'"\s*:\s*)(?P<content>(?&json))(?P<end>,?)}x';
  16056. if ($this->pregMatch($childRegex, $children, $matches)) {
  16057. $children = preg_replace_callback($childRegex, function ($matches) use ($subName, $value, $that) {
  16058. if ($subName !== null) {
  16059. $curVal = json_decode($matches['content'], true);
  16060. if (!is_array($curVal)) {
  16061. $curVal = array();
  16062. }
  16063. $curVal[$subName] = $value;
  16064. $value = $curVal;
  16065. }
  16066. return $matches['start'] . $that->format($value, 1) . $matches['end'];
  16067. }, $children);
  16068. } else {
  16069. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $children, $match);
  16070. $whitespace = '';
  16071. if (!empty($match['trailingspace'])) {
  16072. $whitespace = $match['trailingspace'];
  16073. }
  16074. if (!empty($match['content'])) {
  16075. if ($subName !== null) {
  16076. $value = array($subName => $value);
  16077. }
  16078. $children = preg_replace(
  16079. '#'.$whitespace.'}$#',
  16080. addcslashes(',' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}', '\\$'),
  16081. $children
  16082. );
  16083. } else {
  16084. if ($subName !== null) {
  16085. $value = array($subName => $value);
  16086. }
  16087. $children = '{' . $this->newline . $this->indent . $this->indent . JsonFile::encode($name).': '.$this->format($value, 1) . $whitespace . '}';
  16088. }
  16089. }
  16090. $this->contents = preg_replace_callback($nodeRegex, function ($m) use ($children) {
  16091. return $m['start'] . $children . $m['end'];
  16092. }, $this->contents);
  16093. return true;
  16094. }
  16095. public function removeSubNode($mainNode, $name)
  16096. {
  16097. $decoded = JsonFile::parseJson($this->contents);
  16098. if (empty($decoded[$mainNode])) {
  16099. return true;
  16100. }
  16101. $nodeRegex = '{'.self::$DEFINES.'^(?P<start> \s* \{ \s* (?: (?&string) \s* : (?&json) \s* , \s* )*?'.
  16102. preg_quote(JsonFile::encode($mainNode)).'\s*:\s*)(?P<content>(?&object))(?P<end>.*)}sx';
  16103. try {
  16104. if (!$this->pregMatch($nodeRegex, $this->contents, $match)) {
  16105. return false;
  16106. }
  16107. } catch (\RuntimeException $e) {
  16108. if ($e->getCode() === PREG_BACKTRACK_LIMIT_ERROR) {
  16109. return false;
  16110. }
  16111. throw $e;
  16112. }
  16113. $children = $match['content'];
  16114. if (!@json_decode($children, true)) {
  16115. return false;
  16116. }
  16117. $subName = null;
  16118. if (in_array($mainNode, array('config', 'extra', 'scripts')) && false !== strpos($name, '.')) {
  16119. list($name, $subName) = explode('.', $name, 2);
  16120. }
  16121. if (!isset($decoded[$mainNode][$name]) || ($subName && !isset($decoded[$mainNode][$name][$subName]))) {
  16122. return true;
  16123. }
  16124. $keyRegex = str_replace('/', '\\\\?/', preg_quote($name));
  16125. if ($this->pregMatch('{"'.$keyRegex.'"\s*:}i', $children)) {
  16126. if (preg_match_all('{'.self::$DEFINES.'"'.$keyRegex.'"\s*:\s*(?:(?&json))}x', $children, $matches)) {
  16127. $bestMatch = '';
  16128. foreach ($matches[0] as $match) {
  16129. if (strlen($bestMatch) < strlen($match)) {
  16130. $bestMatch = $match;
  16131. }
  16132. }
  16133. $childrenClean = preg_replace('{,\s*'.preg_quote($bestMatch).'}i', '', $children, -1, $count);
  16134. if (1 !== $count) {
  16135. $childrenClean = preg_replace('{'.preg_quote($bestMatch).'\s*,?\s*}i', '', $childrenClean, -1, $count);
  16136. if (1 !== $count) {
  16137. return false;
  16138. }
  16139. }
  16140. }
  16141. } else {
  16142. $childrenClean = $children;
  16143. }
  16144. $this->pregMatch('#^{ \s*? (?P<content>\S+.*?)? (?P<trailingspace>\s*) }$#sx', $childrenClean, $match);
  16145. if (empty($match['content'])) {
  16146. $newline = $this->newline;
  16147. $indent = $this->indent;
  16148. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($indent, $newline) {
  16149. return $matches['start'] . '{' . $newline . $indent . '}' . $matches['end'];
  16150. }, $this->contents);
  16151. if ($subName !== null) {
  16152. $curVal = json_decode($children, true);
  16153. unset($curVal[$name][$subName]);
  16154. $this->addSubNode($mainNode, $name, $curVal[$name]);
  16155. }
  16156. return true;
  16157. }
  16158. $that = $this;
  16159. $this->contents = preg_replace_callback($nodeRegex, function ($matches) use ($that, $name, $subName, $childrenClean) {
  16160. if ($subName !== null) {
  16161. $curVal = json_decode($matches['content'], true);
  16162. unset($curVal[$name][$subName]);
  16163. $childrenClean = $that->format($curVal, 0);
  16164. }
  16165. return $matches['start'] . $childrenClean . $matches['end'];
  16166. }, $this->contents);
  16167. return true;
  16168. }
  16169. public function addMainKey($key, $content)
  16170. {
  16171. $decoded = JsonFile::parseJson($this->contents);
  16172. $content = $this->format($content);
  16173. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16174. '(?P<key>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))(?P<end>.*)}sx';
  16175. if (isset($decoded[$key]) && $this->pregMatch($regex, $this->contents, $matches)) {
  16176. if (!@json_decode('{'.$matches['key'].'}')) {
  16177. return false;
  16178. }
  16179. $this->contents = $matches['start'] . JsonFile::encode($key).': '.$content . $matches['end'];
  16180. return true;
  16181. }
  16182. if ($this->pregMatch('#[^{\s](\s*)\}$#', $this->contents, $match)) {
  16183. $this->contents = preg_replace(
  16184. '#'.$match[1].'\}$#',
  16185. addcslashes(',' . $this->newline . $this->indent . JsonFile::encode($key). ': '. $content . $this->newline . '}', '\\$'),
  16186. $this->contents
  16187. );
  16188. return true;
  16189. }
  16190. $this->contents = preg_replace(
  16191. '#\}$#',
  16192. addcslashes($this->indent . JsonFile::encode($key). ': '.$content . $this->newline . '}', '\\$'),
  16193. $this->contents
  16194. );
  16195. return true;
  16196. }
  16197. public function removeMainKey($key)
  16198. {
  16199. $decoded = JsonFile::parseJson($this->contents);
  16200. if (!array_key_exists($key, $decoded)) {
  16201. return true;
  16202. }
  16203. $regex = '{'.self::$DEFINES.'^(?P<start>\s*\{\s*(?:(?&string)\s*:\s*(?&json)\s*,\s*)*?)'.
  16204. '(?P<removal>'.preg_quote(JsonFile::encode($key)).'\s*:\s*(?&json))\s*,?\s*(?P<end>.*)}sx';
  16205. if ($this->pregMatch($regex, $this->contents, $matches)) {
  16206. if (!@json_decode('{'.$matches['removal'].'}')) {
  16207. return false;
  16208. }
  16209. if (preg_match('#,\s*$#', $matches['start']) && preg_match('#^\}$#', $matches['end'])) {
  16210. $matches['start'] = rtrim(preg_replace('#,(\s*)$#', '$1', $matches['start']), $this->indent);
  16211. }
  16212. $this->contents = $matches['start'] . $matches['end'];
  16213. if (preg_match('#^\{\s*\}\s*$#', $this->contents)) {
  16214. $this->contents = "{\n}";
  16215. }
  16216. return true;
  16217. }
  16218. return false;
  16219. }
  16220. public function format($data, $depth = 0)
  16221. {
  16222. if (is_array($data)) {
  16223. reset($data);
  16224. if (is_numeric(key($data))) {
  16225. foreach ($data as $key => $val) {
  16226. $data[$key] = $this->format($val, $depth + 1);
  16227. }
  16228. return '['.implode(', ', $data).']';
  16229. }
  16230. $out = '{' . $this->newline;
  16231. $elems = array();
  16232. foreach ($data as $key => $val) {
  16233. $elems[] = str_repeat($this->indent, $depth + 2) . JsonFile::encode($key). ': '.$this->format($val, $depth + 1);
  16234. }
  16235. return $out . implode(','.$this->newline, $elems) . $this->newline . str_repeat($this->indent, $depth + 1) . '}';
  16236. }
  16237. return JsonFile::encode($data);
  16238. }
  16239. protected function detectIndenting()
  16240. {
  16241. if ($this->pregMatch('{^([ \t]+)"}m', $this->contents, $match)) {
  16242. $this->indent = $match[1];
  16243. } else {
  16244. $this->indent = ' ';
  16245. }
  16246. }
  16247. protected function pregMatch($re, $str, &$matches = array())
  16248. {
  16249. $count = preg_match($re, $str, $matches);
  16250. if ($count === false) {
  16251. switch (preg_last_error()) {
  16252. case PREG_NO_ERROR:
  16253. throw new \RuntimeException('Failed to execute regex: PREG_NO_ERROR', PREG_NO_ERROR);
  16254. case PREG_INTERNAL_ERROR:
  16255. throw new \RuntimeException('Failed to execute regex: PREG_INTERNAL_ERROR', PREG_INTERNAL_ERROR);
  16256. case PREG_BACKTRACK_LIMIT_ERROR:
  16257. throw new \RuntimeException('Failed to execute regex: PREG_BACKTRACK_LIMIT_ERROR', PREG_BACKTRACK_LIMIT_ERROR);
  16258. case PREG_RECURSION_LIMIT_ERROR:
  16259. throw new \RuntimeException('Failed to execute regex: PREG_RECURSION_LIMIT_ERROR', PREG_RECURSION_LIMIT_ERROR);
  16260. case PREG_BAD_UTF8_ERROR:
  16261. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_ERROR', PREG_BAD_UTF8_ERROR);
  16262. case PREG_BAD_UTF8_OFFSET_ERROR:
  16263. throw new \RuntimeException('Failed to execute regex: PREG_BAD_UTF8_OFFSET_ERROR', PREG_BAD_UTF8_OFFSET_ERROR);
  16264. case 6:
  16265. if (PHP_VERSION_ID > 70000) {
  16266. throw new \RuntimeException('Failed to execute regex: PREG_JIT_STACKLIMIT_ERROR', 6);
  16267. }
  16268. default:
  16269. throw new \RuntimeException('Failed to execute regex: Unknown error');
  16270. }
  16271. }
  16272. return $count;
  16273. }
  16274. }
  16275. <?php
  16276. namespace Composer\Json;
  16277. use Exception;
  16278. class JsonValidationException extends Exception
  16279. {
  16280. protected $errors;
  16281. public function __construct($message, $errors = array(), Exception $previous = null)
  16282. {
  16283. $this->errors = $errors;
  16284. parent::__construct($message, 0, $previous);
  16285. }
  16286. public function getErrors()
  16287. {
  16288. return $this->errors;
  16289. }
  16290. }
  16291. <?php
  16292. namespace Composer\Package;
  16293. use Composer\Semver\Constraint\Constraint;
  16294. use Composer\Package\Version\VersionParser;
  16295. class AliasPackage extends BasePackage implements CompletePackageInterface
  16296. {
  16297. protected $version;
  16298. protected $prettyVersion;
  16299. protected $dev;
  16300. protected $rootPackageAlias = false;
  16301. protected $stability;
  16302. protected $aliasOf;
  16303. protected $requires;
  16304. protected $devRequires;
  16305. protected $conflicts;
  16306. protected $provides;
  16307. protected $replaces;
  16308. public function __construct(PackageInterface $aliasOf, $version, $prettyVersion)
  16309. {
  16310. parent::__construct($aliasOf->getName());
  16311. $this->version = $version;
  16312. $this->prettyVersion = $prettyVersion;
  16313. $this->aliasOf = $aliasOf;
  16314. $this->stability = VersionParser::parseStability($version);
  16315. $this->dev = $this->stability === 'dev';
  16316. foreach (array('requires', 'devRequires', 'conflicts', 'provides', 'replaces') as $type) {
  16317. $links = $aliasOf->{'get' . ucfirst($type)}();
  16318. $this->$type = $this->replaceSelfVersionDependencies($links, $type);
  16319. }
  16320. }
  16321. public function getAliasOf()
  16322. {
  16323. return $this->aliasOf;
  16324. }
  16325. public function getVersion()
  16326. {
  16327. return $this->version;
  16328. }
  16329. public function getStability()
  16330. {
  16331. return $this->stability;
  16332. }
  16333. public function getPrettyVersion()
  16334. {
  16335. return $this->prettyVersion;
  16336. }
  16337. public function isDev()
  16338. {
  16339. return $this->dev;
  16340. }
  16341. public function getRequires()
  16342. {
  16343. return $this->requires;
  16344. }
  16345. public function getConflicts()
  16346. {
  16347. return $this->conflicts;
  16348. }
  16349. public function getProvides()
  16350. {
  16351. return $this->provides;
  16352. }
  16353. public function getReplaces()
  16354. {
  16355. return $this->replaces;
  16356. }
  16357. public function getDevRequires()
  16358. {
  16359. return $this->devRequires;
  16360. }
  16361. public function setRootPackageAlias($value)
  16362. {
  16363. return $this->rootPackageAlias = $value;
  16364. }
  16365. public function isRootPackageAlias()
  16366. {
  16367. return $this->rootPackageAlias;
  16368. }
  16369. protected function replaceSelfVersionDependencies(array $links, $linkType)
  16370. {
  16371. if (in_array($linkType, array('conflicts', 'provides', 'replaces'), true)) {
  16372. $newLinks = array();
  16373. foreach ($links as $link) {
  16374. if ('self.version' === $link->getPrettyConstraint()) {
  16375. $newLinks[] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16376. }
  16377. }
  16378. $links = array_merge($links, $newLinks);
  16379. } else {
  16380. foreach ($links as $index => $link) {
  16381. if ('self.version' === $link->getPrettyConstraint()) {
  16382. $links[$index] = new Link($link->getSource(), $link->getTarget(), new Constraint('=', $this->version), $linkType, $this->prettyVersion);
  16383. }
  16384. }
  16385. }
  16386. return $links;
  16387. }
  16388. public function getType()
  16389. {
  16390. return $this->aliasOf->getType();
  16391. }
  16392. public function getTargetDir()
  16393. {
  16394. return $this->aliasOf->getTargetDir();
  16395. }
  16396. public function getExtra()
  16397. {
  16398. return $this->aliasOf->getExtra();
  16399. }
  16400. public function setInstallationSource($type)
  16401. {
  16402. $this->aliasOf->setInstallationSource($type);
  16403. }
  16404. public function getInstallationSource()
  16405. {
  16406. return $this->aliasOf->getInstallationSource();
  16407. }
  16408. public function getSourceType()
  16409. {
  16410. return $this->aliasOf->getSourceType();
  16411. }
  16412. public function getSourceUrl()
  16413. {
  16414. return $this->aliasOf->getSourceUrl();
  16415. }
  16416. public function getSourceUrls()
  16417. {
  16418. return $this->aliasOf->getSourceUrls();
  16419. }
  16420. public function getSourceReference()
  16421. {
  16422. return $this->aliasOf->getSourceReference();
  16423. }
  16424. public function setSourceReference($reference)
  16425. {
  16426. return $this->aliasOf->setSourceReference($reference);
  16427. }
  16428. public function setSourceMirrors($mirrors)
  16429. {
  16430. return $this->aliasOf->setSourceMirrors($mirrors);
  16431. }
  16432. public function getSourceMirrors()
  16433. {
  16434. return $this->aliasOf->getSourceMirrors();
  16435. }
  16436. public function getDistType()
  16437. {
  16438. return $this->aliasOf->getDistType();
  16439. }
  16440. public function getDistUrl()
  16441. {
  16442. return $this->aliasOf->getDistUrl();
  16443. }
  16444. public function getDistUrls()
  16445. {
  16446. return $this->aliasOf->getDistUrls();
  16447. }
  16448. public function getDistReference()
  16449. {
  16450. return $this->aliasOf->getDistReference();
  16451. }
  16452. public function setDistReference($reference)
  16453. {
  16454. return $this->aliasOf->setDistReference($reference);
  16455. }
  16456. public function getDistSha1Checksum()
  16457. {
  16458. return $this->aliasOf->getDistSha1Checksum();
  16459. }
  16460. public function setTransportOptions(array $options)
  16461. {
  16462. return $this->aliasOf->setTransportOptions($options);
  16463. }
  16464. public function getTransportOptions()
  16465. {
  16466. return $this->aliasOf->getTransportOptions();
  16467. }
  16468. public function setDistMirrors($mirrors)
  16469. {
  16470. return $this->aliasOf->setDistMirrors($mirrors);
  16471. }
  16472. public function getDistMirrors()
  16473. {
  16474. return $this->aliasOf->getDistMirrors();
  16475. }
  16476. public function getScripts()
  16477. {
  16478. return $this->aliasOf->getScripts();
  16479. }
  16480. public function getLicense()
  16481. {
  16482. return $this->aliasOf->getLicense();
  16483. }
  16484. public function getAutoload()
  16485. {
  16486. return $this->aliasOf->getAutoload();
  16487. }
  16488. public function getDevAutoload()
  16489. {
  16490. return $this->aliasOf->getDevAutoload();
  16491. }
  16492. public function getIncludePaths()
  16493. {
  16494. return $this->aliasOf->getIncludePaths();
  16495. }
  16496. public function getRepositories()
  16497. {
  16498. return $this->aliasOf->getRepositories();
  16499. }
  16500. public function getReleaseDate()
  16501. {
  16502. return $this->aliasOf->getReleaseDate();
  16503. }
  16504. public function getBinaries()
  16505. {
  16506. return $this->aliasOf->getBinaries();
  16507. }
  16508. public function getKeywords()
  16509. {
  16510. return $this->aliasOf->getKeywords();
  16511. }
  16512. public function getDescription()
  16513. {
  16514. return $this->aliasOf->getDescription();
  16515. }
  16516. public function getHomepage()
  16517. {
  16518. return $this->aliasOf->getHomepage();
  16519. }
  16520. public function getSuggests()
  16521. {
  16522. return $this->aliasOf->getSuggests();
  16523. }
  16524. public function getAuthors()
  16525. {
  16526. return $this->aliasOf->getAuthors();
  16527. }
  16528. public function getSupport()
  16529. {
  16530. return $this->aliasOf->getSupport();
  16531. }
  16532. public function getNotificationUrl()
  16533. {
  16534. return $this->aliasOf->getNotificationUrl();
  16535. }
  16536. public function getArchiveExcludes()
  16537. {
  16538. return $this->aliasOf->getArchiveExcludes();
  16539. }
  16540. public function isAbandoned()
  16541. {
  16542. return $this->aliasOf->isAbandoned();
  16543. }
  16544. public function getReplacementPackage()
  16545. {
  16546. return $this->aliasOf->getReplacementPackage();
  16547. }
  16548. public function __toString()
  16549. {
  16550. return parent::__toString().' (alias of '.$this->aliasOf->getVersion().')';
  16551. }
  16552. public function setDistUrl($url)
  16553. {
  16554. return $this->aliasOf->setDistUrl($url);
  16555. }
  16556. public function setDistType($type)
  16557. {
  16558. return $this->aliasOf->setDistType($type);
  16559. }
  16560. }
  16561. <?php
  16562. namespace Composer\Package\Archiver;
  16563. use FilterIterator;
  16564. use PharData;
  16565. class ArchivableFilesFilter extends FilterIterator
  16566. {
  16567. private $dirs = array();
  16568. public function accept()
  16569. {
  16570. $file = $this->getInnerIterator()->current();
  16571. if ($file->isDir()) {
  16572. $this->dirs[] = (string) $file;
  16573. return false;
  16574. }
  16575. return true;
  16576. }
  16577. public function addEmptyDir(PharData $phar, $sources)
  16578. {
  16579. foreach ($this->dirs as $filepath) {
  16580. $localname = str_replace($sources . "/", '', $filepath);
  16581. $phar->addEmptyDir($localname);
  16582. }
  16583. }
  16584. }
  16585. <?php
  16586. namespace Composer\Package\Archiver;
  16587. use Composer\Util\Filesystem;
  16588. use FilesystemIterator;
  16589. use Symfony\Component\Finder\Finder;
  16590. use Symfony\Component\Finder\SplFileInfo;
  16591. class ArchivableFilesFinder extends \FilterIterator
  16592. {
  16593. protected $finder;
  16594. public function __construct($sources, array $excludes, $ignoreFilters = false)
  16595. {
  16596. $fs = new Filesystem();
  16597. $sources = $fs->normalizePath($sources);
  16598. if ($ignoreFilters) {
  16599. $filters = array();
  16600. } else {
  16601. $filters = array(
  16602. new HgExcludeFilter($sources),
  16603. new GitExcludeFilter($sources),
  16604. new ComposerExcludeFilter($sources, $excludes),
  16605. );
  16606. }
  16607. $this->finder = new Finder();
  16608. $filter = function (\SplFileInfo $file) use ($sources, $filters, $fs) {
  16609. if ($file->isLink() && strpos($file->getLinkTarget(), $sources) !== 0) {
  16610. return false;
  16611. }
  16612. $relativePath = preg_replace(
  16613. '#^'.preg_quote($sources, '#').'#',
  16614. '',
  16615. $fs->normalizePath($file->getRealPath())
  16616. );
  16617. $exclude = false;
  16618. foreach ($filters as $filter) {
  16619. $exclude = $filter->filter($relativePath, $exclude);
  16620. }
  16621. return !$exclude;
  16622. };
  16623. if (method_exists($filter, 'bindTo')) {
  16624. $filter = $filter->bindTo(null);
  16625. }
  16626. $this->finder
  16627. ->in($sources)
  16628. ->filter($filter)
  16629. ->ignoreVCS(true)
  16630. ->ignoreDotFiles(false);
  16631. parent::__construct($this->finder->getIterator());
  16632. }
  16633. public function accept()
  16634. {
  16635. $current = $this->getInnerIterator()->current();
  16636. if (!$current->isDir()) {
  16637. return true;
  16638. }
  16639. $iterator = new FilesystemIterator($current, FilesystemIterator::SKIP_DOTS);
  16640. return !$iterator->valid();
  16641. }
  16642. }
  16643. <?php
  16644. namespace Composer\Package\Archiver;
  16645. use Composer\Downloader\DownloadManager;
  16646. use Composer\Package\PackageInterface;
  16647. use Composer\Package\RootPackageInterface;
  16648. use Composer\Util\Filesystem;
  16649. use Composer\Json\JsonFile;
  16650. class ArchiveManager
  16651. {
  16652. protected $downloadManager;
  16653. protected $archivers = array();
  16654. protected $overwriteFiles = true;
  16655. public function __construct(DownloadManager $downloadManager)
  16656. {
  16657. $this->downloadManager = $downloadManager;
  16658. }
  16659. public function addArchiver(ArchiverInterface $archiver)
  16660. {
  16661. $this->archivers[] = $archiver;
  16662. }
  16663. public function setOverwriteFiles($overwriteFiles)
  16664. {
  16665. $this->overwriteFiles = $overwriteFiles;
  16666. return $this;
  16667. }
  16668. public function getPackageFilename(PackageInterface $package)
  16669. {
  16670. $nameParts = array(preg_replace('#[^a-z0-9-_]#i', '-', $package->getName()));
  16671. if (preg_match('{^[a-f0-9]{40}$}', $package->getDistReference())) {
  16672. array_push($nameParts, $package->getDistReference(), $package->getDistType());
  16673. } else {
  16674. array_push($nameParts, $package->getPrettyVersion(), $package->getDistReference());
  16675. }
  16676. if ($package->getSourceReference()) {
  16677. $nameParts[] = substr(sha1($package->getSourceReference()), 0, 6);
  16678. }
  16679. $name = implode('-', array_filter($nameParts, function ($p) {
  16680. return !empty($p);
  16681. }));
  16682. return str_replace('/', '-', $name);
  16683. }
  16684. public function archive(PackageInterface $package, $format, $targetDir, $fileName = null, $ignoreFilters = false)
  16685. {
  16686. if (empty($format)) {
  16687. throw new \InvalidArgumentException('Format must be specified');
  16688. }
  16689. $usableArchiver = null;
  16690. foreach ($this->archivers as $archiver) {
  16691. if ($archiver->supports($format, $package->getSourceType())) {
  16692. $usableArchiver = $archiver;
  16693. break;
  16694. }
  16695. }
  16696. if (null === $usableArchiver) {
  16697. throw new \RuntimeException(sprintf('No archiver found to support %s format', $format));
  16698. }
  16699. $filesystem = new Filesystem();
  16700. if (null === $fileName) {
  16701. $packageName = $this->getPackageFilename($package);
  16702. } else {
  16703. $packageName = $fileName;
  16704. }
  16705. $filesystem->ensureDirectoryExists($targetDir);
  16706. $target = realpath($targetDir).'/'.$packageName.'.'.$format;
  16707. $filesystem->ensureDirectoryExists(dirname($target));
  16708. if (!$this->overwriteFiles && file_exists($target)) {
  16709. return $target;
  16710. }
  16711. if ($package instanceof RootPackageInterface) {
  16712. $sourcePath = realpath('.');
  16713. } else {
  16714. $sourcePath = sys_get_temp_dir().'/composer_archive'.uniqid();
  16715. $filesystem->ensureDirectoryExists($sourcePath);
  16716. try {
  16717. $this->downloadManager->download($package, $sourcePath);
  16718. } catch (\Exception $e) {
  16719. $filesystem->removeDirectory($sourcePath);
  16720. throw $e;
  16721. }
  16722. if (file_exists($composerJsonPath = $sourcePath.'/composer.json')) {
  16723. $jsonFile = new JsonFile($composerJsonPath);
  16724. $jsonData = $jsonFile->read();
  16725. if (!empty($jsonData['archive']['exclude'])) {
  16726. $package->setArchiveExcludes($jsonData['archive']['exclude']);
  16727. }
  16728. }
  16729. }
  16730. $tempTarget = sys_get_temp_dir().'/composer_archive'.uniqid().'.'.$format;
  16731. $filesystem->ensureDirectoryExists(dirname($tempTarget));
  16732. $archivePath = $usableArchiver->archive($sourcePath, $tempTarget, $format, $package->getArchiveExcludes(), $ignoreFilters);
  16733. $filesystem->rename($archivePath, $target);
  16734. if (!$package instanceof RootPackageInterface) {
  16735. $filesystem->removeDirectory($sourcePath);
  16736. }
  16737. $filesystem->remove($tempTarget);
  16738. return $target;
  16739. }
  16740. }
  16741. <?php
  16742. namespace Composer\Package\Archiver;
  16743. interface ArchiverInterface
  16744. {
  16745. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false);
  16746. public function supports($format, $sourceType);
  16747. }
  16748. <?php
  16749. namespace Composer\Package\Archiver;
  16750. use Symfony\Component\Finder;
  16751. abstract class BaseExcludeFilter
  16752. {
  16753. protected $sourcePath;
  16754. protected $excludePatterns;
  16755. public function __construct($sourcePath)
  16756. {
  16757. $this->sourcePath = $sourcePath;
  16758. $this->excludePatterns = array();
  16759. }
  16760. public function filter($relativePath, $exclude)
  16761. {
  16762. foreach ($this->excludePatterns as $patternData) {
  16763. list($pattern, $negate, $stripLeadingSlash) = $patternData;
  16764. if ($stripLeadingSlash) {
  16765. $path = substr($relativePath, 1);
  16766. } else {
  16767. $path = $relativePath;
  16768. }
  16769. if (preg_match($pattern, $path)) {
  16770. $exclude = !$negate;
  16771. }
  16772. }
  16773. return $exclude;
  16774. }
  16775. protected function parseLines(array $lines, $lineParser)
  16776. {
  16777. return array_filter(
  16778. array_map(
  16779. function ($line) use ($lineParser) {
  16780. $line = trim($line);
  16781. if (!$line || 0 === strpos($line, '#')) {
  16782. return null;
  16783. }
  16784. return call_user_func($lineParser, $line);
  16785. },
  16786. $lines
  16787. ),
  16788. function ($pattern) {
  16789. return $pattern !== null;
  16790. }
  16791. );
  16792. }
  16793. protected function generatePatterns($rules)
  16794. {
  16795. $patterns = array();
  16796. foreach ($rules as $rule) {
  16797. $patterns[] = $this->generatePattern($rule);
  16798. }
  16799. return $patterns;
  16800. }
  16801. protected function generatePattern($rule)
  16802. {
  16803. $negate = false;
  16804. $pattern = '{';
  16805. if (strlen($rule) && $rule[0] === '!') {
  16806. $negate = true;
  16807. $rule = substr($rule, 1);
  16808. }
  16809. if (strlen($rule) && $rule[0] === '/') {
  16810. $pattern .= '^/';
  16811. $rule = substr($rule, 1);
  16812. } elseif (strlen($rule) - 1 === strpos($rule, '/')) {
  16813. $pattern .= '/';
  16814. $rule = substr($rule, 0, -1);
  16815. } elseif (false === strpos($rule, '/')) {
  16816. $pattern .= '/';
  16817. }
  16818. $pattern .= substr(Finder\Glob::toRegex($rule), 2, -2) . '(?=$|/)';
  16819. return array($pattern . '}', $negate, false);
  16820. }
  16821. }
  16822. <?php
  16823. namespace Composer\Package\Archiver;
  16824. class ComposerExcludeFilter extends BaseExcludeFilter
  16825. {
  16826. public function __construct($sourcePath, array $excludeRules)
  16827. {
  16828. parent::__construct($sourcePath);
  16829. $this->excludePatterns = $this->generatePatterns($excludeRules);
  16830. }
  16831. }
  16832. <?php
  16833. namespace Composer\Package\Archiver;
  16834. class GitExcludeFilter extends BaseExcludeFilter
  16835. {
  16836. public function __construct($sourcePath)
  16837. {
  16838. parent::__construct($sourcePath);
  16839. if (file_exists($sourcePath.'/.gitignore')) {
  16840. $this->excludePatterns = $this->parseLines(
  16841. file($sourcePath.'/.gitignore'),
  16842. array($this, 'parseGitIgnoreLine')
  16843. );
  16844. }
  16845. if (file_exists($sourcePath.'/.gitattributes')) {
  16846. $this->excludePatterns = array_merge(
  16847. $this->excludePatterns,
  16848. $this->parseLines(
  16849. file($sourcePath.'/.gitattributes'),
  16850. array($this, 'parseGitAttributesLine')
  16851. )
  16852. );
  16853. }
  16854. }
  16855. public function parseGitIgnoreLine($line)
  16856. {
  16857. return $this->generatePattern($line);
  16858. }
  16859. public function parseGitAttributesLine($line)
  16860. {
  16861. $parts = preg_split('#\s+#', $line);
  16862. if (count($parts) == 2 && $parts[1] === 'export-ignore') {
  16863. return $this->generatePattern($parts[0]);
  16864. }
  16865. return null;
  16866. }
  16867. }
  16868. <?php
  16869. namespace Composer\Package\Archiver;
  16870. use Symfony\Component\Finder;
  16871. class HgExcludeFilter extends BaseExcludeFilter
  16872. {
  16873. const HG_IGNORE_REGEX = 1;
  16874. const HG_IGNORE_GLOB = 2;
  16875. protected $patternMode;
  16876. public function __construct($sourcePath)
  16877. {
  16878. parent::__construct($sourcePath);
  16879. $this->patternMode = self::HG_IGNORE_REGEX;
  16880. if (file_exists($sourcePath.'/.hgignore')) {
  16881. $this->excludePatterns = $this->parseLines(
  16882. file($sourcePath.'/.hgignore'),
  16883. array($this, 'parseHgIgnoreLine')
  16884. );
  16885. }
  16886. }
  16887. public function parseHgIgnoreLine($line)
  16888. {
  16889. if (preg_match('#^syntax\s*:\s*(glob|regexp)$#', $line, $matches)) {
  16890. if ($matches[1] === 'glob') {
  16891. $this->patternMode = self::HG_IGNORE_GLOB;
  16892. } else {
  16893. $this->patternMode = self::HG_IGNORE_REGEX;
  16894. }
  16895. return null;
  16896. }
  16897. if ($this->patternMode == self::HG_IGNORE_GLOB) {
  16898. return $this->patternFromGlob($line);
  16899. }
  16900. return $this->patternFromRegex($line);
  16901. }
  16902. protected function patternFromGlob($line)
  16903. {
  16904. $pattern = '#'.substr(Finder\Glob::toRegex($line), 2, -1).'#';
  16905. $pattern = str_replace('[^/]*', '.*', $pattern);
  16906. return array($pattern, false, true);
  16907. }
  16908. public function patternFromRegex($line)
  16909. {
  16910. $pattern = '#'.preg_replace('/((?:\\\\\\\\)*)(\\\\?)#/', '\1\2\2\\#', $line).'#';
  16911. return array($pattern, false, true);
  16912. }
  16913. }
  16914. <?php
  16915. namespace Composer\Package\Archiver;
  16916. class PharArchiver implements ArchiverInterface
  16917. {
  16918. protected static $formats = array(
  16919. 'zip' => \Phar::ZIP,
  16920. 'tar' => \Phar::TAR,
  16921. 'tar.gz' => \Phar::TAR,
  16922. 'tar.bz2' => \Phar::TAR,
  16923. );
  16924. protected static $compressFormats = array(
  16925. 'tar.gz' => \Phar::GZ,
  16926. 'tar.bz2' => \Phar::BZ2,
  16927. );
  16928. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16929. {
  16930. $sources = realpath($sources);
  16931. if (file_exists($target)) {
  16932. unlink($target);
  16933. }
  16934. try {
  16935. $filename = substr($target, 0, strrpos($target, $format) - 1);
  16936. if (isset(static::$compressFormats[$format])) {
  16937. $target = $filename . '.tar';
  16938. }
  16939. $phar = new \PharData($target, null, null, static::$formats[$format]);
  16940. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16941. $filesOnly = new ArchivableFilesFilter($files);
  16942. $phar->buildFromIterator($filesOnly, $sources);
  16943. $filesOnly->addEmptyDir($phar, $sources);
  16944. if (isset(static::$compressFormats[$format])) {
  16945. if (!$phar->canCompress(static::$compressFormats[$format])) {
  16946. throw new \RuntimeException(sprintf('Can not compress to %s format', $format));
  16947. }
  16948. unlink($target);
  16949. $phar->compress(static::$compressFormats[$format]);
  16950. $target = $filename . '.' . $format;
  16951. }
  16952. return $target;
  16953. } catch (\UnexpectedValueException $e) {
  16954. $message = sprintf(
  16955. "Could not create archive '%s' from '%s': %s",
  16956. $target,
  16957. $sources,
  16958. $e->getMessage()
  16959. );
  16960. throw new \RuntimeException($message, $e->getCode(), $e);
  16961. }
  16962. }
  16963. public function supports($format, $sourceType)
  16964. {
  16965. return isset(static::$formats[$format]);
  16966. }
  16967. }
  16968. <?php
  16969. namespace Composer\Package\Archiver;
  16970. use ZipArchive;
  16971. use Composer\Util\Filesystem;
  16972. class ZipArchiver implements ArchiverInterface
  16973. {
  16974. protected static $formats = array(
  16975. 'zip' => 1,
  16976. );
  16977. public function archive($sources, $target, $format, array $excludes = array(), $ignoreFilters = false)
  16978. {
  16979. $fs = new Filesystem();
  16980. $sources = $fs->normalizePath($sources);
  16981. $zip = new ZipArchive();
  16982. $res = $zip->open($target, ZipArchive::CREATE);
  16983. if ($res === true) {
  16984. $files = new ArchivableFilesFinder($sources, $excludes, $ignoreFilters);
  16985. foreach ($files as $file) {
  16986. $filepath = strtr($file->getPath()."/".$file->getFilename(), '\\', '/');
  16987. $localname = str_replace($sources.'/', '', $filepath);
  16988. if ($file->isDir()) {
  16989. $zip->addEmptyDir($localname);
  16990. } else {
  16991. $zip->addFile($filepath, $localname);
  16992. }
  16993. }
  16994. if ($zip->close()) {
  16995. return $target;
  16996. }
  16997. }
  16998. $message = sprintf(
  16999. "Could not create archive '%s' from '%s': %s",
  17000. $target,
  17001. $sources,
  17002. $zip->getStatusString()
  17003. );
  17004. throw new \RuntimeException($message);
  17005. }
  17006. public function supports($format, $sourceType)
  17007. {
  17008. return isset(static::$formats[$format]) && $this->compressionAvailable();
  17009. }
  17010. private function compressionAvailable()
  17011. {
  17012. return class_exists('ZipArchive');
  17013. }
  17014. }
  17015. <?php
  17016. namespace Composer\Package;
  17017. use Composer\Repository\RepositoryInterface;
  17018. use Composer\Repository\PlatformRepository;
  17019. abstract class BasePackage implements PackageInterface
  17020. {
  17021. public static $supportedLinkTypes = array(
  17022. 'require' => array('description' => 'requires', 'method' => 'requires'),
  17023. 'conflict' => array('description' => 'conflicts', 'method' => 'conflicts'),
  17024. 'provide' => array('description' => 'provides', 'method' => 'provides'),
  17025. 'replace' => array('description' => 'replaces', 'method' => 'replaces'),
  17026. 'require-dev' => array('description' => 'requires (for development)', 'method' => 'devRequires'),
  17027. );
  17028. const STABILITY_STABLE = 0;
  17029. const STABILITY_RC = 5;
  17030. const STABILITY_BETA = 10;
  17031. const STABILITY_ALPHA = 15;
  17032. const STABILITY_DEV = 20;
  17033. public static $stabilities = array(
  17034. 'stable' => self::STABILITY_STABLE,
  17035. 'RC' => self::STABILITY_RC,
  17036. 'beta' => self::STABILITY_BETA,
  17037. 'alpha' => self::STABILITY_ALPHA,
  17038. 'dev' => self::STABILITY_DEV,
  17039. );
  17040. public $id;
  17041. protected $name;
  17042. protected $prettyName;
  17043. protected $repository;
  17044. protected $transportOptions = array();
  17045. public function __construct($name)
  17046. {
  17047. $this->prettyName = $name;
  17048. $this->name = strtolower($name);
  17049. $this->id = -1;
  17050. }
  17051. public function getName()
  17052. {
  17053. return $this->name;
  17054. }
  17055. public function getPrettyName()
  17056. {
  17057. return $this->prettyName;
  17058. }
  17059. public function getNames()
  17060. {
  17061. $names = array(
  17062. $this->getName() => true,
  17063. );
  17064. foreach ($this->getProvides() as $link) {
  17065. $names[$link->getTarget()] = true;
  17066. }
  17067. foreach ($this->getReplaces() as $link) {
  17068. $names[$link->getTarget()] = true;
  17069. }
  17070. return array_keys($names);
  17071. }
  17072. public function setId($id)
  17073. {
  17074. $this->id = $id;
  17075. }
  17076. public function getId()
  17077. {
  17078. return $this->id;
  17079. }
  17080. public function setRepository(RepositoryInterface $repository)
  17081. {
  17082. if ($this->repository && $repository !== $this->repository) {
  17083. throw new \LogicException('A package can only be added to one repository');
  17084. }
  17085. $this->repository = $repository;
  17086. }
  17087. public function getRepository()
  17088. {
  17089. return $this->repository;
  17090. }
  17091. public function getTransportOptions()
  17092. {
  17093. return $this->transportOptions;
  17094. }
  17095. public function setTransportOptions(array $options)
  17096. {
  17097. $this->transportOptions = $options;
  17098. }
  17099. public function isPlatform()
  17100. {
  17101. return $this->getRepository() instanceof PlatformRepository;
  17102. }
  17103. public function getUniqueName()
  17104. {
  17105. return $this->getName().'-'.$this->getVersion();
  17106. }
  17107. public function equals(PackageInterface $package)
  17108. {
  17109. $self = $this;
  17110. if ($this instanceof AliasPackage) {
  17111. $self = $this->getAliasOf();
  17112. }
  17113. if ($package instanceof AliasPackage) {
  17114. $package = $package->getAliasOf();
  17115. }
  17116. return $package === $self;
  17117. }
  17118. public function __toString()
  17119. {
  17120. return $this->getUniqueName();
  17121. }
  17122. public function getPrettyString()
  17123. {
  17124. return $this->getPrettyName().' '.$this->getPrettyVersion();
  17125. }
  17126. public function getFullPrettyVersion($truncate = true)
  17127. {
  17128. if (!$this->isDev() || !in_array($this->getSourceType(), array('hg', 'git'))) {
  17129. return $this->getPrettyVersion();
  17130. }
  17131. if ($truncate && strlen($this->getSourceReference()) === 40) {
  17132. return $this->getPrettyVersion() . ' ' . substr($this->getSourceReference(), 0, 7);
  17133. }
  17134. return $this->getPrettyVersion() . ' ' . $this->getSourceReference();
  17135. }
  17136. public function getStabilityPriority()
  17137. {
  17138. return self::$stabilities[$this->getStability()];
  17139. }
  17140. public function __clone()
  17141. {
  17142. $this->repository = null;
  17143. $this->id = -1;
  17144. }
  17145. public static function packageNameToRegexp($whiteListedPattern, $wrap = '{^%s$}i')
  17146. {
  17147. $cleanedWhiteListedPattern = str_replace('\\*', '.*', preg_quote($whiteListedPattern));
  17148. return sprintf($wrap, $cleanedWhiteListedPattern);
  17149. }
  17150. }
  17151. <?php
  17152. namespace Composer\Package\Comparer;
  17153. class Comparer
  17154. {
  17155. private $source;
  17156. private $update;
  17157. private $changed;
  17158. public function setSource($source)
  17159. {
  17160. $this->source = $source;
  17161. }
  17162. public function setUpdate($update)
  17163. {
  17164. $this->update = $update;
  17165. }
  17166. public function getChanged($toString = false, $explicated = false)
  17167. {
  17168. $changed = $this->changed;
  17169. if (!count($changed)) {
  17170. return false;
  17171. }
  17172. if ($explicated) {
  17173. foreach ($changed as $sectionKey => $itemSection) {
  17174. foreach ($itemSection as $itemKey => $item) {
  17175. $changed[$sectionKey][$itemKey] = $item.' ('.$sectionKey.')';
  17176. }
  17177. }
  17178. }
  17179. if ($toString) {
  17180. foreach ($changed as $sectionKey => $itemSection) {
  17181. foreach ($itemSection as $itemKey => $item) {
  17182. $changed['string'][] = $item."\r\n";
  17183. }
  17184. }
  17185. $changed = implode("\r\n", $changed['string']);
  17186. }
  17187. return $changed;
  17188. }
  17189. public function doCompare()
  17190. {
  17191. $source = array();
  17192. $destination = array();
  17193. $this->changed = array();
  17194. $currentDirectory = getcwd();
  17195. chdir($this->source);
  17196. $source = $this->doTree('.', $source);
  17197. if (!is_array($source)) {
  17198. return;
  17199. }
  17200. chdir($currentDirectory);
  17201. chdir($this->update);
  17202. $destination = $this->doTree('.', $destination);
  17203. if (!is_array($destination)) {
  17204. exit;
  17205. }
  17206. chdir($currentDirectory);
  17207. foreach ($source as $dir => $value) {
  17208. foreach ($value as $file => $hash) {
  17209. if (isset($destination[$dir][$file])) {
  17210. if ($hash !== $destination[$dir][$file]) {
  17211. $this->changed['changed'][] = $dir.'/'.$file;
  17212. }
  17213. } else {
  17214. $this->changed['removed'][] = $dir.'/'.$file;
  17215. }
  17216. }
  17217. }
  17218. foreach ($destination as $dir => $value) {
  17219. foreach ($value as $file => $hash) {
  17220. if (!isset($source[$dir][$file])) {
  17221. $this->changed['added'][] = $dir.'/'.$file;
  17222. }
  17223. }
  17224. }
  17225. }
  17226. private function doTree($dir, &$array)
  17227. {
  17228. if ($dh = opendir($dir)) {
  17229. while ($file = readdir($dh)) {
  17230. if ($file !== '.' && $file !== '..') {
  17231. if (is_dir($dir.'/'.$file)) {
  17232. if (!count($array)) {
  17233. $array[0] = 'Temp';
  17234. }
  17235. if (!$this->doTree($dir.'/'.$file, $array)) {
  17236. return false;
  17237. }
  17238. } else {
  17239. if (filesize($dir.'/'.$file)) {
  17240. set_time_limit(30);
  17241. $array[$dir][$file] = md5_file($dir.'/'.$file);
  17242. }
  17243. }
  17244. }
  17245. }
  17246. if (count($array) > 1 && isset($array['0'])) {
  17247. unset($array['0']);
  17248. }
  17249. return $array;
  17250. }
  17251. return false;
  17252. }
  17253. }
  17254. <?php
  17255. namespace Composer\Package;
  17256. class CompletePackage extends Package implements CompletePackageInterface
  17257. {
  17258. protected $repositories;
  17259. protected $license = array();
  17260. protected $keywords;
  17261. protected $authors;
  17262. protected $description;
  17263. protected $homepage;
  17264. protected $scripts = array();
  17265. protected $support = array();
  17266. protected $abandoned = false;
  17267. public function setScripts(array $scripts)
  17268. {
  17269. $this->scripts = $scripts;
  17270. }
  17271. public function getScripts()
  17272. {
  17273. return $this->scripts;
  17274. }
  17275. public function setRepositories($repositories)
  17276. {
  17277. $this->repositories = $repositories;
  17278. }
  17279. public function getRepositories()
  17280. {
  17281. return $this->repositories;
  17282. }
  17283. public function setLicense(array $license)
  17284. {
  17285. $this->license = $license;
  17286. }
  17287. public function getLicense()
  17288. {
  17289. return $this->license;
  17290. }
  17291. public function setKeywords(array $keywords)
  17292. {
  17293. $this->keywords = $keywords;
  17294. }
  17295. public function getKeywords()
  17296. {
  17297. return $this->keywords;
  17298. }
  17299. public function setAuthors(array $authors)
  17300. {
  17301. $this->authors = $authors;
  17302. }
  17303. public function getAuthors()
  17304. {
  17305. return $this->authors;
  17306. }
  17307. public function setDescription($description)
  17308. {
  17309. $this->description = $description;
  17310. }
  17311. public function getDescription()
  17312. {
  17313. return $this->description;
  17314. }
  17315. public function setHomepage($homepage)
  17316. {
  17317. $this->homepage = $homepage;
  17318. }
  17319. public function getHomepage()
  17320. {
  17321. return $this->homepage;
  17322. }
  17323. public function setSupport(array $support)
  17324. {
  17325. $this->support = $support;
  17326. }
  17327. public function getSupport()
  17328. {
  17329. return $this->support;
  17330. }
  17331. public function isAbandoned()
  17332. {
  17333. return (bool) $this->abandoned;
  17334. }
  17335. public function setAbandoned($abandoned)
  17336. {
  17337. $this->abandoned = $abandoned;
  17338. }
  17339. public function getReplacementPackage()
  17340. {
  17341. return is_string($this->abandoned) ? $this->abandoned : null;
  17342. }
  17343. }
  17344. <?php
  17345. namespace Composer\Package;
  17346. interface CompletePackageInterface extends PackageInterface
  17347. {
  17348. public function getScripts();
  17349. public function getRepositories();
  17350. public function getLicense();
  17351. public function getKeywords();
  17352. public function getDescription();
  17353. public function getHomepage();
  17354. public function getAuthors();
  17355. public function getSupport();
  17356. public function isAbandoned();
  17357. public function getReplacementPackage();
  17358. }
  17359. <?php
  17360. namespace Composer\Package\Dumper;
  17361. use Composer\Package\BasePackage;
  17362. use Composer\Package\PackageInterface;
  17363. use Composer\Package\CompletePackageInterface;
  17364. use Composer\Package\RootPackageInterface;
  17365. class ArrayDumper
  17366. {
  17367. public function dump(PackageInterface $package)
  17368. {
  17369. $keys = array(
  17370. 'binaries' => 'bin',
  17371. 'type',
  17372. 'extra',
  17373. 'installationSource' => 'installation-source',
  17374. 'autoload',
  17375. 'devAutoload' => 'autoload-dev',
  17376. 'notificationUrl' => 'notification-url',
  17377. 'includePaths' => 'include-path',
  17378. );
  17379. $data = array();
  17380. $data['name'] = $package->getPrettyName();
  17381. $data['version'] = $package->getPrettyVersion();
  17382. $data['version_normalized'] = $package->getVersion();
  17383. if ($package->getTargetDir()) {
  17384. $data['target-dir'] = $package->getTargetDir();
  17385. }
  17386. if ($package->getSourceType()) {
  17387. $data['source']['type'] = $package->getSourceType();
  17388. $data['source']['url'] = $package->getSourceUrl();
  17389. if (null !== ($value = $package->getSourceReference())) {
  17390. $data['source']['reference'] = $value;
  17391. }
  17392. if ($mirrors = $package->getSourceMirrors()) {
  17393. $data['source']['mirrors'] = $mirrors;
  17394. }
  17395. }
  17396. if ($package->getDistType()) {
  17397. $data['dist']['type'] = $package->getDistType();
  17398. $data['dist']['url'] = $package->getDistUrl();
  17399. if (null !== ($value = $package->getDistReference())) {
  17400. $data['dist']['reference'] = $value;
  17401. }
  17402. if (null !== ($value = $package->getDistSha1Checksum())) {
  17403. $data['dist']['shasum'] = $value;
  17404. }
  17405. if ($mirrors = $package->getDistMirrors()) {
  17406. $data['dist']['mirrors'] = $mirrors;
  17407. }
  17408. }
  17409. if ($package->getArchiveExcludes()) {
  17410. $data['archive']['exclude'] = $package->getArchiveExcludes();
  17411. }
  17412. foreach (BasePackage::$supportedLinkTypes as $type => $opts) {
  17413. if ($links = $package->{'get'.ucfirst($opts['method'])}()) {
  17414. foreach ($links as $link) {
  17415. $data[$type][$link->getTarget()] = $link->getPrettyConstraint();
  17416. }
  17417. ksort($data[$type]);
  17418. }
  17419. }
  17420. if ($packages = $package->getSuggests()) {
  17421. ksort($packages);
  17422. $data['suggest'] = $packages;
  17423. }
  17424. if ($package->getReleaseDate()) {
  17425. $data['time'] = $package->getReleaseDate()->format(DATE_RFC3339);
  17426. }
  17427. $data = $this->dumpValues($package, $keys, $data);
  17428. if ($package instanceof CompletePackageInterface) {
  17429. $keys = array(
  17430. 'scripts',
  17431. 'license',
  17432. 'authors',
  17433. 'description',
  17434. 'homepage',
  17435. 'keywords',
  17436. 'repositories',
  17437. 'support',
  17438. );
  17439. $data = $this->dumpValues($package, $keys, $data);
  17440. if (isset($data['keywords']) && is_array($data['keywords'])) {
  17441. sort($data['keywords']);
  17442. }
  17443. if ($package->isAbandoned()) {
  17444. $data['abandoned'] = $package->getReplacementPackage() ?: true;
  17445. }
  17446. }
  17447. if ($package instanceof RootPackageInterface) {
  17448. $minimumStability = $package->getMinimumStability();
  17449. if ($minimumStability) {
  17450. $data['minimum-stability'] = $minimumStability;
  17451. }
  17452. }
  17453. if (count($package->getTransportOptions()) > 0) {
  17454. $data['transport-options'] = $package->getTransportOptions();
  17455. }
  17456. return $data;
  17457. }
  17458. private function dumpValues(PackageInterface $package, array $keys, array $data)
  17459. {
  17460. foreach ($keys as $method => $key) {
  17461. if (is_numeric($method)) {
  17462. $method = $key;
  17463. }
  17464. $getter = 'get'.ucfirst($method);
  17465. $value = $package->$getter();
  17466. if (null !== $value && !(is_array($value) && 0 === count($value))) {
  17467. $data[$key] = $value;
  17468. }
  17469. }
  17470. return $data;
  17471. }
  17472. }
  17473. <?php
  17474. namespace Composer\Package;
  17475. use Composer\Semver\Constraint\ConstraintInterface;
  17476. class Link
  17477. {
  17478. protected $source;
  17479. protected $target;
  17480. protected $constraint;
  17481. protected $description;
  17482. protected $prettyConstraint;
  17483. public function __construct($source, $target, ConstraintInterface $constraint = null, $description = 'relates to', $prettyConstraint = null)
  17484. {
  17485. $this->source = strtolower($source);
  17486. $this->target = strtolower($target);
  17487. $this->constraint = $constraint;
  17488. $this->description = $description;
  17489. $this->prettyConstraint = $prettyConstraint;
  17490. }
  17491. public function getDescription()
  17492. {
  17493. return $this->description;
  17494. }
  17495. public function getSource()
  17496. {
  17497. return $this->source;
  17498. }
  17499. public function getTarget()
  17500. {
  17501. return $this->target;
  17502. }
  17503. public function getConstraint()
  17504. {
  17505. return $this->constraint;
  17506. }
  17507. public function getPrettyConstraint()
  17508. {
  17509. if (null === $this->prettyConstraint) {
  17510. throw new \UnexpectedValueException(sprintf('Link %s has been misconfigured and had no prettyConstraint given.', $this));
  17511. }
  17512. return $this->prettyConstraint;
  17513. }
  17514. public function __toString()
  17515. {
  17516. return $this->source.' '.$this->description.' '.$this->target.' ('.$this->constraint.')';
  17517. }
  17518. public function getPrettyString(PackageInterface $sourcePackage)
  17519. {
  17520. return $sourcePackage->getPrettyString().' '.$this->description.' '.$this->target.' '.$this->constraint->getPrettyString().'';
  17521. }
  17522. }
  17523. <?php
  17524. namespace Composer\Package\LinkConstraint;
  17525. use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
  17526. trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
  17527. class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
  17528. {
  17529. }
  17530. <?php
  17531. namespace Composer\Package\LinkConstraint;
  17532. use Composer\Semver\Constraint\ConstraintInterface;
  17533. trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
  17534. interface LinkConstraintInterface extends ConstraintInterface
  17535. {
  17536. }
  17537. <?php
  17538. namespace Composer\Package\LinkConstraint;
  17539. use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
  17540. trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
  17541. class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
  17542. {
  17543. }
  17544. <?php
  17545. namespace Composer\Package\LinkConstraint;
  17546. use Composer\Semver\Constraint\AbstractConstraint;
  17547. trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
  17548. abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
  17549. {
  17550. }
  17551. <?php
  17552. namespace Composer\Package\LinkConstraint;
  17553. use Composer\Semver\Constraint\Constraint;
  17554. trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
  17555. class VersionConstraint extends Constraint implements LinkConstraintInterface
  17556. {
  17557. }
  17558. <?php
  17559. namespace Composer\Package\Loader;
  17560. use Composer\Package;
  17561. use Composer\Package\AliasPackage;
  17562. use Composer\Package\Link;
  17563. use Composer\Package\RootAliasPackage;
  17564. use Composer\Package\RootPackageInterface;
  17565. use Composer\Package\Version\VersionParser;
  17566. use Composer\Semver\VersionParser as SemverVersionParser;
  17567. class ArrayLoader implements LoaderInterface
  17568. {
  17569. protected $versionParser;
  17570. protected $loadOptions;
  17571. public function __construct(SemverVersionParser $parser = null, $loadOptions = false)
  17572. {
  17573. if (!$parser) {
  17574. $parser = new VersionParser;
  17575. }
  17576. $this->versionParser = $parser;
  17577. $this->loadOptions = $loadOptions;
  17578. }
  17579. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  17580. {
  17581. if (!isset($config['name'])) {
  17582. throw new \UnexpectedValueException('Unknown package has no name defined ('.json_encode($config).').');
  17583. }
  17584. if (!isset($config['version'])) {
  17585. throw new \UnexpectedValueException('Package '.$config['name'].' has no version defined.');
  17586. }
  17587. if (isset($config['version_normalized'])) {
  17588. $version = $config['version_normalized'];
  17589. } else {
  17590. $version = $this->versionParser->normalize($config['version']);
  17591. }
  17592. $package = new $class($config['name'], $version, $config['version']);
  17593. $package->setType(isset($config['type']) ? strtolower($config['type']) : 'library');
  17594. if (isset($config['target-dir'])) {
  17595. $package->setTargetDir($config['target-dir']);
  17596. }
  17597. if (isset($config['extra']) && is_array($config['extra'])) {
  17598. $package->setExtra($config['extra']);
  17599. }
  17600. if (isset($config['bin'])) {
  17601. foreach ((array) $config['bin'] as $key => $bin) {
  17602. $config['bin'][$key] = ltrim($bin, '/');
  17603. }
  17604. $package->setBinaries((array) $config['bin']);
  17605. }
  17606. if (isset($config['installation-source'])) {
  17607. $package->setInstallationSource($config['installation-source']);
  17608. }
  17609. if (isset($config['source'])) {
  17610. if (!isset($config['source']['type']) || !isset($config['source']['url']) || !isset($config['source']['reference'])) {
  17611. throw new \UnexpectedValueException(sprintf(
  17612. "Package %s's source key should be specified as {\"type\": ..., \"url\": ..., \"reference\": ...},\n%s given.",
  17613. $config['name'],
  17614. json_encode($config['source'])
  17615. ));
  17616. }
  17617. $package->setSourceType($config['source']['type']);
  17618. $package->setSourceUrl($config['source']['url']);
  17619. $package->setSourceReference(isset($config['source']['reference']) ? $config['source']['reference'] : null);
  17620. if (isset($config['source']['mirrors'])) {
  17621. $package->setSourceMirrors($config['source']['mirrors']);
  17622. }
  17623. }
  17624. if (isset($config['dist'])) {
  17625. if (!isset($config['dist']['type'])
  17626. || !isset($config['dist']['url'])) {
  17627. throw new \UnexpectedValueException(sprintf(
  17628. "Package %s's dist key should be specified as ".
  17629. "{\"type\": ..., \"url\": ..., \"reference\": ..., \"shasum\": ...},\n%s given.",
  17630. $config['name'],
  17631. json_encode($config['dist'])
  17632. ));
  17633. }
  17634. $package->setDistType($config['dist']['type']);
  17635. $package->setDistUrl($config['dist']['url']);
  17636. $package->setDistReference(isset($config['dist']['reference']) ? $config['dist']['reference'] : null);
  17637. $package->setDistSha1Checksum(isset($config['dist']['shasum']) ? $config['dist']['shasum'] : null);
  17638. if (isset($config['dist']['mirrors'])) {
  17639. $package->setDistMirrors($config['dist']['mirrors']);
  17640. }
  17641. }
  17642. foreach (Package\BasePackage::$supportedLinkTypes as $type => $opts) {
  17643. if (isset($config[$type])) {
  17644. $method = 'set'.ucfirst($opts['method']);
  17645. $package->{$method}(
  17646. $this->parseLinks(
  17647. $package->getName(),
  17648. $package->getPrettyVersion(),
  17649. $opts['description'],
  17650. $config[$type]
  17651. )
  17652. );
  17653. }
  17654. }
  17655. if (isset($config['suggest']) && is_array($config['suggest'])) {
  17656. foreach ($config['suggest'] as $target => $reason) {
  17657. if ('self.version' === trim($reason)) {
  17658. $config['suggest'][$target] = $package->getPrettyVersion();
  17659. }
  17660. }
  17661. $package->setSuggests($config['suggest']);
  17662. }
  17663. if (isset($config['autoload'])) {
  17664. $package->setAutoload($config['autoload']);
  17665. }
  17666. if (isset($config['autoload-dev'])) {
  17667. $package->setDevAutoload($config['autoload-dev']);
  17668. }
  17669. if (isset($config['include-path'])) {
  17670. $package->setIncludePaths($config['include-path']);
  17671. }
  17672. if (!empty($config['time'])) {
  17673. $time = preg_match('/^\d++$/D', $config['time']) ? '@'.$config['time'] : $config['time'];
  17674. try {
  17675. $date = new \DateTime($time, new \DateTimeZone('UTC'));
  17676. $package->setReleaseDate($date);
  17677. } catch (\Exception $e) {
  17678. }
  17679. }
  17680. if (!empty($config['notification-url'])) {
  17681. $package->setNotificationUrl($config['notification-url']);
  17682. }
  17683. if (!empty($config['archive']['exclude'])) {
  17684. $package->setArchiveExcludes($config['archive']['exclude']);
  17685. }
  17686. if ($package instanceof Package\CompletePackageInterface) {
  17687. if (isset($config['scripts']) && is_array($config['scripts'])) {
  17688. foreach ($config['scripts'] as $event => $listeners) {
  17689. $config['scripts'][$event] = (array) $listeners;
  17690. }
  17691. if (isset($config['scripts']['composer'])) {
  17692. trigger_error('The `composer` script name is reserved for internal use, please avoid defining it', E_USER_DEPRECATED);
  17693. }
  17694. $package->setScripts($config['scripts']);
  17695. }
  17696. if (!empty($config['description']) && is_string($config['description'])) {
  17697. $package->setDescription($config['description']);
  17698. }
  17699. if (!empty($config['homepage']) && is_string($config['homepage'])) {
  17700. $package->setHomepage($config['homepage']);
  17701. }
  17702. if (!empty($config['keywords']) && is_array($config['keywords'])) {
  17703. $package->setKeywords($config['keywords']);
  17704. }
  17705. if (!empty($config['license'])) {
  17706. $package->setLicense(is_array($config['license']) ? $config['license'] : array($config['license']));
  17707. }
  17708. if (!empty($config['authors']) && is_array($config['authors'])) {
  17709. $package->setAuthors($config['authors']);
  17710. }
  17711. if (isset($config['support'])) {
  17712. $package->setSupport($config['support']);
  17713. }
  17714. if (isset($config['abandoned'])) {
  17715. $package->setAbandoned($config['abandoned']);
  17716. }
  17717. }
  17718. if ($aliasNormalized = $this->getBranchAlias($config)) {
  17719. if ($package instanceof RootPackageInterface) {
  17720. $package = new RootAliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17721. } else {
  17722. $package = new AliasPackage($package, $aliasNormalized, preg_replace('{(\.9{7})+}', '.x', $aliasNormalized));
  17723. }
  17724. }
  17725. if ($this->loadOptions && isset($config['transport-options'])) {
  17726. $package->setTransportOptions($config['transport-options']);
  17727. }
  17728. return $package;
  17729. }
  17730. public function parseLinks($source, $sourceVersion, $description, $links)
  17731. {
  17732. $res = array();
  17733. foreach ($links as $target => $constraint) {
  17734. if (!is_string($constraint)) {
  17735. throw new \UnexpectedValueException('Link constraint in '.$source.' '.$description.' > '.$target.' should be a string, got '.gettype($constraint) . ' (' . var_export($constraint, true) . ')');
  17736. }
  17737. if ('self.version' === $constraint) {
  17738. $parsedConstraint = $this->versionParser->parseConstraints($sourceVersion);
  17739. } else {
  17740. $parsedConstraint = $this->versionParser->parseConstraints($constraint);
  17741. }
  17742. $res[strtolower($target)] = new Link($source, $target, $parsedConstraint, $description, $constraint);
  17743. }
  17744. return $res;
  17745. }
  17746. public function getBranchAlias(array $config)
  17747. {
  17748. if (('dev-' !== substr($config['version'], 0, 4) && '-dev' !== substr($config['version'], -4))
  17749. || !isset($config['extra']['branch-alias'])
  17750. || !is_array($config['extra']['branch-alias'])
  17751. ) {
  17752. return;
  17753. }
  17754. foreach ($config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  17755. if ('-dev' !== substr($targetBranch, -4)) {
  17756. continue;
  17757. }
  17758. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  17759. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  17760. continue;
  17761. }
  17762. if (strtolower($config['version']) !== strtolower($sourceBranch)) {
  17763. continue;
  17764. }
  17765. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  17766. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  17767. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  17768. ) {
  17769. continue;
  17770. }
  17771. return $validatedTargetBranch;
  17772. }
  17773. }
  17774. }
  17775. <?php
  17776. namespace Composer\Package\Loader;
  17777. class InvalidPackageException extends \Exception
  17778. {
  17779. private $errors;
  17780. private $warnings;
  17781. private $data;
  17782. public function __construct(array $errors, array $warnings, array $data)
  17783. {
  17784. $this->errors = $errors;
  17785. $this->warnings = $warnings;
  17786. $this->data = $data;
  17787. parent::__construct("Invalid package information: \n".implode("\n", array_merge($errors, $warnings)));
  17788. }
  17789. public function getData()
  17790. {
  17791. return $this->data;
  17792. }
  17793. public function getErrors()
  17794. {
  17795. return $this->errors;
  17796. }
  17797. public function getWarnings()
  17798. {
  17799. return $this->warnings;
  17800. }
  17801. }
  17802. <?php
  17803. namespace Composer\Package\Loader;
  17804. use Composer\Json\JsonFile;
  17805. class JsonLoader
  17806. {
  17807. private $loader;
  17808. public function __construct(LoaderInterface $loader)
  17809. {
  17810. $this->loader = $loader;
  17811. }
  17812. public function load($json)
  17813. {
  17814. if ($json instanceof JsonFile) {
  17815. $config = $json->read();
  17816. } elseif (file_exists($json)) {
  17817. $config = JsonFile::parseJson(file_get_contents($json), $json);
  17818. } elseif (is_string($json)) {
  17819. $config = JsonFile::parseJson($json);
  17820. }
  17821. return $this->loader->load($config);
  17822. }
  17823. }
  17824. <?php
  17825. namespace Composer\Package\Loader;
  17826. interface LoaderInterface
  17827. {
  17828. public function load(array $package, $class = 'Composer\Package\CompletePackage');
  17829. }
  17830. <?php
  17831. namespace Composer\Package\Loader;
  17832. use Composer\Package\BasePackage;
  17833. use Composer\Package\AliasPackage;
  17834. use Composer\Config;
  17835. use Composer\IO\IOInterface;
  17836. use Composer\Package\RootPackageInterface;
  17837. use Composer\Repository\RepositoryFactory;
  17838. use Composer\Package\Version\VersionGuesser;
  17839. use Composer\Package\Version\VersionParser;
  17840. use Composer\Repository\RepositoryManager;
  17841. use Composer\Util\ProcessExecutor;
  17842. class RootPackageLoader extends ArrayLoader
  17843. {
  17844. private $manager;
  17845. private $config;
  17846. private $versionGuesser;
  17847. private $io;
  17848. public function __construct(RepositoryManager $manager, Config $config, VersionParser $parser = null, VersionGuesser $versionGuesser = null, IOInterface $io = null)
  17849. {
  17850. parent::__construct($parser);
  17851. $this->manager = $manager;
  17852. $this->config = $config;
  17853. $this->versionGuesser = $versionGuesser ?: new VersionGuesser($config, new ProcessExecutor(), $this->versionParser);
  17854. $this->io = $io;
  17855. }
  17856. public function load(array $config, $class = 'Composer\Package\RootPackage', $cwd = null)
  17857. {
  17858. if (!isset($config['name'])) {
  17859. $config['name'] = '__root__';
  17860. } elseif ($this->io) {
  17861. if ($err = ValidatingArrayLoader::hasPackageNamingError($config['name'])) {
  17862. $this->io->writeError('<warning>Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17863. }
  17864. }
  17865. $autoVersioned = false;
  17866. if (!isset($config['version'])) {
  17867. $commit = null;
  17868. if (getenv('COMPOSER_ROOT_VERSION')) {
  17869. $config['version'] = getenv('COMPOSER_ROOT_VERSION');
  17870. } else {
  17871. $versionData = $this->versionGuesser->guessVersion($config, $cwd ?: getcwd());
  17872. if ($versionData) {
  17873. $config['version'] = $versionData['pretty_version'];
  17874. $config['version_normalized'] = $versionData['version'];
  17875. $commit = $versionData['commit'];
  17876. }
  17877. }
  17878. if (!isset($config['version'])) {
  17879. $config['version'] = '1.0.0';
  17880. $autoVersioned = true;
  17881. }
  17882. if ($commit) {
  17883. $config['source'] = array(
  17884. 'type' => '',
  17885. 'url' => '',
  17886. 'reference' => $commit,
  17887. );
  17888. $config['dist'] = array(
  17889. 'type' => '',
  17890. 'url' => '',
  17891. 'reference' => $commit,
  17892. );
  17893. }
  17894. }
  17895. $realPackage = $package = parent::load($config, $class);
  17896. if ($realPackage instanceof AliasPackage) {
  17897. $realPackage = $package->getAliasOf();
  17898. }
  17899. if ($autoVersioned) {
  17900. $realPackage->replaceVersion($realPackage->getVersion(), 'No version set (parsed as 1.0.0)');
  17901. }
  17902. if (isset($config['minimum-stability'])) {
  17903. $realPackage->setMinimumStability(VersionParser::normalizeStability($config['minimum-stability']));
  17904. }
  17905. $aliases = array();
  17906. $stabilityFlags = array();
  17907. $references = array();
  17908. foreach (array('require', 'require-dev') as $linkType) {
  17909. if (isset($config[$linkType])) {
  17910. $linkInfo = BasePackage::$supportedLinkTypes[$linkType];
  17911. $method = 'get'.ucfirst($linkInfo['method']);
  17912. $links = array();
  17913. foreach ($realPackage->$method() as $link) {
  17914. $links[$link->getTarget()] = $link->getConstraint()->getPrettyString();
  17915. }
  17916. $aliases = $this->extractAliases($links, $aliases);
  17917. $stabilityFlags = $this->extractStabilityFlags($links, $stabilityFlags, $realPackage->getMinimumStability());
  17918. $references = $this->extractReferences($links, $references);
  17919. }
  17920. }
  17921. if ($this->io) {
  17922. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  17923. if (isset($config[$linkType])) {
  17924. foreach ($config[$linkType] as $linkName => $constraint) {
  17925. if ($err = ValidatingArrayLoader::hasPackageNamingError($linkName, true)) {
  17926. $this->io->writeError('<warning>Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.</warning>');
  17927. }
  17928. }
  17929. }
  17930. }
  17931. }
  17932. if (isset($links[$config['name']])) {
  17933. throw new \InvalidArgumentException(sprintf('Root package \'%s\' cannot require itself in its composer.json' . PHP_EOL .
  17934. 'Did you accidentally name your root package after an external package?', $config['name']));
  17935. }
  17936. $realPackage->setAliases($aliases);
  17937. $realPackage->setStabilityFlags($stabilityFlags);
  17938. $realPackage->setReferences($references);
  17939. if (isset($config['prefer-stable'])) {
  17940. $realPackage->setPreferStable((bool) $config['prefer-stable']);
  17941. }
  17942. if (isset($config['config'])) {
  17943. $realPackage->setConfig($config['config']);
  17944. }
  17945. $repos = RepositoryFactory::defaultRepos(null, $this->config, $this->manager);
  17946. foreach ($repos as $repo) {
  17947. $this->manager->addRepository($repo);
  17948. }
  17949. $realPackage->setRepositories($this->config->getRepositories());
  17950. return $package;
  17951. }
  17952. private function extractAliases(array $requires, array $aliases)
  17953. {
  17954. foreach ($requires as $reqName => $reqVersion) {
  17955. if (preg_match('{^([^,\s#]+)(?:#[^ ]+)? +as +([^,\s]+)$}', $reqVersion, $match)) {
  17956. $aliases[] = array(
  17957. 'package' => strtolower($reqName),
  17958. 'version' => $this->versionParser->normalize($match[1], $reqVersion),
  17959. 'alias' => $match[2],
  17960. 'alias_normalized' => $this->versionParser->normalize($match[2], $reqVersion),
  17961. );
  17962. }
  17963. }
  17964. return $aliases;
  17965. }
  17966. private function extractStabilityFlags(array $requires, array $stabilityFlags, $minimumStability)
  17967. {
  17968. $stabilities = BasePackage::$stabilities;
  17969. $minimumStability = $stabilities[$minimumStability];
  17970. foreach ($requires as $reqName => $reqVersion) {
  17971. $constraints = array();
  17972. $orSplit = preg_split('{\s*\|\|?\s*}', trim($reqVersion));
  17973. foreach ($orSplit as $orConstraint) {
  17974. $andSplit = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $orConstraint);
  17975. foreach ($andSplit as $andConstraint) {
  17976. $constraints[] = $andConstraint;
  17977. }
  17978. }
  17979. $match = false;
  17980. foreach ($constraints as $constraint) {
  17981. if (preg_match('{^[^@]*?@('.implode('|', array_keys($stabilities)).')$}i', $constraint, $match)) {
  17982. $name = strtolower($reqName);
  17983. $stability = $stabilities[VersionParser::normalizeStability($match[1])];
  17984. if (isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) {
  17985. continue;
  17986. }
  17987. $stabilityFlags[$name] = $stability;
  17988. $match = true;
  17989. }
  17990. }
  17991. if ($match) {
  17992. continue;
  17993. }
  17994. foreach ($constraints as $constraint) {
  17995. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $constraint);
  17996. if (preg_match('{^[^,\s@]+$}', $reqVersion) && 'stable' !== ($stabilityName = VersionParser::parseStability($reqVersion))) {
  17997. $name = strtolower($reqName);
  17998. $stability = $stabilities[$stabilityName];
  17999. if ((isset($stabilityFlags[$name]) && $stabilityFlags[$name] > $stability) || ($minimumStability > $stability)) {
  18000. continue;
  18001. }
  18002. $stabilityFlags[$name] = $stability;
  18003. }
  18004. }
  18005. }
  18006. return $stabilityFlags;
  18007. }
  18008. private function extractReferences(array $requires, array $references)
  18009. {
  18010. foreach ($requires as $reqName => $reqVersion) {
  18011. $reqVersion = preg_replace('{^([^,\s@]+) as .+$}', '$1', $reqVersion);
  18012. if (preg_match('{^[^,\s@]+?#([a-f0-9]+)$}', $reqVersion, $match) && 'dev' === VersionParser::parseStability($reqVersion)) {
  18013. $name = strtolower($reqName);
  18014. $references[$name] = $match[1];
  18015. }
  18016. }
  18017. return $references;
  18018. }
  18019. }
  18020. <?php
  18021. namespace Composer\Package\Loader;
  18022. use Composer\Package\BasePackage;
  18023. use Composer\Semver\Constraint\Constraint;
  18024. use Composer\Package\Version\VersionParser;
  18025. use Composer\Repository\PlatformRepository;
  18026. use Composer\Spdx\SpdxLicenses;
  18027. class ValidatingArrayLoader implements LoaderInterface
  18028. {
  18029. const CHECK_ALL = 3;
  18030. const CHECK_UNBOUND_CONSTRAINTS = 1;
  18031. const CHECK_STRICT_CONSTRAINTS = 2;
  18032. private $loader;
  18033. private $versionParser;
  18034. private $errors;
  18035. private $warnings;
  18036. private $config;
  18037. private $strictName;
  18038. private $flags;
  18039. public function __construct(LoaderInterface $loader, $strictName = true, VersionParser $parser = null, $flags = 0)
  18040. {
  18041. $this->loader = $loader;
  18042. $this->versionParser = $parser ?: new VersionParser();
  18043. $this->strictName = $strictName;
  18044. $this->flags = $flags;
  18045. }
  18046. public function load(array $config, $class = 'Composer\Package\CompletePackage')
  18047. {
  18048. $this->errors = array();
  18049. $this->warnings = array();
  18050. $this->config = $config;
  18051. if ($err = self::hasPackageNamingError($config['name'])) {
  18052. $this->warnings[] = 'Deprecation warning: Your package name '.$err.' Make sure you fix this as Composer 2.0 will error.';
  18053. }
  18054. if ($this->strictName) {
  18055. $this->validateRegex('name', '[A-Za-z0-9][A-Za-z0-9_.-]*/[A-Za-z0-9][A-Za-z0-9_.-]*', true);
  18056. } else {
  18057. $this->validateString('name', true);
  18058. }
  18059. if (!empty($this->config['version'])) {
  18060. try {
  18061. $this->versionParser->normalize($this->config['version']);
  18062. } catch (\Exception $e) {
  18063. $this->errors[] = 'version : invalid value ('.$this->config['version'].'): '.$e->getMessage();
  18064. unset($this->config['version']);
  18065. }
  18066. }
  18067. if (!empty($this->config['config']['platform'])) {
  18068. foreach ((array) $this->config['config']['platform'] as $key => $platform) {
  18069. try {
  18070. $this->versionParser->normalize($platform);
  18071. } catch (\Exception $e) {
  18072. $this->errors[] = 'config.platform.' . $key . ' : invalid value ('.$platform.'): '.$e->getMessage();
  18073. }
  18074. }
  18075. }
  18076. $this->validateRegex('type', '[A-Za-z0-9-]+');
  18077. $this->validateString('target-dir');
  18078. $this->validateArray('extra');
  18079. if (isset($this->config['bin'])) {
  18080. if (is_string($this->config['bin'])) {
  18081. $this->validateString('bin');
  18082. } else {
  18083. $this->validateFlatArray('bin');
  18084. }
  18085. }
  18086. $this->validateArray('scripts');
  18087. $this->validateString('description');
  18088. $this->validateUrl('homepage');
  18089. $this->validateFlatArray('keywords', '[\p{N}\p{L} ._-]+');
  18090. $releaseDate = null;
  18091. $this->validateString('time');
  18092. if (!empty($this->config['time'])) {
  18093. try {
  18094. $releaseDate = new \DateTime($this->config['time'], new \DateTimeZone('UTC'));
  18095. } catch (\Exception $e) {
  18096. $this->errors[] = 'time : invalid value ('.$this->config['time'].'): '.$e->getMessage();
  18097. unset($this->config['time']);
  18098. }
  18099. }
  18100. if (isset($this->config['license']) && (!$releaseDate || $releaseDate->getTimestamp() >= strtotime('-8days'))) {
  18101. if (is_array($this->config['license']) || is_string($this->config['license'])) {
  18102. $licenses = (array) $this->config['license'];
  18103. foreach ($licenses as $key => $license) {
  18104. if ('proprietary' === $license) {
  18105. unset($licenses[$key]);
  18106. }
  18107. }
  18108. $licenseValidator = new SpdxLicenses();
  18109. if (count($licenses) === 1 && !$licenseValidator->validate($licenses) && $licenseValidator->validate(trim($licenses[0]))) {
  18110. $this->warnings[] = sprintf(
  18111. 'License %s must not contain extra spaces, make sure to trim it.',
  18112. json_encode($this->config['license'])
  18113. );
  18114. } elseif (array() !== $licenses && !$licenseValidator->validate($licenses)) {
  18115. $this->warnings[] = sprintf(
  18116. 'License %s is not a valid SPDX license identifier, see https://spdx.org/licenses/ if you use an open license.' . PHP_EOL .
  18117. 'If the software is closed-source, you may use "proprietary" as license.',
  18118. json_encode($this->config['license'])
  18119. );
  18120. }
  18121. }
  18122. }
  18123. if ($this->validateArray('authors') && !empty($this->config['authors'])) {
  18124. foreach ($this->config['authors'] as $key => $author) {
  18125. if (!is_array($author)) {
  18126. $this->errors[] = 'authors.'.$key.' : should be an array, '.gettype($author).' given';
  18127. unset($this->config['authors'][$key]);
  18128. continue;
  18129. }
  18130. foreach (array('homepage', 'email', 'name', 'role') as $authorData) {
  18131. if (isset($author[$authorData]) && !is_string($author[$authorData])) {
  18132. $this->errors[] = 'authors.'.$key.'.'.$authorData.' : invalid value, must be a string';
  18133. unset($this->config['authors'][$key][$authorData]);
  18134. }
  18135. }
  18136. if (isset($author['homepage']) && !$this->filterUrl($author['homepage'])) {
  18137. $this->warnings[] = 'authors.'.$key.'.homepage : invalid value ('.$author['homepage'].'), must be an http/https URL';
  18138. unset($this->config['authors'][$key]['homepage']);
  18139. }
  18140. if (isset($author['email']) && !filter_var($author['email'], FILTER_VALIDATE_EMAIL)) {
  18141. $this->warnings[] = 'authors.'.$key.'.email : invalid value ('.$author['email'].'), must be a valid email address';
  18142. unset($this->config['authors'][$key]['email']);
  18143. }
  18144. if (empty($this->config['authors'][$key])) {
  18145. unset($this->config['authors'][$key]);
  18146. }
  18147. }
  18148. if (empty($this->config['authors'])) {
  18149. unset($this->config['authors']);
  18150. }
  18151. }
  18152. if ($this->validateArray('support') && !empty($this->config['support'])) {
  18153. foreach (array('issues', 'forum', 'wiki', 'source', 'email', 'irc', 'docs', 'rss', 'chat') as $key) {
  18154. if (isset($this->config['support'][$key]) && !is_string($this->config['support'][$key])) {
  18155. $this->errors[] = 'support.'.$key.' : invalid value, must be a string';
  18156. unset($this->config['support'][$key]);
  18157. }
  18158. }
  18159. if (isset($this->config['support']['email']) && !filter_var($this->config['support']['email'], FILTER_VALIDATE_EMAIL)) {
  18160. $this->warnings[] = 'support.email : invalid value ('.$this->config['support']['email'].'), must be a valid email address';
  18161. unset($this->config['support']['email']);
  18162. }
  18163. if (isset($this->config['support']['irc']) && !$this->filterUrl($this->config['support']['irc'], array('irc'))) {
  18164. $this->warnings[] = 'support.irc : invalid value ('.$this->config['support']['irc'].'), must be a irc://<server>/<channel> URL';
  18165. unset($this->config['support']['irc']);
  18166. }
  18167. foreach (array('issues', 'forum', 'wiki', 'source', 'docs', 'chat') as $key) {
  18168. if (isset($this->config['support'][$key]) && !$this->filterUrl($this->config['support'][$key])) {
  18169. $this->warnings[] = 'support.'.$key.' : invalid value ('.$this->config['support'][$key].'), must be an http/https URL';
  18170. unset($this->config['support'][$key]);
  18171. }
  18172. }
  18173. if (empty($this->config['support'])) {
  18174. unset($this->config['support']);
  18175. }
  18176. }
  18177. $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master'));
  18178. $stableConstraint = new Constraint('=', '1.0.0');
  18179. foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) {
  18180. if ($this->validateArray($linkType) && isset($this->config[$linkType])) {
  18181. foreach ($this->config[$linkType] as $package => $constraint) {
  18182. if ($err = self::hasPackageNamingError($package, true)) {
  18183. $this->warnings[] = 'Deprecation warning: '.$linkType.'.'.$err.' Make sure you fix this as Composer 2.0 will error.';
  18184. } elseif (!preg_match('{^[A-Za-z0-9_./-]+$}', $package)) {
  18185. $this->warnings[] = $linkType.'.'.$package.' : invalid key, package names must be strings containing only [A-Za-z0-9_./-]';
  18186. }
  18187. if (!is_string($constraint)) {
  18188. $this->errors[] = $linkType.'.'.$package.' : invalid value, must be a string containing a version constraint';
  18189. unset($this->config[$linkType][$package]);
  18190. } elseif ('self.version' !== $constraint) {
  18191. try {
  18192. $linkConstraint = $this->versionParser->parseConstraints($constraint);
  18193. } catch (\Exception $e) {
  18194. $this->errors[] = $linkType.'.'.$package.' : invalid version constraint ('.$e->getMessage().')';
  18195. unset($this->config[$linkType][$package]);
  18196. continue;
  18197. }
  18198. if (
  18199. ($this->flags & self::CHECK_UNBOUND_CONSTRAINTS)
  18200. && 'require' === $linkType
  18201. && $linkConstraint->matches($unboundConstraint)
  18202. && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $package)
  18203. ) {
  18204. $this->warnings[] = $linkType.'.'.$package.' : unbound version constraints ('.$constraint.') should be avoided';
  18205. } elseif (
  18206. ($this->flags & self::CHECK_STRICT_CONSTRAINTS)
  18207. && 'require' === $linkType
  18208. && substr($linkConstraint, 0, 1) === '='
  18209. && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=')
  18210. ) {
  18211. $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning';
  18212. }
  18213. }
  18214. }
  18215. }
  18216. }
  18217. if ($this->validateArray('suggest') && !empty($this->config['suggest'])) {
  18218. foreach ($this->config['suggest'] as $package => $description) {
  18219. if (!is_string($description)) {
  18220. $this->errors[] = 'suggest.'.$package.' : invalid value, must be a string describing why the package is suggested';
  18221. unset($this->config['suggest'][$package]);
  18222. }
  18223. }
  18224. }
  18225. if ($this->validateString('minimum-stability') && !empty($this->config['minimum-stability'])) {
  18226. if (!isset(BasePackage::$stabilities[$this->config['minimum-stability']])) {
  18227. $this->errors[] = 'minimum-stability : invalid value ('.$this->config['minimum-stability'].'), must be one of '.implode(', ', array_keys(BasePackage::$stabilities));
  18228. unset($this->config['minimum-stability']);
  18229. }
  18230. }
  18231. if ($this->validateArray('autoload') && !empty($this->config['autoload'])) {
  18232. $types = array('psr-0', 'psr-4', 'classmap', 'files', 'exclude-from-classmap');
  18233. foreach ($this->config['autoload'] as $type => $typeConfig) {
  18234. if (!in_array($type, $types)) {
  18235. $this->errors[] = 'autoload : invalid value ('.$type.'), must be one of '.implode(', ', $types);
  18236. unset($this->config['autoload'][$type]);
  18237. }
  18238. if ($type === 'psr-4') {
  18239. foreach ($typeConfig as $namespace => $dirs) {
  18240. if ($namespace !== '' && '\\' !== substr($namespace, -1)) {
  18241. $this->errors[] = 'autoload.psr-4 : invalid value ('.$namespace.'), namespaces must end with a namespace separator, should be '.$namespace.'\\\\';
  18242. }
  18243. }
  18244. }
  18245. }
  18246. }
  18247. if (!empty($this->config['autoload']['psr-4']) && !empty($this->config['target-dir'])) {
  18248. $this->errors[] = 'target-dir : this can not be used together with the autoload.psr-4 setting, remove target-dir to upgrade to psr-4';
  18249. unset($this->config['autoload']['psr-4']);
  18250. }
  18251. $this->validateFlatArray('include-path');
  18252. $this->validateArray('transport-options');
  18253. if (isset($this->config['extra']['branch-alias'])) {
  18254. if (!is_array($this->config['extra']['branch-alias'])) {
  18255. $this->errors[] = 'extra.branch-alias : must be an array of versions => aliases';
  18256. } else {
  18257. foreach ($this->config['extra']['branch-alias'] as $sourceBranch => $targetBranch) {
  18258. if ('-dev' !== substr($targetBranch, -4)) {
  18259. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must end in -dev';
  18260. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18261. continue;
  18262. }
  18263. $validatedTargetBranch = $this->versionParser->normalizeBranch(substr($targetBranch, 0, -4));
  18264. if ('-dev' !== substr($validatedTargetBranch, -4)) {
  18265. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') must be a parseable number like 2.0-dev';
  18266. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18267. continue;
  18268. }
  18269. if (($sourcePrefix = $this->versionParser->parseNumericAliasPrefix($sourceBranch))
  18270. && ($targetPrefix = $this->versionParser->parseNumericAliasPrefix($targetBranch))
  18271. && (stripos($targetPrefix, $sourcePrefix) !== 0)
  18272. ) {
  18273. $this->warnings[] = 'extra.branch-alias.'.$sourceBranch.' : the target branch ('.$targetBranch.') is not a valid numeric alias for this version';
  18274. unset($this->config['extra']['branch-alias'][$sourceBranch]);
  18275. }
  18276. }
  18277. }
  18278. }
  18279. if ($this->errors) {
  18280. throw new InvalidPackageException($this->errors, $this->warnings, $config);
  18281. }
  18282. $package = $this->loader->load($this->config, $class);
  18283. $this->config = null;
  18284. return $package;
  18285. }
  18286. public function getWarnings()
  18287. {
  18288. return $this->warnings;
  18289. }
  18290. public function getErrors()
  18291. {
  18292. return $this->errors;
  18293. }
  18294. public static function hasPackageNamingError($name, $isLink = false)
  18295. {
  18296. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name)) {
  18297. return;
  18298. }
  18299. if (!preg_match('{^[a-z0-9]([_.-]?[a-z0-9]+)*/[a-z0-9]([_.-]?[a-z0-9]+)*$}iD', $name)) {
  18300. 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]([_.-]?[a-z0-9]+)*".';
  18301. }
  18302. $reservedNames = array('nul', 'con', 'prn', 'aux', 'com1', 'com2', 'com3', 'com4', 'com5', 'com6', 'com7', 'com8', 'com9', 'lpt1', 'lpt2', 'lpt3', 'lpt4', 'lpt5', 'lpt6', 'lpt7', 'lpt8', 'lpt9');
  18303. $bits = explode('/', strtolower($name));
  18304. if (in_array($bits[0], $reservedNames, true) || in_array($bits[1], $reservedNames, true)) {
  18305. return $name.' is reserved, package and vendor names can not match any of: '.implode(', ', $reservedNames).'.';
  18306. }
  18307. if (preg_match('{\.json$}', $name)) {
  18308. return $name.' is invalid, package names can not end in .json, consider renaming it or perhaps using a -json suffix instead.';
  18309. }
  18310. if (preg_match('{[A-Z]}', $name)) {
  18311. if ($isLink) {
  18312. return $name.' is invalid, it should not contain uppercase characters. Please use '.strtolower($name).' instead.';
  18313. }
  18314. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $name);
  18315. $suggestName = strtolower($suggestName);
  18316. return $name.' is invalid, it should not contain uppercase characters. We suggest using '.$suggestName.' instead.';
  18317. }
  18318. }
  18319. private function validateRegex($property, $regex, $mandatory = false)
  18320. {
  18321. if (!$this->validateString($property, $mandatory)) {
  18322. return false;
  18323. }
  18324. if (!preg_match('{^'.$regex.'$}u', $this->config[$property])) {
  18325. $message = $property.' : invalid value ('.$this->config[$property].'), must match '.$regex;
  18326. if ($mandatory) {
  18327. $this->errors[] = $message;
  18328. } else {
  18329. $this->warnings[] = $message;
  18330. }
  18331. unset($this->config[$property]);
  18332. return false;
  18333. }
  18334. return true;
  18335. }
  18336. private function validateString($property, $mandatory = false)
  18337. {
  18338. if (isset($this->config[$property]) && !is_string($this->config[$property])) {
  18339. $this->errors[] = $property.' : should be a string, '.gettype($this->config[$property]).' given';
  18340. unset($this->config[$property]);
  18341. return false;
  18342. }
  18343. if (!isset($this->config[$property]) || trim($this->config[$property]) === '') {
  18344. if ($mandatory) {
  18345. $this->errors[] = $property.' : must be present';
  18346. }
  18347. unset($this->config[$property]);
  18348. return false;
  18349. }
  18350. return true;
  18351. }
  18352. private function validateArray($property, $mandatory = false)
  18353. {
  18354. if (isset($this->config[$property]) && !is_array($this->config[$property])) {
  18355. $this->errors[] = $property.' : should be an array, '.gettype($this->config[$property]).' given';
  18356. unset($this->config[$property]);
  18357. return false;
  18358. }
  18359. if (!isset($this->config[$property]) || !count($this->config[$property])) {
  18360. if ($mandatory) {
  18361. $this->errors[] = $property.' : must be present and contain at least one element';
  18362. }
  18363. unset($this->config[$property]);
  18364. return false;
  18365. }
  18366. return true;
  18367. }
  18368. private function validateFlatArray($property, $regex = null, $mandatory = false)
  18369. {
  18370. if (!$this->validateArray($property, $mandatory)) {
  18371. return false;
  18372. }
  18373. $pass = true;
  18374. foreach ($this->config[$property] as $key => $value) {
  18375. if (!is_string($value) && !is_numeric($value)) {
  18376. $this->errors[] = $property.'.'.$key.' : must be a string or int, '.gettype($value).' given';
  18377. unset($this->config[$property][$key]);
  18378. $pass = false;
  18379. continue;
  18380. }
  18381. if ($regex && !preg_match('{^'.$regex.'$}u', $value)) {
  18382. $this->warnings[] = $property.'.'.$key.' : invalid value ('.$value.'), must match '.$regex;
  18383. unset($this->config[$property][$key]);
  18384. $pass = false;
  18385. }
  18386. }
  18387. return $pass;
  18388. }
  18389. private function validateUrl($property, $mandatory = false)
  18390. {
  18391. if (!$this->validateString($property, $mandatory)) {
  18392. return false;
  18393. }
  18394. if (!$this->filterUrl($this->config[$property])) {
  18395. $this->warnings[] = $property.' : invalid value ('.$this->config[$property].'), must be an http/https URL';
  18396. unset($this->config[$property]);
  18397. return false;
  18398. }
  18399. return true;
  18400. }
  18401. private function filterUrl($value, array $schemes = array('http', 'https'))
  18402. {
  18403. if ($value === '') {
  18404. return true;
  18405. }
  18406. $bits = parse_url($value);
  18407. if (empty($bits['scheme']) || empty($bits['host'])) {
  18408. return false;
  18409. }
  18410. if (!in_array($bits['scheme'], $schemes, true)) {
  18411. return false;
  18412. }
  18413. return true;
  18414. }
  18415. }
  18416. <?php
  18417. namespace Composer\Package;
  18418. use Composer\Json\JsonFile;
  18419. use Composer\Installer\InstallationManager;
  18420. use Composer\Repository\RepositoryManager;
  18421. use Composer\Util\ProcessExecutor;
  18422. use Composer\Repository\ArrayRepository;
  18423. use Composer\Package\Dumper\ArrayDumper;
  18424. use Composer\Package\Loader\ArrayLoader;
  18425. use Composer\Util\Git as GitUtil;
  18426. use Composer\IO\IOInterface;
  18427. use Seld\JsonLint\ParsingException;
  18428. class Locker
  18429. {
  18430. private $lockFile;
  18431. private $repositoryManager;
  18432. private $installationManager;
  18433. private $hash;
  18434. private $contentHash;
  18435. private $loader;
  18436. private $dumper;
  18437. private $process;
  18438. private $lockDataCache;
  18439. public function __construct(IOInterface $io, JsonFile $lockFile, RepositoryManager $repositoryManager, InstallationManager $installationManager, $composerFileContents)
  18440. {
  18441. $this->lockFile = $lockFile;
  18442. $this->repositoryManager = $repositoryManager;
  18443. $this->installationManager = $installationManager;
  18444. $this->hash = md5($composerFileContents);
  18445. $this->contentHash = self::getContentHash($composerFileContents);
  18446. $this->loader = new ArrayLoader(null, true);
  18447. $this->dumper = new ArrayDumper();
  18448. $this->process = new ProcessExecutor($io);
  18449. }
  18450. public static function getContentHash($composerFileContents)
  18451. {
  18452. $content = json_decode($composerFileContents, true);
  18453. $relevantKeys = array(
  18454. 'name',
  18455. 'version',
  18456. 'require',
  18457. 'require-dev',
  18458. 'conflict',
  18459. 'replace',
  18460. 'provide',
  18461. 'minimum-stability',
  18462. 'prefer-stable',
  18463. 'repositories',
  18464. 'extra',
  18465. );
  18466. $relevantContent = array();
  18467. foreach (array_intersect($relevantKeys, array_keys($content)) as $key) {
  18468. $relevantContent[$key] = $content[$key];
  18469. }
  18470. if (isset($content['config']['platform'])) {
  18471. $relevantContent['config']['platform'] = $content['config']['platform'];
  18472. }
  18473. ksort($relevantContent);
  18474. return md5(json_encode($relevantContent));
  18475. }
  18476. public function isLocked()
  18477. {
  18478. if (!$this->lockFile->exists()) {
  18479. return false;
  18480. }
  18481. $data = $this->getLockData();
  18482. return isset($data['packages']);
  18483. }
  18484. public function isFresh()
  18485. {
  18486. $lock = $this->lockFile->read();
  18487. if (!empty($lock['content-hash'])) {
  18488. return $this->contentHash === $lock['content-hash'];
  18489. }
  18490. if (!empty($lock['hash'])) {
  18491. return $this->hash === $lock['hash'];
  18492. }
  18493. return false;
  18494. }
  18495. public function getLockedRepository($withDevReqs = false)
  18496. {
  18497. $lockData = $this->getLockData();
  18498. $packages = new ArrayRepository();
  18499. $lockedPackages = $lockData['packages'];
  18500. if ($withDevReqs) {
  18501. if (isset($lockData['packages-dev'])) {
  18502. $lockedPackages = array_merge($lockedPackages, $lockData['packages-dev']);
  18503. } else {
  18504. 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.');
  18505. }
  18506. }
  18507. if (empty($lockedPackages)) {
  18508. return $packages;
  18509. }
  18510. if (isset($lockedPackages[0]['name'])) {
  18511. foreach ($lockedPackages as $info) {
  18512. $packages->addPackage($this->loader->load($info));
  18513. }
  18514. return $packages;
  18515. }
  18516. 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.');
  18517. }
  18518. public function getPlatformRequirements($withDevReqs = false)
  18519. {
  18520. $lockData = $this->getLockData();
  18521. $requirements = array();
  18522. if (!empty($lockData['platform'])) {
  18523. $requirements = $this->loader->parseLinks(
  18524. '__ROOT__',
  18525. '1.0.0',
  18526. 'requires',
  18527. isset($lockData['platform']) ? $lockData['platform'] : array()
  18528. );
  18529. }
  18530. if ($withDevReqs && !empty($lockData['platform-dev'])) {
  18531. $devRequirements = $this->loader->parseLinks(
  18532. '__ROOT__',
  18533. '1.0.0',
  18534. 'requires',
  18535. isset($lockData['platform-dev']) ? $lockData['platform-dev'] : array()
  18536. );
  18537. $requirements = array_merge($requirements, $devRequirements);
  18538. }
  18539. return $requirements;
  18540. }
  18541. public function getMinimumStability()
  18542. {
  18543. $lockData = $this->getLockData();
  18544. return isset($lockData['minimum-stability']) ? $lockData['minimum-stability'] : 'stable';
  18545. }
  18546. public function getStabilityFlags()
  18547. {
  18548. $lockData = $this->getLockData();
  18549. return isset($lockData['stability-flags']) ? $lockData['stability-flags'] : array();
  18550. }
  18551. public function getPreferStable()
  18552. {
  18553. $lockData = $this->getLockData();
  18554. return isset($lockData['prefer-stable']) ? $lockData['prefer-stable'] : null;
  18555. }
  18556. public function getPreferLowest()
  18557. {
  18558. $lockData = $this->getLockData();
  18559. return isset($lockData['prefer-lowest']) ? $lockData['prefer-lowest'] : null;
  18560. }
  18561. public function getPlatformOverrides()
  18562. {
  18563. $lockData = $this->getLockData();
  18564. return isset($lockData['platform-overrides']) ? $lockData['platform-overrides'] : array();
  18565. }
  18566. public function getAliases()
  18567. {
  18568. $lockData = $this->getLockData();
  18569. return isset($lockData['aliases']) ? $lockData['aliases'] : array();
  18570. }
  18571. public function getLockData()
  18572. {
  18573. if (null !== $this->lockDataCache) {
  18574. return $this->lockDataCache;
  18575. }
  18576. if (!$this->lockFile->exists()) {
  18577. throw new \LogicException('No lockfile found. Unable to read locked packages');
  18578. }
  18579. return $this->lockDataCache = $this->lockFile->read();
  18580. }
  18581. public function setLockData(array $packages, $devPackages, array $platformReqs, $platformDevReqs, array $aliases, $minimumStability, array $stabilityFlags, $preferStable, $preferLowest, array $platformOverrides)
  18582. {
  18583. $lock = array(
  18584. '_readme' => array('This file locks the dependencies of your project to a known state',
  18585. 'Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies',
  18586. 'This file is @gener'.'ated automatically', ),
  18587. 'content-hash' => $this->contentHash,
  18588. 'packages' => null,
  18589. 'packages-dev' => null,
  18590. 'aliases' => array(),
  18591. 'minimum-stability' => $minimumStability,
  18592. 'stability-flags' => $stabilityFlags,
  18593. 'prefer-stable' => $preferStable,
  18594. 'prefer-lowest' => $preferLowest,
  18595. );
  18596. foreach ($aliases as $package => $versions) {
  18597. foreach ($versions as $version => $alias) {
  18598. $lock['aliases'][] = array(
  18599. 'alias' => $alias['alias'],
  18600. 'alias_normalized' => $alias['alias_normalized'],
  18601. 'version' => $version,
  18602. 'package' => $package,
  18603. );
  18604. }
  18605. }
  18606. $lock['packages'] = $this->lockPackages($packages);
  18607. if (null !== $devPackages) {
  18608. $lock['packages-dev'] = $this->lockPackages($devPackages);
  18609. }
  18610. $lock['platform'] = $platformReqs;
  18611. $lock['platform-dev'] = $platformDevReqs;
  18612. if ($platformOverrides) {
  18613. $lock['platform-overrides'] = $platformOverrides;
  18614. }
  18615. if (empty($lock['packages']) && empty($lock['packages-dev']) && empty($lock['platform']) && empty($lock['platform-dev'])) {
  18616. if ($this->lockFile->exists()) {
  18617. unlink($this->lockFile->getPath());
  18618. }
  18619. return false;
  18620. }
  18621. try {
  18622. $isLocked = $this->isLocked();
  18623. } catch (ParsingException $e) {
  18624. $isLocked = false;
  18625. }
  18626. if (!$isLocked || $lock !== $this->getLockData()) {
  18627. $this->lockFile->write($lock);
  18628. $this->lockDataCache = null;
  18629. return true;
  18630. }
  18631. return false;
  18632. }
  18633. private function lockPackages(array $packages)
  18634. {
  18635. $locked = array();
  18636. foreach ($packages as $package) {
  18637. if ($package instanceof AliasPackage) {
  18638. continue;
  18639. }
  18640. $name = $package->getPrettyName();
  18641. $version = $package->getPrettyVersion();
  18642. if (!$name || !$version) {
  18643. throw new \LogicException(sprintf(
  18644. 'Package "%s" has no version or name and can not be locked',
  18645. $package
  18646. ));
  18647. }
  18648. $spec = $this->dumper->dump($package);
  18649. unset($spec['version_normalized']);
  18650. $time = isset($spec['time']) ? $spec['time'] : null;
  18651. unset($spec['time']);
  18652. if ($package->isDev() && $package->getInstallationSource() === 'source') {
  18653. $time = $this->getPackageTime($package) ?: $time;
  18654. }
  18655. if (null !== $time) {
  18656. $spec['time'] = $time;
  18657. }
  18658. unset($spec['installation-source']);
  18659. $locked[] = $spec;
  18660. }
  18661. usort($locked, function ($a, $b) {
  18662. $comparison = strcmp($a['name'], $b['name']);
  18663. if (0 !== $comparison) {
  18664. return $comparison;
  18665. }
  18666. return strcmp($a['version'], $b['version']);
  18667. });
  18668. return $locked;
  18669. }
  18670. private function getPackageTime(PackageInterface $package)
  18671. {
  18672. if (!function_exists('proc_open')) {
  18673. return null;
  18674. }
  18675. $path = realpath($this->installationManager->getInstallPath($package));
  18676. $sourceType = $package->getSourceType();
  18677. $datetime = null;
  18678. if ($path && in_array($sourceType, array('git', 'hg'))) {
  18679. $sourceRef = $package->getSourceReference() ?: $package->getDistReference();
  18680. switch ($sourceType) {
  18681. case 'git':
  18682. GitUtil::cleanEnv();
  18683. if (0 === $this->process->execute('git log -n1 --pretty=%ct '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*\d+\s*$}', $output)) {
  18684. $datetime = new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  18685. }
  18686. break;
  18687. case 'hg':
  18688. if (0 === $this->process->execute('hg log --template "{date|hgdate}" -r '.ProcessExecutor::escape($sourceRef), $output, $path) && preg_match('{^\s*(\d+)\s*}', $output, $match)) {
  18689. $datetime = new \DateTime('@'.$match[1], new \DateTimeZone('UTC'));
  18690. }
  18691. break;
  18692. }
  18693. }
  18694. return $datetime ? $datetime->format(DATE_RFC3339) : null;
  18695. }
  18696. }
  18697. <?php
  18698. namespace Composer\Package;
  18699. use Composer\Package\Version\VersionParser;
  18700. use Composer\Util\ComposerMirror;
  18701. class Package extends BasePackage
  18702. {
  18703. protected $type;
  18704. protected $targetDir;
  18705. protected $installationSource;
  18706. protected $sourceType;
  18707. protected $sourceUrl;
  18708. protected $sourceReference;
  18709. protected $sourceMirrors;
  18710. protected $distType;
  18711. protected $distUrl;
  18712. protected $distReference;
  18713. protected $distSha1Checksum;
  18714. protected $distMirrors;
  18715. protected $version;
  18716. protected $prettyVersion;
  18717. protected $releaseDate;
  18718. protected $extra = array();
  18719. protected $binaries = array();
  18720. protected $dev;
  18721. protected $stability;
  18722. protected $notificationUrl;
  18723. protected $requires = array();
  18724. protected $conflicts = array();
  18725. protected $provides = array();
  18726. protected $replaces = array();
  18727. protected $devRequires = array();
  18728. protected $suggests = array();
  18729. protected $autoload = array();
  18730. protected $devAutoload = array();
  18731. protected $includePaths = array();
  18732. protected $archiveExcludes = array();
  18733. public function __construct($name, $version, $prettyVersion)
  18734. {
  18735. parent::__construct($name);
  18736. $this->version = $version;
  18737. $this->prettyVersion = $prettyVersion;
  18738. $this->stability = VersionParser::parseStability($version);
  18739. $this->dev = $this->stability === 'dev';
  18740. }
  18741. public function isDev()
  18742. {
  18743. return $this->dev;
  18744. }
  18745. public function setType($type)
  18746. {
  18747. $this->type = $type;
  18748. }
  18749. public function getType()
  18750. {
  18751. return $this->type ?: 'library';
  18752. }
  18753. public function getStability()
  18754. {
  18755. return $this->stability;
  18756. }
  18757. public function setTargetDir($targetDir)
  18758. {
  18759. $this->targetDir = $targetDir;
  18760. }
  18761. public function getTargetDir()
  18762. {
  18763. if (null === $this->targetDir) {
  18764. return;
  18765. }
  18766. return ltrim(preg_replace('{ (?:^|[\\\\/]+) \.\.? (?:[\\\\/]+|$) (?:\.\.? (?:[\\\\/]+|$) )*}x', '/', $this->targetDir), '/');
  18767. }
  18768. public function setExtra(array $extra)
  18769. {
  18770. $this->extra = $extra;
  18771. }
  18772. public function getExtra()
  18773. {
  18774. return $this->extra;
  18775. }
  18776. public function setBinaries(array $binaries)
  18777. {
  18778. $this->binaries = $binaries;
  18779. }
  18780. public function getBinaries()
  18781. {
  18782. return $this->binaries;
  18783. }
  18784. public function setInstallationSource($type)
  18785. {
  18786. $this->installationSource = $type;
  18787. }
  18788. public function getInstallationSource()
  18789. {
  18790. return $this->installationSource;
  18791. }
  18792. public function setSourceType($type)
  18793. {
  18794. $this->sourceType = $type;
  18795. }
  18796. public function getSourceType()
  18797. {
  18798. return $this->sourceType;
  18799. }
  18800. public function setSourceUrl($url)
  18801. {
  18802. $this->sourceUrl = $url;
  18803. }
  18804. public function getSourceUrl()
  18805. {
  18806. return $this->sourceUrl;
  18807. }
  18808. public function setSourceReference($reference)
  18809. {
  18810. $this->sourceReference = $reference;
  18811. }
  18812. public function getSourceReference()
  18813. {
  18814. return $this->sourceReference;
  18815. }
  18816. public function setSourceMirrors($mirrors)
  18817. {
  18818. $this->sourceMirrors = $mirrors;
  18819. }
  18820. public function getSourceMirrors()
  18821. {
  18822. return $this->sourceMirrors;
  18823. }
  18824. public function getSourceUrls()
  18825. {
  18826. return $this->getUrls($this->sourceUrl, $this->sourceMirrors, $this->sourceReference, $this->sourceType, 'source');
  18827. }
  18828. public function setDistType($type)
  18829. {
  18830. $this->distType = $type;
  18831. }
  18832. public function getDistType()
  18833. {
  18834. return $this->distType;
  18835. }
  18836. public function setDistUrl($url)
  18837. {
  18838. $this->distUrl = $url;
  18839. }
  18840. public function getDistUrl()
  18841. {
  18842. return $this->distUrl;
  18843. }
  18844. public function setDistReference($reference)
  18845. {
  18846. $this->distReference = $reference;
  18847. }
  18848. public function getDistReference()
  18849. {
  18850. return $this->distReference;
  18851. }
  18852. public function setDistSha1Checksum($sha1checksum)
  18853. {
  18854. $this->distSha1Checksum = $sha1checksum;
  18855. }
  18856. public function getDistSha1Checksum()
  18857. {
  18858. return $this->distSha1Checksum;
  18859. }
  18860. public function setDistMirrors($mirrors)
  18861. {
  18862. $this->distMirrors = $mirrors;
  18863. }
  18864. public function getDistMirrors()
  18865. {
  18866. return $this->distMirrors;
  18867. }
  18868. public function getDistUrls()
  18869. {
  18870. return $this->getUrls($this->distUrl, $this->distMirrors, $this->distReference, $this->distType, 'dist');
  18871. }
  18872. public function getVersion()
  18873. {
  18874. return $this->version;
  18875. }
  18876. public function getPrettyVersion()
  18877. {
  18878. return $this->prettyVersion;
  18879. }
  18880. public function setReleaseDate(\DateTime $releaseDate)
  18881. {
  18882. $this->releaseDate = $releaseDate;
  18883. }
  18884. public function getReleaseDate()
  18885. {
  18886. return $this->releaseDate;
  18887. }
  18888. public function setRequires(array $requires)
  18889. {
  18890. $this->requires = $requires;
  18891. }
  18892. public function getRequires()
  18893. {
  18894. return $this->requires;
  18895. }
  18896. public function setConflicts(array $conflicts)
  18897. {
  18898. $this->conflicts = $conflicts;
  18899. }
  18900. public function getConflicts()
  18901. {
  18902. return $this->conflicts;
  18903. }
  18904. public function setProvides(array $provides)
  18905. {
  18906. $this->provides = $provides;
  18907. }
  18908. public function getProvides()
  18909. {
  18910. return $this->provides;
  18911. }
  18912. public function setReplaces(array $replaces)
  18913. {
  18914. $this->replaces = $replaces;
  18915. }
  18916. public function getReplaces()
  18917. {
  18918. return $this->replaces;
  18919. }
  18920. public function setDevRequires(array $devRequires)
  18921. {
  18922. $this->devRequires = $devRequires;
  18923. }
  18924. public function getDevRequires()
  18925. {
  18926. return $this->devRequires;
  18927. }
  18928. public function setSuggests(array $suggests)
  18929. {
  18930. $this->suggests = $suggests;
  18931. }
  18932. public function getSuggests()
  18933. {
  18934. return $this->suggests;
  18935. }
  18936. public function setAutoload(array $autoload)
  18937. {
  18938. $this->autoload = $autoload;
  18939. }
  18940. public function getAutoload()
  18941. {
  18942. return $this->autoload;
  18943. }
  18944. public function setDevAutoload(array $devAutoload)
  18945. {
  18946. $this->devAutoload = $devAutoload;
  18947. }
  18948. public function getDevAutoload()
  18949. {
  18950. return $this->devAutoload;
  18951. }
  18952. public function setIncludePaths(array $includePaths)
  18953. {
  18954. $this->includePaths = $includePaths;
  18955. }
  18956. public function getIncludePaths()
  18957. {
  18958. return $this->includePaths;
  18959. }
  18960. public function setNotificationUrl($notificationUrl)
  18961. {
  18962. $this->notificationUrl = $notificationUrl;
  18963. }
  18964. public function getNotificationUrl()
  18965. {
  18966. return $this->notificationUrl;
  18967. }
  18968. public function setArchiveExcludes(array $excludes)
  18969. {
  18970. $this->archiveExcludes = $excludes;
  18971. }
  18972. public function getArchiveExcludes()
  18973. {
  18974. return $this->archiveExcludes;
  18975. }
  18976. public function replaceVersion($version, $prettyVersion)
  18977. {
  18978. $this->version = $version;
  18979. $this->prettyVersion = $prettyVersion;
  18980. $this->stability = VersionParser::parseStability($version);
  18981. $this->dev = $this->stability === 'dev';
  18982. }
  18983. protected function getUrls($url, $mirrors, $ref, $type, $urlType)
  18984. {
  18985. if (!$url) {
  18986. return array();
  18987. }
  18988. $urls = array($url);
  18989. if ($mirrors) {
  18990. foreach ($mirrors as $mirror) {
  18991. if ($urlType === 'dist') {
  18992. $mirrorUrl = ComposerMirror::processUrl($mirror['url'], $this->name, $this->version, $ref, $type);
  18993. } elseif ($urlType === 'source' && $type === 'git') {
  18994. $mirrorUrl = ComposerMirror::processGitUrl($mirror['url'], $this->name, $url, $type);
  18995. } elseif ($urlType === 'source' && $type === 'hg') {
  18996. $mirrorUrl = ComposerMirror::processHgUrl($mirror['url'], $this->name, $url, $type);
  18997. }
  18998. if (!in_array($mirrorUrl, $urls)) {
  18999. $func = $mirror['preferred'] ? 'array_unshift' : 'array_push';
  19000. $func($urls, $mirrorUrl);
  19001. }
  19002. }
  19003. }
  19004. return $urls;
  19005. }
  19006. }
  19007. <?php
  19008. namespace Composer\Package;
  19009. use Composer\Repository\RepositoryInterface;
  19010. interface PackageInterface
  19011. {
  19012. public function getName();
  19013. public function getPrettyName();
  19014. public function getNames();
  19015. public function setId($id);
  19016. public function getId();
  19017. public function isDev();
  19018. public function getType();
  19019. public function getTargetDir();
  19020. public function getExtra();
  19021. public function setInstallationSource($type);
  19022. public function getInstallationSource();
  19023. public function getSourceType();
  19024. public function getSourceUrl();
  19025. public function getSourceUrls();
  19026. public function getSourceReference();
  19027. public function getSourceMirrors();
  19028. public function getDistType();
  19029. public function getDistUrl();
  19030. public function getDistUrls();
  19031. public function getDistReference();
  19032. public function getDistSha1Checksum();
  19033. public function getDistMirrors();
  19034. public function getVersion();
  19035. public function getPrettyVersion();
  19036. public function getFullPrettyVersion($truncate = true);
  19037. public function getReleaseDate();
  19038. public function getStability();
  19039. public function getRequires();
  19040. public function getConflicts();
  19041. public function getProvides();
  19042. public function getReplaces();
  19043. public function getDevRequires();
  19044. public function getSuggests();
  19045. public function getAutoload();
  19046. public function getDevAutoload();
  19047. public function getIncludePaths();
  19048. public function setRepository(RepositoryInterface $repository);
  19049. public function getRepository();
  19050. public function getBinaries();
  19051. public function getUniqueName();
  19052. public function getNotificationUrl();
  19053. public function __toString();
  19054. public function getPrettyString();
  19055. public function getArchiveExcludes();
  19056. public function getTransportOptions();
  19057. public function setSourceReference($reference);
  19058. public function setDistUrl($url);
  19059. public function setDistType($type);
  19060. public function setDistReference($reference);
  19061. }
  19062. <?php
  19063. namespace Composer\Package;
  19064. class RootAliasPackage extends AliasPackage implements RootPackageInterface
  19065. {
  19066. public function __construct(RootPackageInterface $aliasOf, $version, $prettyVersion)
  19067. {
  19068. parent::__construct($aliasOf, $version, $prettyVersion);
  19069. }
  19070. public function getAliases()
  19071. {
  19072. return $this->aliasOf->getAliases();
  19073. }
  19074. public function getMinimumStability()
  19075. {
  19076. return $this->aliasOf->getMinimumStability();
  19077. }
  19078. public function getStabilityFlags()
  19079. {
  19080. return $this->aliasOf->getStabilityFlags();
  19081. }
  19082. public function getReferences()
  19083. {
  19084. return $this->aliasOf->getReferences();
  19085. }
  19086. public function getPreferStable()
  19087. {
  19088. return $this->aliasOf->getPreferStable();
  19089. }
  19090. public function getConfig()
  19091. {
  19092. return $this->aliasOf->getConfig();
  19093. }
  19094. public function setRequires(array $require)
  19095. {
  19096. $this->requires = $this->replaceSelfVersionDependencies($require, 'requires');
  19097. $this->aliasOf->setRequires($require);
  19098. }
  19099. public function setDevRequires(array $devRequire)
  19100. {
  19101. $this->devRequires = $this->replaceSelfVersionDependencies($devRequire, 'devRequires');
  19102. $this->aliasOf->setDevRequires($devRequire);
  19103. }
  19104. public function setConflicts(array $conflicts)
  19105. {
  19106. $this->conflicts = $this->replaceSelfVersionDependencies($conflicts, 'conflicts');
  19107. $this->aliasOf->setConflicts($conflicts);
  19108. }
  19109. public function setProvides(array $provides)
  19110. {
  19111. $this->provides = $this->replaceSelfVersionDependencies($provides, 'provides');
  19112. $this->aliasOf->setProvides($provides);
  19113. }
  19114. public function setReplaces(array $replaces)
  19115. {
  19116. $this->replaces = $this->replaceSelfVersionDependencies($replaces, 'replaces');
  19117. $this->aliasOf->setReplaces($replaces);
  19118. }
  19119. public function setRepositories($repositories)
  19120. {
  19121. $this->aliasOf->setRepositories($repositories);
  19122. }
  19123. public function setAutoload(array $autoload)
  19124. {
  19125. $this->aliasOf->setAutoload($autoload);
  19126. }
  19127. public function setDevAutoload(array $devAutoload)
  19128. {
  19129. $this->aliasOf->setDevAutoload($devAutoload);
  19130. }
  19131. public function setStabilityFlags(array $stabilityFlags)
  19132. {
  19133. $this->aliasOf->setStabilityFlags($stabilityFlags);
  19134. }
  19135. public function setSuggests(array $suggests)
  19136. {
  19137. $this->aliasOf->setSuggests($suggests);
  19138. }
  19139. public function setExtra(array $extra)
  19140. {
  19141. $this->aliasOf->setExtra($extra);
  19142. }
  19143. public function __clone()
  19144. {
  19145. parent::__clone();
  19146. $this->aliasOf = clone $this->aliasOf;
  19147. }
  19148. }
  19149. <?php
  19150. namespace Composer\Package;
  19151. class RootPackage extends CompletePackage implements RootPackageInterface
  19152. {
  19153. protected $minimumStability = 'stable';
  19154. protected $preferStable = false;
  19155. protected $stabilityFlags = array();
  19156. protected $config = array();
  19157. protected $references = array();
  19158. protected $aliases = array();
  19159. public function setMinimumStability($minimumStability)
  19160. {
  19161. $this->minimumStability = $minimumStability;
  19162. }
  19163. public function getMinimumStability()
  19164. {
  19165. return $this->minimumStability;
  19166. }
  19167. public function setStabilityFlags(array $stabilityFlags)
  19168. {
  19169. $this->stabilityFlags = $stabilityFlags;
  19170. }
  19171. public function getStabilityFlags()
  19172. {
  19173. return $this->stabilityFlags;
  19174. }
  19175. public function setPreferStable($preferStable)
  19176. {
  19177. $this->preferStable = $preferStable;
  19178. }
  19179. public function getPreferStable()
  19180. {
  19181. return $this->preferStable;
  19182. }
  19183. public function setConfig(array $config)
  19184. {
  19185. $this->config = $config;
  19186. }
  19187. public function getConfig()
  19188. {
  19189. return $this->config;
  19190. }
  19191. public function setReferences(array $references)
  19192. {
  19193. $this->references = $references;
  19194. }
  19195. public function getReferences()
  19196. {
  19197. return $this->references;
  19198. }
  19199. public function setAliases(array $aliases)
  19200. {
  19201. $this->aliases = $aliases;
  19202. }
  19203. public function getAliases()
  19204. {
  19205. return $this->aliases;
  19206. }
  19207. }
  19208. <?php
  19209. namespace Composer\Package;
  19210. interface RootPackageInterface extends CompletePackageInterface
  19211. {
  19212. public function getAliases();
  19213. public function getMinimumStability();
  19214. public function getStabilityFlags();
  19215. public function getReferences();
  19216. public function getPreferStable();
  19217. public function getConfig();
  19218. public function setRequires(array $requires);
  19219. public function setDevRequires(array $devRequires);
  19220. public function setConflicts(array $conflicts);
  19221. public function setProvides(array $provides);
  19222. public function setReplaces(array $replaces);
  19223. public function setRepositories($repositories);
  19224. public function setAutoload(array $autoload);
  19225. public function setDevAutoload(array $devAutoload);
  19226. public function setStabilityFlags(array $stabilityFlags);
  19227. public function setSuggests(array $suggests);
  19228. public function setExtra(array $extra);
  19229. }
  19230. <?php
  19231. namespace Composer\Package\Version;
  19232. use Composer\Config;
  19233. use Composer\Repository\Vcs\HgDriver;
  19234. use Composer\IO\NullIO;
  19235. use Composer\Semver\VersionParser as SemverVersionParser;
  19236. use Composer\Util\Git as GitUtil;
  19237. use Composer\Util\ProcessExecutor;
  19238. use Composer\Util\Svn as SvnUtil;
  19239. class VersionGuesser
  19240. {
  19241. private $config;
  19242. private $process;
  19243. private $versionParser;
  19244. public function __construct(Config $config, ProcessExecutor $process, SemverVersionParser $versionParser)
  19245. {
  19246. $this->config = $config;
  19247. $this->process = $process;
  19248. $this->versionParser = $versionParser;
  19249. }
  19250. public function guessVersion(array $packageConfig, $path)
  19251. {
  19252. if (function_exists('proc_open')) {
  19253. $versionData = $this->guessGitVersion($packageConfig, $path);
  19254. if (null !== $versionData && null !== $versionData['version']) {
  19255. return $this->postprocess($versionData);
  19256. }
  19257. $versionData = $this->guessHgVersion($packageConfig, $path);
  19258. if (null !== $versionData && null !== $versionData['version']) {
  19259. return $this->postprocess($versionData);
  19260. }
  19261. $versionData = $this->guessFossilVersion($packageConfig, $path);
  19262. if (null !== $versionData && null !== $versionData['version']) {
  19263. return $this->postprocess($versionData);
  19264. }
  19265. $versionData = $this->guessSvnVersion($packageConfig, $path);
  19266. if (null !== $versionData && null !== $versionData['version']) {
  19267. return $this->postprocess($versionData);
  19268. }
  19269. }
  19270. }
  19271. private function postprocess(array $versionData)
  19272. {
  19273. if ('-dev' === substr($versionData['version'], -4) && preg_match('{\.9{7}}', $versionData['version'])) {
  19274. $versionData['pretty_version'] = preg_replace('{(\.9{7})+}', '.x', $versionData['version']);
  19275. }
  19276. return $versionData;
  19277. }
  19278. private function guessGitVersion(array $packageConfig, $path)
  19279. {
  19280. GitUtil::cleanEnv();
  19281. $commit = null;
  19282. $version = null;
  19283. $prettyVersion = null;
  19284. $isDetached = false;
  19285. if (0 === $this->process->execute('git branch --no-color --no-abbrev -v', $output, $path)) {
  19286. $branches = array();
  19287. $isFeatureBranch = false;
  19288. foreach ($this->process->splitLines($output) as $branch) {
  19289. if ($branch && preg_match('{^(?:\* ) *(\(no branch\)|\(detached from \S+\)|\(HEAD detached at \S+\)|\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19290. if ($match[1] === '(no branch)' || substr($match[1], 0, 10) === '(detached ' || substr($match[1], 0, 17) === '(HEAD detached at') {
  19291. $version = 'dev-' . $match[2];
  19292. $prettyVersion = $version;
  19293. $isFeatureBranch = true;
  19294. $isDetached = true;
  19295. } else {
  19296. $version = $this->versionParser->normalizeBranch($match[1]);
  19297. $prettyVersion = 'dev-' . $match[1];
  19298. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19299. }
  19300. if ($match[2]) {
  19301. $commit = $match[2];
  19302. }
  19303. }
  19304. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  19305. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+) .*$}', $branch, $match)) {
  19306. $branches[] = $match[1];
  19307. }
  19308. }
  19309. }
  19310. if ($isFeatureBranch) {
  19311. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'git rev-list %candidate%..%branch%', $path);
  19312. $version = $result['version'];
  19313. $prettyVersion = $result['pretty_version'];
  19314. }
  19315. }
  19316. if (!$version || $isDetached) {
  19317. $result = $this->versionFromGitTags($path);
  19318. if ($result) {
  19319. $version = $result['version'];
  19320. $prettyVersion = $result['pretty_version'];
  19321. }
  19322. }
  19323. if (!$commit) {
  19324. $command = 'git log --pretty="%H" -n1 HEAD';
  19325. if (0 === $this->process->execute($command, $output, $path)) {
  19326. $commit = trim($output) ?: null;
  19327. }
  19328. }
  19329. return array('version' => $version, 'commit' => $commit, 'pretty_version' => $prettyVersion);
  19330. }
  19331. private function versionFromGitTags($path)
  19332. {
  19333. if (0 === $this->process->execute('git describe --exact-match --tags', $output, $path)) {
  19334. try {
  19335. $version = $this->versionParser->normalize(trim($output));
  19336. return array('version' => $version, 'pretty_version' => trim($output));
  19337. } catch (\Exception $e) {
  19338. }
  19339. }
  19340. return null;
  19341. }
  19342. private function guessHgVersion(array $packageConfig, $path)
  19343. {
  19344. if (0 === $this->process->execute('hg branch', $output, $path)) {
  19345. $branch = trim($output);
  19346. $version = $this->versionParser->normalizeBranch($branch);
  19347. $isFeatureBranch = 0 === strpos($version, 'dev-');
  19348. if ('9999999-dev' === $version) {
  19349. return array('version' => $version, 'commit' => null, 'pretty_version' => 'dev-'.$branch);
  19350. }
  19351. if (!$isFeatureBranch) {
  19352. return array('version' => $version, 'commit' => null, 'pretty_version' => $version);
  19353. }
  19354. $driver = new HgDriver(array('url' => $path), new NullIO(), $this->config, $this->process);
  19355. $branches = array_keys($driver->getBranches());
  19356. $result = $this->guessFeatureVersion($packageConfig, $version, $branches, 'hg log -r "not ancestors(\'%candidate%\') and ancestors(\'%branch%\')" --template "{node}\\n"', $path);
  19357. $result['commit'] = '';
  19358. return $result;
  19359. }
  19360. }
  19361. private function guessFeatureVersion(array $packageConfig, $version, array $branches, $scmCmdline, $path)
  19362. {
  19363. $prettyVersion = $version;
  19364. if ((isset($packageConfig['extra']['branch-alias']) && !isset($packageConfig['extra']['branch-alias'][$version]))
  19365. || strpos(json_encode($packageConfig), '"self.version"')
  19366. ) {
  19367. $branch = preg_replace('{^dev-}', '', $version);
  19368. $length = PHP_INT_MAX;
  19369. $nonFeatureBranches = '';
  19370. if (!empty($packageConfig['non-feature-branches'])) {
  19371. $nonFeatureBranches = implode('|', $packageConfig['non-feature-branches']);
  19372. }
  19373. foreach ($branches as $candidate) {
  19374. if ($candidate === $branch && preg_match('{^(' . $nonFeatureBranches . ')$}', $candidate)) {
  19375. break;
  19376. }
  19377. if ($candidate === $branch || !preg_match('{^(' . $nonFeatureBranches . '|master|trunk|default|develop|\d+\..+)$}', $candidate, $match)) {
  19378. continue;
  19379. }
  19380. $cmdLine = str_replace(array('%candidate%', '%branch%'), array($candidate, $branch), $scmCmdline);
  19381. if (0 !== $this->process->execute($cmdLine, $output, $path)) {
  19382. continue;
  19383. }
  19384. if (strlen($output) < $length) {
  19385. $length = strlen($output);
  19386. $version = $this->versionParser->normalizeBranch($candidate);
  19387. $prettyVersion = 'dev-' . $match[1];
  19388. }
  19389. }
  19390. }
  19391. return array('version' => $version, 'pretty_version' => $prettyVersion);
  19392. }
  19393. private function guessFossilVersion(array $packageConfig, $path)
  19394. {
  19395. $version = null;
  19396. $prettyVersion = null;
  19397. if (0 === $this->process->execute('fossil branch list', $output, $path)) {
  19398. $branch = trim($output);
  19399. $version = $this->versionParser->normalizeBranch($branch);
  19400. $prettyVersion = 'dev-' . $branch;
  19401. }
  19402. if (0 === $this->process->execute('fossil tag list', $output, $path)) {
  19403. try {
  19404. $version = $this->versionParser->normalize(trim($output));
  19405. $prettyVersion = trim($output);
  19406. } catch (\Exception $e) {
  19407. }
  19408. }
  19409. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19410. }
  19411. private function guessSvnVersion(array $packageConfig, $path)
  19412. {
  19413. SvnUtil::cleanEnv();
  19414. if (0 === $this->process->execute('svn info --xml', $output, $path)) {
  19415. $trunkPath = isset($packageConfig['trunk-path']) ? preg_quote($packageConfig['trunk-path'], '#') : 'trunk';
  19416. $branchesPath = isset($packageConfig['branches-path']) ? preg_quote($packageConfig['branches-path'], '#') : 'branches';
  19417. $tagsPath = isset($packageConfig['tags-path']) ? preg_quote($packageConfig['tags-path'], '#') : 'tags';
  19418. $urlPattern = '#<url>.*/(' . $trunkPath . '|(' . $branchesPath . '|' . $tagsPath . ')/(.*))</url>#';
  19419. if (preg_match($urlPattern, $output, $matches)) {
  19420. if (isset($matches[2]) && ($branchesPath === $matches[2] || $tagsPath === $matches[2])) {
  19421. $version = $this->versionParser->normalizeBranch($matches[3]);
  19422. $prettyVersion = 'dev-' . $matches[3];
  19423. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19424. }
  19425. $prettyVersion = trim($matches[1]);
  19426. $version = $this->versionParser->normalize($prettyVersion);
  19427. return array('version' => $version, 'commit' => '', 'pretty_version' => $prettyVersion);
  19428. }
  19429. }
  19430. }
  19431. }
  19432. <?php
  19433. namespace Composer\Package\Version;
  19434. use Composer\Repository\PlatformRepository;
  19435. use Composer\Semver\VersionParser as SemverVersionParser;
  19436. use Composer\Semver\Semver;
  19437. class VersionParser extends SemverVersionParser
  19438. {
  19439. private static $constraints = array();
  19440. public function parseConstraints($constraints)
  19441. {
  19442. if (!isset(self::$constraints[$constraints])) {
  19443. self::$constraints[$constraints] = parent::parseConstraints($constraints);
  19444. }
  19445. return self::$constraints[$constraints];
  19446. }
  19447. public function parseNameVersionPairs(array $pairs)
  19448. {
  19449. $pairs = array_values($pairs);
  19450. $result = array();
  19451. for ($i = 0, $count = count($pairs); $i < $count; $i++) {
  19452. $pair = preg_replace('{^([^=: ]+)[=: ](.*)$}', '$1 $2', trim($pairs[$i]));
  19453. if (false === strpos($pair, ' ') && isset($pairs[$i + 1]) && false === strpos($pairs[$i + 1], '/') && !preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $pairs[$i + 1])) {
  19454. $pair .= ' '.$pairs[$i + 1];
  19455. $i++;
  19456. }
  19457. if (strpos($pair, ' ')) {
  19458. list($name, $version) = explode(' ', $pair, 2);
  19459. $result[] = array('name' => $name, 'version' => $version);
  19460. } else {
  19461. $result[] = array('name' => $pair);
  19462. }
  19463. }
  19464. return $result;
  19465. }
  19466. public static function isUpgrade($normalizedFrom, $normalizedTo)
  19467. {
  19468. if (substr($normalizedFrom, 0, 4) === 'dev-' || substr($normalizedTo, 0, 4) === 'dev-') {
  19469. return true;
  19470. }
  19471. $sorted = Semver::sort(array($normalizedTo, $normalizedFrom));
  19472. return $sorted[0] === $normalizedFrom;
  19473. }
  19474. }
  19475. <?php
  19476. namespace Composer\Package\Version;
  19477. use Composer\DependencyResolver\Pool;
  19478. use Composer\Package\BasePackage;
  19479. use Composer\Package\PackageInterface;
  19480. use Composer\Package\Loader\ArrayLoader;
  19481. use Composer\Package\Dumper\ArrayDumper;
  19482. use Composer\Semver\Constraint\Constraint;
  19483. class VersionSelector
  19484. {
  19485. private $pool;
  19486. private $parser;
  19487. public function __construct(Pool $pool)
  19488. {
  19489. $this->pool = $pool;
  19490. }
  19491. public function findBestCandidate($packageName, $targetPackageVersion = null, $targetPhpVersion = null, $preferredStability = 'stable')
  19492. {
  19493. $constraint = $targetPackageVersion ? $this->getParser()->parseConstraints($targetPackageVersion) : null;
  19494. $candidates = $this->pool->whatProvides(strtolower($packageName), $constraint, true);
  19495. if ($targetPhpVersion) {
  19496. $phpConstraint = new Constraint('==', $this->getParser()->normalize($targetPhpVersion));
  19497. $candidates = array_filter($candidates, function ($pkg) use ($phpConstraint) {
  19498. $reqs = $pkg->getRequires();
  19499. return !isset($reqs['php']) || $reqs['php']->getConstraint()->matches($phpConstraint);
  19500. });
  19501. }
  19502. if (!$candidates) {
  19503. return false;
  19504. }
  19505. $package = reset($candidates);
  19506. $minPriority = BasePackage::$stabilities[$preferredStability];
  19507. foreach ($candidates as $candidate) {
  19508. $candidatePriority = $candidate->getStabilityPriority();
  19509. $currentPriority = $package->getStabilityPriority();
  19510. if ($minPriority < $candidatePriority && $currentPriority < $candidatePriority) {
  19511. continue;
  19512. }
  19513. if ($minPriority < $candidatePriority && $candidatePriority < $currentPriority) {
  19514. $package = $candidate;
  19515. continue;
  19516. }
  19517. if ($minPriority >= $candidatePriority && $minPriority < $currentPriority) {
  19518. $package = $candidate;
  19519. continue;
  19520. }
  19521. if (version_compare($package->getVersion(), $candidate->getVersion(), '<')) {
  19522. $package = $candidate;
  19523. }
  19524. }
  19525. return $package;
  19526. }
  19527. public function findRecommendedRequireVersion(PackageInterface $package)
  19528. {
  19529. $version = $package->getVersion();
  19530. if (!$package->isDev()) {
  19531. return $this->transformVersion($version, $package->getPrettyVersion(), $package->getStability());
  19532. }
  19533. $loader = new ArrayLoader($this->getParser());
  19534. $dumper = new ArrayDumper();
  19535. $extra = $loader->getBranchAlias($dumper->dump($package));
  19536. if ($extra) {
  19537. $extra = preg_replace('{^(\d+\.\d+\.\d+)(\.9999999)-dev$}', '$1.0', $extra, -1, $count);
  19538. if ($count) {
  19539. $extra = str_replace('.9999999', '.0', $extra);
  19540. return $this->transformVersion($extra, $extra, 'dev');
  19541. }
  19542. }
  19543. return $package->getPrettyVersion();
  19544. }
  19545. private function transformVersion($version, $prettyVersion, $stability)
  19546. {
  19547. $semanticVersionParts = explode('.', $version);
  19548. if (count($semanticVersionParts) == 4 && preg_match('{^0\D?}', $semanticVersionParts[3])) {
  19549. if ($semanticVersionParts[0] === '0') {
  19550. unset($semanticVersionParts[3]);
  19551. } else {
  19552. unset($semanticVersionParts[2], $semanticVersionParts[3]);
  19553. }
  19554. $version = implode('.', $semanticVersionParts);
  19555. } else {
  19556. return $prettyVersion;
  19557. }
  19558. if ($stability != 'stable') {
  19559. $version .= '@'.$stability;
  19560. }
  19561. return '^' . $version;
  19562. }
  19563. private function getParser()
  19564. {
  19565. if ($this->parser === null) {
  19566. $this->parser = new VersionParser();
  19567. }
  19568. return $this->parser;
  19569. }
  19570. }
  19571. <?php
  19572. namespace Composer\Plugin\Capability;
  19573. interface Capability
  19574. {
  19575. }
  19576. <?php
  19577. namespace Composer\Plugin\Capability;
  19578. interface CommandProvider extends Capability
  19579. {
  19580. public function getCommands();
  19581. }
  19582. <?php
  19583. namespace Composer\Plugin;
  19584. interface Capable
  19585. {
  19586. public function getCapabilities();
  19587. }
  19588. <?php
  19589. namespace Composer\Plugin;
  19590. use Composer\EventDispatcher\Event;
  19591. use Symfony\Component\Console\Input\InputInterface;
  19592. use Symfony\Component\Console\Output\OutputInterface;
  19593. class CommandEvent extends Event
  19594. {
  19595. private $commandName;
  19596. private $input;
  19597. private $output;
  19598. public function __construct($name, $commandName, $input, $output, array $args = array(), array $flags = array())
  19599. {
  19600. parent::__construct($name, $args, $flags);
  19601. $this->commandName = $commandName;
  19602. $this->input = $input;
  19603. $this->output = $output;
  19604. }
  19605. public function getInput()
  19606. {
  19607. return $this->input;
  19608. }
  19609. public function getOutput()
  19610. {
  19611. return $this->output;
  19612. }
  19613. public function getCommandName()
  19614. {
  19615. return $this->commandName;
  19616. }
  19617. }
  19618. <?php
  19619. namespace Composer\Plugin;
  19620. class PluginEvents
  19621. {
  19622. const INIT = 'init';
  19623. const COMMAND = 'command';
  19624. const PRE_FILE_DOWNLOAD = 'pre-file-download';
  19625. const PRE_COMMAND_RUN = 'pre-command-run';
  19626. }
  19627. <?php
  19628. namespace Composer\Plugin;
  19629. use Composer\Composer;
  19630. use Composer\IO\IOInterface;
  19631. interface PluginInterface
  19632. {
  19633. const PLUGIN_API_VERSION = '1.1.0';
  19634. public function activate(Composer $composer, IOInterface $io);
  19635. }
  19636. <?php
  19637. namespace Composer\Plugin;
  19638. use Composer\Composer;
  19639. use Composer\EventDispatcher\EventSubscriberInterface;
  19640. use Composer\IO\IOInterface;
  19641. use Composer\Package\CompletePackage;
  19642. use Composer\Package\Package;
  19643. use Composer\Package\Version\VersionParser;
  19644. use Composer\Repository\RepositoryInterface;
  19645. use Composer\Package\PackageInterface;
  19646. use Composer\Package\Link;
  19647. use Composer\Semver\Constraint\Constraint;
  19648. use Composer\DependencyResolver\Pool;
  19649. use Composer\Plugin\Capability\Capability;
  19650. use Composer\Util\PackageSorter;
  19651. class PluginManager
  19652. {
  19653. protected $composer;
  19654. protected $io;
  19655. protected $globalComposer;
  19656. protected $versionParser;
  19657. protected $disablePlugins = false;
  19658. protected $plugins = array();
  19659. protected $registeredPlugins = array();
  19660. private static $classCounter = 0;
  19661. public function __construct(IOInterface $io, Composer $composer, Composer $globalComposer = null, $disablePlugins = false)
  19662. {
  19663. $this->io = $io;
  19664. $this->composer = $composer;
  19665. $this->globalComposer = $globalComposer;
  19666. $this->versionParser = new VersionParser();
  19667. $this->disablePlugins = $disablePlugins;
  19668. }
  19669. public function loadInstalledPlugins()
  19670. {
  19671. if ($this->disablePlugins) {
  19672. return;
  19673. }
  19674. $repo = $this->composer->getRepositoryManager()->getLocalRepository();
  19675. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19676. if ($repo) {
  19677. $this->loadRepository($repo);
  19678. }
  19679. if ($globalRepo) {
  19680. $this->loadRepository($globalRepo);
  19681. }
  19682. }
  19683. public function getPlugins()
  19684. {
  19685. return $this->plugins;
  19686. }
  19687. public function getGlobalComposer()
  19688. {
  19689. return $this->globalComposer;
  19690. }
  19691. public function registerPackage(PackageInterface $package, $failOnMissingClasses = false)
  19692. {
  19693. if ($this->disablePlugins) {
  19694. return;
  19695. }
  19696. if ($package->getType() === 'composer-plugin') {
  19697. $requiresComposer = null;
  19698. foreach ($package->getRequires() as $link) {
  19699. if ('composer-plugin-api' === $link->getTarget()) {
  19700. $requiresComposer = $link->getConstraint();
  19701. break;
  19702. }
  19703. }
  19704. if (!$requiresComposer) {
  19705. throw new \RuntimeException("Plugin ".$package->getName()." is missing a require statement for a version of the composer-plugin-api package.");
  19706. }
  19707. $currentPluginApiVersion = $this->getPluginApiVersion();
  19708. $currentPluginApiConstraint = new Constraint('==', $this->versionParser->normalize($currentPluginApiVersion));
  19709. if ($requiresComposer->getPrettyString() === '1.0.0' && $this->getPluginApiVersion() === '1.0.0') {
  19710. $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>');
  19711. } elseif (!$requiresComposer->matches($currentPluginApiConstraint)) {
  19712. $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>');
  19713. return;
  19714. }
  19715. }
  19716. $oldInstallerPlugin = ($package->getType() === 'composer-installer');
  19717. if (in_array($package->getName(), $this->registeredPlugins)) {
  19718. return;
  19719. }
  19720. $extra = $package->getExtra();
  19721. if (empty($extra['class'])) {
  19722. throw new \UnexpectedValueException('Error while installing '.$package->getPrettyName().', composer-plugin packages should have a class defined in their extra key to be usable.');
  19723. }
  19724. $classes = is_array($extra['class']) ? $extra['class'] : array($extra['class']);
  19725. $localRepo = $this->composer->getRepositoryManager()->getLocalRepository();
  19726. $globalRepo = $this->globalComposer ? $this->globalComposer->getRepositoryManager()->getLocalRepository() : null;
  19727. $pool = new Pool('dev');
  19728. $pool->addRepository($localRepo);
  19729. if ($globalRepo) {
  19730. $pool->addRepository($globalRepo);
  19731. }
  19732. $autoloadPackages = array($package->getName() => $package);
  19733. $autoloadPackages = $this->collectDependencies($pool, $autoloadPackages, $package);
  19734. $generator = $this->composer->getAutoloadGenerator();
  19735. $autoloads = array();
  19736. foreach ($autoloadPackages as $autoloadPackage) {
  19737. $downloadPath = $this->getInstallPath($autoloadPackage, $globalRepo && $globalRepo->hasPackage($autoloadPackage));
  19738. $autoloads[] = array($autoloadPackage, $downloadPath);
  19739. }
  19740. $map = $generator->parseAutoloads($autoloads, new Package('dummy', '1.0.0.0', '1.0.0'));
  19741. $classLoader = $generator->createLoader($map);
  19742. $classLoader->register();
  19743. foreach ($classes as $class) {
  19744. if (class_exists($class, false)) {
  19745. $class = trim($class, '\\');
  19746. $path = $classLoader->findFile($class);
  19747. $code = file_get_contents($path);
  19748. $separatorPos = strrpos($class, '\\');
  19749. $className = $class;
  19750. if ($separatorPos) {
  19751. $className = substr($class, $separatorPos + 1);
  19752. }
  19753. $code = preg_replace('{^((?:final\s+)?(?:\s*))class\s+('.preg_quote($className).')}mi', '$1class $2_composer_tmp'.self::$classCounter, $code, 1);
  19754. $code = str_replace('__FILE__', var_export($path, true), $code);
  19755. $code = str_replace('__DIR__', var_export(dirname($path), true), $code);
  19756. $code = str_replace('__CLASS__', var_export($class, true), $code);
  19757. $code = preg_replace('/^\s*<\?(php)?/i', '', $code, 1);
  19758. eval($code);
  19759. $class .= '_composer_tmp'.self::$classCounter;
  19760. self::$classCounter++;
  19761. }
  19762. if ($oldInstallerPlugin) {
  19763. $installer = new $class($this->io, $this->composer);
  19764. $this->composer->getInstallationManager()->addInstaller($installer);
  19765. } elseif (class_exists($class)) {
  19766. $plugin = new $class();
  19767. $this->addPlugin($plugin);
  19768. $this->registeredPlugins[] = $package->getName();
  19769. } elseif ($failOnMissingClasses) {
  19770. throw new \UnexpectedValueException('Plugin '.$package->getName().' could not be initialized, class not found: '.$class);
  19771. }
  19772. }
  19773. }
  19774. protected function getPluginApiVersion()
  19775. {
  19776. return PluginInterface::PLUGIN_API_VERSION;
  19777. }
  19778. public function addPlugin(PluginInterface $plugin)
  19779. {
  19780. $this->io->writeError('Loading plugin '.get_class($plugin), true, IOInterface::DEBUG);
  19781. $this->plugins[] = $plugin;
  19782. $plugin->activate($this->composer, $this->io);
  19783. if ($plugin instanceof EventSubscriberInterface) {
  19784. $this->composer->getEventDispatcher()->addSubscriber($plugin);
  19785. }
  19786. }
  19787. private function loadRepository(RepositoryInterface $repo)
  19788. {
  19789. $packages = $repo->getPackages();
  19790. $sortedPackages = array_reverse(PackageSorter::sortPackages($packages));
  19791. foreach ($sortedPackages as $package) {
  19792. if (!($package instanceof CompletePackage)) {
  19793. continue;
  19794. }
  19795. if ('composer-plugin' === $package->getType()) {
  19796. $this->registerPackage($package);
  19797. } elseif ('composer-installer' === $package->getType()) {
  19798. $this->registerPackage($package);
  19799. }
  19800. }
  19801. }
  19802. private function collectDependencies(Pool $pool, array $collected, PackageInterface $package)
  19803. {
  19804. $requires = array_merge(
  19805. $package->getRequires(),
  19806. $package->getDevRequires()
  19807. );
  19808. foreach ($requires as $requireLink) {
  19809. $requiredPackage = $this->lookupInstalledPackage($pool, $requireLink);
  19810. if ($requiredPackage && !isset($collected[$requiredPackage->getName()])) {
  19811. $collected[$requiredPackage->getName()] = $requiredPackage;
  19812. $collected = $this->collectDependencies($pool, $collected, $requiredPackage);
  19813. }
  19814. }
  19815. return $collected;
  19816. }
  19817. private function lookupInstalledPackage(Pool $pool, Link $link)
  19818. {
  19819. $packages = $pool->whatProvides($link->getTarget(), $link->getConstraint());
  19820. return !empty($packages) ? $packages[0] : null;
  19821. }
  19822. private function getInstallPath(PackageInterface $package, $global = false)
  19823. {
  19824. if (!$global) {
  19825. return $this->composer->getInstallationManager()->getInstallPath($package);
  19826. }
  19827. return $this->globalComposer->getInstallationManager()->getInstallPath($package);
  19828. }
  19829. protected function getCapabilityImplementationClassName(PluginInterface $plugin, $capability)
  19830. {
  19831. if (!($plugin instanceof Capable)) {
  19832. return null;
  19833. }
  19834. $capabilities = (array) $plugin->getCapabilities();
  19835. if (!empty($capabilities[$capability]) && is_string($capabilities[$capability]) && trim($capabilities[$capability])) {
  19836. return trim($capabilities[$capability]);
  19837. }
  19838. if (
  19839. array_key_exists($capability, $capabilities)
  19840. && (empty($capabilities[$capability]) || !is_string($capabilities[$capability]) || !trim($capabilities[$capability]))
  19841. ) {
  19842. throw new \UnexpectedValueException('Plugin '.get_class($plugin).' provided invalid capability class name(s), got '.var_export($capabilities[$capability], 1));
  19843. }
  19844. }
  19845. public function getPluginCapability(PluginInterface $plugin, $capabilityClassName, array $ctorArgs = array())
  19846. {
  19847. if ($capabilityClass = $this->getCapabilityImplementationClassName($plugin, $capabilityClassName)) {
  19848. if (!class_exists($capabilityClass)) {
  19849. throw new \RuntimeException("Cannot instantiate Capability, as class $capabilityClass from plugin ".get_class($plugin)." does not exist.");
  19850. }
  19851. $ctorArgs['plugin'] = $plugin;
  19852. $capabilityObj = new $capabilityClass($ctorArgs);
  19853. if (!$capabilityObj instanceof Capability || !$capabilityObj instanceof $capabilityClassName) {
  19854. throw new \RuntimeException(
  19855. 'Class ' . $capabilityClass . ' must implement both Composer\Plugin\Capability\Capability and '. $capabilityClassName . '.'
  19856. );
  19857. }
  19858. return $capabilityObj;
  19859. }
  19860. }
  19861. public function getPluginCapabilities($capabilityClassName, array $ctorArgs = array())
  19862. {
  19863. $capabilities = array();
  19864. foreach ($this->getPlugins() as $plugin) {
  19865. if ($capability = $this->getPluginCapability($plugin, $capabilityClassName, $ctorArgs)) {
  19866. $capabilities[] = $capability;
  19867. }
  19868. }
  19869. return $capabilities;
  19870. }
  19871. }
  19872. <?php
  19873. namespace Composer\Plugin;
  19874. use Composer\EventDispatcher\Event;
  19875. use Symfony\Component\Console\Input\InputInterface;
  19876. class PreCommandRunEvent extends Event
  19877. {
  19878. private $input;
  19879. private $command;
  19880. public function __construct($name, InputInterface $input, $command)
  19881. {
  19882. parent::__construct($name);
  19883. $this->input = $input;
  19884. $this->command = $command;
  19885. }
  19886. public function getInput()
  19887. {
  19888. return $this->input;
  19889. }
  19890. public function getCommand()
  19891. {
  19892. return $this->command;
  19893. }
  19894. }
  19895. <?php
  19896. namespace Composer\Plugin;
  19897. use Composer\EventDispatcher\Event;
  19898. use Composer\Util\RemoteFilesystem;
  19899. class PreFileDownloadEvent extends Event
  19900. {
  19901. private $rfs;
  19902. private $processedUrl;
  19903. public function __construct($name, RemoteFilesystem $rfs, $processedUrl)
  19904. {
  19905. parent::__construct($name);
  19906. $this->rfs = $rfs;
  19907. $this->processedUrl = $processedUrl;
  19908. }
  19909. public function getRemoteFilesystem()
  19910. {
  19911. return $this->rfs;
  19912. }
  19913. public function setRemoteFilesystem(RemoteFilesystem $rfs)
  19914. {
  19915. $this->rfs = $rfs;
  19916. }
  19917. public function getProcessedUrl()
  19918. {
  19919. return $this->processedUrl;
  19920. }
  19921. }
  19922. <?php
  19923. namespace Composer\Question;
  19924. use Symfony\Component\Console\Exception\InvalidArgumentException;
  19925. use Symfony\Component\Console\Question\Question;
  19926. class StrictConfirmationQuestion extends Question
  19927. {
  19928. private $trueAnswerRegex;
  19929. private $falseAnswerRegex;
  19930. public function __construct($question, $default = true, $trueAnswerRegex = '/^y(?:es)?$/i', $falseAnswerRegex = '/^no?$/i')
  19931. {
  19932. parent::__construct($question, (bool) $default);
  19933. $this->trueAnswerRegex = $trueAnswerRegex;
  19934. $this->falseAnswerRegex = $falseAnswerRegex;
  19935. $this->setNormalizer($this->getDefaultNormalizer());
  19936. $this->setValidator($this->getDefaultValidator());
  19937. }
  19938. private function getDefaultNormalizer()
  19939. {
  19940. $default = $this->getDefault();
  19941. $trueRegex = $this->trueAnswerRegex;
  19942. $falseRegex = $this->falseAnswerRegex;
  19943. return function ($answer) use ($default, $trueRegex, $falseRegex) {
  19944. if (is_bool($answer)) {
  19945. return $answer;
  19946. }
  19947. if (empty($answer) && !empty($default)) {
  19948. return $default;
  19949. }
  19950. if (preg_match($trueRegex, $answer)) {
  19951. return true;
  19952. }
  19953. if (preg_match($falseRegex, $answer)) {
  19954. return false;
  19955. }
  19956. return null;
  19957. };
  19958. }
  19959. private function getDefaultValidator()
  19960. {
  19961. return function ($answer) {
  19962. if (!is_bool($answer)) {
  19963. throw new InvalidArgumentException('Please answer yes, y, no, or n.');
  19964. }
  19965. return $answer;
  19966. };
  19967. }
  19968. }
  19969. <?php
  19970. namespace Composer\Repository;
  19971. use Composer\Package\AliasPackage;
  19972. use Composer\Package\PackageInterface;
  19973. use Composer\Package\CompletePackageInterface;
  19974. use Composer\Package\Version\VersionParser;
  19975. use Composer\Semver\Constraint\ConstraintInterface;
  19976. use Composer\Semver\Constraint\Constraint;
  19977. class ArrayRepository extends BaseRepository
  19978. {
  19979. protected $packages;
  19980. public function __construct(array $packages = array())
  19981. {
  19982. foreach ($packages as $package) {
  19983. $this->addPackage($package);
  19984. }
  19985. }
  19986. public function findPackage($name, $constraint)
  19987. {
  19988. $name = strtolower($name);
  19989. if (!$constraint instanceof ConstraintInterface) {
  19990. $versionParser = new VersionParser();
  19991. $constraint = $versionParser->parseConstraints($constraint);
  19992. }
  19993. foreach ($this->getPackages() as $package) {
  19994. if ($name === $package->getName()) {
  19995. $pkgConstraint = new Constraint('==', $package->getVersion());
  19996. if ($constraint->matches($pkgConstraint)) {
  19997. return $package;
  19998. }
  19999. }
  20000. }
  20001. return null;
  20002. }
  20003. public function findPackages($name, $constraint = null)
  20004. {
  20005. $name = strtolower($name);
  20006. $packages = array();
  20007. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20008. $versionParser = new VersionParser();
  20009. $constraint = $versionParser->parseConstraints($constraint);
  20010. }
  20011. foreach ($this->getPackages() as $package) {
  20012. if ($name === $package->getName()) {
  20013. $pkgConstraint = new Constraint('==', $package->getVersion());
  20014. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20015. $packages[] = $package;
  20016. }
  20017. }
  20018. }
  20019. return $packages;
  20020. }
  20021. public function search($query, $mode = 0, $type = null)
  20022. {
  20023. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20024. $matches = array();
  20025. foreach ($this->getPackages() as $package) {
  20026. $name = $package->getName();
  20027. if (isset($matches[$name])) {
  20028. continue;
  20029. }
  20030. if (preg_match($regex, $name)
  20031. || ($mode === self::SEARCH_FULLTEXT && $package instanceof CompletePackageInterface && preg_match($regex, implode(' ', (array) $package->getKeywords()) . ' ' . $package->getDescription()))
  20032. ) {
  20033. if (null !== $type && $package->getType() !== $type) {
  20034. continue;
  20035. }
  20036. $matches[$name] = array(
  20037. 'name' => $package->getPrettyName(),
  20038. 'description' => $package instanceof CompletePackageInterface ? $package->getDescription() : null,
  20039. );
  20040. }
  20041. }
  20042. return array_values($matches);
  20043. }
  20044. public function hasPackage(PackageInterface $package)
  20045. {
  20046. $packageId = $package->getUniqueName();
  20047. foreach ($this->getPackages() as $repoPackage) {
  20048. if ($packageId === $repoPackage->getUniqueName()) {
  20049. return true;
  20050. }
  20051. }
  20052. return false;
  20053. }
  20054. public function addPackage(PackageInterface $package)
  20055. {
  20056. if (null === $this->packages) {
  20057. $this->initialize();
  20058. }
  20059. $package->setRepository($this);
  20060. $this->packages[] = $package;
  20061. if ($package instanceof AliasPackage) {
  20062. $aliasedPackage = $package->getAliasOf();
  20063. if (null === $aliasedPackage->getRepository()) {
  20064. $this->addPackage($aliasedPackage);
  20065. }
  20066. }
  20067. }
  20068. protected function createAliasPackage(PackageInterface $package, $alias, $prettyAlias)
  20069. {
  20070. return new AliasPackage($package instanceof AliasPackage ? $package->getAliasOf() : $package, $alias, $prettyAlias);
  20071. }
  20072. public function removePackage(PackageInterface $package)
  20073. {
  20074. $packageId = $package->getUniqueName();
  20075. foreach ($this->getPackages() as $key => $repoPackage) {
  20076. if ($packageId === $repoPackage->getUniqueName()) {
  20077. array_splice($this->packages, $key, 1);
  20078. return;
  20079. }
  20080. }
  20081. }
  20082. public function getPackages()
  20083. {
  20084. if (null === $this->packages) {
  20085. $this->initialize();
  20086. }
  20087. return $this->packages;
  20088. }
  20089. public function count()
  20090. {
  20091. return count($this->packages);
  20092. }
  20093. protected function initialize()
  20094. {
  20095. $this->packages = array();
  20096. }
  20097. }
  20098. <?php
  20099. namespace Composer\Repository;
  20100. use Composer\IO\IOInterface;
  20101. use Composer\Json\JsonFile;
  20102. use Composer\Package\Loader\ArrayLoader;
  20103. use Composer\Package\Loader\LoaderInterface;
  20104. use Composer\Util\Zip;
  20105. class ArtifactRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20106. {
  20107. protected $loader;
  20108. protected $lookup;
  20109. protected $repoConfig;
  20110. private $io;
  20111. public function __construct(array $repoConfig, IOInterface $io)
  20112. {
  20113. parent::__construct();
  20114. if (!extension_loaded('zip')) {
  20115. throw new \RuntimeException('The artifact repository requires PHP\'s zip extension');
  20116. }
  20117. $this->loader = new ArrayLoader();
  20118. $this->lookup = $repoConfig['url'];
  20119. $this->io = $io;
  20120. $this->repoConfig = $repoConfig;
  20121. }
  20122. public function getRepoConfig()
  20123. {
  20124. return $this->repoConfig;
  20125. }
  20126. protected function initialize()
  20127. {
  20128. parent::initialize();
  20129. $this->scanDirectory($this->lookup);
  20130. }
  20131. private function scanDirectory($path)
  20132. {
  20133. $io = $this->io;
  20134. $directory = new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
  20135. $iterator = new \RecursiveIteratorIterator($directory);
  20136. $regex = new \RegexIterator($iterator, '/^.+\.(zip|phar)$/i');
  20137. foreach ($regex as $file) {
  20138. if (!$file->isFile()) {
  20139. continue;
  20140. }
  20141. $package = $this->getComposerInformation($file);
  20142. if (!$package) {
  20143. $io->writeError("File <comment>{$file->getBasename()}</comment> doesn't seem to hold a package", true, IOInterface::VERBOSE);
  20144. continue;
  20145. }
  20146. $template = 'Found package <info>%s</info> (<comment>%s</comment>) in file <info>%s</info>';
  20147. $io->writeError(sprintf($template, $package->getName(), $package->getPrettyVersion(), $file->getBasename()), true, IOInterface::VERBOSE);
  20148. $this->addPackage($package);
  20149. }
  20150. }
  20151. private function getComposerInformation(\SplFileInfo $file)
  20152. {
  20153. $json = Zip::getComposerJson($file->getPathname());
  20154. if (null === $json) {
  20155. return false;
  20156. }
  20157. $package = JsonFile::parseJson($json, $file->getPathname().'#composer.json');
  20158. $package['dist'] = array(
  20159. 'type' => 'zip',
  20160. 'url' => strtr($file->getPathname(), '\\', '/'),
  20161. 'shasum' => sha1_file($file->getRealPath()),
  20162. );
  20163. try {
  20164. $package = $this->loader->load($package);
  20165. } catch (\UnexpectedValueException $e) {
  20166. throw new \UnexpectedValueException('Failed loading package in '.$file.': '.$e->getMessage(), 0, $e);
  20167. }
  20168. return $package;
  20169. }
  20170. }
  20171. <?php
  20172. namespace Composer\Repository;
  20173. use Composer\Package\RootPackageInterface;
  20174. use Composer\Semver\Constraint\ConstraintInterface;
  20175. use Composer\Semver\Constraint\Constraint;
  20176. use Composer\Package\Link;
  20177. abstract class BaseRepository implements RepositoryInterface
  20178. {
  20179. public function getDependents($needle, $constraint = null, $invert = false, $recurse = true, $packagesFound = null)
  20180. {
  20181. $needles = array_map('strtolower', (array) $needle);
  20182. $results = array();
  20183. if (null === $packagesFound) {
  20184. $packagesFound = $needles;
  20185. }
  20186. $rootPackage = null;
  20187. foreach ($this->getPackages() as $package) {
  20188. if ($package instanceof RootPackageInterface) {
  20189. $rootPackage = $package;
  20190. break;
  20191. }
  20192. }
  20193. foreach ($this->getPackages() as $package) {
  20194. $links = $package->getRequires();
  20195. $packagesInTree = $packagesFound;
  20196. if (!$invert) {
  20197. $links += $package->getReplaces();
  20198. foreach ($package->getReplaces() as $link) {
  20199. foreach ($needles as $needle) {
  20200. if ($link->getSource() === $needle) {
  20201. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20202. if (in_array($link->getTarget(), $packagesInTree)) {
  20203. $results[] = array($package, $link, false);
  20204. continue;
  20205. }
  20206. $packagesInTree[] = $link->getTarget();
  20207. $dependents = $recurse ? $this->getDependents($link->getTarget(), null, false, true, $packagesInTree) : array();
  20208. $results[] = array($package, $link, $dependents);
  20209. $needles[] = $link->getTarget();
  20210. }
  20211. }
  20212. }
  20213. }
  20214. }
  20215. if ($package instanceof RootPackageInterface) {
  20216. $links += $package->getDevRequires();
  20217. }
  20218. foreach ($links as $link) {
  20219. foreach ($needles as $needle) {
  20220. if ($link->getTarget() === $needle) {
  20221. if ($constraint === null || ($link->getConstraint()->matches($constraint) === !$invert)) {
  20222. if (in_array($link->getSource(), $packagesInTree)) {
  20223. $results[] = array($package, $link, false);
  20224. continue;
  20225. }
  20226. $packagesInTree[] = $link->getSource();
  20227. $dependents = $recurse ? $this->getDependents($link->getSource(), null, false, true, $packagesInTree) : array();
  20228. $results[] = array($package, $link, $dependents);
  20229. }
  20230. }
  20231. }
  20232. }
  20233. if ($invert && in_array($package->getName(), $needles)) {
  20234. foreach ($package->getConflicts() as $link) {
  20235. foreach ($this->findPackages($link->getTarget()) as $pkg) {
  20236. $version = new Constraint('=', $pkg->getVersion());
  20237. if ($link->getConstraint()->matches($version) === $invert) {
  20238. $results[] = array($package, $link, false);
  20239. }
  20240. }
  20241. }
  20242. }
  20243. if ($invert && $constraint && in_array($package->getName(), $needles) && $constraint->matches(new Constraint('=', $package->getVersion()))) {
  20244. foreach ($package->getRequires() as $link) {
  20245. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $link->getTarget())) {
  20246. if ($this->findPackage($link->getTarget(), $link->getConstraint())) {
  20247. continue;
  20248. }
  20249. $platformPkg = $this->findPackage($link->getTarget(), '*');
  20250. $description = $platformPkg ? 'but '.$platformPkg->getPrettyVersion().' is installed' : 'but it is missing';
  20251. $results[] = array($package, new Link($package->getName(), $link->getTarget(), null, 'requires', $link->getPrettyConstraint().' '.$description), false);
  20252. continue;
  20253. }
  20254. foreach ($this->getPackages() as $pkg) {
  20255. if (!in_array($link->getTarget(), $pkg->getNames())) {
  20256. continue;
  20257. }
  20258. $version = new Constraint('=', $pkg->getVersion());
  20259. if (!$link->getConstraint()->matches($version)) {
  20260. if ($rootPackage) {
  20261. foreach (array_merge($rootPackage->getRequires(), $rootPackage->getDevRequires()) as $rootReq) {
  20262. if (in_array($rootReq->getTarget(), $pkg->getNames()) && !$rootReq->getConstraint()->matches($link->getConstraint())) {
  20263. $results[] = array($package, $link, false);
  20264. $results[] = array($rootPackage, $rootReq, false);
  20265. continue 3;
  20266. }
  20267. }
  20268. $results[] = array($package, $link, false);
  20269. $results[] = array($rootPackage, new Link($rootPackage->getName(), $link->getTarget(), null, 'does not require', 'but ' . $pkg->getPrettyVersion() . ' is installed'), false);
  20270. } else {
  20271. $results[] = array($package, $link, false);
  20272. }
  20273. }
  20274. continue 2;
  20275. }
  20276. }
  20277. }
  20278. }
  20279. ksort($results);
  20280. return $results;
  20281. }
  20282. }
  20283. <?php
  20284. namespace Composer\Repository;
  20285. use Composer\Package\Loader\ArrayLoader;
  20286. use Composer\Package\PackageInterface;
  20287. use Composer\Package\AliasPackage;
  20288. use Composer\Package\Version\VersionParser;
  20289. use Composer\DependencyResolver\Pool;
  20290. use Composer\Json\JsonFile;
  20291. use Composer\Cache;
  20292. use Composer\Config;
  20293. use Composer\Composer;
  20294. use Composer\Factory;
  20295. use Composer\IO\IOInterface;
  20296. use Composer\Util\RemoteFilesystem;
  20297. use Composer\Plugin\PluginEvents;
  20298. use Composer\Plugin\PreFileDownloadEvent;
  20299. use Composer\EventDispatcher\EventDispatcher;
  20300. use Composer\Downloader\TransportException;
  20301. use Composer\Semver\Constraint\ConstraintInterface;
  20302. use Composer\Semver\Constraint\Constraint;
  20303. class ComposerRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  20304. {
  20305. protected $config;
  20306. protected $repoConfig;
  20307. protected $options;
  20308. protected $url;
  20309. protected $baseUrl;
  20310. protected $io;
  20311. protected $rfs;
  20312. protected $cache;
  20313. protected $notifyUrl;
  20314. protected $searchUrl;
  20315. protected $hasProviders = false;
  20316. protected $providersUrl;
  20317. protected $lazyProvidersUrl;
  20318. protected $providerListing;
  20319. protected $providers = array();
  20320. protected $providersByUid = array();
  20321. protected $loader;
  20322. protected $rootAliases;
  20323. protected $allowSslDowngrade = false;
  20324. protected $eventDispatcher;
  20325. protected $sourceMirrors;
  20326. protected $distMirrors;
  20327. private $degradedMode = false;
  20328. private $rootData;
  20329. private $hasPartialPackages;
  20330. private $partialPackagesByName;
  20331. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  20332. {
  20333. parent::__construct();
  20334. if (!preg_match('{^[\w.]+\??://}', $repoConfig['url'])) {
  20335. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  20336. }
  20337. $repoConfig['url'] = rtrim($repoConfig['url'], '/');
  20338. if ('https?' === substr($repoConfig['url'], 0, 6)) {
  20339. $repoConfig['url'] = (extension_loaded('openssl') ? 'https' : 'http') . substr($repoConfig['url'], 6);
  20340. }
  20341. $urlBits = parse_url($repoConfig['url']);
  20342. if ($urlBits === false || empty($urlBits['scheme'])) {
  20343. throw new \UnexpectedValueException('Invalid url given for Composer repository: '.$repoConfig['url']);
  20344. }
  20345. if (!isset($repoConfig['options'])) {
  20346. $repoConfig['options'] = array();
  20347. }
  20348. if (isset($repoConfig['allow_ssl_downgrade']) && true === $repoConfig['allow_ssl_downgrade']) {
  20349. $this->allowSslDowngrade = true;
  20350. }
  20351. $this->config = $config;
  20352. $this->options = $repoConfig['options'];
  20353. $this->url = $repoConfig['url'];
  20354. if (preg_match('{^(?P<proto>https?)://packagist\.org/?$}i', $this->url, $match)) {
  20355. $this->url = $match['proto'].'://repo.packagist.org';
  20356. }
  20357. $this->baseUrl = rtrim(preg_replace('{(?:/[^/\\\\]+\.json)?(?:[?#].*)?$}', '', $this->url), '/');
  20358. $this->io = $io;
  20359. $this->cache = new Cache($io, $config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->url), 'a-z0-9.$');
  20360. $this->loader = new ArrayLoader();
  20361. if ($rfs && $this->options) {
  20362. $rfs = clone $rfs;
  20363. $rfs->setOptions($this->options);
  20364. }
  20365. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $this->config, $this->options);
  20366. $this->eventDispatcher = $eventDispatcher;
  20367. $this->repoConfig = $repoConfig;
  20368. }
  20369. public function getRepoConfig()
  20370. {
  20371. return $this->repoConfig;
  20372. }
  20373. public function setRootAliases(array $rootAliases)
  20374. {
  20375. $this->rootAliases = $rootAliases;
  20376. }
  20377. public function findPackage($name, $constraint)
  20378. {
  20379. if (!$this->hasProviders()) {
  20380. return parent::findPackage($name, $constraint);
  20381. }
  20382. $name = strtolower($name);
  20383. if (!$constraint instanceof ConstraintInterface) {
  20384. $versionParser = new VersionParser();
  20385. $constraint = $versionParser->parseConstraints($constraint);
  20386. }
  20387. foreach ($this->getProviderNames() as $providerName) {
  20388. if ($name === $providerName) {
  20389. $packages = $this->whatProvides(new Pool('dev'), $providerName);
  20390. foreach ($packages as $package) {
  20391. if ($name === $package->getName()) {
  20392. $pkgConstraint = new Constraint('==', $package->getVersion());
  20393. if ($constraint->matches($pkgConstraint)) {
  20394. return $package;
  20395. }
  20396. }
  20397. }
  20398. break;
  20399. }
  20400. }
  20401. }
  20402. public function findPackages($name, $constraint = null)
  20403. {
  20404. if (!$this->hasProviders()) {
  20405. return parent::findPackages($name, $constraint);
  20406. }
  20407. $name = strtolower($name);
  20408. if (null !== $constraint && !$constraint instanceof ConstraintInterface) {
  20409. $versionParser = new VersionParser();
  20410. $constraint = $versionParser->parseConstraints($constraint);
  20411. }
  20412. $packages = array();
  20413. foreach ($this->getProviderNames() as $providerName) {
  20414. if ($name === $providerName) {
  20415. $candidates = $this->whatProvides(new Pool('dev'), $providerName);
  20416. foreach ($candidates as $package) {
  20417. if ($name === $package->getName()) {
  20418. $pkgConstraint = new Constraint('==', $package->getVersion());
  20419. if (null === $constraint || $constraint->matches($pkgConstraint)) {
  20420. $packages[] = $package;
  20421. }
  20422. }
  20423. }
  20424. break;
  20425. }
  20426. }
  20427. return $packages;
  20428. }
  20429. public function getPackages()
  20430. {
  20431. if ($this->hasProviders()) {
  20432. throw new \LogicException('Composer repositories that have providers can not load the complete list of packages, use getProviderNames instead.');
  20433. }
  20434. return parent::getPackages();
  20435. }
  20436. public function search($query, $mode = 0, $type = null)
  20437. {
  20438. $this->loadRootServerFile();
  20439. if ($this->searchUrl && $mode === self::SEARCH_FULLTEXT) {
  20440. $url = str_replace(array('%query%', '%type%'), array($query, $type), $this->searchUrl);
  20441. $origin = RemoteFilesystem::getOrigin($url);
  20442. $json = $this->rfs->getContents($origin, $url, false);
  20443. $search = JsonFile::parseJson($json, $url);
  20444. if (empty($search['results'])) {
  20445. return array();
  20446. }
  20447. $results = array();
  20448. foreach ($search['results'] as $result) {
  20449. if (empty($result['virtual'])) {
  20450. $results[] = $result;
  20451. }
  20452. }
  20453. return $results;
  20454. }
  20455. if ($this->hasProviders()) {
  20456. $results = array();
  20457. $regex = '{(?:'.implode('|', preg_split('{\s+}', $query)).')}i';
  20458. foreach ($this->getProviderNames() as $name) {
  20459. if (preg_match($regex, $name)) {
  20460. $results[] = array('name' => $name);
  20461. }
  20462. }
  20463. return $results;
  20464. }
  20465. return parent::search($query, $mode);
  20466. }
  20467. public function getProviderNames()
  20468. {
  20469. $this->loadRootServerFile();
  20470. if (null === $this->providerListing) {
  20471. $this->loadProviderListings($this->loadRootServerFile());
  20472. }
  20473. if ($this->lazyProvidersUrl) {
  20474. return array();
  20475. }
  20476. if ($this->providersUrl) {
  20477. return array_keys($this->providerListing);
  20478. }
  20479. return array();
  20480. }
  20481. protected function configurePackageTransportOptions(PackageInterface $package)
  20482. {
  20483. foreach ($package->getDistUrls() as $url) {
  20484. if (strpos($url, $this->baseUrl) === 0) {
  20485. $package->setTransportOptions($this->options);
  20486. return;
  20487. }
  20488. }
  20489. }
  20490. public function hasProviders()
  20491. {
  20492. $this->loadRootServerFile();
  20493. return $this->hasProviders;
  20494. }
  20495. public function resetPackageIds()
  20496. {
  20497. foreach ($this->providersByUid as $package) {
  20498. if ($package instanceof AliasPackage) {
  20499. $package->getAliasOf()->setId(-1);
  20500. }
  20501. $package->setId(-1);
  20502. }
  20503. }
  20504. public function whatProvides(Pool $pool, $name, $bypassFilters = false)
  20505. {
  20506. if (isset($this->providers[$name]) && !$bypassFilters) {
  20507. return $this->providers[$name];
  20508. }
  20509. if ($this->hasPartialPackages && null === $this->partialPackagesByName) {
  20510. $this->initializePartialPackages();
  20511. }
  20512. if (!$this->hasPartialPackages || !isset($this->partialPackagesByName[$name])) {
  20513. if (preg_match(PlatformRepository::PLATFORM_PACKAGE_REGEX, $name) || '__root__' === $name || 'composer-plugin-api' === $name) {
  20514. return array();
  20515. }
  20516. if (null === $this->providerListing) {
  20517. $this->loadProviderListings($this->loadRootServerFile());
  20518. }
  20519. $useLastModifiedCheck = false;
  20520. if ($this->lazyProvidersUrl && !isset($this->providerListing[$name])) {
  20521. $hash = null;
  20522. $url = str_replace('%package%', $name, $this->lazyProvidersUrl);
  20523. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20524. $useLastModifiedCheck = true;
  20525. } elseif ($this->providersUrl) {
  20526. if (!isset($this->providerListing[$name])) {
  20527. return array();
  20528. }
  20529. $hash = $this->providerListing[$name]['sha256'];
  20530. $url = str_replace(array('%package%', '%hash%'), array($name, $hash), $this->providersUrl);
  20531. $cacheKey = 'provider-'.strtr($name, '/', '$').'.json';
  20532. } else {
  20533. return array();
  20534. }
  20535. $packages = null;
  20536. if ($cacheKey) {
  20537. if (!$useLastModifiedCheck && $hash && $this->cache->sha256($cacheKey) === $hash) {
  20538. $packages = json_decode($this->cache->read($cacheKey), true);
  20539. } elseif ($useLastModifiedCheck) {
  20540. if ($contents = $this->cache->read($cacheKey)) {
  20541. $contents = json_decode($contents, true);
  20542. if (isset($contents['last-modified'])) {
  20543. $response = $this->fetchFileIfLastModified($url, $cacheKey, $contents['last-modified']);
  20544. if (true === $response) {
  20545. $packages = $contents;
  20546. } elseif ($response) {
  20547. $packages = $response;
  20548. }
  20549. }
  20550. }
  20551. }
  20552. }
  20553. if (!$packages) {
  20554. try {
  20555. $packages = $this->fetchFile($url, $cacheKey, $hash, $useLastModifiedCheck);
  20556. } catch (TransportException $e) {
  20557. if ($e->getStatusCode() === 404 && $this->lazyProvidersUrl) {
  20558. $packages = array('packages' => array());
  20559. } else {
  20560. throw $e;
  20561. }
  20562. }
  20563. }
  20564. $loadingPartialPackage = false;
  20565. } else {
  20566. $packages = array('packages' => array('versions' => $this->partialPackagesByName[$name]));
  20567. $loadingPartialPackage = true;
  20568. }
  20569. $this->providers[$name] = array();
  20570. foreach ($packages['packages'] as $versions) {
  20571. foreach ($versions as $version) {
  20572. if (!$loadingPartialPackage && $this->hasPartialPackages && isset($this->partialPackagesByName[$version['name']])) {
  20573. continue;
  20574. }
  20575. if (isset($this->providersByUid[$version['uid']])) {
  20576. if (!isset($this->providers[$name][$version['uid']])) {
  20577. if ($this->providersByUid[$version['uid']] instanceof AliasPackage) {
  20578. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']]->getAliasOf();
  20579. $this->providers[$name][$version['uid'].'-alias'] = $this->providersByUid[$version['uid']];
  20580. } else {
  20581. $this->providers[$name][$version['uid']] = $this->providersByUid[$version['uid']];
  20582. }
  20583. if (isset($this->providersByUid[$version['uid'].'-root'])) {
  20584. $this->providers[$name][$version['uid'].'-root'] = $this->providersByUid[$version['uid'].'-root'];
  20585. }
  20586. }
  20587. } else {
  20588. if (!$bypassFilters && !$pool->isPackageAcceptable(strtolower($version['name']), VersionParser::parseStability($version['version']))) {
  20589. continue;
  20590. }
  20591. $package = $this->createPackage($version, 'Composer\Package\CompletePackage');
  20592. $package->setRepository($this);
  20593. if ($package instanceof AliasPackage) {
  20594. $aliased = $package->getAliasOf();
  20595. $aliased->setRepository($this);
  20596. $this->providers[$name][$version['uid']] = $aliased;
  20597. $this->providers[$name][$version['uid'].'-alias'] = $package;
  20598. $this->providersByUid[$version['uid']] = $package;
  20599. } else {
  20600. $this->providers[$name][$version['uid']] = $package;
  20601. $this->providersByUid[$version['uid']] = $package;
  20602. }
  20603. unset($rootAliasData);
  20604. if (isset($this->rootAliases[$package->getName()][$package->getVersion()])) {
  20605. $rootAliasData = $this->rootAliases[$package->getName()][$package->getVersion()];
  20606. } elseif ($package instanceof AliasPackage && isset($this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()])) {
  20607. $rootAliasData = $this->rootAliases[$package->getName()][$package->getAliasOf()->getVersion()];
  20608. }
  20609. if (isset($rootAliasData)) {
  20610. $alias = $this->createAliasPackage($package, $rootAliasData['alias_normalized'], $rootAliasData['alias']);
  20611. $alias->setRepository($this);
  20612. $this->providers[$name][$version['uid'].'-root'] = $alias;
  20613. $this->providersByUid[$version['uid'].'-root'] = $alias;
  20614. }
  20615. }
  20616. }
  20617. }
  20618. $result = $this->providers[$name];
  20619. if ($bypassFilters) {
  20620. foreach ($this->providers[$name] as $uid => $provider) {
  20621. unset($this->providersByUid[$uid]);
  20622. }
  20623. unset($this->providers[$name]);
  20624. }
  20625. return $result;
  20626. }
  20627. protected function initialize()
  20628. {
  20629. parent::initialize();
  20630. $repoData = $this->loadDataFromServer();
  20631. foreach ($repoData as $package) {
  20632. $this->addPackage($this->createPackage($package, 'Composer\Package\CompletePackage'));
  20633. }
  20634. }
  20635. public function addPackage(PackageInterface $package)
  20636. {
  20637. parent::addPackage($package);
  20638. $this->configurePackageTransportOptions($package);
  20639. }
  20640. protected function loadRootServerFile()
  20641. {
  20642. if (null !== $this->rootData) {
  20643. return $this->rootData;
  20644. }
  20645. if (!extension_loaded('openssl') && 'https' === substr($this->url, 0, 5)) {
  20646. throw new \RuntimeException('You must enable the openssl extension in your php.ini to load information from '.$this->url);
  20647. }
  20648. $jsonUrlParts = parse_url($this->url);
  20649. if (isset($jsonUrlParts['path']) && false !== strpos($jsonUrlParts['path'], '.json')) {
  20650. $jsonUrl = $this->url;
  20651. } else {
  20652. $jsonUrl = $this->url . '/packages.json';
  20653. }
  20654. $data = $this->fetchFile($jsonUrl, 'packages.json');
  20655. if (!empty($data['notify-batch'])) {
  20656. $this->notifyUrl = $this->canonicalizeUrl($data['notify-batch']);
  20657. } elseif (!empty($data['notify'])) {
  20658. $this->notifyUrl = $this->canonicalizeUrl($data['notify']);
  20659. }
  20660. if (!empty($data['search'])) {
  20661. $this->searchUrl = $this->canonicalizeUrl($data['search']);
  20662. }
  20663. if (!empty($data['mirrors'])) {
  20664. foreach ($data['mirrors'] as $mirror) {
  20665. if (!empty($mirror['git-url'])) {
  20666. $this->sourceMirrors['git'][] = array('url' => $mirror['git-url'], 'preferred' => !empty($mirror['preferred']));
  20667. }
  20668. if (!empty($mirror['hg-url'])) {
  20669. $this->sourceMirrors['hg'][] = array('url' => $mirror['hg-url'], 'preferred' => !empty($mirror['preferred']));
  20670. }
  20671. if (!empty($mirror['dist-url'])) {
  20672. $this->distMirrors[] = array(
  20673. 'url' => $this->canonicalizeUrl($mirror['dist-url']),
  20674. 'preferred' => !empty($mirror['preferred']),
  20675. );
  20676. }
  20677. }
  20678. }
  20679. if (!empty($data['providers-lazy-url'])) {
  20680. $this->lazyProvidersUrl = $this->canonicalizeUrl($data['providers-lazy-url']);
  20681. $this->hasProviders = true;
  20682. $this->hasPartialPackages = !empty($data['packages']) && is_array($data['packages']);
  20683. }
  20684. if ($this->allowSslDowngrade) {
  20685. $this->url = str_replace('https://', 'http://', $this->url);
  20686. $this->baseUrl = str_replace('https://', 'http://', $this->baseUrl);
  20687. }
  20688. if (!empty($data['providers-url'])) {
  20689. $this->providersUrl = $this->canonicalizeUrl($data['providers-url']);
  20690. $this->hasProviders = true;
  20691. }
  20692. if (!empty($data['providers']) || !empty($data['providers-includes'])) {
  20693. $this->hasProviders = true;
  20694. }
  20695. if (preg_match('{^https?://repo\.packagist\.org/?$}i', $this->url) && !empty($this->repoConfig['force-lazy-providers'])) {
  20696. $this->url = 'https://repo.packagist.org';
  20697. $this->baseUrl = 'https://repo.packagist.org';
  20698. $this->lazyProvidersUrl = $this->canonicalizeUrl('https://repo.packagist.org/p/%package%.json');
  20699. $this->providersUrl = null;
  20700. } elseif (!empty($this->repoConfig['force-lazy-providers'])) {
  20701. $this->lazyProvidersUrl = $this->canonicalizeUrl('/p/%package%.json');
  20702. $this->providersUrl = null;
  20703. }
  20704. return $this->rootData = $data;
  20705. }
  20706. protected function canonicalizeUrl($url)
  20707. {
  20708. if ('/' === $url[0]) {
  20709. if (preg_match('{^[^:]++://[^/]*+}', $this->url, $matches)) {
  20710. return $matches[0] . $url;
  20711. }
  20712. return $this->url;
  20713. }
  20714. return $url;
  20715. }
  20716. protected function loadDataFromServer()
  20717. {
  20718. $data = $this->loadRootServerFile();
  20719. return $this->loadIncludes($data);
  20720. }
  20721. protected function loadProviderListings($data)
  20722. {
  20723. if (isset($data['providers'])) {
  20724. if (!is_array($this->providerListing)) {
  20725. $this->providerListing = array();
  20726. }
  20727. $this->providerListing = array_merge($this->providerListing, $data['providers']);
  20728. }
  20729. if ($this->providersUrl && isset($data['provider-includes'])) {
  20730. $includes = $data['provider-includes'];
  20731. foreach ($includes as $include => $metadata) {
  20732. $url = $this->baseUrl . '/' . str_replace('%hash%', $metadata['sha256'], $include);
  20733. $cacheKey = str_replace(array('%hash%','$'), '', $include);
  20734. if ($this->cache->sha256($cacheKey) === $metadata['sha256']) {
  20735. $includedData = json_decode($this->cache->read($cacheKey), true);
  20736. } else {
  20737. $includedData = $this->fetchFile($url, $cacheKey, $metadata['sha256']);
  20738. }
  20739. $this->loadProviderListings($includedData);
  20740. }
  20741. }
  20742. }
  20743. protected function loadIncludes($data)
  20744. {
  20745. $packages = array();
  20746. if (!isset($data['packages']) && !isset($data['includes'])) {
  20747. foreach ($data as $pkg) {
  20748. foreach ($pkg['versions'] as $metadata) {
  20749. $packages[] = $metadata;
  20750. }
  20751. }
  20752. return $packages;
  20753. }
  20754. if (isset($data['packages'])) {
  20755. foreach ($data['packages'] as $package => $versions) {
  20756. foreach ($versions as $version => $metadata) {
  20757. $packages[] = $metadata;
  20758. }
  20759. }
  20760. }
  20761. if (isset($data['includes'])) {
  20762. foreach ($data['includes'] as $include => $metadata) {
  20763. if ($this->cache->sha1($include) === $metadata['sha1']) {
  20764. $includedData = json_decode($this->cache->read($include), true);
  20765. } else {
  20766. $includedData = $this->fetchFile($include);
  20767. }
  20768. $packages = array_merge($packages, $this->loadIncludes($includedData));
  20769. }
  20770. }
  20771. return $packages;
  20772. }
  20773. protected function createPackage(array $data, $class = 'Composer\Package\CompletePackage')
  20774. {
  20775. try {
  20776. if (!isset($data['notification-url'])) {
  20777. $data['notification-url'] = $this->notifyUrl;
  20778. }
  20779. $package = $this->loader->load($data, $class);
  20780. if (isset($this->sourceMirrors[$package->getSourceType()])) {
  20781. $package->setSourceMirrors($this->sourceMirrors[$package->getSourceType()]);
  20782. }
  20783. $package->setDistMirrors($this->distMirrors);
  20784. $this->configurePackageTransportOptions($package);
  20785. return $package;
  20786. } catch (\Exception $e) {
  20787. 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);
  20788. }
  20789. }
  20790. protected function fetchFile($filename, $cacheKey = null, $sha256 = null, $storeLastModifiedTime = false)
  20791. {
  20792. if (null === $cacheKey) {
  20793. $cacheKey = $filename;
  20794. $filename = $this->baseUrl.'/'.$filename;
  20795. }
  20796. if (($pos = strpos($filename, '$')) && preg_match('{^https?://.*}i', $filename)) {
  20797. $filename = substr($filename, 0, $pos) . '%24' . substr($filename, $pos + 1);
  20798. }
  20799. $retries = 3;
  20800. while ($retries--) {
  20801. try {
  20802. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20803. if ($this->eventDispatcher) {
  20804. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20805. }
  20806. $origin = RemoteFilesystem::getOrigin($filename);
  20807. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20808. $json = $rfs->getContents($origin, $filename, false);
  20809. if ($sha256 && $sha256 !== hash('sha256', $json)) {
  20810. if ($this->allowSslDowngrade) {
  20811. $this->url = str_replace('http://', 'https://', $this->url);
  20812. $this->baseUrl = str_replace('http://', 'https://', $this->baseUrl);
  20813. $filename = str_replace('http://', 'https://', $filename);
  20814. }
  20815. if ($retries) {
  20816. usleep(100000);
  20817. continue;
  20818. }
  20819. 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.');
  20820. }
  20821. $data = JsonFile::parseJson($json, $filename);
  20822. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20823. if ($cacheKey) {
  20824. if ($storeLastModifiedTime) {
  20825. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20826. if ($lastModifiedDate) {
  20827. $data['last-modified'] = $lastModifiedDate;
  20828. $json = json_encode($data);
  20829. }
  20830. }
  20831. $this->cache->write($cacheKey, $json);
  20832. }
  20833. break;
  20834. } catch (\Exception $e) {
  20835. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20836. throw $e;
  20837. }
  20838. if ($retries) {
  20839. usleep(100000);
  20840. continue;
  20841. }
  20842. if ($e instanceof RepositorySecurityException) {
  20843. throw $e;
  20844. }
  20845. if ($cacheKey && ($contents = $this->cache->read($cacheKey))) {
  20846. if (!$this->degradedMode) {
  20847. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20848. $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>');
  20849. }
  20850. $this->degradedMode = true;
  20851. $data = JsonFile::parseJson($contents, $this->cache->getRoot().$cacheKey);
  20852. break;
  20853. }
  20854. throw $e;
  20855. }
  20856. }
  20857. return $data;
  20858. }
  20859. protected function fetchFileIfLastModified($filename, $cacheKey, $lastModifiedTime)
  20860. {
  20861. $retries = 3;
  20862. while ($retries--) {
  20863. try {
  20864. $preFileDownloadEvent = new PreFileDownloadEvent(PluginEvents::PRE_FILE_DOWNLOAD, $this->rfs, $filename);
  20865. if ($this->eventDispatcher) {
  20866. $this->eventDispatcher->dispatch($preFileDownloadEvent->getName(), $preFileDownloadEvent);
  20867. }
  20868. $origin = RemoteFilesystem::getOrigin($filename);
  20869. $rfs = $preFileDownloadEvent->getRemoteFilesystem();
  20870. $options = array('http' => array('header' => array('If-Modified-Since: '.$lastModifiedTime)));
  20871. $json = $rfs->getContents($origin, $filename, false, $options);
  20872. if ($json === '' && $rfs->findStatusCode($rfs->getLastHeaders()) === 304) {
  20873. return true;
  20874. }
  20875. $data = JsonFile::parseJson($json, $filename);
  20876. RemoteFilesystem::outputWarnings($this->io, $this->url, $data);
  20877. $lastModifiedDate = $rfs->findHeaderValue($rfs->getLastHeaders(), 'last-modified');
  20878. if ($lastModifiedDate) {
  20879. $data['last-modified'] = $lastModifiedDate;
  20880. $json = json_encode($data);
  20881. }
  20882. $this->cache->write($cacheKey, $json);
  20883. return $data;
  20884. } catch (\Exception $e) {
  20885. if ($e instanceof TransportException && $e->getStatusCode() === 404) {
  20886. throw $e;
  20887. }
  20888. if ($retries) {
  20889. usleep(100000);
  20890. continue;
  20891. }
  20892. if (!$this->degradedMode) {
  20893. $this->io->writeError('<warning>'.$e->getMessage().'</warning>');
  20894. $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>');
  20895. }
  20896. $this->degradedMode = true;
  20897. return true;
  20898. }
  20899. }
  20900. }
  20901. private function initializePartialPackages()
  20902. {
  20903. $rootData = $this->loadRootServerFile();
  20904. $this->partialPackagesByName = array();
  20905. foreach ($rootData['packages'] as $package => $versions) {
  20906. $package = strtolower($package);
  20907. foreach ($versions as $version) {
  20908. $this->partialPackagesByName[$package][] = $version;
  20909. if (!empty($version['provide']) && is_array($version['provide'])) {
  20910. foreach ($version['provide'] as $provided => $providedVersion) {
  20911. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20912. }
  20913. }
  20914. if (!empty($version['replace']) && is_array($version['replace'])) {
  20915. foreach ($version['replace'] as $provided => $providedVersion) {
  20916. $this->partialPackagesByName[strtolower($provided)][] = $version;
  20917. }
  20918. }
  20919. }
  20920. }
  20921. $this->rootData = true;
  20922. }
  20923. }
  20924. <?php
  20925. namespace Composer\Repository;
  20926. use Composer\Package\PackageInterface;
  20927. class CompositeRepository extends BaseRepository
  20928. {
  20929. private $repositories;
  20930. public function __construct(array $repositories)
  20931. {
  20932. $this->repositories = array();
  20933. foreach ($repositories as $repo) {
  20934. $this->addRepository($repo);
  20935. }
  20936. }
  20937. public function getRepositories()
  20938. {
  20939. return $this->repositories;
  20940. }
  20941. public function hasPackage(PackageInterface $package)
  20942. {
  20943. foreach ($this->repositories as $repository) {
  20944. if ($repository->hasPackage($package)) {
  20945. return true;
  20946. }
  20947. }
  20948. return false;
  20949. }
  20950. public function findPackage($name, $constraint)
  20951. {
  20952. foreach ($this->repositories as $repository) {
  20953. $package = $repository->findPackage($name, $constraint);
  20954. if (null !== $package) {
  20955. return $package;
  20956. }
  20957. }
  20958. return null;
  20959. }
  20960. public function findPackages($name, $constraint = null)
  20961. {
  20962. $packages = array();
  20963. foreach ($this->repositories as $repository) {
  20964. $packages[] = $repository->findPackages($name, $constraint);
  20965. }
  20966. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20967. }
  20968. public function search($query, $mode = 0, $type = null)
  20969. {
  20970. $matches = array();
  20971. foreach ($this->repositories as $repository) {
  20972. $matches[] = $repository->search($query, $mode, $type);
  20973. }
  20974. return $matches ? call_user_func_array('array_merge', $matches) : array();
  20975. }
  20976. public function getPackages()
  20977. {
  20978. $packages = array();
  20979. foreach ($this->repositories as $repository) {
  20980. $packages[] = $repository->getPackages();
  20981. }
  20982. return $packages ? call_user_func_array('array_merge', $packages) : array();
  20983. }
  20984. public function removePackage(PackageInterface $package)
  20985. {
  20986. foreach ($this->repositories as $repository) {
  20987. $repository->removePackage($package);
  20988. }
  20989. }
  20990. public function count()
  20991. {
  20992. $total = 0;
  20993. foreach ($this->repositories as $repository) {
  20994. $total += $repository->count();
  20995. }
  20996. return $total;
  20997. }
  20998. public function addRepository(RepositoryInterface $repository)
  20999. {
  21000. if ($repository instanceof self) {
  21001. foreach ($repository->getRepositories() as $repo) {
  21002. $this->addRepository($repo);
  21003. }
  21004. } else {
  21005. $this->repositories[] = $repository;
  21006. }
  21007. }
  21008. }
  21009. <?php
  21010. namespace Composer\Repository;
  21011. interface ConfigurableRepositoryInterface
  21012. {
  21013. public function getRepoConfig();
  21014. }
  21015. <?php
  21016. namespace Composer\Repository;
  21017. use Composer\Json\JsonFile;
  21018. use Composer\Package\Loader\ArrayLoader;
  21019. use Composer\Package\Dumper\ArrayDumper;
  21020. class FilesystemRepository extends WritableArrayRepository
  21021. {
  21022. private $file;
  21023. public function __construct(JsonFile $repositoryFile)
  21024. {
  21025. parent::__construct();
  21026. $this->file = $repositoryFile;
  21027. }
  21028. protected function initialize()
  21029. {
  21030. parent::initialize();
  21031. if (!$this->file->exists()) {
  21032. return;
  21033. }
  21034. try {
  21035. $packages = $this->file->read();
  21036. if (isset($packages['packages'])) {
  21037. $packages = $packages['packages'];
  21038. }
  21039. if (!is_array($packages)) {
  21040. throw new \UnexpectedValueException('Could not parse package list from the repository');
  21041. }
  21042. } catch (\Exception $e) {
  21043. throw new InvalidRepositoryException('Invalid repository data in '.$this->file->getPath().', packages could not be loaded: ['.get_class($e).'] '.$e->getMessage());
  21044. }
  21045. $loader = new ArrayLoader(null, true);
  21046. foreach ($packages as $packageData) {
  21047. $package = $loader->load($packageData);
  21048. $this->addPackage($package);
  21049. }
  21050. }
  21051. public function reload()
  21052. {
  21053. $this->packages = null;
  21054. $this->initialize();
  21055. }
  21056. public function write()
  21057. {
  21058. $data = array();
  21059. $dumper = new ArrayDumper();
  21060. foreach ($this->getCanonicalPackages() as $package) {
  21061. $data[] = $dumper->dump($package);
  21062. }
  21063. usort($data, function ($a, $b) {
  21064. return strcmp($a['name'], $b['name']);
  21065. });
  21066. $this->file->write($data);
  21067. }
  21068. }
  21069. <?php
  21070. namespace Composer\Repository;
  21071. class InstalledArrayRepository extends WritableArrayRepository implements InstalledRepositoryInterface
  21072. {
  21073. }
  21074. <?php
  21075. namespace Composer\Repository;
  21076. class InstalledFilesystemRepository extends FilesystemRepository implements InstalledRepositoryInterface
  21077. {
  21078. }
  21079. <?php
  21080. namespace Composer\Repository;
  21081. interface InstalledRepositoryInterface extends WritableRepositoryInterface
  21082. {
  21083. }
  21084. <?php
  21085. namespace Composer\Repository;
  21086. class InvalidRepositoryException extends \Exception
  21087. {
  21088. }
  21089. <?php
  21090. namespace Composer\Repository;
  21091. use Composer\Package\Loader\ArrayLoader;
  21092. use Composer\Package\Loader\ValidatingArrayLoader;
  21093. class PackageRepository extends ArrayRepository
  21094. {
  21095. private $config;
  21096. public function __construct(array $config)
  21097. {
  21098. parent::__construct();
  21099. $this->config = $config['package'];
  21100. if (!is_numeric(key($this->config))) {
  21101. $this->config = array($this->config);
  21102. }
  21103. }
  21104. protected function initialize()
  21105. {
  21106. parent::initialize();
  21107. $loader = new ValidatingArrayLoader(new ArrayLoader(null, true), false);
  21108. foreach ($this->config as $package) {
  21109. try {
  21110. $package = $loader->load($package);
  21111. } catch (\Exception $e) {
  21112. throw new InvalidRepositoryException('A repository of type "package" contains an invalid package definition: '.$e->getMessage()."\n\nInvalid package definition:\n".json_encode($package));
  21113. }
  21114. $this->addPackage($package);
  21115. }
  21116. }
  21117. }
  21118. <?php
  21119. namespace Composer\Repository;
  21120. use Composer\Config;
  21121. use Composer\IO\IOInterface;
  21122. use Composer\Json\JsonFile;
  21123. use Composer\Package\Loader\ArrayLoader;
  21124. use Composer\Package\Version\VersionGuesser;
  21125. use Composer\Package\Version\VersionParser;
  21126. use Composer\Util\Platform;
  21127. use Composer\Util\ProcessExecutor;
  21128. class PathRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21129. {
  21130. private $loader;
  21131. private $versionGuesser;
  21132. private $url;
  21133. private $repoConfig;
  21134. private $process;
  21135. private $options;
  21136. public function __construct(array $repoConfig, IOInterface $io, Config $config)
  21137. {
  21138. if (!isset($repoConfig['url'])) {
  21139. throw new \RuntimeException('You must specify the `url` configuration for the path repository');
  21140. }
  21141. $this->loader = new ArrayLoader(null, true);
  21142. $this->url = Platform::expandPath($repoConfig['url']);
  21143. $this->process = new ProcessExecutor($io);
  21144. $this->versionGuesser = new VersionGuesser($config, $this->process, new VersionParser());
  21145. $this->repoConfig = $repoConfig;
  21146. $this->options = isset($repoConfig['options']) ? $repoConfig['options'] : array();
  21147. parent::__construct();
  21148. }
  21149. public function getRepoConfig()
  21150. {
  21151. return $this->repoConfig;
  21152. }
  21153. protected function initialize()
  21154. {
  21155. parent::initialize();
  21156. foreach ($this->getUrlMatches() as $url) {
  21157. $path = realpath($url) . DIRECTORY_SEPARATOR;
  21158. $composerFilePath = $path.'composer.json';
  21159. if (!file_exists($composerFilePath)) {
  21160. continue;
  21161. }
  21162. $json = file_get_contents($composerFilePath);
  21163. $package = JsonFile::parseJson($json, $composerFilePath);
  21164. $package['dist'] = array(
  21165. 'type' => 'path',
  21166. 'url' => $url,
  21167. 'reference' => sha1($json . serialize($this->options)),
  21168. );
  21169. $package['transport-options'] = $this->options;
  21170. if (!isset($package['version']) && ($rootVersion = getenv('COMPOSER_ROOT_VERSION'))) {
  21171. if (
  21172. 0 === $this->process->execute('git rev-parse HEAD', $ref1, $path)
  21173. && 0 === $this->process->execute('git rev-parse HEAD', $ref2)
  21174. && $ref1 === $ref2
  21175. ) {
  21176. $package['version'] = $rootVersion;
  21177. }
  21178. }
  21179. if (!isset($package['version'])) {
  21180. $versionData = $this->versionGuesser->guessVersion($package, $path);
  21181. if (is_array($versionData) && $versionData['pretty_version']) {
  21182. $package['version'] = $versionData['pretty_version'];
  21183. } else {
  21184. $package['version'] = 'dev-master';
  21185. }
  21186. }
  21187. $output = '';
  21188. if (is_dir($path . DIRECTORY_SEPARATOR . '.git') && 0 === $this->process->execute('git log -n1 --pretty=%H', $output, $path)) {
  21189. $package['dist']['reference'] = trim($output);
  21190. }
  21191. $package = $this->loader->load($package);
  21192. $this->addPackage($package);
  21193. }
  21194. }
  21195. private function getUrlMatches()
  21196. {
  21197. $flags = GLOB_MARK | GLOB_ONLYDIR;
  21198. if (defined('GLOB_BRACE')) {
  21199. $flags |= GLOB_BRACE;
  21200. } elseif (strpos($this->url, '{') !== false || strpos($this->url, '}') !== false) {
  21201. throw new \RuntimeException('The operating system does not support GLOB_BRACE which is required for the url '. $this->url);
  21202. }
  21203. return array_map(function ($val) {
  21204. return rtrim(str_replace(DIRECTORY_SEPARATOR, '/', $val), '/');
  21205. }, glob($this->url, $flags));
  21206. }
  21207. }
  21208. <?php
  21209. namespace Composer\Repository\Pear;
  21210. use Composer\Util\RemoteFilesystem;
  21211. abstract class BaseChannelReader
  21212. {
  21213. const CHANNEL_NS = 'http://pear.php.net/channel-1.0';
  21214. const ALL_CATEGORIES_NS = 'http://pear.php.net/dtd/rest.allcategories';
  21215. const CATEGORY_PACKAGES_INFO_NS = 'http://pear.php.net/dtd/rest.categorypackageinfo';
  21216. const ALL_PACKAGES_NS = 'http://pear.php.net/dtd/rest.allpackages';
  21217. const ALL_RELEASES_NS = 'http://pear.php.net/dtd/rest.allreleases';
  21218. const PACKAGE_INFO_NS = 'http://pear.php.net/dtd/rest.package';
  21219. private $rfs;
  21220. protected function __construct(RemoteFilesystem $rfs)
  21221. {
  21222. $this->rfs = $rfs;
  21223. }
  21224. protected function requestContent($origin, $path)
  21225. {
  21226. $url = rtrim($origin, '/') . '/' . ltrim($path, '/');
  21227. $content = $this->rfs->getContents($origin, $url, false);
  21228. if (!$content) {
  21229. throw new \UnexpectedValueException('The PEAR channel at ' . $url . ' did not respond.');
  21230. }
  21231. return str_replace('http://pear.php.net/rest/', 'https://pear.php.net/rest/', $content);
  21232. }
  21233. protected function requestXml($origin, $path)
  21234. {
  21235. $xml = simplexml_load_string($this->requestContent($origin, $path), "SimpleXMLElement", LIBXML_NOERROR);
  21236. if (false === $xml) {
  21237. throw new \UnexpectedValueException(sprintf('The PEAR channel at ' . $origin . ' is broken. (Invalid XML at file `%s`)', $path));
  21238. }
  21239. return $xml;
  21240. }
  21241. }
  21242. <?php
  21243. namespace Composer\Repository\Pear;
  21244. class ChannelInfo
  21245. {
  21246. private $name;
  21247. private $alias;
  21248. private $packages;
  21249. public function __construct($name, $alias, array $packages)
  21250. {
  21251. $this->name = $name;
  21252. $this->alias = $alias;
  21253. $this->packages = $packages;
  21254. }
  21255. public function getName()
  21256. {
  21257. return $this->name;
  21258. }
  21259. public function getAlias()
  21260. {
  21261. return $this->alias;
  21262. }
  21263. public function getPackages()
  21264. {
  21265. return $this->packages;
  21266. }
  21267. }
  21268. <?php
  21269. namespace Composer\Repository\Pear;
  21270. use Composer\Util\RemoteFilesystem;
  21271. class ChannelReader extends BaseChannelReader
  21272. {
  21273. private $readerMap;
  21274. public function __construct(RemoteFilesystem $rfs)
  21275. {
  21276. parent::__construct($rfs);
  21277. $rest10reader = new ChannelRest10Reader($rfs);
  21278. $rest11reader = new ChannelRest11Reader($rfs);
  21279. $this->readerMap = array(
  21280. 'REST1.3' => $rest11reader,
  21281. 'REST1.2' => $rest11reader,
  21282. 'REST1.1' => $rest11reader,
  21283. 'REST1.0' => $rest10reader,
  21284. );
  21285. }
  21286. public function read($url)
  21287. {
  21288. $xml = $this->requestXml($url, "/channel.xml");
  21289. $channelName = (string) $xml->name;
  21290. $channelAlias = (string) $xml->suggestedalias;
  21291. $supportedVersions = array_keys($this->readerMap);
  21292. $selectedRestVersion = $this->selectRestVersion($xml, $supportedVersions);
  21293. if (!$selectedRestVersion) {
  21294. throw new \UnexpectedValueException(sprintf('PEAR repository %s does not supports any of %s protocols.', $url, implode(', ', $supportedVersions)));
  21295. }
  21296. $reader = $this->readerMap[$selectedRestVersion['version']];
  21297. $packageDefinitions = $reader->read($selectedRestVersion['baseUrl']);
  21298. return new ChannelInfo($channelName, $channelAlias, $packageDefinitions);
  21299. }
  21300. private function selectRestVersion($channelXml, $supportedVersions)
  21301. {
  21302. $channelXml->registerXPathNamespace('ns', self::CHANNEL_NS);
  21303. foreach ($supportedVersions as $version) {
  21304. $xpathTest = "ns:servers/ns:*/ns:rest/ns:baseurl[@type='{$version}']";
  21305. $testResult = $channelXml->xpath($xpathTest);
  21306. foreach ($testResult as $result) {
  21307. $result = (string) $result;
  21308. if (preg_match('{^https://}i', $result)) {
  21309. return array('version' => $version, 'baseUrl' => $result);
  21310. }
  21311. }
  21312. if (count($testResult) > 0) {
  21313. return array('version' => $version, 'baseUrl' => (string) $testResult[0]);
  21314. }
  21315. }
  21316. return null;
  21317. }
  21318. }
  21319. <?php
  21320. namespace Composer\Repository\Pear;
  21321. use Composer\Downloader\TransportException;
  21322. class ChannelRest10Reader extends BaseChannelReader
  21323. {
  21324. private $dependencyReader;
  21325. public function __construct($rfs)
  21326. {
  21327. parent::__construct($rfs);
  21328. $this->dependencyReader = new PackageDependencyParser();
  21329. }
  21330. public function read($baseUrl)
  21331. {
  21332. return $this->readPackages($baseUrl);
  21333. }
  21334. private function readPackages($baseUrl)
  21335. {
  21336. $result = array();
  21337. $xmlPath = '/p/packages.xml';
  21338. $xml = $this->requestXml($baseUrl, $xmlPath);
  21339. $xml->registerXPathNamespace('ns', self::ALL_PACKAGES_NS);
  21340. foreach ($xml->xpath('ns:p') as $node) {
  21341. $packageName = (string) $node;
  21342. $packageInfo = $this->readPackage($baseUrl, $packageName);
  21343. $result[] = $packageInfo;
  21344. }
  21345. return $result;
  21346. }
  21347. private function readPackage($baseUrl, $packageName)
  21348. {
  21349. $xmlPath = '/p/' . strtolower($packageName) . '/info.xml';
  21350. $xml = $this->requestXml($baseUrl, $xmlPath);
  21351. $xml->registerXPathNamespace('ns', self::PACKAGE_INFO_NS);
  21352. $channelName = (string) $xml->c;
  21353. $packageName = (string) $xml->n;
  21354. $license = (string) $xml->l;
  21355. $shortDescription = (string) $xml->s;
  21356. $description = (string) $xml->d;
  21357. return new PackageInfo(
  21358. $channelName,
  21359. $packageName,
  21360. $license,
  21361. $shortDescription,
  21362. $description,
  21363. $this->readPackageReleases($baseUrl, $packageName)
  21364. );
  21365. }
  21366. private function readPackageReleases($baseUrl, $packageName)
  21367. {
  21368. $result = array();
  21369. try {
  21370. $xmlPath = '/r/' . strtolower($packageName) . '/allreleases.xml';
  21371. $xml = $this->requestXml($baseUrl, $xmlPath);
  21372. $xml->registerXPathNamespace('ns', self::ALL_RELEASES_NS);
  21373. foreach ($xml->xpath('ns:r') as $node) {
  21374. $releaseVersion = (string) $node->v;
  21375. $releaseStability = (string) $node->s;
  21376. try {
  21377. $result[$releaseVersion] = new ReleaseInfo(
  21378. $releaseStability,
  21379. $this->readPackageReleaseDependencies($baseUrl, $packageName, $releaseVersion)
  21380. );
  21381. } catch (TransportException $exception) {
  21382. if ($exception->getCode() != 404) {
  21383. throw $exception;
  21384. }
  21385. }
  21386. }
  21387. } catch (TransportException $exception) {
  21388. if ($exception->getCode() != 404) {
  21389. throw $exception;
  21390. }
  21391. }
  21392. return $result;
  21393. }
  21394. private function readPackageReleaseDependencies($baseUrl, $packageName, $version)
  21395. {
  21396. $dependencyReader = new PackageDependencyParser();
  21397. $depthPath = '/r/' . strtolower($packageName) . '/deps.' . $version . '.txt';
  21398. $content = $this->requestContent($baseUrl, $depthPath);
  21399. $dependencyArray = unserialize($content);
  21400. return $dependencyReader->buildDependencyInfo($dependencyArray);
  21401. }
  21402. }
  21403. <?php
  21404. namespace Composer\Repository\Pear;
  21405. class ChannelRest11Reader extends BaseChannelReader
  21406. {
  21407. private $dependencyReader;
  21408. public function __construct($rfs)
  21409. {
  21410. parent::__construct($rfs);
  21411. $this->dependencyReader = new PackageDependencyParser();
  21412. }
  21413. public function read($baseUrl)
  21414. {
  21415. return $this->readChannelPackages($baseUrl);
  21416. }
  21417. private function readChannelPackages($baseUrl)
  21418. {
  21419. $result = array();
  21420. $xml = $this->requestXml($baseUrl, "/c/categories.xml");
  21421. $xml->registerXPathNamespace('ns', self::ALL_CATEGORIES_NS);
  21422. foreach ($xml->xpath('ns:c') as $node) {
  21423. $categoryName = (string) $node;
  21424. $categoryPackages = $this->readCategoryPackages($baseUrl, $categoryName);
  21425. $result = array_merge($result, $categoryPackages);
  21426. }
  21427. return $result;
  21428. }
  21429. private function readCategoryPackages($baseUrl, $categoryName)
  21430. {
  21431. $result = array();
  21432. $categoryPath = '/c/'.urlencode($categoryName).'/packagesinfo.xml';
  21433. $xml = $this->requestXml($baseUrl, $categoryPath);
  21434. $xml->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21435. foreach ($xml->xpath('ns:pi') as $node) {
  21436. $packageInfo = $this->parsePackage($node);
  21437. $result[] = $packageInfo;
  21438. }
  21439. return $result;
  21440. }
  21441. private function parsePackage($packageInfo)
  21442. {
  21443. $packageInfo->registerXPathNamespace('ns', self::CATEGORY_PACKAGES_INFO_NS);
  21444. $channelName = (string) $packageInfo->p->c;
  21445. $packageName = (string) $packageInfo->p->n;
  21446. $license = (string) $packageInfo->p->l;
  21447. $shortDescription = (string) $packageInfo->p->s;
  21448. $description = (string) $packageInfo->p->d;
  21449. $dependencies = array();
  21450. foreach ($packageInfo->xpath('ns:deps') as $node) {
  21451. $dependencyVersion = (string) $node->v;
  21452. $dependencyArray = unserialize((string) $node->d);
  21453. $dependencyInfo = $this->dependencyReader->buildDependencyInfo($dependencyArray);
  21454. $dependencies[$dependencyVersion] = $dependencyInfo;
  21455. }
  21456. $releases = array();
  21457. $releasesInfo = $packageInfo->xpath('ns:a/ns:r');
  21458. if ($releasesInfo) {
  21459. foreach ($releasesInfo as $node) {
  21460. $releaseVersion = (string) $node->v;
  21461. $releaseStability = (string) $node->s;
  21462. $releases[$releaseVersion] = new ReleaseInfo(
  21463. $releaseStability,
  21464. isset($dependencies[$releaseVersion]) ? $dependencies[$releaseVersion] : new DependencyInfo(array(), array())
  21465. );
  21466. }
  21467. }
  21468. return new PackageInfo(
  21469. $channelName,
  21470. $packageName,
  21471. $license,
  21472. $shortDescription,
  21473. $description,
  21474. $releases
  21475. );
  21476. }
  21477. }
  21478. <?php
  21479. namespace Composer\Repository\Pear;
  21480. class DependencyConstraint
  21481. {
  21482. private $type;
  21483. private $constraint;
  21484. private $channelName;
  21485. private $packageName;
  21486. public function __construct($type, $constraint, $channelName, $packageName)
  21487. {
  21488. $this->type = $type;
  21489. $this->constraint = $constraint;
  21490. $this->channelName = $channelName;
  21491. $this->packageName = $packageName;
  21492. }
  21493. public function getChannelName()
  21494. {
  21495. return $this->channelName;
  21496. }
  21497. public function getConstraint()
  21498. {
  21499. return $this->constraint;
  21500. }
  21501. public function getPackageName()
  21502. {
  21503. return $this->packageName;
  21504. }
  21505. public function getType()
  21506. {
  21507. return $this->type;
  21508. }
  21509. }
  21510. <?php
  21511. namespace Composer\Repository\Pear;
  21512. class DependencyInfo
  21513. {
  21514. private $requires;
  21515. private $optionals;
  21516. public function __construct($requires, $optionals)
  21517. {
  21518. $this->requires = $requires;
  21519. $this->optionals = $optionals;
  21520. }
  21521. public function getRequires()
  21522. {
  21523. return $this->requires;
  21524. }
  21525. public function getOptionals()
  21526. {
  21527. return $this->optionals;
  21528. }
  21529. }
  21530. <?php
  21531. namespace Composer\Repository\Pear;
  21532. class PackageDependencyParser
  21533. {
  21534. public function buildDependencyInfo($depArray)
  21535. {
  21536. if (!is_array($depArray)) {
  21537. return new DependencyInfo(array(), array());
  21538. }
  21539. if (!$this->isHash($depArray)) {
  21540. return new DependencyInfo($this->buildDependency10Info($depArray), array());
  21541. }
  21542. return $this->buildDependency20Info($depArray);
  21543. }
  21544. private function buildDependency10Info($depArray)
  21545. {
  21546. static $dep10toOperatorMap = array('has' => '==', 'eq' => '==', 'ge' => '>=', 'gt' => '>', 'le' => '<=', 'lt' => '<', 'not' => '!=');
  21547. $result = array();
  21548. foreach ($depArray as $depItem) {
  21549. if (empty($depItem['rel']) || !array_key_exists($depItem['rel'], $dep10toOperatorMap)) {
  21550. continue;
  21551. }
  21552. $depType = !empty($depItem['optional']) && 'yes' == $depItem['optional']
  21553. ? 'optional'
  21554. : 'required';
  21555. $depType = 'not' == $depItem['rel']
  21556. ? 'conflicts'
  21557. : $depType;
  21558. $depVersion = !empty($depItem['version']) ? $this->parseVersion($depItem['version']) : '*';
  21559. $depVersionConstraint = ('has' == $depItem['rel'] || 'not' == $depItem['rel']) && '*' == $depVersion
  21560. ? '*'
  21561. : $dep10toOperatorMap[$depItem['rel']] . $depVersion;
  21562. switch ($depItem['type']) {
  21563. case 'php':
  21564. $depChannelName = 'php';
  21565. $depPackageName = '';
  21566. break;
  21567. case 'pkg':
  21568. $depChannelName = !empty($depItem['channel']) ? $depItem['channel'] : 'pear.php.net';
  21569. $depPackageName = $depItem['name'];
  21570. break;
  21571. case 'ext':
  21572. $depChannelName = 'ext';
  21573. $depPackageName = $depItem['name'];
  21574. break;
  21575. case 'os':
  21576. case 'sapi':
  21577. $depChannelName = '';
  21578. $depPackageName = '';
  21579. break;
  21580. default:
  21581. $depChannelName = '';
  21582. $depPackageName = '';
  21583. break;
  21584. }
  21585. if ('' != $depChannelName) {
  21586. $result[] = new DependencyConstraint(
  21587. $depType,
  21588. $depVersionConstraint,
  21589. $depChannelName,
  21590. $depPackageName
  21591. );
  21592. }
  21593. }
  21594. return $result;
  21595. }
  21596. private function buildDependency20Info($depArray)
  21597. {
  21598. $result = array();
  21599. $optionals = array();
  21600. $defaultOptionals = array();
  21601. foreach ($depArray as $depType => $depTypeGroup) {
  21602. if (!is_array($depTypeGroup)) {
  21603. continue;
  21604. }
  21605. if ('required' == $depType || 'optional' == $depType) {
  21606. foreach ($depTypeGroup as $depItemType => $depItem) {
  21607. switch ($depItemType) {
  21608. case 'php':
  21609. $result[] = new DependencyConstraint(
  21610. $depType,
  21611. $this->parse20VersionConstraint($depItem),
  21612. 'php',
  21613. ''
  21614. );
  21615. break;
  21616. case 'package':
  21617. $deps = $this->buildDepPackageConstraints($depItem, $depType);
  21618. $result = array_merge($result, $deps);
  21619. break;
  21620. case 'extension':
  21621. $deps = $this->buildDepExtensionConstraints($depItem, $depType);
  21622. $result = array_merge($result, $deps);
  21623. break;
  21624. case 'subpackage':
  21625. $deps = $this->buildDepPackageConstraints($depItem, 'replaces');
  21626. $defaultOptionals += $deps;
  21627. break;
  21628. case 'os':
  21629. case 'pearinstaller':
  21630. break;
  21631. default:
  21632. break;
  21633. }
  21634. }
  21635. } elseif ('group' == $depType) {
  21636. if ($this->isHash($depTypeGroup)) {
  21637. $depTypeGroup = array($depTypeGroup);
  21638. }
  21639. foreach ($depTypeGroup as $depItem) {
  21640. $groupName = $depItem['attribs']['name'];
  21641. if (!isset($optionals[$groupName])) {
  21642. $optionals[$groupName] = array();
  21643. }
  21644. if (isset($depItem['subpackage'])) {
  21645. $optionals[$groupName] += $this->buildDepPackageConstraints($depItem['subpackage'], 'replaces');
  21646. } else {
  21647. $result += $this->buildDepPackageConstraints($depItem['package'], 'optional');
  21648. }
  21649. }
  21650. }
  21651. }
  21652. if (count($defaultOptionals) > 0) {
  21653. $optionals['*'] = $defaultOptionals;
  21654. }
  21655. return new DependencyInfo($result, $optionals);
  21656. }
  21657. private function buildDepExtensionConstraints($depItem, $depType)
  21658. {
  21659. if ($this->isHash($depItem)) {
  21660. $depItem = array($depItem);
  21661. }
  21662. $result = array();
  21663. foreach ($depItem as $subDepItem) {
  21664. $depChannelName = 'ext';
  21665. $depPackageName = $subDepItem['name'];
  21666. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21667. $result[] = new DependencyConstraint(
  21668. $depType,
  21669. $depVersionConstraint,
  21670. $depChannelName,
  21671. $depPackageName
  21672. );
  21673. }
  21674. return $result;
  21675. }
  21676. private function buildDepPackageConstraints($depItem, $depType)
  21677. {
  21678. if ($this->isHash($depItem)) {
  21679. $depItem = array($depItem);
  21680. }
  21681. $result = array();
  21682. foreach ($depItem as $subDepItem) {
  21683. if (!array_key_exists('channel', $subDepItem)) {
  21684. $subDepItem['channel'] = $subDepItem['uri'];
  21685. }
  21686. $depChannelName = $subDepItem['channel'];
  21687. $depPackageName = $subDepItem['name'];
  21688. $depVersionConstraint = $this->parse20VersionConstraint($subDepItem);
  21689. if (isset($subDepItem['conflicts'])) {
  21690. $depType = 'conflicts';
  21691. }
  21692. $result[] = new DependencyConstraint(
  21693. $depType,
  21694. $depVersionConstraint,
  21695. $depChannelName,
  21696. $depPackageName
  21697. );
  21698. }
  21699. return $result;
  21700. }
  21701. private function parse20VersionConstraint(array $data)
  21702. {
  21703. static $dep20toOperatorMap = array('has' => '==', 'min' => '>=', 'max' => '<=', 'exclude' => '!=');
  21704. $versions = array();
  21705. $values = array_intersect_key($data, $dep20toOperatorMap);
  21706. if (0 == count($values)) {
  21707. return '*';
  21708. }
  21709. if (isset($values['min']) && isset($values['exclude']) && $data['min'] == $data['exclude']) {
  21710. $versions[] = '>' . $this->parseVersion($values['min']);
  21711. } elseif (isset($values['max']) && isset($values['exclude']) && $data['max'] == $data['exclude']) {
  21712. $versions[] = '<' . $this->parseVersion($values['max']);
  21713. } else {
  21714. foreach ($values as $op => $version) {
  21715. if ('exclude' == $op && is_array($version)) {
  21716. foreach ($version as $versionPart) {
  21717. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($versionPart);
  21718. }
  21719. } else {
  21720. $versions[] = $dep20toOperatorMap[$op] . $this->parseVersion($version);
  21721. }
  21722. }
  21723. }
  21724. return implode(',', $versions);
  21725. }
  21726. private function parseVersion($version)
  21727. {
  21728. if (preg_match('{^v?(\d{1,3})(\.\d+)?(\.\d+)?(\.\d+)?}i', $version, $matches)) {
  21729. $version = $matches[1]
  21730. .(!empty($matches[2]) ? $matches[2] : '.0')
  21731. .(!empty($matches[3]) ? $matches[3] : '.0')
  21732. .(!empty($matches[4]) ? $matches[4] : '.0');
  21733. return $version;
  21734. }
  21735. return null;
  21736. }
  21737. private function isHash(array $array)
  21738. {
  21739. return !array_key_exists(1, $array) && !array_key_exists(0, $array);
  21740. }
  21741. }
  21742. <?php
  21743. namespace Composer\Repository\Pear;
  21744. class PackageInfo
  21745. {
  21746. private $channelName;
  21747. private $packageName;
  21748. private $license;
  21749. private $shortDescription;
  21750. private $description;
  21751. private $releases;
  21752. public function __construct($channelName, $packageName, $license, $shortDescription, $description, $releases)
  21753. {
  21754. $this->channelName = $channelName;
  21755. $this->packageName = $packageName;
  21756. $this->license = $license;
  21757. $this->shortDescription = $shortDescription;
  21758. $this->description = $description;
  21759. $this->releases = $releases;
  21760. }
  21761. public function getChannelName()
  21762. {
  21763. return $this->channelName;
  21764. }
  21765. public function getPackageName()
  21766. {
  21767. return $this->packageName;
  21768. }
  21769. public function getDescription()
  21770. {
  21771. return $this->description;
  21772. }
  21773. public function getShortDescription()
  21774. {
  21775. return $this->shortDescription;
  21776. }
  21777. public function getLicense()
  21778. {
  21779. return $this->license;
  21780. }
  21781. public function getReleases()
  21782. {
  21783. return $this->releases;
  21784. }
  21785. }
  21786. <?php
  21787. namespace Composer\Repository\Pear;
  21788. class ReleaseInfo
  21789. {
  21790. private $stability;
  21791. private $dependencyInfo;
  21792. public function __construct($stability, $dependencyInfo)
  21793. {
  21794. $this->stability = $stability;
  21795. $this->dependencyInfo = $dependencyInfo;
  21796. }
  21797. public function getDependencyInfo()
  21798. {
  21799. return $this->dependencyInfo;
  21800. }
  21801. public function getStability()
  21802. {
  21803. return $this->stability;
  21804. }
  21805. }
  21806. <?php
  21807. namespace Composer\Repository;
  21808. use Composer\IO\IOInterface;
  21809. use Composer\Semver\VersionParser as SemverVersionParser;
  21810. use Composer\Package\Version\VersionParser;
  21811. use Composer\Repository\Pear\ChannelReader;
  21812. use Composer\Package\CompletePackage;
  21813. use Composer\Repository\Pear\ChannelInfo;
  21814. use Composer\EventDispatcher\EventDispatcher;
  21815. use Composer\Package\Link;
  21816. use Composer\Semver\Constraint\Constraint;
  21817. use Composer\Util\RemoteFilesystem;
  21818. use Composer\Config;
  21819. use Composer\Factory;
  21820. class PearRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  21821. {
  21822. private $url;
  21823. private $io;
  21824. private $rfs;
  21825. private $versionParser;
  21826. private $repoConfig;
  21827. private $vendorAlias;
  21828. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, RemoteFilesystem $rfs = null)
  21829. {
  21830. parent::__construct();
  21831. if (!preg_match('{^https?://}', $repoConfig['url'])) {
  21832. $repoConfig['url'] = 'http://'.$repoConfig['url'];
  21833. }
  21834. $urlBits = parse_url($repoConfig['url']);
  21835. if (empty($urlBits['scheme']) || empty($urlBits['host'])) {
  21836. throw new \UnexpectedValueException('Invalid url given for PEAR repository: '.$repoConfig['url']);
  21837. }
  21838. $this->url = rtrim($repoConfig['url'], '/');
  21839. $this->io = $io;
  21840. $this->rfs = $rfs ?: Factory::createRemoteFilesystem($this->io, $config);
  21841. $this->vendorAlias = isset($repoConfig['vendor-alias']) ? $repoConfig['vendor-alias'] : null;
  21842. $this->versionParser = new VersionParser();
  21843. $this->repoConfig = $repoConfig;
  21844. }
  21845. public function getRepoConfig()
  21846. {
  21847. return $this->repoConfig;
  21848. }
  21849. protected function initialize()
  21850. {
  21851. parent::initialize();
  21852. $this->io->writeError('Initializing PEAR repository '.$this->url);
  21853. $reader = new ChannelReader($this->rfs);
  21854. try {
  21855. $channelInfo = $reader->read($this->url);
  21856. } catch (\Exception $e) {
  21857. $this->io->writeError('<warning>PEAR repository from '.$this->url.' could not be loaded. '.$e->getMessage().'</warning>');
  21858. return;
  21859. }
  21860. $packages = $this->buildComposerPackages($channelInfo, $this->versionParser);
  21861. foreach ($packages as $package) {
  21862. $this->addPackage($package);
  21863. }
  21864. }
  21865. private function buildComposerPackages(ChannelInfo $channelInfo, SemverVersionParser $versionParser)
  21866. {
  21867. $result = array();
  21868. foreach ($channelInfo->getPackages() as $packageDefinition) {
  21869. foreach ($packageDefinition->getReleases() as $version => $releaseInfo) {
  21870. try {
  21871. $normalizedVersion = $versionParser->normalize($version);
  21872. } catch (\UnexpectedValueException $e) {
  21873. $this->io->writeError('Could not load '.$packageDefinition->getPackageName().' '.$version.': '.$e->getMessage(), true, IOInterface::VERBOSE);
  21874. continue;
  21875. }
  21876. $composerPackageName = $this->buildComposerPackageName($packageDefinition->getChannelName(), $packageDefinition->getPackageName());
  21877. $urlBits = parse_url($this->url);
  21878. $scheme = (isset($urlBits['scheme']) && 'https' === $urlBits['scheme'] && extension_loaded('openssl')) ? 'https' : 'http';
  21879. $distUrl = "{$scheme}://{$packageDefinition->getChannelName()}/get/{$packageDefinition->getPackageName()}-{$version}.tgz";
  21880. $requires = array();
  21881. $suggests = array();
  21882. $conflicts = array();
  21883. $replaces = array();
  21884. if ($channelInfo->getName() == $packageDefinition->getChannelName()) {
  21885. $composerPackageAlias = $this->buildComposerPackageName($channelInfo->getAlias(), $packageDefinition->getPackageName());
  21886. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21887. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21888. }
  21889. if (!empty($this->vendorAlias)
  21890. && ($this->vendorAlias != 'pear-'.$channelInfo->getAlias() || $channelInfo->getName() != $packageDefinition->getChannelName())
  21891. ) {
  21892. $composerPackageAlias = "{$this->vendorAlias}/{$packageDefinition->getPackageName()}";
  21893. $aliasConstraint = new Constraint('==', $normalizedVersion);
  21894. $replaces[] = new Link($composerPackageName, $composerPackageAlias, $aliasConstraint, 'replaces', (string) $aliasConstraint);
  21895. }
  21896. foreach ($releaseInfo->getDependencyInfo()->getRequires() as $dependencyConstraint) {
  21897. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21898. $constraint = $versionParser->parseConstraints($dependencyConstraint->getConstraint());
  21899. $link = new Link($composerPackageName, $dependencyPackageName, $constraint, $dependencyConstraint->getType(), $dependencyConstraint->getConstraint());
  21900. switch ($dependencyConstraint->getType()) {
  21901. case 'required':
  21902. $requires[] = $link;
  21903. break;
  21904. case 'conflicts':
  21905. $conflicts[] = $link;
  21906. break;
  21907. case 'replaces':
  21908. $replaces[] = $link;
  21909. break;
  21910. }
  21911. }
  21912. foreach ($releaseInfo->getDependencyInfo()->getOptionals() as $group => $dependencyConstraints) {
  21913. foreach ($dependencyConstraints as $dependencyConstraint) {
  21914. $dependencyPackageName = $this->buildComposerPackageName($dependencyConstraint->getChannelName(), $dependencyConstraint->getPackageName());
  21915. $suggests[$group.'-'.$dependencyPackageName] = $dependencyConstraint->getConstraint();
  21916. }
  21917. }
  21918. $package = new CompletePackage($composerPackageName, $normalizedVersion, $version);
  21919. $package->setType('pear-library');
  21920. $package->setDescription($packageDefinition->getDescription());
  21921. $package->setLicense(array($packageDefinition->getLicense()));
  21922. $package->setDistType('file');
  21923. $package->setDistUrl($distUrl);
  21924. $package->setAutoload(array('classmap' => array('')));
  21925. $package->setIncludePaths(array('/'));
  21926. $package->setRequires($requires);
  21927. $package->setConflicts($conflicts);
  21928. $package->setSuggests($suggests);
  21929. $package->setReplaces($replaces);
  21930. $result[] = $package;
  21931. }
  21932. }
  21933. return $result;
  21934. }
  21935. private function buildComposerPackageName($channelName, $packageName)
  21936. {
  21937. if ('php' === $channelName) {
  21938. return "php";
  21939. }
  21940. if ('ext' === $channelName) {
  21941. return "ext-{$packageName}";
  21942. }
  21943. return "pear-{$channelName}/{$packageName}";
  21944. }
  21945. }
  21946. <?php
  21947. namespace Composer\Repository;
  21948. use Composer\Package\CompletePackage;
  21949. use Composer\Package\PackageInterface;
  21950. use Composer\Package\Version\VersionParser;
  21951. use Composer\Plugin\PluginInterface;
  21952. use Composer\Util\ProcessExecutor;
  21953. use Composer\Util\Silencer;
  21954. use Composer\Util\Platform;
  21955. use Composer\XdebugHandler\XdebugHandler;
  21956. use Symfony\Component\Process\ExecutableFinder;
  21957. class PlatformRepository extends ArrayRepository
  21958. {
  21959. const PLATFORM_PACKAGE_REGEX = '{^(?:php(?:-64bit|-ipv6|-zts|-debug)?|hhvm|(?:ext|lib)-[a-z0-9](?:[_.-]?[a-z0-9]+)*|composer-plugin-api)$}iD';
  21960. private $versionParser;
  21961. private $overrides = array();
  21962. private $process;
  21963. public function __construct(array $packages = array(), array $overrides = array(), ProcessExecutor $process = null)
  21964. {
  21965. $this->process = $process === null ? (new ProcessExecutor()) : $process;
  21966. foreach ($overrides as $name => $version) {
  21967. $this->overrides[strtolower($name)] = array('name' => $name, 'version' => $version);
  21968. }
  21969. parent::__construct($packages);
  21970. }
  21971. protected function initialize()
  21972. {
  21973. parent::initialize();
  21974. $this->versionParser = new VersionParser();
  21975. foreach ($this->overrides as $override) {
  21976. if (!preg_match(self::PLATFORM_PACKAGE_REGEX, $override['name'])) {
  21977. throw new \InvalidArgumentException('Invalid platform package name in config.platform: '.$override['name']);
  21978. }
  21979. $this->addOverriddenPackage($override);
  21980. }
  21981. $prettyVersion = PluginInterface::PLUGIN_API_VERSION;
  21982. $version = $this->versionParser->normalize($prettyVersion);
  21983. $composerPluginApi = new CompletePackage('composer-plugin-api', $version, $prettyVersion);
  21984. $composerPluginApi->setDescription('The Composer Plugin API');
  21985. $this->addPackage($composerPluginApi);
  21986. try {
  21987. $prettyVersion = PHP_VERSION;
  21988. $version = $this->versionParser->normalize($prettyVersion);
  21989. } catch (\UnexpectedValueException $e) {
  21990. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', PHP_VERSION);
  21991. $version = $this->versionParser->normalize($prettyVersion);
  21992. }
  21993. $php = new CompletePackage('php', $version, $prettyVersion);
  21994. $php->setDescription('The PHP interpreter');
  21995. $this->addPackage($php);
  21996. if (PHP_DEBUG) {
  21997. $phpdebug = new CompletePackage('php-debug', $version, $prettyVersion);
  21998. $phpdebug->setDescription('The PHP interpreter, with debugging symbols');
  21999. $this->addPackage($phpdebug);
  22000. }
  22001. if (defined('PHP_ZTS') && PHP_ZTS) {
  22002. $phpzts = new CompletePackage('php-zts', $version, $prettyVersion);
  22003. $phpzts->setDescription('The PHP interpreter, with Zend Thread Safety');
  22004. $this->addPackage($phpzts);
  22005. }
  22006. if (PHP_INT_SIZE === 8) {
  22007. $php64 = new CompletePackage('php-64bit', $version, $prettyVersion);
  22008. $php64->setDescription('The PHP interpreter, 64bit');
  22009. $this->addPackage($php64);
  22010. }
  22011. if (defined('AF_INET6') || Silencer::call('inet_pton', '::') !== false) {
  22012. $phpIpv6 = new CompletePackage('php-ipv6', $version, $prettyVersion);
  22013. $phpIpv6->setDescription('The PHP interpreter, with IPv6 support');
  22014. $this->addPackage($phpIpv6);
  22015. }
  22016. $loadedExtensions = get_loaded_extensions();
  22017. foreach ($loadedExtensions as $name) {
  22018. if (in_array($name, array('standard', 'Core'))) {
  22019. continue;
  22020. }
  22021. $reflExt = new \ReflectionExtension($name);
  22022. $prettyVersion = $reflExt->getVersion();
  22023. $this->addExtension($name, $prettyVersion);
  22024. }
  22025. if (!in_array('xdebug', $loadedExtensions, true) && ($prettyVersion = XdebugHandler::getSkippedVersion())) {
  22026. $this->addExtension('xdebug', $prettyVersion);
  22027. }
  22028. foreach ($loadedExtensions as $name) {
  22029. $prettyVersion = null;
  22030. $description = 'The '.$name.' PHP library';
  22031. switch ($name) {
  22032. case 'curl':
  22033. $curlVersion = curl_version();
  22034. $prettyVersion = $curlVersion['version'];
  22035. break;
  22036. case 'iconv':
  22037. $prettyVersion = ICONV_VERSION;
  22038. break;
  22039. case 'intl':
  22040. $name = 'ICU';
  22041. if (defined('INTL_ICU_VERSION')) {
  22042. $prettyVersion = INTL_ICU_VERSION;
  22043. } else {
  22044. $reflector = new \ReflectionExtension('intl');
  22045. ob_start();
  22046. $reflector->info();
  22047. $output = ob_get_clean();
  22048. preg_match('/^ICU version => (.*)$/m', $output, $matches);
  22049. $prettyVersion = $matches[1];
  22050. }
  22051. break;
  22052. case 'imagick':
  22053. $imagick = new \Imagick();
  22054. $imageMagickVersion = $imagick->getVersion();
  22055. preg_match('/^ImageMagick ([\d.]+)(?:-(\d+))?/', $imageMagickVersion['versionString'], $matches);
  22056. if (isset($matches[2])) {
  22057. $prettyVersion = "{$matches[1]}.{$matches[2]}";
  22058. } else {
  22059. $prettyVersion = $matches[1];
  22060. }
  22061. break;
  22062. case 'libxml':
  22063. $prettyVersion = LIBXML_DOTTED_VERSION;
  22064. break;
  22065. case 'openssl':
  22066. $prettyVersion = preg_replace_callback('{^(?:OpenSSL|LibreSSL)?\s*([0-9.]+)([a-z]*).*}i', function ($match) {
  22067. if (empty($match[2])) {
  22068. return $match[1];
  22069. }
  22070. if (!preg_match('{^z*[a-z]$}', $match[2])) {
  22071. return 0;
  22072. }
  22073. $len = strlen($match[2]);
  22074. $patchVersion = ($len - 1) * 26;
  22075. $patchVersion += ord($match[2][$len - 1]) - 96;
  22076. return $match[1].'.'.$patchVersion;
  22077. }, OPENSSL_VERSION_TEXT);
  22078. $description = OPENSSL_VERSION_TEXT;
  22079. break;
  22080. case 'pcre':
  22081. $prettyVersion = preg_replace('{^(\S+).*}', '$1', PCRE_VERSION);
  22082. break;
  22083. case 'uuid':
  22084. $prettyVersion = phpversion('uuid');
  22085. break;
  22086. case 'xsl':
  22087. $prettyVersion = LIBXSLT_DOTTED_VERSION;
  22088. break;
  22089. default:
  22090. continue 2;
  22091. }
  22092. try {
  22093. $version = $this->versionParser->normalize($prettyVersion);
  22094. } catch (\UnexpectedValueException $e) {
  22095. continue;
  22096. }
  22097. $lib = new CompletePackage('lib-'.$name, $version, $prettyVersion);
  22098. $lib->setDescription($description);
  22099. $this->addPackage($lib);
  22100. }
  22101. $hhvmVersion = defined('HHVM_VERSION') ? HHVM_VERSION : null;
  22102. if ($hhvmVersion === null && !Platform::isWindows()) {
  22103. $finder = new ExecutableFinder();
  22104. $hhvm = $finder->find('hhvm');
  22105. if ($hhvm !== null) {
  22106. $exitCode = $this->process->execute(
  22107. ProcessExecutor::escape($hhvm).
  22108. ' --php -d hhvm.jit=0 -r "echo HHVM_VERSION;" 2>/dev/null',
  22109. $hhvmVersion
  22110. );
  22111. if ($exitCode !== 0) {
  22112. $hhvmVersion = null;
  22113. }
  22114. }
  22115. }
  22116. if ($hhvmVersion) {
  22117. try {
  22118. $prettyVersion = $hhvmVersion;
  22119. $version = $this->versionParser->normalize($prettyVersion);
  22120. } catch (\UnexpectedValueException $e) {
  22121. $prettyVersion = preg_replace('#^([^~+-]+).*$#', '$1', $hhvmVersion);
  22122. $version = $this->versionParser->normalize($prettyVersion);
  22123. }
  22124. $hhvm = new CompletePackage('hhvm', $version, $prettyVersion);
  22125. $hhvm->setDescription('The HHVM Runtime (64bit)');
  22126. $this->addPackage($hhvm);
  22127. }
  22128. }
  22129. public function addPackage(PackageInterface $package)
  22130. {
  22131. if (isset($this->overrides[$package->getName()])) {
  22132. $overrider = $this->findPackage($package->getName(), '*');
  22133. if ($package->getVersion() === $overrider->getVersion()) {
  22134. $actualText = 'same as actual';
  22135. } else {
  22136. $actualText = 'actual: '.$package->getPrettyVersion();
  22137. }
  22138. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22139. return;
  22140. }
  22141. if (isset($this->overrides['php']) && 0 === strpos($package->getName(), 'php-')) {
  22142. $overrider = $this->addOverriddenPackage($this->overrides['php'], $package->getPrettyName());
  22143. if ($package->getVersion() === $overrider->getVersion()) {
  22144. $actualText = 'same as actual';
  22145. } else {
  22146. $actualText = 'actual: '.$package->getPrettyVersion();
  22147. }
  22148. $overrider->setDescription($overrider->getDescription().' ('.$actualText.')');
  22149. return;
  22150. }
  22151. parent::addPackage($package);
  22152. }
  22153. private function addOverriddenPackage(array $override, $name = null)
  22154. {
  22155. $version = $this->versionParser->normalize($override['version']);
  22156. $package = new CompletePackage($name ?: $override['name'], $version, $override['version']);
  22157. $package->setDescription('Package overridden via config.platform');
  22158. $package->setExtra(array('config.platform' => true));
  22159. parent::addPackage($package);
  22160. return $package;
  22161. }
  22162. private function addExtension($name, $prettyVersion)
  22163. {
  22164. $extraDescription = null;
  22165. try {
  22166. $version = $this->versionParser->normalize($prettyVersion);
  22167. } catch (\UnexpectedValueException $e) {
  22168. $extraDescription = ' (actual version: '.$prettyVersion.')';
  22169. if (preg_match('{^(\d+\.\d+\.\d+(?:\.\d+)?)}', $prettyVersion, $match)) {
  22170. $prettyVersion = $match[1];
  22171. } else {
  22172. $prettyVersion = '0';
  22173. }
  22174. $version = $this->versionParser->normalize($prettyVersion);
  22175. }
  22176. $packageName = $this->buildPackageName($name);
  22177. $ext = new CompletePackage($packageName, $version, $prettyVersion);
  22178. $ext->setDescription('The '.$name.' PHP extension'.$extraDescription);
  22179. $this->addPackage($ext);
  22180. }
  22181. private function buildPackageName($name)
  22182. {
  22183. return 'ext-' . str_replace(' ', '-', $name);
  22184. }
  22185. }
  22186. <?php
  22187. namespace Composer\Repository;
  22188. use Composer\Factory;
  22189. use Composer\IO\IOInterface;
  22190. use Composer\Config;
  22191. use Composer\EventDispatcher\EventDispatcher;
  22192. use Composer\Util\RemoteFilesystem;
  22193. use Composer\Json\JsonFile;
  22194. class RepositoryFactory
  22195. {
  22196. public static function configFromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22197. {
  22198. if (0 === strpos($repository, 'http')) {
  22199. $repoConfig = array('type' => 'composer', 'url' => $repository);
  22200. } elseif ("json" === pathinfo($repository, PATHINFO_EXTENSION)) {
  22201. $json = new JsonFile($repository, Factory::createRemoteFilesystem($io, $config));
  22202. $data = $json->read();
  22203. if (!empty($data['packages']) || !empty($data['includes']) || !empty($data['provider-includes'])) {
  22204. $repoConfig = array('type' => 'composer', 'url' => 'file://' . strtr(realpath($repository), '\\', '/'));
  22205. } elseif ($allowFilesystem) {
  22206. $repoConfig = array('type' => 'filesystem', 'json' => $json);
  22207. } else {
  22208. throw new \InvalidArgumentException("Invalid repository URL ($repository) given. This file does not contain a valid composer repository.");
  22209. }
  22210. } elseif ('{' === substr($repository, 0, 1)) {
  22211. $repoConfig = JsonFile::parseJson($repository);
  22212. } else {
  22213. throw new \InvalidArgumentException("Invalid repository url ($repository) given. Has to be a .json file, an http url or a JSON object.");
  22214. }
  22215. return $repoConfig;
  22216. }
  22217. public static function fromString(IOInterface $io, Config $config, $repository, $allowFilesystem = false)
  22218. {
  22219. $repoConfig = static::configFromString($io, $config, $repository, $allowFilesystem);
  22220. return static::createRepo($io, $config, $repoConfig);
  22221. }
  22222. public static function createRepo(IOInterface $io, Config $config, array $repoConfig)
  22223. {
  22224. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22225. $repos = static::createRepos($rm, array($repoConfig));
  22226. return reset($repos);
  22227. }
  22228. public static function defaultRepos(IOInterface $io = null, Config $config = null, RepositoryManager $rm = null)
  22229. {
  22230. if (!$config) {
  22231. $config = Factory::createConfig($io);
  22232. }
  22233. if ($io) {
  22234. $io->loadConfiguration($config);
  22235. }
  22236. if (!$rm) {
  22237. if (!$io) {
  22238. throw new \InvalidArgumentException('This function requires either an IOInterface or a RepositoryManager');
  22239. }
  22240. $rm = static::manager($io, $config, null, Factory::createRemoteFilesystem($io, $config));
  22241. }
  22242. return static::createRepos($rm, $config->getRepositories());
  22243. }
  22244. public static function manager(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22245. {
  22246. $rm = new RepositoryManager($io, $config, $eventDispatcher, $rfs);
  22247. $rm->setRepositoryClass('composer', 'Composer\Repository\ComposerRepository');
  22248. $rm->setRepositoryClass('vcs', 'Composer\Repository\VcsRepository');
  22249. $rm->setRepositoryClass('package', 'Composer\Repository\PackageRepository');
  22250. $rm->setRepositoryClass('pear', 'Composer\Repository\PearRepository');
  22251. $rm->setRepositoryClass('git', 'Composer\Repository\VcsRepository');
  22252. $rm->setRepositoryClass('git-bitbucket', 'Composer\Repository\VcsRepository');
  22253. $rm->setRepositoryClass('github', 'Composer\Repository\VcsRepository');
  22254. $rm->setRepositoryClass('gitlab', 'Composer\Repository\VcsRepository');
  22255. $rm->setRepositoryClass('svn', 'Composer\Repository\VcsRepository');
  22256. $rm->setRepositoryClass('fossil', 'Composer\Repository\VcsRepository');
  22257. $rm->setRepositoryClass('perforce', 'Composer\Repository\VcsRepository');
  22258. $rm->setRepositoryClass('hg', 'Composer\Repository\VcsRepository');
  22259. $rm->setRepositoryClass('hg-bitbucket', 'Composer\Repository\VcsRepository');
  22260. $rm->setRepositoryClass('artifact', 'Composer\Repository\ArtifactRepository');
  22261. $rm->setRepositoryClass('path', 'Composer\Repository\PathRepository');
  22262. return $rm;
  22263. }
  22264. private static function createRepos(RepositoryManager $rm, array $repoConfigs)
  22265. {
  22266. $repos = array();
  22267. foreach ($repoConfigs as $index => $repo) {
  22268. if (is_string($repo)) {
  22269. throw new \UnexpectedValueException('"repositories" should be an array of repository definitions, only a single repository was given');
  22270. }
  22271. if (!is_array($repo)) {
  22272. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') should be an array, '.gettype($repo).' given');
  22273. }
  22274. if (!isset($repo['type'])) {
  22275. throw new \UnexpectedValueException('Repository "'.$index.'" ('.json_encode($repo).') must have a type defined');
  22276. }
  22277. $name = is_int($index) && isset($repo['url']) ? preg_replace('{^https?://}i', '', $repo['url']) : $index;
  22278. while (isset($repos[$name])) {
  22279. $name .= '2';
  22280. }
  22281. if ($repo['type'] === 'filesystem') {
  22282. $repos[$name] = new FilesystemRepository($repo['json']);
  22283. } else {
  22284. $repos[$name] = $rm->createRepository($repo['type'], $repo, $index);
  22285. }
  22286. }
  22287. return $repos;
  22288. }
  22289. }
  22290. <?php
  22291. namespace Composer\Repository;
  22292. use Composer\Package\PackageInterface;
  22293. interface RepositoryInterface extends \Countable
  22294. {
  22295. const SEARCH_FULLTEXT = 0;
  22296. const SEARCH_NAME = 1;
  22297. public function hasPackage(PackageInterface $package);
  22298. public function findPackage($name, $constraint);
  22299. public function findPackages($name, $constraint = null);
  22300. public function getPackages();
  22301. public function search($query, $mode = 0);
  22302. }
  22303. <?php
  22304. namespace Composer\Repository;
  22305. use Composer\IO\IOInterface;
  22306. use Composer\Config;
  22307. use Composer\EventDispatcher\EventDispatcher;
  22308. use Composer\Package\PackageInterface;
  22309. use Composer\Util\RemoteFilesystem;
  22310. class RepositoryManager
  22311. {
  22312. private $localRepository;
  22313. private $repositories = array();
  22314. private $repositoryClasses = array();
  22315. private $io;
  22316. private $config;
  22317. private $eventDispatcher;
  22318. private $rfs;
  22319. public function __construct(IOInterface $io, Config $config, EventDispatcher $eventDispatcher = null, RemoteFilesystem $rfs = null)
  22320. {
  22321. $this->io = $io;
  22322. $this->config = $config;
  22323. $this->eventDispatcher = $eventDispatcher;
  22324. $this->rfs = $rfs;
  22325. }
  22326. public function findPackage($name, $constraint)
  22327. {
  22328. foreach ($this->repositories as $repository) {
  22329. if ($package = $repository->findPackage($name, $constraint)) {
  22330. return $package;
  22331. }
  22332. }
  22333. return null;
  22334. }
  22335. public function findPackages($name, $constraint)
  22336. {
  22337. $packages = array();
  22338. foreach ($this->getRepositories() as $repository) {
  22339. $packages = array_merge($packages, $repository->findPackages($name, $constraint));
  22340. }
  22341. return $packages;
  22342. }
  22343. public function addRepository(RepositoryInterface $repository)
  22344. {
  22345. $this->repositories[] = $repository;
  22346. }
  22347. public function prependRepository(RepositoryInterface $repository)
  22348. {
  22349. array_unshift($this->repositories, $repository);
  22350. }
  22351. public function createRepository($type, $config, $name = null)
  22352. {
  22353. if (!isset($this->repositoryClasses[$type])) {
  22354. throw new \InvalidArgumentException('Repository type is not registered: '.$type);
  22355. }
  22356. if (isset($config['packagist']) && false === $config['packagist']) {
  22357. $this->io->writeError('<warning>Repository "'.$name.'" ('.json_encode($config).') has a packagist key which should be in its own repository definition</warning>');
  22358. }
  22359. $class = $this->repositoryClasses[$type];
  22360. $reflMethod = new \ReflectionMethod($class, '__construct');
  22361. $params = $reflMethod->getParameters();
  22362. if (isset($params[4]) && $params[4]->getClass() && $params[4]->getClass()->getName() === 'Composer\Util\RemoteFilesystem') {
  22363. return new $class($config, $this->io, $this->config, $this->eventDispatcher, $this->rfs);
  22364. }
  22365. return new $class($config, $this->io, $this->config, $this->eventDispatcher);
  22366. }
  22367. public function setRepositoryClass($type, $class)
  22368. {
  22369. $this->repositoryClasses[$type] = $class;
  22370. }
  22371. public function getRepositories()
  22372. {
  22373. return $this->repositories;
  22374. }
  22375. public function setLocalRepository(WritableRepositoryInterface $repository)
  22376. {
  22377. $this->localRepository = $repository;
  22378. }
  22379. public function getLocalRepository()
  22380. {
  22381. return $this->localRepository;
  22382. }
  22383. }
  22384. <?php
  22385. namespace Composer\Repository;
  22386. class RepositorySecurityException extends \Exception
  22387. {
  22388. }
  22389. <?php
  22390. namespace Composer\Repository\Vcs;
  22391. use Composer\Cache;
  22392. use Composer\Downloader\TransportException;
  22393. use Composer\Json\JsonFile;
  22394. use Composer\Util\Bitbucket;
  22395. abstract class BitbucketDriver extends VcsDriver
  22396. {
  22397. protected $cache;
  22398. protected $owner;
  22399. protected $repository;
  22400. protected $hasIssues;
  22401. protected $rootIdentifier;
  22402. protected $tags;
  22403. protected $branches;
  22404. protected $infoCache = array();
  22405. protected $branchesUrl = '';
  22406. protected $tagsUrl = '';
  22407. protected $homeUrl = '';
  22408. protected $website = '';
  22409. protected $cloneHttpsUrl = '';
  22410. protected $fallbackDriver;
  22411. protected $vcsType;
  22412. public function initialize()
  22413. {
  22414. preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+?)(\.git|/?)$#i', $this->url, $match);
  22415. $this->owner = $match[1];
  22416. $this->repository = $match[2];
  22417. $this->originUrl = 'bitbucket.org';
  22418. $this->cache = new Cache(
  22419. $this->io,
  22420. implode('/', array(
  22421. $this->config->get('cache-repo-dir'),
  22422. $this->originUrl,
  22423. $this->owner,
  22424. $this->repository,
  22425. ))
  22426. );
  22427. }
  22428. public function getUrl()
  22429. {
  22430. if ($this->fallbackDriver) {
  22431. return $this->fallbackDriver->getUrl();
  22432. }
  22433. return $this->cloneHttpsUrl;
  22434. }
  22435. protected function getRepoData()
  22436. {
  22437. $resource = sprintf(
  22438. 'https://api.bitbucket.org/2.0/repositories/%s/%s?%s',
  22439. $this->owner,
  22440. $this->repository,
  22441. http_build_query(
  22442. array('fields' => '-project,-owner'),
  22443. null,
  22444. '&'
  22445. )
  22446. );
  22447. $repoData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource, true), $resource);
  22448. if ($this->fallbackDriver) {
  22449. return false;
  22450. }
  22451. $this->parseCloneUrls($repoData['links']['clone']);
  22452. $this->hasIssues = !empty($repoData['has_issues']);
  22453. $this->branchesUrl = $repoData['links']['branches']['href'];
  22454. $this->tagsUrl = $repoData['links']['tags']['href'];
  22455. $this->homeUrl = $repoData['links']['html']['href'];
  22456. $this->website = $repoData['website'];
  22457. $this->vcsType = $repoData['scm'];
  22458. return true;
  22459. }
  22460. public function getComposerInformation($identifier)
  22461. {
  22462. if ($this->fallbackDriver) {
  22463. return $this->fallbackDriver->getComposerInformation($identifier);
  22464. }
  22465. if (!isset($this->infoCache[$identifier])) {
  22466. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  22467. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  22468. }
  22469. $composer = $this->getBaseComposerInformation($identifier);
  22470. if ($composer) {
  22471. if (!isset($composer['support']['source'])) {
  22472. $label = array_search(
  22473. $identifier,
  22474. $this->getTags()
  22475. ) ?: array_search(
  22476. $identifier,
  22477. $this->getBranches()
  22478. ) ?: $identifier;
  22479. if (array_key_exists($label, $tags = $this->getTags())) {
  22480. $hash = $tags[$label];
  22481. } elseif (array_key_exists($label, $branches = $this->getBranches())) {
  22482. $hash = $branches[$label];
  22483. }
  22484. if (! isset($hash)) {
  22485. $composer['support']['source'] = sprintf(
  22486. 'https://%s/%s/%s/src',
  22487. $this->originUrl,
  22488. $this->owner,
  22489. $this->repository
  22490. );
  22491. } else {
  22492. $composer['support']['source'] = sprintf(
  22493. 'https://%s/%s/%s/src/%s/?at=%s',
  22494. $this->originUrl,
  22495. $this->owner,
  22496. $this->repository,
  22497. $hash,
  22498. $label
  22499. );
  22500. }
  22501. }
  22502. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  22503. $composer['support']['issues'] = sprintf(
  22504. 'https://%s/%s/%s/issues',
  22505. $this->originUrl,
  22506. $this->owner,
  22507. $this->repository
  22508. );
  22509. }
  22510. if (!isset($composer['homepage'])) {
  22511. $composer['homepage'] = empty($this->website) ? $this->homeUrl : $this->website;
  22512. }
  22513. }
  22514. $this->infoCache[$identifier] = $composer;
  22515. if ($this->shouldCache($identifier)) {
  22516. $this->cache->write($identifier, json_encode($composer));
  22517. }
  22518. }
  22519. return $this->infoCache[$identifier];
  22520. }
  22521. public function getFileContent($file, $identifier)
  22522. {
  22523. if ($this->fallbackDriver) {
  22524. return $this->fallbackDriver->getFileContent($file, $identifier);
  22525. }
  22526. if (strpos($identifier, '/') !== false) {
  22527. $branches = $this->getBranches();
  22528. if (isset($branches[$identifier])) {
  22529. $identifier = $branches[$identifier];
  22530. }
  22531. }
  22532. $resource = sprintf(
  22533. 'https://api.bitbucket.org/2.0/repositories/%s/%s/src/%s/%s',
  22534. $this->owner,
  22535. $this->repository,
  22536. $identifier,
  22537. $file
  22538. );
  22539. return $this->getContentsWithOAuthCredentials($resource);
  22540. }
  22541. public function getChangeDate($identifier)
  22542. {
  22543. if ($this->fallbackDriver) {
  22544. return $this->fallbackDriver->getChangeDate($identifier);
  22545. }
  22546. if (strpos($identifier, '/') !== false) {
  22547. $branches = $this->getBranches();
  22548. if (isset($branches[$identifier])) {
  22549. $identifier = $branches[$identifier];
  22550. }
  22551. }
  22552. $resource = sprintf(
  22553. 'https://api.bitbucket.org/2.0/repositories/%s/%s/commit/%s?fields=date',
  22554. $this->owner,
  22555. $this->repository,
  22556. $identifier
  22557. );
  22558. $commit = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22559. return new \DateTime($commit['date']);
  22560. }
  22561. public function getSource($identifier)
  22562. {
  22563. if ($this->fallbackDriver) {
  22564. return $this->fallbackDriver->getSource($identifier);
  22565. }
  22566. return array('type' => $this->vcsType, 'url' => $this->getUrl(), 'reference' => $identifier);
  22567. }
  22568. public function getDist($identifier)
  22569. {
  22570. if ($this->fallbackDriver) {
  22571. return $this->fallbackDriver->getDist($identifier);
  22572. }
  22573. $url = sprintf(
  22574. 'https://bitbucket.org/%s/%s/get/%s.zip',
  22575. $this->owner,
  22576. $this->repository,
  22577. $identifier
  22578. );
  22579. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  22580. }
  22581. public function getTags()
  22582. {
  22583. if ($this->fallbackDriver) {
  22584. return $this->fallbackDriver->getTags();
  22585. }
  22586. if (null === $this->tags) {
  22587. $this->tags = array();
  22588. $resource = sprintf(
  22589. '%s?%s',
  22590. $this->tagsUrl,
  22591. http_build_query(
  22592. array(
  22593. 'pagelen' => 100,
  22594. 'fields' => 'values.name,values.target.hash,next',
  22595. 'sort' => '-target.date',
  22596. ),
  22597. null,
  22598. '&'
  22599. )
  22600. );
  22601. $hasNext = true;
  22602. while ($hasNext) {
  22603. $tagsData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22604. foreach ($tagsData['values'] as $data) {
  22605. $this->tags[$data['name']] = $data['target']['hash'];
  22606. }
  22607. if (empty($tagsData['next'])) {
  22608. $hasNext = false;
  22609. } else {
  22610. $resource = $tagsData['next'];
  22611. }
  22612. }
  22613. if ($this->vcsType === 'hg') {
  22614. unset($this->tags['tip']);
  22615. }
  22616. }
  22617. return $this->tags;
  22618. }
  22619. public function getBranches()
  22620. {
  22621. if ($this->fallbackDriver) {
  22622. return $this->fallbackDriver->getBranches();
  22623. }
  22624. if (null === $this->branches) {
  22625. $this->branches = array();
  22626. $resource = sprintf(
  22627. '%s?%s',
  22628. $this->branchesUrl,
  22629. http_build_query(
  22630. array(
  22631. 'pagelen' => 100,
  22632. 'fields' => 'values.name,values.target.hash,values.heads,next',
  22633. 'sort' => '-target.date',
  22634. ),
  22635. null,
  22636. '&'
  22637. )
  22638. );
  22639. $hasNext = true;
  22640. while ($hasNext) {
  22641. $branchData = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22642. foreach ($branchData['values'] as $data) {
  22643. if ($this->vcsType === 'hg' && empty($data['heads'])) {
  22644. continue;
  22645. }
  22646. $this->branches[$data['name']] = $data['target']['hash'];
  22647. }
  22648. if (empty($branchData['next'])) {
  22649. $hasNext = false;
  22650. } else {
  22651. $resource = $branchData['next'];
  22652. }
  22653. }
  22654. }
  22655. return $this->branches;
  22656. }
  22657. protected function getContentsWithOAuthCredentials($url, $fetchingRepoData = false)
  22658. {
  22659. try {
  22660. return parent::getContents($url);
  22661. } catch (TransportException $e) {
  22662. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process, $this->remoteFilesystem);
  22663. if (403 === $e->getCode() || (401 === $e->getCode() && strpos($e->getMessage(), 'Could not authenticate against') === 0)) {
  22664. if (!$this->io->hasAuthentication($this->originUrl)
  22665. && $bitbucketUtil->authorizeOAuth($this->originUrl)
  22666. ) {
  22667. return parent::getContents($url);
  22668. }
  22669. if (!$this->io->isInteractive() && $fetchingRepoData) {
  22670. return $this->attemptCloneFallback();
  22671. }
  22672. }
  22673. throw $e;
  22674. }
  22675. }
  22676. abstract protected function generateSshUrl();
  22677. protected function attemptCloneFallback()
  22678. {
  22679. try {
  22680. $this->setupFallbackDriver($this->generateSshUrl());
  22681. } catch (\RuntimeException $e) {
  22682. $this->fallbackDriver = null;
  22683. $this->io->writeError(
  22684. '<error>Failed to clone the ' . $this->generateSshUrl() . ' repository, try running in interactive mode'
  22685. . ' so that you can enter your Bitbucket OAuth consumer credentials</error>'
  22686. );
  22687. throw $e;
  22688. }
  22689. }
  22690. abstract protected function setupFallbackDriver($url);
  22691. protected function parseCloneUrls(array $cloneLinks)
  22692. {
  22693. foreach ($cloneLinks as $cloneLink) {
  22694. if ($cloneLink['name'] === 'https') {
  22695. $this->cloneHttpsUrl = preg_replace('/https:\/\/([^@]+@)?/', 'https://', $cloneLink['href']);
  22696. }
  22697. }
  22698. }
  22699. protected function getMainBranchData()
  22700. {
  22701. $resource = sprintf(
  22702. 'https://api.bitbucket.org/2.0/repositories/%s/%s?fields=mainbranch',
  22703. $this->owner,
  22704. $this->repository
  22705. );
  22706. $data = JsonFile::parseJson($this->getContentsWithOAuthCredentials($resource), $resource);
  22707. if (isset($data['mainbranch'])) {
  22708. return $data['mainbranch'];
  22709. }
  22710. return null;
  22711. }
  22712. }
  22713. <?php
  22714. namespace Composer\Repository\Vcs;
  22715. use Composer\Cache;
  22716. use Composer\Config;
  22717. use Composer\Util\ProcessExecutor;
  22718. use Composer\Util\Filesystem;
  22719. use Composer\IO\IOInterface;
  22720. class FossilDriver extends VcsDriver
  22721. {
  22722. protected $tags;
  22723. protected $branches;
  22724. protected $rootIdentifier;
  22725. protected $repoFile;
  22726. protected $checkoutDir;
  22727. protected $infoCache = array();
  22728. public function initialize()
  22729. {
  22730. $this->checkFossil();
  22731. $this->config->prohibitUrlByConfig($this->url, $this->io);
  22732. if (Filesystem::isLocalPath($this->url) && is_dir($this->url)) {
  22733. $this->checkoutDir = $this->url;
  22734. } else {
  22735. if (!Cache::isUsable($this->config->get('cache-repo-dir')) || !Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  22736. throw new \RuntimeException('FossilDriver requires a usable cache directory, and it looks like you set it to be disabled');
  22737. }
  22738. $localName = preg_replace('{[^a-z0-9]}i', '-', $this->url);
  22739. $this->repoFile = $this->config->get('cache-repo-dir') . '/' . $localName . '.fossil';
  22740. $this->checkoutDir = $this->config->get('cache-vcs-dir') . '/' . $localName . '/';
  22741. $this->updateLocalRepo();
  22742. }
  22743. $this->getTags();
  22744. $this->getBranches();
  22745. }
  22746. protected function checkFossil()
  22747. {
  22748. if (0 !== $this->process->execute('fossil version', $ignoredOutput)) {
  22749. throw new \RuntimeException("fossil was not found, check that it is installed and in your PATH env.\n\n" . $this->process->getErrorOutput());
  22750. }
  22751. }
  22752. protected function updateLocalRepo()
  22753. {
  22754. $fs = new Filesystem();
  22755. $fs->ensureDirectoryExists($this->checkoutDir);
  22756. if (!is_writable(dirname($this->checkoutDir))) {
  22757. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$this->checkoutDir.'" directory is not writable by the current user.');
  22758. }
  22759. if (is_file($this->repoFile) && is_dir($this->checkoutDir) && 0 === $this->process->execute('fossil info', $output, $this->checkoutDir)) {
  22760. if (0 !== $this->process->execute('fossil pull', $output, $this->checkoutDir)) {
  22761. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  22762. }
  22763. } else {
  22764. $fs->removeDirectory($this->checkoutDir);
  22765. $fs->remove($this->repoFile);
  22766. $fs->ensureDirectoryExists($this->checkoutDir);
  22767. if (0 !== $this->process->execute(sprintf('fossil clone %s %s', ProcessExecutor::escape($this->url), ProcessExecutor::escape($this->repoFile)), $output)) {
  22768. $output = $this->process->getErrorOutput();
  22769. throw new \RuntimeException('Failed to clone '.$this->url.' to repository ' . $this->repoFile . "\n\n" .$output);
  22770. }
  22771. if (0 !== $this->process->execute(sprintf('fossil open %s --nested', ProcessExecutor::escape($this->repoFile)), $output, $this->checkoutDir)) {
  22772. $output = $this->process->getErrorOutput();
  22773. throw new \RuntimeException('Failed to open repository '.$this->repoFile.' in ' . $this->checkoutDir . "\n\n" .$output);
  22774. }
  22775. }
  22776. }
  22777. public function getRootIdentifier()
  22778. {
  22779. if (null === $this->rootIdentifier) {
  22780. $this->rootIdentifier = 'trunk';
  22781. }
  22782. return $this->rootIdentifier;
  22783. }
  22784. public function getUrl()
  22785. {
  22786. return $this->url;
  22787. }
  22788. public function getSource($identifier)
  22789. {
  22790. return array('type' => 'fossil', 'url' => $this->getUrl(), 'reference' => $identifier);
  22791. }
  22792. public function getDist($identifier)
  22793. {
  22794. return null;
  22795. }
  22796. public function getFileContent($file, $identifier)
  22797. {
  22798. $command = sprintf('fossil cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22799. $this->process->execute($command, $content, $this->checkoutDir);
  22800. if (!trim($content)) {
  22801. return null;
  22802. }
  22803. return $content;
  22804. }
  22805. public function getChangeDate($identifier)
  22806. {
  22807. $this->process->execute('fossil finfo -b -n 1 composer.json', $output, $this->checkoutDir);
  22808. list($ckout, $date, $message) = explode(' ', trim($output), 3);
  22809. return new \DateTime($date, new \DateTimeZone('UTC'));
  22810. }
  22811. public function getTags()
  22812. {
  22813. if (null === $this->tags) {
  22814. $tags = array();
  22815. $this->process->execute('fossil tag list', $output, $this->checkoutDir);
  22816. foreach ($this->process->splitLines($output) as $tag) {
  22817. $tags[$tag] = $tag;
  22818. }
  22819. $this->tags = $tags;
  22820. }
  22821. return $this->tags;
  22822. }
  22823. public function getBranches()
  22824. {
  22825. if (null === $this->branches) {
  22826. $branches = array();
  22827. $bookmarks = array();
  22828. $this->process->execute('fossil branch list', $output, $this->checkoutDir);
  22829. foreach ($this->process->splitLines($output) as $branch) {
  22830. $branch = trim(preg_replace('/^\*/', '', trim($branch)));
  22831. $branches[$branch] = $branch;
  22832. }
  22833. $this->branches = $branches;
  22834. }
  22835. return $this->branches;
  22836. }
  22837. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22838. {
  22839. if (preg_match('#(^(?:https?|ssh)://(?:[^@]@)?(?:chiselapp\.com|fossil\.))#i', $url)) {
  22840. return true;
  22841. }
  22842. if (preg_match('!/fossil/|\.fossil!', $url)) {
  22843. return true;
  22844. }
  22845. if (Filesystem::isLocalPath($url)) {
  22846. $url = Filesystem::getPlatformPath($url);
  22847. if (!is_dir($url)) {
  22848. return false;
  22849. }
  22850. $process = new ProcessExecutor($io);
  22851. if ($process->execute('fossil info', $output, $url) === 0) {
  22852. return true;
  22853. }
  22854. }
  22855. return false;
  22856. }
  22857. }
  22858. <?php
  22859. namespace Composer\Repository\Vcs;
  22860. use Composer\Config;
  22861. use Composer\IO\IOInterface;
  22862. class GitBitbucketDriver extends BitbucketDriver
  22863. {
  22864. public function getRootIdentifier()
  22865. {
  22866. if ($this->fallbackDriver) {
  22867. return $this->fallbackDriver->getRootIdentifier();
  22868. }
  22869. if (null === $this->rootIdentifier) {
  22870. if (! $this->getRepoData()) {
  22871. return $this->fallbackDriver->getRootIdentifier();
  22872. }
  22873. if ($this->vcsType !== 'git') {
  22874. throw new \RuntimeException(
  22875. $this->url.' does not appear to be a git repository, use '.
  22876. $this->cloneHttpsUrl.' if this is a mercurial bitbucket repository'
  22877. );
  22878. }
  22879. $mainBranchData = $this->getMainBranchData();
  22880. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'master';
  22881. }
  22882. return $this->rootIdentifier;
  22883. }
  22884. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  22885. {
  22886. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/(.+?)\.git$#i', $url)) {
  22887. return false;
  22888. }
  22889. if (!extension_loaded('openssl')) {
  22890. $io->writeError('Skipping Bitbucket git driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  22891. return false;
  22892. }
  22893. return true;
  22894. }
  22895. protected function setupFallbackDriver($url)
  22896. {
  22897. $this->fallbackDriver = new GitDriver(
  22898. array('url' => $url),
  22899. $this->io,
  22900. $this->config,
  22901. $this->process,
  22902. $this->remoteFilesystem
  22903. );
  22904. $this->fallbackDriver->initialize();
  22905. }
  22906. protected function generateSshUrl()
  22907. {
  22908. return 'git@' . $this->originUrl . ':' . $this->owner.'/'.$this->repository.'.git';
  22909. }
  22910. }
  22911. <?php
  22912. namespace Composer\Repository\Vcs;
  22913. use Composer\Util\ProcessExecutor;
  22914. use Composer\Util\Filesystem;
  22915. use Composer\Util\Git as GitUtil;
  22916. use Composer\IO\IOInterface;
  22917. use Composer\Cache;
  22918. use Composer\Config;
  22919. class GitDriver extends VcsDriver
  22920. {
  22921. protected $cache;
  22922. protected $tags;
  22923. protected $branches;
  22924. protected $rootIdentifier;
  22925. protected $repoDir;
  22926. protected $infoCache = array();
  22927. public function initialize()
  22928. {
  22929. if (Filesystem::isLocalPath($this->url)) {
  22930. $this->url = preg_replace('{[\\/]\.git/?$}', '', $this->url);
  22931. $this->repoDir = $this->url;
  22932. $cacheUrl = realpath($this->url);
  22933. } else {
  22934. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  22935. throw new \RuntimeException('GitDriver requires a usable cache directory, and it looks like you set it to be disabled');
  22936. }
  22937. $this->repoDir = $this->config->get('cache-vcs-dir') . '/' . preg_replace('{[^a-z0-9.]}i', '-', $this->url) . '/';
  22938. GitUtil::cleanEnv();
  22939. $fs = new Filesystem();
  22940. $fs->ensureDirectoryExists(dirname($this->repoDir));
  22941. if (!is_writable(dirname($this->repoDir))) {
  22942. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.dirname($this->repoDir).'" directory is not writable by the current user.');
  22943. }
  22944. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $this->url)) {
  22945. 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.');
  22946. }
  22947. $gitUtil = new GitUtil($this->io, $this->config, $this->process, $fs);
  22948. if (!$gitUtil->syncMirror($this->url, $this->repoDir)) {
  22949. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated</error>');
  22950. }
  22951. $cacheUrl = $this->url;
  22952. }
  22953. $this->getTags();
  22954. $this->getBranches();
  22955. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $cacheUrl));
  22956. }
  22957. public function getRootIdentifier()
  22958. {
  22959. if (null === $this->rootIdentifier) {
  22960. $this->rootIdentifier = 'master';
  22961. $this->process->execute('git branch --no-color', $output, $this->repoDir);
  22962. $branches = $this->process->splitLines($output);
  22963. if (!in_array('* master', $branches)) {
  22964. foreach ($branches as $branch) {
  22965. if ($branch && preg_match('{^\* +(\S+)}', $branch, $match)) {
  22966. $this->rootIdentifier = $match[1];
  22967. break;
  22968. }
  22969. }
  22970. }
  22971. }
  22972. return $this->rootIdentifier;
  22973. }
  22974. public function getUrl()
  22975. {
  22976. return $this->url;
  22977. }
  22978. public function getSource($identifier)
  22979. {
  22980. return array('type' => 'git', 'url' => $this->getUrl(), 'reference' => $identifier);
  22981. }
  22982. public function getDist($identifier)
  22983. {
  22984. return null;
  22985. }
  22986. public function getFileContent($file, $identifier)
  22987. {
  22988. $resource = sprintf('%s:%s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  22989. $this->process->execute(sprintf('git show %s', $resource), $content, $this->repoDir);
  22990. if (!trim($content)) {
  22991. return null;
  22992. }
  22993. return $content;
  22994. }
  22995. public function getChangeDate($identifier)
  22996. {
  22997. $this->process->execute(sprintf(
  22998. 'git log -1 --format=%%at %s',
  22999. ProcessExecutor::escape($identifier)
  23000. ), $output, $this->repoDir);
  23001. return new \DateTime('@'.trim($output), new \DateTimeZone('UTC'));
  23002. }
  23003. public function getTags()
  23004. {
  23005. if (null === $this->tags) {
  23006. $this->tags = array();
  23007. $this->process->execute('git show-ref --tags --dereference', $output, $this->repoDir);
  23008. foreach ($output = $this->process->splitLines($output) as $tag) {
  23009. if ($tag && preg_match('{^([a-f0-9]{40}) refs/tags/(\S+?)(\^\{\})?$}', $tag, $match)) {
  23010. $this->tags[$match[2]] = $match[1];
  23011. }
  23012. }
  23013. }
  23014. return $this->tags;
  23015. }
  23016. public function getBranches()
  23017. {
  23018. if (null === $this->branches) {
  23019. $branches = array();
  23020. $this->process->execute('git branch --no-color --no-abbrev -v', $output, $this->repoDir);
  23021. foreach ($this->process->splitLines($output) as $branch) {
  23022. if ($branch && !preg_match('{^ *[^/]+/HEAD }', $branch)) {
  23023. if (preg_match('{^(?:\* )? *(\S+) *([a-f0-9]+)(?: .*)?$}', $branch, $match)) {
  23024. $branches[$match[1]] = $match[2];
  23025. }
  23026. }
  23027. }
  23028. $this->branches = $branches;
  23029. }
  23030. return $this->branches;
  23031. }
  23032. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23033. {
  23034. if (preg_match('#(^git://|\.git/?$|git(?:olite)?@|//git\.|//github.com/)#i', $url)) {
  23035. return true;
  23036. }
  23037. if (Filesystem::isLocalPath($url)) {
  23038. $url = Filesystem::getPlatformPath($url);
  23039. if (!is_dir($url)) {
  23040. return false;
  23041. }
  23042. $process = new ProcessExecutor($io);
  23043. if ($process->execute('git tag', $output, $url) === 0) {
  23044. return true;
  23045. }
  23046. }
  23047. if (!$deep) {
  23048. return false;
  23049. }
  23050. $process = new ProcessExecutor($io);
  23051. return $process->execute('git ls-remote --heads ' . ProcessExecutor::escape($url), $output) === 0;
  23052. }
  23053. }
  23054. <?php
  23055. namespace Composer\Repository\Vcs;
  23056. use Composer\Config;
  23057. use Composer\Downloader\TransportException;
  23058. use Composer\Json\JsonFile;
  23059. use Composer\Cache;
  23060. use Composer\IO\IOInterface;
  23061. use Composer\Util\GitHub;
  23062. class GitHubDriver extends VcsDriver
  23063. {
  23064. protected $cache;
  23065. protected $owner;
  23066. protected $repository;
  23067. protected $tags;
  23068. protected $branches;
  23069. protected $rootIdentifier;
  23070. protected $repoData;
  23071. protected $hasIssues;
  23072. protected $infoCache = array();
  23073. protected $isPrivate = false;
  23074. protected $gitDriver;
  23075. public function initialize()
  23076. {
  23077. preg_match('#^(?:(?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $this->url, $match);
  23078. $this->owner = $match[3];
  23079. $this->repository = $match[4];
  23080. $this->originUrl = strtolower(!empty($match[1]) ? $match[1] : $match[2]);
  23081. if ($this->originUrl === 'www.github.com') {
  23082. $this->originUrl = 'github.com';
  23083. }
  23084. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->owner.'/'.$this->repository);
  23085. if ( $this->config->get('use-github-api') === false || (isset($this->repoConfig['no-api']) && $this->repoConfig['no-api'] ) ){
  23086. $this->setupGitDriver($this->url);
  23087. return;
  23088. }
  23089. $this->fetchRootIdentifier();
  23090. }
  23091. public function getRepositoryUrl()
  23092. {
  23093. return 'https://'.$this->originUrl.'/'.$this->owner.'/'.$this->repository;
  23094. }
  23095. public function getRootIdentifier()
  23096. {
  23097. if ($this->gitDriver) {
  23098. return $this->gitDriver->getRootIdentifier();
  23099. }
  23100. return $this->rootIdentifier;
  23101. }
  23102. public function getUrl()
  23103. {
  23104. if ($this->gitDriver) {
  23105. return $this->gitDriver->getUrl();
  23106. }
  23107. return 'https://' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23108. }
  23109. protected function getApiUrl()
  23110. {
  23111. if ('github.com' === $this->originUrl) {
  23112. $apiUrl = 'api.github.com';
  23113. } else {
  23114. $apiUrl = $this->originUrl . '/api/v3';
  23115. }
  23116. return 'https://' . $apiUrl;
  23117. }
  23118. public function getSource($identifier)
  23119. {
  23120. if ($this->gitDriver) {
  23121. return $this->gitDriver->getSource($identifier);
  23122. }
  23123. if ($this->isPrivate) {
  23124. $url = $this->generateSshUrl();
  23125. } else {
  23126. $url = $this->getUrl();
  23127. }
  23128. return array('type' => 'git', 'url' => $url, 'reference' => $identifier);
  23129. }
  23130. public function getDist($identifier)
  23131. {
  23132. $url = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/zipball/'.$identifier;
  23133. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23134. }
  23135. public function getComposerInformation($identifier)
  23136. {
  23137. if ($this->gitDriver) {
  23138. return $this->gitDriver->getComposerInformation($identifier);
  23139. }
  23140. if (!isset($this->infoCache[$identifier])) {
  23141. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  23142. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  23143. }
  23144. $composer = $this->getBaseComposerInformation($identifier);
  23145. if ($composer) {
  23146. if (!isset($composer['support']['source'])) {
  23147. $label = array_search($identifier, $this->getTags()) ?: array_search($identifier, $this->getBranches()) ?: $identifier;
  23148. $composer['support']['source'] = sprintf('https://%s/%s/%s/tree/%s', $this->originUrl, $this->owner, $this->repository, $label);
  23149. }
  23150. if (!isset($composer['support']['issues']) && $this->hasIssues) {
  23151. $composer['support']['issues'] = sprintf('https://%s/%s/%s/issues', $this->originUrl, $this->owner, $this->repository);
  23152. }
  23153. }
  23154. if ($this->shouldCache($identifier)) {
  23155. $this->cache->write($identifier, json_encode($composer));
  23156. }
  23157. $this->infoCache[$identifier] = $composer;
  23158. }
  23159. return $this->infoCache[$identifier];
  23160. }
  23161. public function getFileContent($file, $identifier)
  23162. {
  23163. if ($this->gitDriver) {
  23164. return $this->gitDriver->getFileContent($file, $identifier);
  23165. }
  23166. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/contents/' . $file . '?ref='.urlencode($identifier);
  23167. $resource = JsonFile::parseJson($this->getContents($resource));
  23168. if (empty($resource['content']) || $resource['encoding'] !== 'base64' || !($content = base64_decode($resource['content']))) {
  23169. throw new \RuntimeException('Could not retrieve ' . $file . ' for '.$identifier);
  23170. }
  23171. return $content;
  23172. }
  23173. public function getChangeDate($identifier)
  23174. {
  23175. if ($this->gitDriver) {
  23176. return $this->gitDriver->getChangeDate($identifier);
  23177. }
  23178. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/commits/'.urlencode($identifier);
  23179. $commit = JsonFile::parseJson($this->getContents($resource), $resource);
  23180. return new \DateTime($commit['commit']['committer']['date']);
  23181. }
  23182. public function getTags()
  23183. {
  23184. if ($this->gitDriver) {
  23185. return $this->gitDriver->getTags();
  23186. }
  23187. if (null === $this->tags) {
  23188. $this->tags = array();
  23189. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/tags?per_page=100';
  23190. do {
  23191. $tagsData = JsonFile::parseJson($this->getContents($resource), $resource);
  23192. foreach ($tagsData as $tag) {
  23193. $this->tags[$tag['name']] = $tag['commit']['sha'];
  23194. }
  23195. $resource = $this->getNextPage();
  23196. } while ($resource);
  23197. }
  23198. return $this->tags;
  23199. }
  23200. public function getBranches()
  23201. {
  23202. if ($this->gitDriver) {
  23203. return $this->gitDriver->getBranches();
  23204. }
  23205. if (null === $this->branches) {
  23206. $this->branches = array();
  23207. $resource = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository.'/git/refs/heads?per_page=100';
  23208. $branchBlacklist = array('gh-pages');
  23209. do {
  23210. $branchData = JsonFile::parseJson($this->getContents($resource), $resource);
  23211. foreach ($branchData as $branch) {
  23212. $name = substr($branch['ref'], 11);
  23213. if (!in_array($name, $branchBlacklist)) {
  23214. $this->branches[$name] = $branch['object']['sha'];
  23215. }
  23216. }
  23217. $resource = $this->getNextPage();
  23218. } while ($resource);
  23219. }
  23220. return $this->branches;
  23221. }
  23222. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23223. {
  23224. if (!preg_match('#^((?:https?|git)://([^/]+)/|git@([^:]+):/?)([^/]+)/(.+?)(?:\.git|/)?$#', $url, $matches)) {
  23225. return false;
  23226. }
  23227. $originUrl = !empty($matches[2]) ? $matches[2] : $matches[3];
  23228. if (!in_array(strtolower(preg_replace('{^www\.}i', '', $originUrl)), $config->get('github-domains'))) {
  23229. return false;
  23230. }
  23231. if (!extension_loaded('openssl')) {
  23232. $io->writeError('Skipping GitHub driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23233. return false;
  23234. }
  23235. return true;
  23236. }
  23237. public function getRepoData()
  23238. {
  23239. $this->fetchRootIdentifier();
  23240. return $this->repoData;
  23241. }
  23242. protected function generateSshUrl()
  23243. {
  23244. if (false !== strpos($this->originUrl, ':')) {
  23245. return 'ssh://git@' . $this->originUrl . '/'.$this->owner.'/'.$this->repository.'.git';
  23246. }
  23247. return 'git@' . $this->originUrl . ':'.$this->owner.'/'.$this->repository.'.git';
  23248. }
  23249. protected function getContents($url, $fetchingRepoData = false)
  23250. {
  23251. try {
  23252. return parent::getContents($url);
  23253. } catch (TransportException $e) {
  23254. $gitHubUtil = new GitHub($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23255. switch ($e->getCode()) {
  23256. case 401:
  23257. case 404:
  23258. if (!$fetchingRepoData) {
  23259. throw $e;
  23260. }
  23261. if ($gitHubUtil->authorizeOAuth($this->originUrl)) {
  23262. return parent::getContents($url);
  23263. }
  23264. if (!$this->io->isInteractive()) {
  23265. return $this->attemptCloneFallback();
  23266. }
  23267. $scopesIssued = array();
  23268. $scopesNeeded = array();
  23269. if ($headers = $e->getHeaders()) {
  23270. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-OAuth-Scopes')) {
  23271. $scopesIssued = explode(' ', $scopes);
  23272. }
  23273. if ($scopes = $this->remoteFilesystem->findHeaderValue($headers, 'X-Accepted-OAuth-Scopes')) {
  23274. $scopesNeeded = explode(' ', $scopes);
  23275. }
  23276. }
  23277. $scopesFailed = array_diff($scopesNeeded, $scopesIssued);
  23278. if (!$headers || !count($scopesNeeded) || count($scopesFailed)) {
  23279. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'Your GitHub credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23280. }
  23281. return parent::getContents($url);
  23282. case 403:
  23283. if (!$this->io->hasAuthentication($this->originUrl) && $gitHubUtil->authorizeOAuth($this->originUrl)) {
  23284. return parent::getContents($url);
  23285. }
  23286. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23287. return $this->attemptCloneFallback();
  23288. }
  23289. $rateLimited = $gitHubUtil->isRateLimited($e->getHeaders());
  23290. if (!$this->io->hasAuthentication($this->originUrl)) {
  23291. if (!$this->io->isInteractive()) {
  23292. $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>');
  23293. throw $e;
  23294. }
  23295. $gitHubUtil->authorizeOAuthInteractively($this->originUrl, 'API limit exhausted. Enter your GitHub credentials to get a larger API limit (<info>'.$this->url.'</info>)');
  23296. return parent::getContents($url);
  23297. }
  23298. if ($rateLimited) {
  23299. $rateLimit = $gitHubUtil->getRateLimit($e->getHeaders());
  23300. $this->io->writeError(sprintf(
  23301. '<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>',
  23302. $rateLimit['limit'],
  23303. $rateLimit['reset']
  23304. ));
  23305. }
  23306. throw $e;
  23307. default:
  23308. throw $e;
  23309. }
  23310. }
  23311. }
  23312. protected function fetchRootIdentifier()
  23313. {
  23314. if ($this->repoData) {
  23315. return;
  23316. }
  23317. $repoDataUrl = $this->getApiUrl() . '/repos/'.$this->owner.'/'.$this->repository;
  23318. $this->repoData = JsonFile::parseJson($this->getContents($repoDataUrl, true), $repoDataUrl);
  23319. if (null === $this->repoData && null !== $this->gitDriver) {
  23320. return;
  23321. }
  23322. $this->owner = $this->repoData['owner']['login'];
  23323. $this->repository = $this->repoData['name'];
  23324. $this->isPrivate = !empty($this->repoData['private']);
  23325. if (isset($this->repoData['default_branch'])) {
  23326. $this->rootIdentifier = $this->repoData['default_branch'];
  23327. } elseif (isset($this->repoData['master_branch'])) {
  23328. $this->rootIdentifier = $this->repoData['master_branch'];
  23329. } else {
  23330. $this->rootIdentifier = 'master';
  23331. }
  23332. $this->hasIssues = !empty($this->repoData['has_issues']);
  23333. }
  23334. protected function attemptCloneFallback()
  23335. {
  23336. $this->isPrivate = true;
  23337. try {
  23338. $this->setupGitDriver($this->generateSshUrl());
  23339. return;
  23340. } catch (\RuntimeException $e) {
  23341. $this->gitDriver = null;
  23342. $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>');
  23343. throw $e;
  23344. }
  23345. }
  23346. protected function setupGitDriver($url)
  23347. {
  23348. $this->gitDriver = new GitDriver(
  23349. array('url' => $url),
  23350. $this->io,
  23351. $this->config,
  23352. $this->process,
  23353. $this->remoteFilesystem
  23354. );
  23355. $this->gitDriver->initialize();
  23356. }
  23357. protected function getNextPage()
  23358. {
  23359. $headers = $this->remoteFilesystem->getLastHeaders();
  23360. foreach ($headers as $header) {
  23361. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23362. $links = explode(',', $match[1]);
  23363. foreach ($links as $link) {
  23364. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23365. return $match[1];
  23366. }
  23367. }
  23368. }
  23369. }
  23370. }
  23371. }
  23372. <?php
  23373. namespace Composer\Repository\Vcs;
  23374. use Composer\Config;
  23375. use Composer\Cache;
  23376. use Composer\IO\IOInterface;
  23377. use Composer\Json\JsonFile;
  23378. use Composer\Downloader\TransportException;
  23379. use Composer\Util\RemoteFilesystem;
  23380. use Composer\Util\GitLab;
  23381. class GitLabDriver extends VcsDriver
  23382. {
  23383. private $scheme;
  23384. private $namespace;
  23385. private $repository;
  23386. private $project;
  23387. private $commits = array();
  23388. private $tags;
  23389. private $branches;
  23390. protected $gitDriver;
  23391. private $isPrivate = true;
  23392. private $hasNonstandardOrigin = false;
  23393. const URL_REGEX = '#^(?:(?P<scheme>https?)://(?P<domain>.+?)(?::(?P<port>[0-9]+))?/|git@(?P<domain2>[^:]+):)(?P<parts>.+)/(?P<repo>[^/]+?)(?:\.git|/)?$#';
  23394. public function initialize()
  23395. {
  23396. if (!preg_match(self::URL_REGEX, $this->url, $match)) {
  23397. throw new \InvalidArgumentException('The URL provided is invalid. It must be the HTTP URL of a GitLab project.');
  23398. }
  23399. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23400. $configuredDomains = $this->config->get('gitlab-domains');
  23401. $urlParts = explode('/', $match['parts']);
  23402. $this->scheme = !empty($match['scheme'])
  23403. ? $match['scheme']
  23404. : (isset($this->repoConfig['secure-http']) && $this->repoConfig['secure-http'] === false ? 'http' : 'https')
  23405. ;
  23406. $this->originUrl = $this->determineOrigin($configuredDomains, $guessedDomain, $urlParts, $match['port']);
  23407. if (false !== strpos($this->originUrl, ':') || false !== strpos($this->originUrl, '/')) {
  23408. $this->hasNonstandardOrigin = true;
  23409. }
  23410. $this->namespace = implode('/', $urlParts);
  23411. $this->repository = preg_replace('#(\.git)$#', '', $match['repo']);
  23412. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository);
  23413. $this->fetchProject();
  23414. }
  23415. public function setRemoteFilesystem(RemoteFilesystem $remoteFilesystem)
  23416. {
  23417. $this->remoteFilesystem = $remoteFilesystem;
  23418. }
  23419. public function getFileContent($file, $identifier)
  23420. {
  23421. if ($this->gitDriver) {
  23422. return $this->gitDriver->getFileContent($file, $identifier);
  23423. }
  23424. if (!preg_match('{[a-f0-9]{40}}i', $identifier)) {
  23425. $branches = $this->getBranches();
  23426. if (isset($branches[$identifier])) {
  23427. $identifier = $branches[$identifier];
  23428. }
  23429. }
  23430. $resource = $this->getApiUrl().'/repository/files/'.$this->urlEncodeAll($file).'/raw?ref='.$identifier;
  23431. try {
  23432. $content = $this->getContents($resource);
  23433. } catch (TransportException $e) {
  23434. if ($e->getCode() !== 404) {
  23435. throw $e;
  23436. }
  23437. return null;
  23438. }
  23439. return $content;
  23440. }
  23441. public function getChangeDate($identifier)
  23442. {
  23443. if ($this->gitDriver) {
  23444. return $this->gitDriver->getChangeDate($identifier);
  23445. }
  23446. if (isset($this->commits[$identifier])) {
  23447. return new \DateTime($this->commits[$identifier]['committed_date']);
  23448. }
  23449. return new \DateTime();
  23450. }
  23451. public function getRepositoryUrl()
  23452. {
  23453. return $this->isPrivate ? $this->project['ssh_url_to_repo'] : $this->project['http_url_to_repo'];
  23454. }
  23455. public function getUrl()
  23456. {
  23457. if ($this->gitDriver) {
  23458. return $this->gitDriver->getUrl();
  23459. }
  23460. return $this->project['web_url'];
  23461. }
  23462. public function getDist($identifier)
  23463. {
  23464. $url = $this->getApiUrl().'/repository/archive.zip?sha='.$identifier;
  23465. return array('type' => 'zip', 'url' => $url, 'reference' => $identifier, 'shasum' => '');
  23466. }
  23467. public function getSource($identifier)
  23468. {
  23469. if ($this->gitDriver) {
  23470. return $this->gitDriver->getSource($identifier);
  23471. }
  23472. return array('type' => 'git', 'url' => $this->getRepositoryUrl(), 'reference' => $identifier);
  23473. }
  23474. public function getRootIdentifier()
  23475. {
  23476. if ($this->gitDriver) {
  23477. return $this->gitDriver->getRootIdentifier();
  23478. }
  23479. return $this->project['default_branch'];
  23480. }
  23481. public function getBranches()
  23482. {
  23483. if ($this->gitDriver) {
  23484. return $this->gitDriver->getBranches();
  23485. }
  23486. if (!$this->branches) {
  23487. $this->branches = $this->getReferences('branches');
  23488. }
  23489. return $this->branches;
  23490. }
  23491. public function getTags()
  23492. {
  23493. if ($this->gitDriver) {
  23494. return $this->gitDriver->getTags();
  23495. }
  23496. if (!$this->tags) {
  23497. $this->tags = $this->getReferences('tags');
  23498. }
  23499. return $this->tags;
  23500. }
  23501. public function getApiUrl()
  23502. {
  23503. return $this->scheme.'://'.$this->originUrl.'/api/v4/projects/'.$this->urlEncodeAll($this->namespace).'%2F'.$this->urlEncodeAll($this->repository);
  23504. }
  23505. private function urlEncodeAll($string)
  23506. {
  23507. $encoded = '';
  23508. for ($i = 0; isset($string[$i]); $i++) {
  23509. $character = $string[$i];
  23510. if (!ctype_alnum($character) && !in_array($character, array('-', '_'), true)) {
  23511. $character = '%' . sprintf('%02X', ord($character));
  23512. }
  23513. $encoded .= $character;
  23514. }
  23515. return $encoded;
  23516. }
  23517. protected function getReferences($type)
  23518. {
  23519. $perPage = 100;
  23520. $resource = $this->getApiUrl().'/repository/'.$type.'?per_page='.$perPage;
  23521. $references = array();
  23522. do {
  23523. $data = JsonFile::parseJson($this->getContents($resource), $resource);
  23524. foreach ($data as $datum) {
  23525. $references[$datum['name']] = $datum['commit']['id'];
  23526. $this->commits[$datum['commit']['id']] = $datum['commit'];
  23527. }
  23528. if (count($data) >= $perPage) {
  23529. $resource = $this->getNextPage();
  23530. } else {
  23531. $resource = false;
  23532. }
  23533. } while ($resource);
  23534. return $references;
  23535. }
  23536. protected function fetchProject()
  23537. {
  23538. $resource = $this->getApiUrl();
  23539. $this->project = JsonFile::parseJson($this->getContents($resource, true), $resource);
  23540. if (isset($this->project['visibility'])) {
  23541. $this->isPrivate = $this->project['visibility'] !== 'public';
  23542. } else {
  23543. $this->isPrivate = false;
  23544. }
  23545. }
  23546. protected function attemptCloneFallback()
  23547. {
  23548. try {
  23549. if ($this->isPrivate === false) {
  23550. $url = $this->generatePublicUrl();
  23551. } else {
  23552. $url = $this->generateSshUrl();
  23553. }
  23554. $this->setupGitDriver($url);
  23555. return;
  23556. } catch (\RuntimeException $e) {
  23557. $this->gitDriver = null;
  23558. $this->io->writeError('<error>Failed to clone the '.$url.' repository, try running in interactive mode so that you can enter your credentials</error>');
  23559. throw $e;
  23560. }
  23561. }
  23562. protected function generateSshUrl()
  23563. {
  23564. if ($this->hasNonstandardOrigin) {
  23565. return 'ssh://git@'.$this->originUrl.'/'.$this->namespace.'/'.$this->repository.'.git';
  23566. }
  23567. return 'git@' . $this->originUrl . ':'.$this->namespace.'/'.$this->repository.'.git';
  23568. }
  23569. protected function generatePublicUrl()
  23570. {
  23571. return $this->scheme . '://' . $this->originUrl . '/'.$this->namespace.'/'.$this->repository.'.git';
  23572. }
  23573. protected function setupGitDriver($url)
  23574. {
  23575. $this->gitDriver = new GitDriver(
  23576. array('url' => $url),
  23577. $this->io,
  23578. $this->config,
  23579. $this->process,
  23580. $this->remoteFilesystem
  23581. );
  23582. $this->gitDriver->initialize();
  23583. }
  23584. protected function getContents($url, $fetchingRepoData = false)
  23585. {
  23586. try {
  23587. $res = parent::getContents($url);
  23588. if ($fetchingRepoData) {
  23589. $json = JsonFile::parseJson($res, $url);
  23590. if (!isset($json['default_branch'])) {
  23591. if (!empty($json['id'])) {
  23592. $this->isPrivate = false;
  23593. }
  23594. throw new TransportException('GitLab API seems to not be authenticated as it did not return a default_branch', 401);
  23595. }
  23596. }
  23597. return $res;
  23598. } catch (TransportException $e) {
  23599. $gitLabUtil = new GitLab($this->io, $this->config, $this->process, $this->remoteFilesystem);
  23600. switch ($e->getCode()) {
  23601. case 401:
  23602. case 404:
  23603. if (!$fetchingRepoData) {
  23604. throw $e;
  23605. }
  23606. if ($gitLabUtil->authorizeOAuth($this->originUrl)) {
  23607. return parent::getContents($url);
  23608. }
  23609. if (!$this->io->isInteractive()) {
  23610. return $this->attemptCloneFallback();
  23611. }
  23612. $this->io->writeError('<warning>Failed to download ' . $this->namespace . '/' . $this->repository . ':' . $e->getMessage() . '</warning>');
  23613. $gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, 'Your credentials are required to fetch private repository metadata (<info>'.$this->url.'</info>)');
  23614. return parent::getContents($url);
  23615. case 403:
  23616. if (!$this->io->hasAuthentication($this->originUrl) && $gitLabUtil->authorizeOAuth($this->originUrl)) {
  23617. return parent::getContents($url);
  23618. }
  23619. if (!$this->io->isInteractive() && $fetchingRepoData) {
  23620. return $this->attemptCloneFallback();
  23621. }
  23622. throw $e;
  23623. default:
  23624. throw $e;
  23625. }
  23626. }
  23627. }
  23628. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23629. {
  23630. if (!preg_match(self::URL_REGEX, $url, $match)) {
  23631. return false;
  23632. }
  23633. $scheme = !empty($match['scheme']) ? $match['scheme'] : null;
  23634. $guessedDomain = !empty($match['domain']) ? $match['domain'] : $match['domain2'];
  23635. $urlParts = explode('/', $match['parts']);
  23636. if (false === self::determineOrigin((array) $config->get('gitlab-domains'), $guessedDomain, $urlParts, $match['port'])) {
  23637. return false;
  23638. }
  23639. if ('https' === $scheme && !extension_loaded('openssl')) {
  23640. $io->writeError('Skipping GitLab driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23641. return false;
  23642. }
  23643. return true;
  23644. }
  23645. private function getNextPage()
  23646. {
  23647. $headers = $this->remoteFilesystem->getLastHeaders();
  23648. foreach ($headers as $header) {
  23649. if (preg_match('{^link:\s*(.+?)\s*$}i', $header, $match)) {
  23650. $links = explode(',', $match[1]);
  23651. foreach ($links as $link) {
  23652. if (preg_match('{<(.+?)>; *rel="next"}', $link, $match)) {
  23653. return $match[1];
  23654. }
  23655. }
  23656. }
  23657. }
  23658. }
  23659. private static function determineOrigin(array $configuredDomains, $guessedDomain, array &$urlParts, $portNumber)
  23660. {
  23661. $guessedDomain = strtolower($guessedDomain);
  23662. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array($guessedDomain.':'.$portNumber, $configuredDomains))) {
  23663. if ($portNumber) {
  23664. return $guessedDomain.':'.$portNumber;
  23665. }
  23666. return $guessedDomain;
  23667. }
  23668. if ($portNumber) {
  23669. $guessedDomain .= ':'.$portNumber;
  23670. }
  23671. while (null !== ($part = array_shift($urlParts))) {
  23672. $guessedDomain .= '/' . $part;
  23673. if (in_array($guessedDomain, $configuredDomains) || ($portNumber && in_array(preg_replace('{:\d+}', '', $guessedDomain), $configuredDomains))) {
  23674. return $guessedDomain;
  23675. }
  23676. }
  23677. return false;
  23678. }
  23679. }
  23680. <?php
  23681. namespace Composer\Repository\Vcs;
  23682. use Composer\Config;
  23683. use Composer\IO\IOInterface;
  23684. class HgBitbucketDriver extends BitbucketDriver
  23685. {
  23686. public function getRootIdentifier()
  23687. {
  23688. if ($this->fallbackDriver) {
  23689. return $this->fallbackDriver->getRootIdentifier();
  23690. }
  23691. if (null === $this->rootIdentifier) {
  23692. if (! $this->getRepoData()) {
  23693. return $this->fallbackDriver->getRootIdentifier();
  23694. }
  23695. if ($this->vcsType !== 'hg') {
  23696. throw new \RuntimeException(
  23697. $this->url.' does not appear to be a mercurial repository, use '.
  23698. $this->cloneHttpsUrl.' if this is a git bitbucket repository'
  23699. );
  23700. }
  23701. $mainBranchData = $this->getMainBranchData();
  23702. $this->rootIdentifier = !empty($mainBranchData['name']) ? $mainBranchData['name'] : 'default';
  23703. }
  23704. return $this->rootIdentifier;
  23705. }
  23706. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23707. {
  23708. if (!preg_match('#^https?://bitbucket\.org/([^/]+)/([^/]+)/?$#i', $url)) {
  23709. return false;
  23710. }
  23711. if (!extension_loaded('openssl')) {
  23712. $io->writeError('Skipping Bitbucket hg driver for '.$url.' because the OpenSSL PHP extension is missing.', true, IOInterface::VERBOSE);
  23713. return false;
  23714. }
  23715. return true;
  23716. }
  23717. protected function setupFallbackDriver($url)
  23718. {
  23719. $this->fallbackDriver = new HgDriver(
  23720. array('url' => $url),
  23721. $this->io,
  23722. $this->config,
  23723. $this->process,
  23724. $this->remoteFilesystem
  23725. );
  23726. $this->fallbackDriver->initialize();
  23727. }
  23728. protected function generateSshUrl()
  23729. {
  23730. return 'ssh://hg@' . $this->originUrl . '/' . $this->owner.'/'.$this->repository;
  23731. }
  23732. }
  23733. <?php
  23734. namespace Composer\Repository\Vcs;
  23735. use Composer\Config;
  23736. use Composer\Cache;
  23737. use Composer\Util\Hg as HgUtils;
  23738. use Composer\Util\ProcessExecutor;
  23739. use Composer\Util\Filesystem;
  23740. use Composer\IO\IOInterface;
  23741. class HgDriver extends VcsDriver
  23742. {
  23743. protected $tags;
  23744. protected $branches;
  23745. protected $rootIdentifier;
  23746. protected $repoDir;
  23747. protected $infoCache = array();
  23748. public function initialize()
  23749. {
  23750. if (Filesystem::isLocalPath($this->url)) {
  23751. $this->repoDir = $this->url;
  23752. } else {
  23753. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23754. throw new \RuntimeException('HgDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23755. }
  23756. $cacheDir = $this->config->get('cache-vcs-dir');
  23757. $this->repoDir = $cacheDir . '/' . preg_replace('{[^a-z0-9]}i', '-', $this->url) . '/';
  23758. $fs = new Filesystem();
  23759. $fs->ensureDirectoryExists($cacheDir);
  23760. if (!is_writable(dirname($this->repoDir))) {
  23761. throw new \RuntimeException('Can not clone '.$this->url.' to access package information. The "'.$cacheDir.'" directory is not writable by the current user.');
  23762. }
  23763. $this->config->prohibitUrlByConfig($this->url, $this->io);
  23764. $hgUtils = new HgUtils($this->io, $this->config, $this->process);
  23765. if (is_dir($this->repoDir) && 0 === $this->process->execute('hg summary', $output, $this->repoDir)) {
  23766. if (0 !== $this->process->execute('hg pull', $output, $this->repoDir)) {
  23767. $this->io->writeError('<error>Failed to update '.$this->url.', package information from this repository may be outdated ('.$this->process->getErrorOutput().')</error>');
  23768. }
  23769. } else {
  23770. $fs->removeDirectory($this->repoDir);
  23771. $repoDir = $this->repoDir;
  23772. $command = function ($url) use ($repoDir) {
  23773. return sprintf('hg clone --noupdate %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($repoDir));
  23774. };
  23775. $hgUtils->runCommand($command, $this->url, null);
  23776. }
  23777. }
  23778. $this->getTags();
  23779. $this->getBranches();
  23780. }
  23781. public function getRootIdentifier()
  23782. {
  23783. if (null === $this->rootIdentifier) {
  23784. $this->process->execute(sprintf('hg tip --template "{node}"'), $output, $this->repoDir);
  23785. $output = $this->process->splitLines($output);
  23786. $this->rootIdentifier = $output[0];
  23787. }
  23788. return $this->rootIdentifier;
  23789. }
  23790. public function getUrl()
  23791. {
  23792. return $this->url;
  23793. }
  23794. public function getSource($identifier)
  23795. {
  23796. return array('type' => 'hg', 'url' => $this->getUrl(), 'reference' => $identifier);
  23797. }
  23798. public function getDist($identifier)
  23799. {
  23800. return null;
  23801. }
  23802. public function getFileContent($file, $identifier)
  23803. {
  23804. $resource = sprintf('hg cat -r %s %s', ProcessExecutor::escape($identifier), ProcessExecutor::escape($file));
  23805. $this->process->execute($resource, $content, $this->repoDir);
  23806. if (!trim($content)) {
  23807. return;
  23808. }
  23809. return $content;
  23810. }
  23811. public function getChangeDate($identifier)
  23812. {
  23813. $this->process->execute(
  23814. sprintf(
  23815. 'hg log --template "{date|rfc3339date}" -r %s',
  23816. ProcessExecutor::escape($identifier)
  23817. ),
  23818. $output,
  23819. $this->repoDir
  23820. );
  23821. return new \DateTime(trim($output), new \DateTimeZone('UTC'));
  23822. }
  23823. public function getTags()
  23824. {
  23825. if (null === $this->tags) {
  23826. $tags = array();
  23827. $this->process->execute('hg tags', $output, $this->repoDir);
  23828. foreach ($this->process->splitLines($output) as $tag) {
  23829. if ($tag && preg_match('(^([^\s]+)\s+\d+:(.*)$)', $tag, $match)) {
  23830. $tags[$match[1]] = $match[2];
  23831. }
  23832. }
  23833. unset($tags['tip']);
  23834. $this->tags = $tags;
  23835. }
  23836. return $this->tags;
  23837. }
  23838. public function getBranches()
  23839. {
  23840. if (null === $this->branches) {
  23841. $branches = array();
  23842. $bookmarks = array();
  23843. $this->process->execute('hg branches', $output, $this->repoDir);
  23844. foreach ($this->process->splitLines($output) as $branch) {
  23845. if ($branch && preg_match('(^([^\s]+)\s+\d+:([a-f0-9]+))', $branch, $match)) {
  23846. $branches[$match[1]] = $match[2];
  23847. }
  23848. }
  23849. $this->process->execute('hg bookmarks', $output, $this->repoDir);
  23850. foreach ($this->process->splitLines($output) as $branch) {
  23851. if ($branch && preg_match('(^(?:[\s*]*)([^\s]+)\s+\d+:(.*)$)', $branch, $match)) {
  23852. $bookmarks[$match[1]] = $match[2];
  23853. }
  23854. }
  23855. $this->branches = array_merge($bookmarks, $branches);
  23856. }
  23857. return $this->branches;
  23858. }
  23859. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23860. {
  23861. if (preg_match('#(^(?:https?|ssh)://(?:[^@]+@)?bitbucket.org|https://(?:.*?)\.kilnhg.com)#i', $url)) {
  23862. return true;
  23863. }
  23864. if (Filesystem::isLocalPath($url)) {
  23865. $url = Filesystem::getPlatformPath($url);
  23866. if (!is_dir($url)) {
  23867. return false;
  23868. }
  23869. $process = new ProcessExecutor($io);
  23870. if ($process->execute('hg summary', $output, $url) === 0) {
  23871. return true;
  23872. }
  23873. }
  23874. if (!$deep) {
  23875. return false;
  23876. }
  23877. $processExecutor = new ProcessExecutor($io);
  23878. $exit = $processExecutor->execute(sprintf('hg identify %s', ProcessExecutor::escape($url)), $ignored);
  23879. return $exit === 0;
  23880. }
  23881. }
  23882. <?php
  23883. namespace Composer\Repository\Vcs;
  23884. use Composer\Config;
  23885. use Composer\Cache;
  23886. use Composer\IO\IOInterface;
  23887. use Composer\Util\ProcessExecutor;
  23888. use Composer\Util\Perforce;
  23889. class PerforceDriver extends VcsDriver
  23890. {
  23891. protected $depot;
  23892. protected $branch;
  23893. protected $perforce;
  23894. public function initialize()
  23895. {
  23896. $this->depot = $this->repoConfig['depot'];
  23897. $this->branch = '';
  23898. if (!empty($this->repoConfig['branch'])) {
  23899. $this->branch = $this->repoConfig['branch'];
  23900. }
  23901. $this->initPerforce($this->repoConfig);
  23902. $this->perforce->p4Login();
  23903. $this->perforce->checkStream();
  23904. $this->perforce->writeP4ClientSpec();
  23905. $this->perforce->connectClient();
  23906. return true;
  23907. }
  23908. private function initPerforce($repoConfig)
  23909. {
  23910. if (!empty($this->perforce)) {
  23911. return;
  23912. }
  23913. if (!Cache::isUsable($this->config->get('cache-vcs-dir'))) {
  23914. throw new \RuntimeException('PerforceDriver requires a usable cache directory, and it looks like you set it to be disabled');
  23915. }
  23916. $repoDir = $this->config->get('cache-vcs-dir') . '/' . $this->depot;
  23917. $this->perforce = Perforce::create($repoConfig, $this->getUrl(), $repoDir, $this->process, $this->io);
  23918. }
  23919. public function getFileContent($file, $identifier)
  23920. {
  23921. return $this->perforce->getFileContent($file, $identifier);
  23922. }
  23923. public function getChangeDate($identifier)
  23924. {
  23925. return null;
  23926. }
  23927. public function getRootIdentifier()
  23928. {
  23929. return $this->branch;
  23930. }
  23931. public function getBranches()
  23932. {
  23933. return $this->perforce->getBranches();
  23934. }
  23935. public function getTags()
  23936. {
  23937. return $this->perforce->getTags();
  23938. }
  23939. public function getDist($identifier)
  23940. {
  23941. return null;
  23942. }
  23943. public function getSource($identifier)
  23944. {
  23945. $source = array(
  23946. 'type' => 'perforce',
  23947. 'url' => $this->repoConfig['url'],
  23948. 'reference' => $identifier,
  23949. 'p4user' => $this->perforce->getUser(),
  23950. );
  23951. return $source;
  23952. }
  23953. public function getUrl()
  23954. {
  23955. return $this->url;
  23956. }
  23957. public function hasComposerFile($identifier)
  23958. {
  23959. $composerInfo = $this->perforce->getComposerInformation('//' . $this->depot . '/' . $identifier);
  23960. $composerInfoIdentifier = $identifier;
  23961. return !empty($composerInfo);
  23962. }
  23963. public function getContents($url)
  23964. {
  23965. return false;
  23966. }
  23967. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  23968. {
  23969. if ($deep || preg_match('#\b(perforce|p4)\b#i', $url)) {
  23970. return Perforce::checkServerExists($url, new ProcessExecutor($io));
  23971. }
  23972. return false;
  23973. }
  23974. public function cleanup()
  23975. {
  23976. $this->perforce->cleanupClientSpec();
  23977. $this->perforce = null;
  23978. }
  23979. public function getDepot()
  23980. {
  23981. return $this->depot;
  23982. }
  23983. public function getBranch()
  23984. {
  23985. return $this->branch;
  23986. }
  23987. }
  23988. <?php
  23989. namespace Composer\Repository\Vcs;
  23990. use Composer\Cache;
  23991. use Composer\Config;
  23992. use Composer\Json\JsonFile;
  23993. use Composer\Util\ProcessExecutor;
  23994. use Composer\Util\Filesystem;
  23995. use Composer\Util\Svn as SvnUtil;
  23996. use Composer\IO\IOInterface;
  23997. use Composer\Downloader\TransportException;
  23998. class SvnDriver extends VcsDriver
  23999. {
  24000. protected $cache;
  24001. protected $baseUrl;
  24002. protected $tags;
  24003. protected $branches;
  24004. protected $rootIdentifier;
  24005. protected $infoCache = array();
  24006. protected $trunkPath = 'trunk';
  24007. protected $branchesPath = 'branches';
  24008. protected $tagsPath = 'tags';
  24009. protected $packagePath = '';
  24010. protected $cacheCredentials = true;
  24011. private $util;
  24012. public function initialize()
  24013. {
  24014. $this->url = $this->baseUrl = rtrim(self::normalizeUrl($this->url), '/');
  24015. SvnUtil::cleanEnv();
  24016. if (isset($this->repoConfig['trunk-path'])) {
  24017. $this->trunkPath = $this->repoConfig['trunk-path'];
  24018. }
  24019. if (isset($this->repoConfig['branches-path'])) {
  24020. $this->branchesPath = $this->repoConfig['branches-path'];
  24021. }
  24022. if (isset($this->repoConfig['tags-path'])) {
  24023. $this->tagsPath = $this->repoConfig['tags-path'];
  24024. }
  24025. if (array_key_exists('svn-cache-credentials', $this->repoConfig)) {
  24026. $this->cacheCredentials = (bool) $this->repoConfig['svn-cache-credentials'];
  24027. }
  24028. if (isset($this->repoConfig['package-path'])) {
  24029. $this->packagePath = '/' . trim($this->repoConfig['package-path'], '/');
  24030. }
  24031. if (false !== ($pos = strrpos($this->url, '/' . $this->trunkPath))) {
  24032. $this->baseUrl = substr($this->url, 0, $pos);
  24033. }
  24034. $this->cache = new Cache($this->io, $this->config->get('cache-repo-dir').'/'.preg_replace('{[^a-z0-9.]}i', '-', $this->baseUrl));
  24035. $this->getBranches();
  24036. $this->getTags();
  24037. }
  24038. public function getRootIdentifier()
  24039. {
  24040. return $this->rootIdentifier ?: $this->trunkPath;
  24041. }
  24042. public function getUrl()
  24043. {
  24044. return $this->url;
  24045. }
  24046. public function getSource($identifier)
  24047. {
  24048. return array('type' => 'svn', 'url' => $this->baseUrl, 'reference' => $identifier);
  24049. }
  24050. public function getDist($identifier)
  24051. {
  24052. return null;
  24053. }
  24054. protected function shouldCache($identifier)
  24055. {
  24056. return $this->cache && preg_match('{@\d+$}', $identifier);
  24057. }
  24058. public function getComposerInformation($identifier)
  24059. {
  24060. if (!isset($this->infoCache[$identifier])) {
  24061. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier.'.json')) {
  24062. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24063. }
  24064. try {
  24065. $composer = $this->getBaseComposerInformation($identifier);
  24066. } catch (TransportException $e) {
  24067. $message = $e->getMessage();
  24068. if (stripos($message, 'path not found') === false && stripos($message, 'svn: warning: W160013') === false) {
  24069. throw $e;
  24070. }
  24071. $composer = '';
  24072. }
  24073. if ($this->shouldCache($identifier)) {
  24074. $this->cache->write($identifier.'.json', json_encode($composer));
  24075. }
  24076. $this->infoCache[$identifier] = $composer;
  24077. }
  24078. return $this->infoCache[$identifier];
  24079. }
  24080. public function getFileContent($file, $identifier)
  24081. {
  24082. $identifier = '/' . trim($identifier, '/') . '/';
  24083. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24084. if (!empty($match[2])) {
  24085. $path = $match[1];
  24086. $rev = $match[2];
  24087. } else {
  24088. $path = $identifier;
  24089. $rev = '';
  24090. }
  24091. try {
  24092. $resource = $path.$file;
  24093. $output = $this->execute('svn cat', $this->baseUrl . $resource . $rev);
  24094. if (!trim($output)) {
  24095. return null;
  24096. }
  24097. } catch (\RuntimeException $e) {
  24098. throw new TransportException($e->getMessage());
  24099. }
  24100. return $output;
  24101. }
  24102. public function getChangeDate($identifier)
  24103. {
  24104. $identifier = '/' . trim($identifier, '/') . '/';
  24105. preg_match('{^(.+?)(@\d+)?/$}', $identifier, $match);
  24106. if (!empty($match[2])) {
  24107. $path = $match[1];
  24108. $rev = $match[2];
  24109. } else {
  24110. $path = $identifier;
  24111. $rev = '';
  24112. }
  24113. $output = $this->execute('svn info', $this->baseUrl . $path . $rev);
  24114. foreach ($this->process->splitLines($output) as $line) {
  24115. if ($line && preg_match('{^Last Changed Date: ([^(]+)}', $line, $match)) {
  24116. return new \DateTime($match[1], new \DateTimeZone('UTC'));
  24117. }
  24118. }
  24119. return null;
  24120. }
  24121. public function getTags()
  24122. {
  24123. if (null === $this->tags) {
  24124. $this->tags = array();
  24125. if ($this->tagsPath !== false) {
  24126. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->tagsPath);
  24127. if ($output) {
  24128. foreach ($this->process->splitLines($output) as $line) {
  24129. $line = trim($line);
  24130. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24131. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24132. $this->tags[rtrim($match[2], '/')] = $this->buildIdentifier(
  24133. '/' . $this->tagsPath . '/' . $match[2],
  24134. $match[1]
  24135. );
  24136. }
  24137. }
  24138. }
  24139. }
  24140. }
  24141. }
  24142. return $this->tags;
  24143. }
  24144. public function getBranches()
  24145. {
  24146. if (null === $this->branches) {
  24147. $this->branches = array();
  24148. if (false === $this->trunkPath) {
  24149. $trunkParent = $this->baseUrl . '/';
  24150. } else {
  24151. $trunkParent = $this->baseUrl . '/' . $this->trunkPath;
  24152. }
  24153. $output = $this->execute('svn ls --verbose', $trunkParent);
  24154. if ($output) {
  24155. foreach ($this->process->splitLines($output) as $line) {
  24156. $line = trim($line);
  24157. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24158. if (isset($match[1]) && isset($match[2]) && $match[2] === './') {
  24159. $this->branches['trunk'] = $this->buildIdentifier(
  24160. '/' . $this->trunkPath,
  24161. $match[1]
  24162. );
  24163. $this->rootIdentifier = $this->branches['trunk'];
  24164. break;
  24165. }
  24166. }
  24167. }
  24168. }
  24169. unset($output);
  24170. if ($this->branchesPath !== false) {
  24171. $output = $this->execute('svn ls --verbose', $this->baseUrl . '/' . $this->branchesPath);
  24172. if ($output) {
  24173. foreach ($this->process->splitLines(trim($output)) as $line) {
  24174. $line = trim($line);
  24175. if ($line && preg_match('{^\s*(\S+).*?(\S+)\s*$}', $line, $match)) {
  24176. if (isset($match[1]) && isset($match[2]) && $match[2] !== './') {
  24177. $this->branches[rtrim($match[2], '/')] = $this->buildIdentifier(
  24178. '/' . $this->branchesPath . '/' . $match[2],
  24179. $match[1]
  24180. );
  24181. }
  24182. }
  24183. }
  24184. }
  24185. }
  24186. }
  24187. return $this->branches;
  24188. }
  24189. public static function supports(IOInterface $io, Config $config, $url, $deep = false)
  24190. {
  24191. $url = self::normalizeUrl($url);
  24192. if (preg_match('#(^svn://|^svn\+ssh://|svn\.)#i', $url)) {
  24193. return true;
  24194. }
  24195. if (!$deep && !Filesystem::isLocalPath($url)) {
  24196. return false;
  24197. }
  24198. $processExecutor = new ProcessExecutor($io);
  24199. $exit = $processExecutor->execute(
  24200. "svn info --non-interactive ".ProcessExecutor::escape($url),
  24201. $ignoredOutput
  24202. );
  24203. if ($exit === 0) {
  24204. return true;
  24205. }
  24206. if (false !== stripos($processExecutor->getErrorOutput(), 'authorization failed:')) {
  24207. return true;
  24208. }
  24209. if (false !== stripos($processExecutor->getErrorOutput(), 'Authentication failed')) {
  24210. return true;
  24211. }
  24212. return false;
  24213. }
  24214. protected static function normalizeUrl($url)
  24215. {
  24216. $fs = new Filesystem();
  24217. if ($fs->isAbsolutePath($url)) {
  24218. return 'file://' . strtr($url, '\\', '/');
  24219. }
  24220. return $url;
  24221. }
  24222. protected function execute($command, $url)
  24223. {
  24224. if (null === $this->util) {
  24225. $this->util = new SvnUtil($this->baseUrl, $this->io, $this->config, $this->process);
  24226. $this->util->setCacheCredentials($this->cacheCredentials);
  24227. }
  24228. try {
  24229. return $this->util->execute($command, $url);
  24230. } catch (\RuntimeException $e) {
  24231. if (null === $this->util->binaryVersion()) {
  24232. 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());
  24233. }
  24234. throw new \RuntimeException(
  24235. 'Repository '.$this->url.' could not be processed, '.$e->getMessage()
  24236. );
  24237. }
  24238. }
  24239. protected function buildIdentifier($baseDir, $revision)
  24240. {
  24241. return rtrim($baseDir, '/') . $this->packagePath . '/@' . $revision;
  24242. }
  24243. }
  24244. <?php
  24245. namespace Composer\Repository\Vcs;
  24246. use Composer\Cache;
  24247. use Composer\Downloader\TransportException;
  24248. use Composer\Config;
  24249. use Composer\Factory;
  24250. use Composer\IO\IOInterface;
  24251. use Composer\Json\JsonFile;
  24252. use Composer\Util\ProcessExecutor;
  24253. use Composer\Util\RemoteFilesystem;
  24254. use Composer\Util\Filesystem;
  24255. abstract class VcsDriver implements VcsDriverInterface
  24256. {
  24257. protected $url;
  24258. protected $originUrl;
  24259. protected $repoConfig;
  24260. protected $io;
  24261. protected $config;
  24262. protected $process;
  24263. protected $remoteFilesystem;
  24264. protected $infoCache = array();
  24265. protected $cache;
  24266. final public function __construct(array $repoConfig, IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  24267. {
  24268. if (Filesystem::isLocalPath($repoConfig['url'])) {
  24269. $repoConfig['url'] = Filesystem::getPlatformPath($repoConfig['url']);
  24270. }
  24271. $this->url = $repoConfig['url'];
  24272. $this->originUrl = $repoConfig['url'];
  24273. $this->repoConfig = $repoConfig;
  24274. $this->io = $io;
  24275. $this->config = $config;
  24276. $this->process = $process ?: new ProcessExecutor($io);
  24277. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24278. }
  24279. protected function shouldCache($identifier)
  24280. {
  24281. return $this->cache && preg_match('{[a-f0-9]{40}}i', $identifier);
  24282. }
  24283. public function getComposerInformation($identifier)
  24284. {
  24285. if (!isset($this->infoCache[$identifier])) {
  24286. if ($this->shouldCache($identifier) && $res = $this->cache->read($identifier)) {
  24287. return $this->infoCache[$identifier] = JsonFile::parseJson($res);
  24288. }
  24289. $composer = $this->getBaseComposerInformation($identifier);
  24290. if ($this->shouldCache($identifier)) {
  24291. $this->cache->write($identifier, json_encode($composer));
  24292. }
  24293. $this->infoCache[$identifier] = $composer;
  24294. }
  24295. return $this->infoCache[$identifier];
  24296. }
  24297. protected function getBaseComposerInformation($identifier)
  24298. {
  24299. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  24300. if (!$composerFileContent) {
  24301. return null;
  24302. }
  24303. $composer = JsonFile::parseJson($composerFileContent, $identifier . ':composer.json');
  24304. if (empty($composer['time']) && $changeDate = $this->getChangeDate($identifier)) {
  24305. $composer['time'] = $changeDate->format(DATE_RFC3339);
  24306. }
  24307. return $composer;
  24308. }
  24309. public function hasComposerFile($identifier)
  24310. {
  24311. try {
  24312. return (bool) $this->getComposerInformation($identifier);
  24313. } catch (TransportException $e) {
  24314. }
  24315. return false;
  24316. }
  24317. protected function getScheme()
  24318. {
  24319. if (extension_loaded('openssl')) {
  24320. return 'https';
  24321. }
  24322. return 'http';
  24323. }
  24324. protected function getContents($url)
  24325. {
  24326. $options = isset($this->repoConfig['options']) ? $this->repoConfig['options'] : array();
  24327. return $this->remoteFilesystem->getContents($this->originUrl, $url, false, $options);
  24328. }
  24329. public function cleanup()
  24330. {
  24331. return;
  24332. }
  24333. }
  24334. <?php
  24335. namespace Composer\Repository\Vcs;
  24336. use Composer\Config;
  24337. use Composer\IO\IOInterface;
  24338. interface VcsDriverInterface
  24339. {
  24340. public function initialize();
  24341. public function getComposerInformation($identifier);
  24342. public function getFileContent($file, $identifier);
  24343. public function getChangeDate($identifier);
  24344. public function getRootIdentifier();
  24345. public function getBranches();
  24346. public function getTags();
  24347. public function getDist($identifier);
  24348. public function getSource($identifier);
  24349. public function getUrl();
  24350. public function hasComposerFile($identifier);
  24351. public function cleanup();
  24352. public static function supports(IOInterface $io, Config $config, $url, $deep = false);
  24353. }
  24354. <?php
  24355. namespace Composer\Repository;
  24356. use Composer\Downloader\TransportException;
  24357. use Composer\Repository\Vcs\VcsDriverInterface;
  24358. use Composer\Package\Version\VersionParser;
  24359. use Composer\Package\Loader\ArrayLoader;
  24360. use Composer\Package\Loader\ValidatingArrayLoader;
  24361. use Composer\Package\Loader\InvalidPackageException;
  24362. use Composer\Package\Loader\LoaderInterface;
  24363. use Composer\EventDispatcher\EventDispatcher;
  24364. use Composer\IO\IOInterface;
  24365. use Composer\Config;
  24366. class VcsRepository extends ArrayRepository implements ConfigurableRepositoryInterface
  24367. {
  24368. protected $url;
  24369. protected $packageName;
  24370. protected $isVerbose;
  24371. protected $isVeryVerbose;
  24372. protected $io;
  24373. protected $config;
  24374. protected $versionParser;
  24375. protected $type;
  24376. protected $loader;
  24377. protected $repoConfig;
  24378. protected $branchErrorOccurred = false;
  24379. private $drivers;
  24380. private $driver;
  24381. private $versionCache;
  24382. private $emptyReferences = array();
  24383. public function __construct(array $repoConfig, IOInterface $io, Config $config, EventDispatcher $dispatcher = null, array $drivers = null, VersionCacheInterface $versionCache = null)
  24384. {
  24385. parent::__construct();
  24386. $this->drivers = $drivers ?: array(
  24387. 'github' => 'Composer\Repository\Vcs\GitHubDriver',
  24388. 'gitlab' => 'Composer\Repository\Vcs\GitLabDriver',
  24389. 'git-bitbucket' => 'Composer\Repository\Vcs\GitBitbucketDriver',
  24390. 'git' => 'Composer\Repository\Vcs\GitDriver',
  24391. 'hg-bitbucket' => 'Composer\Repository\Vcs\HgBitbucketDriver',
  24392. 'hg' => 'Composer\Repository\Vcs\HgDriver',
  24393. 'perforce' => 'Composer\Repository\Vcs\PerforceDriver',
  24394. 'fossil' => 'Composer\Repository\Vcs\FossilDriver',
  24395. 'svn' => 'Composer\Repository\Vcs\SvnDriver',
  24396. );
  24397. $this->url = $repoConfig['url'];
  24398. $this->io = $io;
  24399. $this->type = isset($repoConfig['type']) ? $repoConfig['type'] : 'vcs';
  24400. $this->isVerbose = $io->isVerbose();
  24401. $this->isVeryVerbose = $io->isVeryVerbose();
  24402. $this->config = $config;
  24403. $this->repoConfig = $repoConfig;
  24404. $this->versionCache = $versionCache;
  24405. }
  24406. public function getRepoConfig()
  24407. {
  24408. return $this->repoConfig;
  24409. }
  24410. public function setLoader(LoaderInterface $loader)
  24411. {
  24412. $this->loader = $loader;
  24413. }
  24414. public function getDriver()
  24415. {
  24416. if ($this->driver) {
  24417. return $this->driver;
  24418. }
  24419. if (isset($this->drivers[$this->type])) {
  24420. $class = $this->drivers[$this->type];
  24421. $this->driver = new $class($this->repoConfig, $this->io, $this->config);
  24422. $this->driver->initialize();
  24423. return $this->driver;
  24424. }
  24425. foreach ($this->drivers as $driver) {
  24426. if ($driver::supports($this->io, $this->config, $this->url)) {
  24427. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24428. $this->driver->initialize();
  24429. return $this->driver;
  24430. }
  24431. }
  24432. foreach ($this->drivers as $driver) {
  24433. if ($driver::supports($this->io, $this->config, $this->url, true)) {
  24434. $this->driver = new $driver($this->repoConfig, $this->io, $this->config);
  24435. $this->driver->initialize();
  24436. return $this->driver;
  24437. }
  24438. }
  24439. }
  24440. public function hadInvalidBranches()
  24441. {
  24442. return $this->branchErrorOccurred;
  24443. }
  24444. public function getEmptyReferences()
  24445. {
  24446. return $this->emptyReferences;
  24447. }
  24448. protected function initialize()
  24449. {
  24450. parent::initialize();
  24451. $isVerbose = $this->isVerbose;
  24452. $isVeryVerbose = $this->isVeryVerbose;
  24453. $driver = $this->getDriver();
  24454. if (!$driver) {
  24455. throw new \InvalidArgumentException('No driver found to handle VCS repository '.$this->url);
  24456. }
  24457. $this->versionParser = new VersionParser;
  24458. if (!$this->loader) {
  24459. $this->loader = new ArrayLoader($this->versionParser);
  24460. }
  24461. try {
  24462. if ($driver->hasComposerFile($driver->getRootIdentifier())) {
  24463. $data = $driver->getComposerInformation($driver->getRootIdentifier());
  24464. $this->packageName = !empty($data['name']) ? $data['name'] : null;
  24465. }
  24466. } catch (\Exception $e) {
  24467. if ($isVeryVerbose) {
  24468. $this->io->writeError('<error>Skipped parsing '.$driver->getRootIdentifier().', '.$e->getMessage().'</error>');
  24469. }
  24470. }
  24471. foreach ($driver->getTags() as $tag => $identifier) {
  24472. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $tag . '</comment>)';
  24473. if ($isVeryVerbose) {
  24474. $this->io->writeError($msg);
  24475. } elseif ($isVerbose) {
  24476. $this->io->overwriteError($msg, false);
  24477. }
  24478. $tag = str_replace('release-', '', $tag);
  24479. $cachedPackage = $this->getCachedPackageVersion($tag, $identifier, $isVerbose, $isVeryVerbose);
  24480. if ($cachedPackage) {
  24481. $this->addPackage($cachedPackage);
  24482. continue;
  24483. } elseif ($cachedPackage === false) {
  24484. $this->emptyReferences[] = $identifier;
  24485. continue;
  24486. }
  24487. if (!$parsedTag = $this->validateTag($tag)) {
  24488. if ($isVeryVerbose) {
  24489. $this->io->writeError('<warning>Skipped tag '.$tag.', invalid tag name</warning>');
  24490. }
  24491. continue;
  24492. }
  24493. try {
  24494. if (!$data = $driver->getComposerInformation($identifier)) {
  24495. if ($isVeryVerbose) {
  24496. $this->io->writeError('<warning>Skipped tag '.$tag.', no composer file</warning>');
  24497. }
  24498. $this->emptyReferences[] = $identifier;
  24499. continue;
  24500. }
  24501. if (isset($data['version'])) {
  24502. $data['version_normalized'] = $this->versionParser->normalize($data['version']);
  24503. } else {
  24504. $data['version'] = $tag;
  24505. $data['version_normalized'] = $parsedTag;
  24506. }
  24507. $data['version'] = preg_replace('{[.-]?dev$}i', '', $data['version']);
  24508. $data['version_normalized'] = preg_replace('{(^dev-|[.-]?dev$)}i', '', $data['version_normalized']);
  24509. if ($data['version_normalized'] !== $parsedTag) {
  24510. if ($isVeryVerbose) {
  24511. $this->io->writeError('<warning>Skipped tag '.$tag.', tag ('.$parsedTag.') does not match version ('.$data['version_normalized'].') in composer.json</warning>');
  24512. }
  24513. continue;
  24514. }
  24515. $tagPackageName = isset($data['name']) ? $data['name'] : $this->packageName;
  24516. if ($existingPackage = $this->findPackage($tagPackageName, $data['version_normalized'])) {
  24517. if ($isVeryVerbose) {
  24518. $this->io->writeError('<warning>Skipped tag '.$tag.', it conflicts with an another tag ('.$existingPackage->getPrettyVersion().') as both resolve to '.$data['version_normalized'].' internally</warning>');
  24519. }
  24520. continue;
  24521. }
  24522. if ($isVeryVerbose) {
  24523. $this->io->writeError('Importing tag '.$tag.' ('.$data['version_normalized'].')');
  24524. }
  24525. $this->addPackage($this->loader->load($this->preProcess($driver, $data, $identifier)));
  24526. } catch (\Exception $e) {
  24527. if ($e instanceof TransportException && $e->getCode() === 404) {
  24528. $this->emptyReferences[] = $identifier;
  24529. }
  24530. if ($isVeryVerbose) {
  24531. $this->io->writeError('<warning>Skipped tag '.$tag.', '.($e instanceof TransportException ? 'no composer file was found' : $e->getMessage()).'</warning>');
  24532. }
  24533. continue;
  24534. }
  24535. }
  24536. if (!$isVeryVerbose) {
  24537. $this->io->overwriteError('', false);
  24538. }
  24539. $branches = $driver->getBranches();
  24540. foreach ($branches as $branch => $identifier) {
  24541. $msg = 'Reading composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $branch . '</comment>)';
  24542. if ($isVeryVerbose) {
  24543. $this->io->writeError($msg);
  24544. } elseif ($isVerbose) {
  24545. $this->io->overwriteError($msg, false);
  24546. }
  24547. if ($branch === 'trunk' && isset($branches['master'])) {
  24548. if ($isVeryVerbose) {
  24549. $this->io->writeError('<warning>Skipped branch '.$branch.', can not parse both master and trunk branches as they both resolve to 9999999-dev internally</warning>');
  24550. }
  24551. continue;
  24552. }
  24553. if (!$parsedBranch = $this->validateBranch($branch)) {
  24554. if ($isVeryVerbose) {
  24555. $this->io->writeError('<warning>Skipped branch '.$branch.', invalid name</warning>');
  24556. }
  24557. continue;
  24558. }
  24559. if ('dev-' === substr($parsedBranch, 0, 4) || '9999999-dev' === $parsedBranch) {
  24560. $version = 'dev-' . $branch;
  24561. } else {
  24562. $prefix = substr($branch, 0, 1) === 'v' ? 'v' : '';
  24563. $version = $prefix . preg_replace('{(\.9{7})+}', '.x', $parsedBranch);
  24564. }
  24565. $cachedPackage = $this->getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose);
  24566. if ($cachedPackage) {
  24567. $this->addPackage($cachedPackage);
  24568. continue;
  24569. } elseif ($cachedPackage === false) {
  24570. $this->emptyReferences[] = $identifier;
  24571. continue;
  24572. }
  24573. try {
  24574. if (!$data = $driver->getComposerInformation($identifier)) {
  24575. if ($isVeryVerbose) {
  24576. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file</warning>');
  24577. }
  24578. $this->emptyReferences[] = $identifier;
  24579. continue;
  24580. }
  24581. $data['version'] = $version;
  24582. $data['version_normalized'] = $parsedBranch;
  24583. if ($isVeryVerbose) {
  24584. $this->io->writeError('Importing branch '.$branch.' ('.$data['version'].')');
  24585. }
  24586. $packageData = $this->preProcess($driver, $data, $identifier);
  24587. $package = $this->loader->load($packageData);
  24588. if ($this->loader instanceof ValidatingArrayLoader && $this->loader->getWarnings()) {
  24589. throw new InvalidPackageException($this->loader->getErrors(), $this->loader->getWarnings(), $packageData);
  24590. }
  24591. $this->addPackage($package);
  24592. } catch (TransportException $e) {
  24593. if ($e->getCode() === 404) {
  24594. $this->emptyReferences[] = $identifier;
  24595. }
  24596. if ($isVeryVerbose) {
  24597. $this->io->writeError('<warning>Skipped branch '.$branch.', no composer file was found</warning>');
  24598. }
  24599. continue;
  24600. } catch (\Exception $e) {
  24601. if (!$isVeryVerbose) {
  24602. $this->io->writeError('');
  24603. }
  24604. $this->branchErrorOccurred = true;
  24605. $this->io->writeError('<error>Skipped branch '.$branch.', '.$e->getMessage().'</error>');
  24606. $this->io->writeError('');
  24607. continue;
  24608. }
  24609. }
  24610. $driver->cleanup();
  24611. if (!$isVeryVerbose) {
  24612. $this->io->overwriteError('', false);
  24613. }
  24614. if (!$this->getPackages()) {
  24615. throw new InvalidRepositoryException('No valid composer.json was found in any branch or tag of '.$this->url.', could not load a package from it.');
  24616. }
  24617. }
  24618. protected function preProcess(VcsDriverInterface $driver, array $data, $identifier)
  24619. {
  24620. $dataPackageName = isset($data['name']) ? $data['name'] : null;
  24621. $data['name'] = $this->packageName ?: $dataPackageName;
  24622. if (!isset($data['dist'])) {
  24623. $data['dist'] = $driver->getDist($identifier);
  24624. }
  24625. if (!isset($data['source'])) {
  24626. $data['source'] = $driver->getSource($identifier);
  24627. }
  24628. return $data;
  24629. }
  24630. private function validateBranch($branch)
  24631. {
  24632. try {
  24633. return $this->versionParser->normalizeBranch($branch);
  24634. } catch (\Exception $e) {
  24635. }
  24636. return false;
  24637. }
  24638. private function validateTag($version)
  24639. {
  24640. try {
  24641. return $this->versionParser->normalize($version);
  24642. } catch (\Exception $e) {
  24643. }
  24644. return false;
  24645. }
  24646. private function getCachedPackageVersion($version, $identifier, $isVerbose, $isVeryVerbose)
  24647. {
  24648. if (!$this->versionCache) {
  24649. return;
  24650. }
  24651. $cachedPackage = $this->versionCache->getVersionPackage($version, $identifier);
  24652. if ($cachedPackage === false) {
  24653. if ($isVeryVerbose) {
  24654. $this->io->writeError('<warning>Skipped '.$version.', no composer file (cached from ref '.$identifier.')</warning>');
  24655. }
  24656. return false;
  24657. }
  24658. if ($cachedPackage) {
  24659. $msg = 'Found cached composer.json of <info>' . ($this->packageName ?: $this->url) . '</info> (<comment>' . $version . '</comment>)';
  24660. if ($isVeryVerbose) {
  24661. $this->io->writeError($msg);
  24662. } elseif ($isVerbose) {
  24663. $this->io->overwriteError($msg, false);
  24664. }
  24665. if ($existingPackage = $this->findPackage($cachedPackage['name'], $cachedPackage['version_normalized'])) {
  24666. if ($isVeryVerbose) {
  24667. $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>');
  24668. }
  24669. $cachedPackage = null;
  24670. }
  24671. }
  24672. if ($cachedPackage) {
  24673. return $this->loader->load($cachedPackage);
  24674. }
  24675. return null;
  24676. }
  24677. }
  24678. <?php
  24679. namespace Composer\Repository;
  24680. interface VersionCacheInterface
  24681. {
  24682. public function getVersionPackage($version, $identifier);
  24683. }
  24684. <?php
  24685. namespace Composer\Repository;
  24686. use Composer\Package\AliasPackage;
  24687. class WritableArrayRepository extends ArrayRepository implements WritableRepositoryInterface
  24688. {
  24689. public function write()
  24690. {
  24691. }
  24692. public function reload()
  24693. {
  24694. }
  24695. public function getCanonicalPackages()
  24696. {
  24697. $packages = $this->getPackages();
  24698. $packagesByName = array();
  24699. foreach ($packages as $package) {
  24700. if (!isset($packagesByName[$package->getName()]) || $packagesByName[$package->getName()] instanceof AliasPackage) {
  24701. $packagesByName[$package->getName()] = $package;
  24702. }
  24703. }
  24704. $canonicalPackages = array();
  24705. foreach ($packagesByName as $package) {
  24706. while ($package instanceof AliasPackage) {
  24707. $package = $package->getAliasOf();
  24708. }
  24709. $canonicalPackages[] = $package;
  24710. }
  24711. return $canonicalPackages;
  24712. }
  24713. }
  24714. <?php
  24715. namespace Composer\Repository;
  24716. use Composer\Package\PackageInterface;
  24717. interface WritableRepositoryInterface extends RepositoryInterface
  24718. {
  24719. public function write();
  24720. public function addPackage(PackageInterface $package);
  24721. public function removePackage(PackageInterface $package);
  24722. public function getCanonicalPackages();
  24723. public function reload();
  24724. }
  24725. <?php
  24726. namespace Composer\Script;
  24727. class CommandEvent extends Event
  24728. {
  24729. }
  24730. <?php
  24731. namespace Composer\Script;
  24732. use Composer\Composer;
  24733. use Composer\IO\IOInterface;
  24734. use Composer\EventDispatcher\Event as BaseEvent;
  24735. class Event extends BaseEvent
  24736. {
  24737. private $composer;
  24738. private $io;
  24739. private $devMode;
  24740. private $originatingEvent;
  24741. public function __construct($name, Composer $composer, IOInterface $io, $devMode = false, array $args = array(), array $flags = array())
  24742. {
  24743. parent::__construct($name, $args, $flags);
  24744. $this->composer = $composer;
  24745. $this->io = $io;
  24746. $this->devMode = $devMode;
  24747. $this->originatingEvent = null;
  24748. }
  24749. public function getComposer()
  24750. {
  24751. return $this->composer;
  24752. }
  24753. public function getIO()
  24754. {
  24755. return $this->io;
  24756. }
  24757. public function isDevMode()
  24758. {
  24759. return $this->devMode;
  24760. }
  24761. public function getOriginatingEvent()
  24762. {
  24763. return $this->originatingEvent;
  24764. }
  24765. public function setOriginatingEvent(BaseEvent $event)
  24766. {
  24767. $this->originatingEvent = $this->calculateOriginatingEvent($event);
  24768. return $this;
  24769. }
  24770. private function calculateOriginatingEvent(BaseEvent $event)
  24771. {
  24772. if ($event instanceof Event && $event->getOriginatingEvent()) {
  24773. return $this->calculateOriginatingEvent($event->getOriginatingEvent());
  24774. }
  24775. return $event;
  24776. }
  24777. }
  24778. <?php
  24779. namespace Composer\Script;
  24780. use Composer\Installer\PackageEvent as BasePackageEvent;
  24781. class PackageEvent extends BasePackageEvent
  24782. {
  24783. }
  24784. <?php
  24785. namespace Composer\Script;
  24786. class ScriptEvents
  24787. {
  24788. const PRE_INSTALL_CMD = 'pre-install-cmd';
  24789. const POST_INSTALL_CMD = 'post-install-cmd';
  24790. const PRE_UPDATE_CMD = 'pre-update-cmd';
  24791. const POST_UPDATE_CMD = 'post-update-cmd';
  24792. const PRE_STATUS_CMD = 'pre-status-cmd';
  24793. const POST_STATUS_CMD = 'post-status-cmd';
  24794. const PRE_AUTOLOAD_DUMP = 'pre-autoload-dump';
  24795. const POST_AUTOLOAD_DUMP = 'post-autoload-dump';
  24796. const POST_ROOT_PACKAGE_INSTALL = 'post-root-package-install';
  24797. const POST_CREATE_PROJECT_CMD = 'post-create-project-cmd';
  24798. const PRE_ARCHIVE_CMD = 'pre-archive-cmd';
  24799. const POST_ARCHIVE_CMD = 'post-archive-cmd';
  24800. const PRE_PACKAGE_INSTALL = 'pre-package-install';
  24801. const POST_PACKAGE_INSTALL = 'post-package-install';
  24802. const PRE_PACKAGE_UPDATE = 'pre-package-update';
  24803. const POST_PACKAGE_UPDATE = 'post-package-update';
  24804. const PRE_PACKAGE_UNINSTALL = 'pre-package-uninstall';
  24805. const POST_PACKAGE_UNINSTALL = 'post-package-uninstall';
  24806. }
  24807. <?php
  24808. namespace Composer\SelfUpdate;
  24809. class Keys
  24810. {
  24811. public static function fingerprint($path)
  24812. {
  24813. $hash = strtoupper(hash('sha256', preg_replace('{\s}', '', file_get_contents($path))));
  24814. return implode(' ', array(
  24815. substr($hash, 0, 8),
  24816. substr($hash, 8, 8),
  24817. substr($hash, 16, 8),
  24818. substr($hash, 24, 8),
  24819. '',
  24820. substr($hash, 32, 8),
  24821. substr($hash, 40, 8),
  24822. substr($hash, 48, 8),
  24823. substr($hash, 56, 8),
  24824. ));
  24825. }
  24826. }
  24827. <?php
  24828. namespace Composer\SelfUpdate;
  24829. use Composer\Util\RemoteFilesystem;
  24830. use Composer\Config;
  24831. use Composer\Json\JsonFile;
  24832. class Versions
  24833. {
  24834. private $rfs;
  24835. private $config;
  24836. private $channel;
  24837. public function __construct(Config $config, RemoteFilesystem $rfs)
  24838. {
  24839. $this->rfs = $rfs;
  24840. $this->config = $config;
  24841. }
  24842. public function getChannel()
  24843. {
  24844. if ($this->channel) {
  24845. return $this->channel;
  24846. }
  24847. $channelFile = $this->config->get('home').'/update-channel';
  24848. if (file_exists($channelFile)) {
  24849. $channel = trim(file_get_contents($channelFile));
  24850. if (in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24851. return $this->channel = $channel;
  24852. }
  24853. }
  24854. return $this->channel = 'stable';
  24855. }
  24856. public function setChannel($channel)
  24857. {
  24858. if (!in_array($channel, array('stable', 'preview', 'snapshot'), true)) {
  24859. throw new \InvalidArgumentException('Invalid channel '.$channel.', must be one of: stable, preview, snapshot');
  24860. }
  24861. $channelFile = $this->config->get('home').'/update-channel';
  24862. $this->channel = $channel;
  24863. file_put_contents($channelFile, $channel.PHP_EOL);
  24864. }
  24865. public function getLatest()
  24866. {
  24867. $protocol = extension_loaded('openssl') ? 'https' : 'http';
  24868. $versions = JsonFile::parseJson($this->rfs->getContents('getcomposer.org', $protocol . '://getcomposer.org/versions', false));
  24869. foreach ($versions[$this->getChannel()] as $version) {
  24870. if ($version['min-php'] <= PHP_VERSION_ID) {
  24871. return $version;
  24872. }
  24873. }
  24874. throw new \LogicException('There is no version of Composer available for your PHP version ('.PHP_VERSION.')');
  24875. }
  24876. }
  24877. <?php
  24878. namespace Composer\Util;
  24879. use Composer\Config;
  24880. use Composer\IO\IOInterface;
  24881. class AuthHelper
  24882. {
  24883. protected $io;
  24884. protected $config;
  24885. public function __construct(IOInterface $io, Config $config)
  24886. {
  24887. $this->io = $io;
  24888. $this->config = $config;
  24889. }
  24890. public function storeAuth($originUrl, $storeAuth)
  24891. {
  24892. $store = false;
  24893. $configSource = $this->config->getAuthConfigSource();
  24894. if ($storeAuth === true) {
  24895. $store = $configSource;
  24896. } elseif ($storeAuth === 'prompt') {
  24897. $answer = $this->io->askAndValidate(
  24898. 'Do you want to store credentials for '.$originUrl.' in '.$configSource->getName().' ? [Yn] ',
  24899. function ($value) {
  24900. $input = strtolower(substr(trim($value), 0, 1));
  24901. if (in_array($input, array('y','n'))) {
  24902. return $input;
  24903. }
  24904. throw new \RuntimeException('Please answer (y)es or (n)o');
  24905. },
  24906. null,
  24907. 'y'
  24908. );
  24909. if ($answer === 'y') {
  24910. $store = $configSource;
  24911. }
  24912. }
  24913. if ($store) {
  24914. $store->addConfigSetting(
  24915. 'http-basic.'.$originUrl,
  24916. $this->io->getAuthentication($originUrl)
  24917. );
  24918. }
  24919. }
  24920. }
  24921. <?php
  24922. namespace Composer\Util;
  24923. use Composer\Factory;
  24924. use Composer\IO\IOInterface;
  24925. use Composer\Config;
  24926. use Composer\Downloader\TransportException;
  24927. class Bitbucket
  24928. {
  24929. private $io;
  24930. private $config;
  24931. private $process;
  24932. private $remoteFilesystem;
  24933. private $token = array();
  24934. private $time;
  24935. const OAUTH2_ACCESS_TOKEN_URL = 'https://bitbucket.org/site/oauth2/access_token';
  24936. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null, $time = null)
  24937. {
  24938. $this->io = $io;
  24939. $this->config = $config;
  24940. $this->process = $process ?: new ProcessExecutor($io);
  24941. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  24942. $this->time = $time;
  24943. }
  24944. public function getToken()
  24945. {
  24946. if (!isset($this->token['access_token'])) {
  24947. return '';
  24948. }
  24949. return $this->token['access_token'];
  24950. }
  24951. public function authorizeOAuth($originUrl)
  24952. {
  24953. if ($originUrl !== 'bitbucket.org') {
  24954. return false;
  24955. }
  24956. if (0 === $this->process->execute('git config bitbucket.accesstoken', $output)) {
  24957. $this->io->setAuthentication($originUrl, 'x-token-auth', trim($output));
  24958. return true;
  24959. }
  24960. return false;
  24961. }
  24962. private function requestAccessToken($originUrl)
  24963. {
  24964. try {
  24965. $json = $this->remoteFilesystem->getContents($originUrl, self::OAUTH2_ACCESS_TOKEN_URL, false, array(
  24966. 'retry-auth-failure' => false,
  24967. 'http' => array(
  24968. 'method' => 'POST',
  24969. 'content' => 'grant_type=client_credentials',
  24970. ),
  24971. ));
  24972. $this->token = json_decode($json, true);
  24973. } catch (TransportException $e) {
  24974. if ($e->getCode() === 400) {
  24975. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24976. $this->io->writeError('This can have two reasons:');
  24977. $this->io->writeError('1. You are authenticating with a bitbucket username/password combination');
  24978. $this->io->writeError('2. You are using an OAuth consumer, but didn\'t configure a (dummy) callback url');
  24979. return false;
  24980. } elseif (in_array($e->getCode(), array(403, 401))) {
  24981. $this->io->writeError('<error>Invalid OAuth consumer provided.</error>');
  24982. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  24983. return false;
  24984. }
  24985. throw $e;
  24986. }
  24987. return true;
  24988. }
  24989. public function authorizeOAuthInteractively($originUrl, $message = null)
  24990. {
  24991. if ($message) {
  24992. $this->io->writeError($message);
  24993. }
  24994. $url = 'https://confluence.atlassian.com/bitbucket/oauth-on-bitbucket-cloud-238027431.html';
  24995. $this->io->writeError(sprintf('Follow the instructions on %s', $url));
  24996. $this->io->writeError(sprintf('to create a consumer. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  24997. $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)');
  24998. $consumerKey = trim($this->io->askAndHideAnswer('Consumer Key (hidden): '));
  24999. if (!$consumerKey) {
  25000. $this->io->writeError('<warning>No consumer key given, aborting.</warning>');
  25001. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25002. return false;
  25003. }
  25004. $consumerSecret = trim($this->io->askAndHideAnswer('Consumer Secret (hidden): '));
  25005. if (!$consumerSecret) {
  25006. $this->io->writeError('<warning>No consumer secret given, aborting.</warning>');
  25007. $this->io->writeError('You can also add it manually later by using "composer config --global --auth bitbucket-oauth.bitbucket.org <consumer-key> <consumer-secret>"');
  25008. return false;
  25009. }
  25010. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25011. if (!$this->requestAccessToken($originUrl)) {
  25012. return false;
  25013. }
  25014. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25015. $this->config->getAuthConfigSource()->removeConfigSetting('http-basic.' . $originUrl);
  25016. $this->io->writeError('<info>Consumer stored successfully.</info>');
  25017. return true;
  25018. }
  25019. public function requestToken($originUrl, $consumerKey, $consumerSecret)
  25020. {
  25021. if (!empty($this->token) || $this->getTokenFromConfig($originUrl)) {
  25022. return $this->token['access_token'];
  25023. }
  25024. $this->io->setAuthentication($originUrl, $consumerKey, $consumerSecret);
  25025. if (!$this->requestAccessToken($originUrl)) {
  25026. return '';
  25027. }
  25028. $this->storeInAuthConfig($originUrl, $consumerKey, $consumerSecret);
  25029. return $this->token['access_token'];
  25030. }
  25031. private function storeInAuthConfig($originUrl, $consumerKey, $consumerSecret)
  25032. {
  25033. $this->config->getConfigSource()->removeConfigSetting('bitbucket-oauth.'.$originUrl);
  25034. $time = null === $this->time ? time() : $this->time;
  25035. $consumer = array(
  25036. "consumer-key" => $consumerKey,
  25037. "consumer-secret" => $consumerSecret,
  25038. "access-token" => $this->token['access_token'],
  25039. "access-token-expiration" => $time + $this->token['expires_in'],
  25040. );
  25041. $this->config->getAuthConfigSource()->addConfigSetting('bitbucket-oauth.'.$originUrl, $consumer);
  25042. }
  25043. private function getTokenFromConfig($originUrl)
  25044. {
  25045. $authConfig = $this->config->get('bitbucket-oauth');
  25046. if (
  25047. !isset($authConfig[$originUrl]['access-token'])
  25048. || !isset($authConfig[$originUrl]['access-token-expiration'])
  25049. || time() > $authConfig[$originUrl]['access-token-expiration']
  25050. ) {
  25051. return false;
  25052. }
  25053. $this->token = array(
  25054. 'access_token' => $authConfig[$originUrl]['access-token'],
  25055. );
  25056. return true;
  25057. }
  25058. }
  25059. <?php
  25060. namespace Composer\Util;
  25061. class ComposerMirror
  25062. {
  25063. public static function processUrl($mirrorUrl, $packageName, $version, $reference, $type)
  25064. {
  25065. if ($reference) {
  25066. $reference = preg_match('{^([a-f0-9]*|%reference%)$}', $reference) ? $reference : md5($reference);
  25067. }
  25068. $version = strpos($version, '/') === false ? $version : md5($version);
  25069. return str_replace(
  25070. array('%package%', '%version%', '%reference%', '%type%'),
  25071. array($packageName, $version, $reference, $type),
  25072. $mirrorUrl
  25073. );
  25074. }
  25075. public static function processGitUrl($mirrorUrl, $packageName, $url, $type)
  25076. {
  25077. if (preg_match('#^(?:(?:https?|git)://github\.com/|git@github\.com:)([^/]+)/(.+?)(?:\.git)?$#', $url, $match)) {
  25078. $url = 'gh-'.$match[1].'/'.$match[2];
  25079. } elseif (preg_match('#^https://bitbucket\.org/([^/]+)/(.+?)(?:\.git)?/?$#', $url, $match)) {
  25080. $url = 'bb-'.$match[1].'/'.$match[2];
  25081. } else {
  25082. $url = preg_replace('{[^a-z0-9_.-]}i', '-', trim($url, '/'));
  25083. }
  25084. return str_replace(
  25085. array('%package%', '%normalizedUrl%', '%type%'),
  25086. array($packageName, $url, $type),
  25087. $mirrorUrl
  25088. );
  25089. }
  25090. public static function processHgUrl($mirrorUrl, $packageName, $url, $type)
  25091. {
  25092. return self::processGitUrl($mirrorUrl, $packageName, $url, $type);
  25093. }
  25094. }
  25095. <?php
  25096. namespace Composer\Util;
  25097. use Composer\Package\Loader\ArrayLoader;
  25098. use Composer\Package\Loader\ValidatingArrayLoader;
  25099. use Composer\Package\Loader\InvalidPackageException;
  25100. use Composer\Json\JsonValidationException;
  25101. use Composer\IO\IOInterface;
  25102. use Composer\Json\JsonFile;
  25103. use Composer\Spdx\SpdxLicenses;
  25104. class ConfigValidator
  25105. {
  25106. private $io;
  25107. public function __construct(IOInterface $io)
  25108. {
  25109. $this->io = $io;
  25110. }
  25111. public function validate($file, $arrayLoaderValidationFlags = ValidatingArrayLoader::CHECK_ALL)
  25112. {
  25113. $errors = array();
  25114. $publishErrors = array();
  25115. $warnings = array();
  25116. $laxValid = false;
  25117. try {
  25118. $json = new JsonFile($file, null, $this->io);
  25119. $manifest = $json->read();
  25120. $json->validateSchema(JsonFile::LAX_SCHEMA);
  25121. $laxValid = true;
  25122. $json->validateSchema();
  25123. } catch (JsonValidationException $e) {
  25124. foreach ($e->getErrors() as $message) {
  25125. if ($laxValid) {
  25126. $publishErrors[] = $message;
  25127. } else {
  25128. $errors[] = $message;
  25129. }
  25130. }
  25131. } catch (\Exception $e) {
  25132. $errors[] = $e->getMessage();
  25133. return array($errors, $publishErrors, $warnings);
  25134. }
  25135. if (empty($manifest['license'])) {
  25136. $warnings[] = 'No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.';
  25137. } else {
  25138. $licenses = (array) $manifest['license'];
  25139. foreach ($licenses as $key => $license) {
  25140. if ('proprietary' === $license) {
  25141. unset($licenses[$key]);
  25142. }
  25143. }
  25144. $licenseValidator = new SpdxLicenses();
  25145. foreach ($licenses as $license) {
  25146. $spdxLicense = $licenseValidator->getLicenseByIdentifier($license);
  25147. if ($spdxLicense && $spdxLicense[3]) {
  25148. if (preg_match('{^[AL]?GPL-[123](\.[01])?\+$}i', $license)) {
  25149. $warnings[] = sprintf(
  25150. 'License "%s" is a deprecated SPDX license identifier, use "'.str_replace('+', '', $license).'-or-later" instead',
  25151. $license
  25152. );
  25153. } elseif (preg_match('{^[AL]?GPL-[123](\.[01])?$}i', $license)) {
  25154. $warnings[] = sprintf(
  25155. 'License "%s" is a deprecated SPDX license identifier, use "'.$license.'-only" or "'.$license.'-or-later" instead',
  25156. $license
  25157. );
  25158. } else {
  25159. $warnings[] = sprintf(
  25160. 'License "%s" is a deprecated SPDX license identifier, see https://spdx.org/licenses/',
  25161. $license
  25162. );
  25163. }
  25164. }
  25165. }
  25166. }
  25167. if (isset($manifest['version'])) {
  25168. $warnings[] = 'The version field is present, it is recommended to leave it out if the package is published on Packagist.';
  25169. }
  25170. if (!empty($manifest['name']) && preg_match('{[A-Z]}', $manifest['name'])) {
  25171. $suggestName = preg_replace('{(?:([a-z])([A-Z])|([A-Z])([A-Z][a-z]))}', '\\1\\3-\\2\\4', $manifest['name']);
  25172. $suggestName = strtolower($suggestName);
  25173. $publishErrors[] = sprintf(
  25174. '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.',
  25175. $manifest['name'],
  25176. $suggestName
  25177. );
  25178. }
  25179. if (!empty($manifest['type']) && $manifest['type'] == 'composer-installer') {
  25180. $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.";
  25181. }
  25182. if (isset($manifest['require']) && isset($manifest['require-dev'])) {
  25183. $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']);
  25184. if (!empty($requireOverrides)) {
  25185. $plural = (count($requireOverrides) > 1) ? 'are' : 'is';
  25186. $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior";
  25187. }
  25188. }
  25189. $require = isset($manifest['require']) ? $manifest['require'] : array();
  25190. $requireDev = isset($manifest['require-dev']) ? $manifest['require-dev'] : array();
  25191. $packages = array_merge($require, $requireDev);
  25192. foreach ($packages as $package => $version) {
  25193. if (preg_match('/#/', $version) === 1) {
  25194. $warnings[] = sprintf(
  25195. 'The package "%s" is pointing to a commit-ref, this is bad practice and can cause unforeseen issues.',
  25196. $package
  25197. );
  25198. }
  25199. }
  25200. $scriptsDescriptions = isset($manifest['scripts-descriptions']) ? $manifest['scripts-descriptions'] : array();
  25201. $scripts = isset($manifest['scripts']) ? $manifest['scripts'] : array();
  25202. foreach ($scriptsDescriptions as $scriptName => $scriptDescription) {
  25203. if (!array_key_exists($scriptName, $scripts)) {
  25204. $warnings[] = sprintf(
  25205. 'Description for non-existent script "%s" found in "scripts-descriptions"',
  25206. $scriptName
  25207. );
  25208. }
  25209. }
  25210. if (isset($manifest['autoload']['psr-0'][''])) {
  25211. $warnings[] = "Defining autoload.psr-0 with an empty namespace prefix is a bad idea for performance";
  25212. }
  25213. if (isset($manifest['autoload']['psr-4'][''])) {
  25214. $warnings[] = "Defining autoload.psr-4 with an empty namespace prefix is a bad idea for performance";
  25215. }
  25216. try {
  25217. $loader = new ValidatingArrayLoader(new ArrayLoader(), true, null, $arrayLoaderValidationFlags);
  25218. if (!isset($manifest['version'])) {
  25219. $manifest['version'] = '1.0.0';
  25220. }
  25221. if (!isset($manifest['name'])) {
  25222. $manifest['name'] = 'dummy/dummy';
  25223. }
  25224. $loader->load($manifest);
  25225. } catch (InvalidPackageException $e) {
  25226. $errors = array_merge($errors, $e->getErrors());
  25227. }
  25228. $warnings = array_merge($warnings, $loader->getWarnings());
  25229. return array($errors, $publishErrors, $warnings);
  25230. }
  25231. }
  25232. <?php
  25233. namespace Composer\Util;
  25234. use Composer\IO\IOInterface;
  25235. class ErrorHandler
  25236. {
  25237. private static $io;
  25238. public static function handle($level, $message, $file, $line)
  25239. {
  25240. if (!(error_reporting() & $level)) {
  25241. return;
  25242. }
  25243. if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
  25244. $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
  25245. "\na legitimately suppressed error that you were not supposed to see.";
  25246. }
  25247. if ($level !== E_DEPRECATED && $level !== E_USER_DEPRECATED) {
  25248. throw new \ErrorException($message, 0, $level, $file, $line);
  25249. }
  25250. if (self::$io) {
  25251. self::$io->writeError('<warning>Deprecation Notice: '.$message.' in '.$file.':'.$line.'</warning>');
  25252. if (self::$io->isVerbose()) {
  25253. self::$io->writeError('<warning>Stack trace:</warning>');
  25254. self::$io->writeError(array_filter(array_map(function ($a) {
  25255. if (isset($a['line'], $a['file'])) {
  25256. return '<warning> '.$a['file'].':'.$a['line'].'</warning>';
  25257. }
  25258. return null;
  25259. }, array_slice(debug_backtrace(), 2))));
  25260. }
  25261. }
  25262. return true;
  25263. }
  25264. public static function register(IOInterface $io = null)
  25265. {
  25266. set_error_handler(array(__CLASS__, 'handle'));
  25267. error_reporting(E_ALL | E_STRICT);
  25268. self::$io = $io;
  25269. }
  25270. }
  25271. <?php
  25272. namespace Composer\Util;
  25273. use RecursiveDirectoryIterator;
  25274. use RecursiveIteratorIterator;
  25275. use Symfony\Component\Filesystem\Exception\IOException;
  25276. use Symfony\Component\Finder\Finder;
  25277. class Filesystem
  25278. {
  25279. private $processExecutor;
  25280. public function __construct(ProcessExecutor $executor = null)
  25281. {
  25282. $this->processExecutor = $executor ?: new ProcessExecutor();
  25283. }
  25284. public function remove($file)
  25285. {
  25286. if (is_dir($file)) {
  25287. return $this->removeDirectory($file);
  25288. }
  25289. if (file_exists($file)) {
  25290. return $this->unlink($file);
  25291. }
  25292. return false;
  25293. }
  25294. public function isDirEmpty($dir)
  25295. {
  25296. $finder = Finder::create()
  25297. ->ignoreVCS(false)
  25298. ->ignoreDotFiles(false)
  25299. ->depth(0)
  25300. ->in($dir);
  25301. return count($finder) === 0;
  25302. }
  25303. public function emptyDirectory($dir, $ensureDirectoryExists = true)
  25304. {
  25305. if (file_exists($dir) && is_link($dir)) {
  25306. $this->unlink($dir);
  25307. }
  25308. if ($ensureDirectoryExists) {
  25309. $this->ensureDirectoryExists($dir);
  25310. }
  25311. if (is_dir($dir)) {
  25312. $finder = Finder::create()
  25313. ->ignoreVCS(false)
  25314. ->ignoreDotFiles(false)
  25315. ->depth(0)
  25316. ->in($dir);
  25317. foreach ($finder as $path) {
  25318. $this->remove((string) $path);
  25319. }
  25320. }
  25321. }
  25322. public function removeDirectory($directory)
  25323. {
  25324. if ($this->isSymlinkedDirectory($directory)) {
  25325. return $this->unlinkSymlinkedDirectory($directory);
  25326. }
  25327. if ($this->isJunction($directory)) {
  25328. return $this->removeJunction($directory);
  25329. }
  25330. if (is_link($directory)) {
  25331. return unlink($directory);
  25332. }
  25333. if (!file_exists($directory) || !is_dir($directory)) {
  25334. return true;
  25335. }
  25336. if (preg_match('{^(?:[a-z]:)?[/\\\\]+$}i', $directory)) {
  25337. throw new \RuntimeException('Aborting an attempted deletion of '.$directory.', this was probably not intended, if it is a real use case please report it.');
  25338. }
  25339. if (!function_exists('proc_open')) {
  25340. return $this->removeDirectoryPhp($directory);
  25341. }
  25342. if (Platform::isWindows()) {
  25343. $cmd = sprintf('rmdir /S /Q %s', ProcessExecutor::escape(realpath($directory)));
  25344. } else {
  25345. $cmd = sprintf('rm -rf %s', ProcessExecutor::escape($directory));
  25346. }
  25347. $result = $this->getProcess()->execute($cmd, $output) === 0;
  25348. clearstatcache();
  25349. if ($result && !file_exists($directory)) {
  25350. return true;
  25351. }
  25352. return $this->removeDirectoryPhp($directory);
  25353. }
  25354. public function removeDirectoryPhp($directory)
  25355. {
  25356. try {
  25357. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25358. } catch (\UnexpectedValueException $e) {
  25359. clearstatcache();
  25360. usleep(100000);
  25361. if (!is_dir($directory)) {
  25362. return true;
  25363. }
  25364. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25365. }
  25366. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25367. foreach ($ri as $file) {
  25368. if ($file->isDir()) {
  25369. $this->rmdir($file->getPathname());
  25370. } else {
  25371. $this->unlink($file->getPathname());
  25372. }
  25373. }
  25374. return $this->rmdir($directory);
  25375. }
  25376. public function ensureDirectoryExists($directory)
  25377. {
  25378. if (!is_dir($directory)) {
  25379. if (file_exists($directory)) {
  25380. throw new \RuntimeException(
  25381. $directory.' exists and is not a directory.'
  25382. );
  25383. }
  25384. if (!@mkdir($directory, 0777, true)) {
  25385. throw new \RuntimeException(
  25386. $directory.' does not exist and could not be created.'
  25387. );
  25388. }
  25389. }
  25390. }
  25391. public function unlink($path)
  25392. {
  25393. $unlinked = @$this->unlinkImplementation($path);
  25394. if (!$unlinked) {
  25395. if (Platform::isWindows()) {
  25396. usleep(350000);
  25397. $unlinked = @$this->unlinkImplementation($path);
  25398. }
  25399. if (!$unlinked) {
  25400. $error = error_get_last();
  25401. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25402. if (Platform::isWindows()) {
  25403. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25404. }
  25405. throw new \RuntimeException($message);
  25406. }
  25407. }
  25408. return true;
  25409. }
  25410. public function rmdir($path)
  25411. {
  25412. $deleted = @rmdir($path);
  25413. if (!$deleted) {
  25414. if (Platform::isWindows()) {
  25415. usleep(350000);
  25416. $deleted = @rmdir($path);
  25417. }
  25418. if (!$deleted) {
  25419. $error = error_get_last();
  25420. $message = 'Could not delete '.$path.': ' . @$error['message'];
  25421. if (Platform::isWindows()) {
  25422. $message .= "\nThis can be due to an antivirus or the Windows Search Indexer locking the file while they are analyzed";
  25423. }
  25424. throw new \RuntimeException($message);
  25425. }
  25426. }
  25427. return true;
  25428. }
  25429. public function copyThenRemove($source, $target)
  25430. {
  25431. $this->copy($source, $target);
  25432. if (!is_dir($source)) {
  25433. $this->unlink($source);
  25434. return;
  25435. }
  25436. $this->removeDirectoryPhp($source);
  25437. }
  25438. public function copy($source, $target)
  25439. {
  25440. if (!is_dir($source)) {
  25441. return copy($source, $target);
  25442. }
  25443. $it = new RecursiveDirectoryIterator($source, RecursiveDirectoryIterator::SKIP_DOTS);
  25444. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::SELF_FIRST);
  25445. $this->ensureDirectoryExists($target);
  25446. $result = true;
  25447. foreach ($ri as $file) {
  25448. $targetPath = $target . DIRECTORY_SEPARATOR . $ri->getSubPathName();
  25449. if ($file->isDir()) {
  25450. $this->ensureDirectoryExists($targetPath);
  25451. } else {
  25452. $result = $result && copy($file->getPathname(), $targetPath);
  25453. }
  25454. }
  25455. return $result;
  25456. }
  25457. public function rename($source, $target)
  25458. {
  25459. if (true === @rename($source, $target)) {
  25460. return;
  25461. }
  25462. if (!function_exists('proc_open')) {
  25463. return $this->copyThenRemove($source, $target);
  25464. }
  25465. if (Platform::isWindows()) {
  25466. $command = sprintf('xcopy %s %s /E /I /Q /Y', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25467. $result = $this->processExecutor->execute($command, $output);
  25468. clearstatcache();
  25469. if (0 === $result) {
  25470. $this->remove($source);
  25471. return;
  25472. }
  25473. } else {
  25474. $command = sprintf('mv %s %s', ProcessExecutor::escape($source), ProcessExecutor::escape($target));
  25475. $result = $this->processExecutor->execute($command, $output);
  25476. clearstatcache();
  25477. if (0 === $result) {
  25478. return;
  25479. }
  25480. }
  25481. return $this->copyThenRemove($source, $target);
  25482. }
  25483. public function findShortestPath($from, $to, $directories = false)
  25484. {
  25485. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25486. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25487. }
  25488. $from = lcfirst($this->normalizePath($from));
  25489. $to = lcfirst($this->normalizePath($to));
  25490. if ($directories) {
  25491. $from = rtrim($from, '/') . '/dummy_file';
  25492. }
  25493. if (dirname($from) === dirname($to)) {
  25494. return './'.basename($to);
  25495. }
  25496. $commonPath = $to;
  25497. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath)) {
  25498. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25499. }
  25500. if (0 !== strpos($from, $commonPath) || '/' === $commonPath) {
  25501. return $to;
  25502. }
  25503. $commonPath = rtrim($commonPath, '/') . '/';
  25504. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/');
  25505. $commonPathCode = str_repeat('../', $sourcePathDepth);
  25506. return ($commonPathCode . substr($to, strlen($commonPath))) ?: './';
  25507. }
  25508. public function findShortestPathCode($from, $to, $directories = false, $staticCode = false)
  25509. {
  25510. if (!$this->isAbsolutePath($from) || !$this->isAbsolutePath($to)) {
  25511. throw new \InvalidArgumentException(sprintf('$from (%s) and $to (%s) must be absolute paths.', $from, $to));
  25512. }
  25513. $from = lcfirst($this->normalizePath($from));
  25514. $to = lcfirst($this->normalizePath($to));
  25515. if ($from === $to) {
  25516. return $directories ? '__DIR__' : '__FILE__';
  25517. }
  25518. $commonPath = $to;
  25519. while (strpos($from.'/', $commonPath.'/') !== 0 && '/' !== $commonPath && !preg_match('{^[a-z]:/?$}i', $commonPath) && '.' !== $commonPath) {
  25520. $commonPath = strtr(dirname($commonPath), '\\', '/');
  25521. }
  25522. if (0 !== strpos($from, $commonPath) || '/' === $commonPath || '.' === $commonPath) {
  25523. return var_export($to, true);
  25524. }
  25525. $commonPath = rtrim($commonPath, '/') . '/';
  25526. if (strpos($to, $from.'/') === 0) {
  25527. return '__DIR__ . '.var_export(substr($to, strlen($from)), true);
  25528. }
  25529. $sourcePathDepth = substr_count(substr($from, strlen($commonPath)), '/') + $directories;
  25530. if ($staticCode) {
  25531. $commonPathCode = "__DIR__ . '".str_repeat('/..', $sourcePathDepth)."'";
  25532. } else {
  25533. $commonPathCode = str_repeat('dirname(', $sourcePathDepth).'__DIR__'.str_repeat(')', $sourcePathDepth);
  25534. }
  25535. $relTarget = substr($to, strlen($commonPath));
  25536. return $commonPathCode . (strlen($relTarget) ? '.' . var_export('/' . $relTarget, true) : '');
  25537. }
  25538. public function isAbsolutePath($path)
  25539. {
  25540. return substr($path, 0, 1) === '/' || substr($path, 1, 1) === ':' || substr($path, 0, 2) === '\\\\';
  25541. }
  25542. public function size($path)
  25543. {
  25544. if (!file_exists($path)) {
  25545. throw new \RuntimeException("$path does not exist.");
  25546. }
  25547. if (is_dir($path)) {
  25548. return $this->directorySize($path);
  25549. }
  25550. return filesize($path);
  25551. }
  25552. public function normalizePath($path)
  25553. {
  25554. $parts = array();
  25555. $path = strtr($path, '\\', '/');
  25556. $prefix = '';
  25557. $absolute = false;
  25558. if (preg_match('{^( [0-9a-z]{2,}+: (?: // (?: [a-z]: )? )? | [a-z]: )}ix', $path, $match)) {
  25559. $prefix = $match[1];
  25560. $path = substr($path, strlen($prefix));
  25561. }
  25562. if (substr($path, 0, 1) === '/') {
  25563. $absolute = true;
  25564. $path = substr($path, 1);
  25565. }
  25566. $up = false;
  25567. foreach (explode('/', $path) as $chunk) {
  25568. if ('..' === $chunk && ($absolute || $up)) {
  25569. array_pop($parts);
  25570. $up = !(empty($parts) || '..' === end($parts));
  25571. } elseif ('.' !== $chunk && '' !== $chunk) {
  25572. $parts[] = $chunk;
  25573. $up = '..' !== $chunk;
  25574. }
  25575. }
  25576. return $prefix.($absolute ? '/' : '').implode('/', $parts);
  25577. }
  25578. public static function isLocalPath($path)
  25579. {
  25580. return (bool) preg_match('{^(file://(?!//)|/(?!/)|/?[a-z]:[\\\\/]|\.\.[\\\\/]|[a-z0-9_.-]+[\\\\/])}i', $path);
  25581. }
  25582. public static function getPlatformPath($path)
  25583. {
  25584. if (Platform::isWindows()) {
  25585. $path = preg_replace('{^(?:file:///([a-z]):?/)}i', 'file://$1:/', $path);
  25586. }
  25587. return preg_replace('{^file://}i', '', $path);
  25588. }
  25589. protected function directorySize($directory)
  25590. {
  25591. $it = new RecursiveDirectoryIterator($directory, RecursiveDirectoryIterator::SKIP_DOTS);
  25592. $ri = new RecursiveIteratorIterator($it, RecursiveIteratorIterator::CHILD_FIRST);
  25593. $size = 0;
  25594. foreach ($ri as $file) {
  25595. if ($file->isFile()) {
  25596. $size += $file->getSize();
  25597. }
  25598. }
  25599. return $size;
  25600. }
  25601. protected function getProcess()
  25602. {
  25603. return $this->processExecutor;
  25604. }
  25605. private function unlinkImplementation($path)
  25606. {
  25607. if (Platform::isWindows() && is_dir($path) && is_link($path)) {
  25608. return rmdir($path);
  25609. }
  25610. return unlink($path);
  25611. }
  25612. public function relativeSymlink($target, $link)
  25613. {
  25614. $cwd = getcwd();
  25615. $relativePath = $this->findShortestPath($link, $target);
  25616. chdir(dirname($link));
  25617. $result = @symlink($relativePath, $link);
  25618. chdir($cwd);
  25619. return $result;
  25620. }
  25621. public function isSymlinkedDirectory($directory)
  25622. {
  25623. if (!is_dir($directory)) {
  25624. return false;
  25625. }
  25626. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25627. return is_link($resolved);
  25628. }
  25629. private function unlinkSymlinkedDirectory($directory)
  25630. {
  25631. $resolved = $this->resolveSymlinkedDirectorySymlink($directory);
  25632. return $this->unlink($resolved);
  25633. }
  25634. private function resolveSymlinkedDirectorySymlink($pathname)
  25635. {
  25636. if (!is_dir($pathname)) {
  25637. return $pathname;
  25638. }
  25639. $resolved = rtrim($pathname, '/');
  25640. if (!strlen($resolved)) {
  25641. return $pathname;
  25642. }
  25643. return $resolved;
  25644. }
  25645. public function junction($target, $junction)
  25646. {
  25647. if (!Platform::isWindows()) {
  25648. throw new \LogicException(sprintf('Function %s is not available on non-Windows platform', __CLASS__));
  25649. }
  25650. if (!is_dir($target)) {
  25651. throw new IOException(sprintf('Cannot junction to "%s" as it is not a directory.', $target), 0, null, $target);
  25652. }
  25653. $cmd = sprintf(
  25654. 'mklink /J %s %s',
  25655. ProcessExecutor::escape(str_replace('/', DIRECTORY_SEPARATOR, $junction)),
  25656. ProcessExecutor::escape(realpath($target))
  25657. );
  25658. if ($this->getProcess()->execute($cmd, $output) !== 0) {
  25659. throw new IOException(sprintf('Failed to create junction to "%s" at "%s".', $target, $junction), 0, null, $target);
  25660. }
  25661. clearstatcache(true, $junction);
  25662. }
  25663. public function isJunction($junction)
  25664. {
  25665. if (!Platform::isWindows()) {
  25666. return false;
  25667. }
  25668. clearstatcache(true, $junction);
  25669. if (!is_dir($junction) || is_link($junction)) {
  25670. return false;
  25671. }
  25672. $stat = lstat($junction);
  25673. return $stat ? 0x4000 !== ($stat['mode'] & 0xF000) : false;
  25674. }
  25675. public function removeJunction($junction)
  25676. {
  25677. if (!Platform::isWindows()) {
  25678. return false;
  25679. }
  25680. $junction = rtrim(str_replace('/', DIRECTORY_SEPARATOR, $junction), DIRECTORY_SEPARATOR);
  25681. if (!$this->isJunction($junction)) {
  25682. throw new IOException(sprintf('%s is not a junction and thus cannot be removed as one', $junction));
  25683. }
  25684. return $this->rmdir($junction);
  25685. }
  25686. }
  25687. <?php
  25688. namespace Composer\Util;
  25689. use Composer\Config;
  25690. use Composer\IO\IOInterface;
  25691. class Git
  25692. {
  25693. private static $version;
  25694. protected $io;
  25695. protected $config;
  25696. protected $process;
  25697. protected $filesystem;
  25698. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process, Filesystem $fs)
  25699. {
  25700. $this->io = $io;
  25701. $this->config = $config;
  25702. $this->process = $process;
  25703. $this->filesystem = $fs;
  25704. }
  25705. public function runCommand($commandCallable, $url, $cwd, $initialClone = false)
  25706. {
  25707. $this->config->prohibitUrlByConfig($url, $this->io);
  25708. if ($initialClone) {
  25709. $origCwd = $cwd;
  25710. $cwd = null;
  25711. }
  25712. if (preg_match('{^ssh://[^@]+@[^:]+:[^0-9]+}', $url)) {
  25713. 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.');
  25714. }
  25715. if (!$initialClone) {
  25716. $this->process->execute('git remote -v', $output, $cwd);
  25717. if (preg_match('{^(?:composer|origin)\s+https?://(.+):(.+)@([^/]+)}im', $output, $match) && !$this->io->hasAuthentication($match[3])) {
  25718. $this->io->setAuthentication($match[3], rawurldecode($match[1]), rawurldecode($match[2]));
  25719. }
  25720. }
  25721. $protocols = $this->config->get('github-protocols');
  25722. if (!is_array($protocols)) {
  25723. throw new \RuntimeException('Config value "github-protocols" must be an array, got ' . gettype($protocols));
  25724. }
  25725. if (preg_match('{^(?:https?|git)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)) {
  25726. $messages = array();
  25727. foreach ($protocols as $protocol) {
  25728. if ('ssh' === $protocol) {
  25729. $protoUrl = "git@" . $match[1] . ":" . $match[2];
  25730. } else {
  25731. $protoUrl = $protocol . "://" . $match[1] . "/" . $match[2];
  25732. }
  25733. if (0 === $this->process->execute(call_user_func($commandCallable, $protoUrl), $ignoredOutput, $cwd)) {
  25734. return;
  25735. }
  25736. $messages[] = '- ' . $protoUrl . "\n" . preg_replace('#^#m', ' ', $this->process->getErrorOutput());
  25737. if ($initialClone) {
  25738. $this->filesystem->removeDirectory($origCwd);
  25739. }
  25740. }
  25741. $this->throwException('Failed to clone ' . $url . ' via ' . implode(', ', $protocols) . ' protocols, aborting.' . "\n\n" . implode("\n", $messages), $url);
  25742. }
  25743. $bypassSshForGitHub = preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url) && !in_array('ssh', $protocols, true);
  25744. $command = call_user_func($commandCallable, $url);
  25745. $auth = null;
  25746. if ($bypassSshForGitHub || 0 !== $this->process->execute($command, $ignoredOutput, $cwd)) {
  25747. if (preg_match('{^git@' . self::getGitHubDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  25748. || preg_match('{^(https?)://' . self::getGitHubDomainsRegex($this->config) . '/(.*)}', $url, $match)
  25749. ) {
  25750. if (!$this->io->hasAuthentication($match[1])) {
  25751. $gitHubUtil = new GitHub($this->io, $this->config, $this->process);
  25752. $message = 'Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos';
  25753. if (!$gitHubUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25754. $gitHubUtil->authorizeOAuthInteractively($match[1], $message);
  25755. }
  25756. }
  25757. if ($this->io->hasAuthentication($match[1])) {
  25758. $auth = $this->io->getAuthentication($match[1]);
  25759. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25760. $command = call_user_func($commandCallable, $authUrl);
  25761. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25762. return;
  25763. }
  25764. }
  25765. } elseif (preg_match('{^https://(bitbucket\.org)/(.*)(\.git)?$}U', $url, $match)) {
  25766. $bitbucketUtil = new Bitbucket($this->io, $this->config, $this->process);
  25767. if (!$this->io->hasAuthentication($match[1])) {
  25768. $message = 'Enter your Bitbucket credentials to access private repos';
  25769. if (!$bitbucketUtil->authorizeOAuth($match[1]) && $this->io->isInteractive()) {
  25770. $bitbucketUtil->authorizeOAuthInteractively($match[1], $message);
  25771. $accessToken = $bitbucketUtil->getToken();
  25772. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25773. }
  25774. } else {
  25775. $auth = $this->io->getAuthentication($match[1]);
  25776. if ($auth['username'] !== 'x-token-auth') {
  25777. $accessToken = $bitbucketUtil->requestToken($match[1], $auth['username'], $auth['password']);
  25778. if (! empty($accessToken)) {
  25779. $this->io->setAuthentication($match[1], 'x-token-auth', $accessToken);
  25780. }
  25781. }
  25782. }
  25783. if ($this->io->hasAuthentication($match[1])) {
  25784. $auth = $this->io->getAuthentication($match[1]);
  25785. $authUrl = 'https://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[1] . '/' . $match[2] . '.git';
  25786. $command = call_user_func($commandCallable, $authUrl);
  25787. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25788. return;
  25789. }
  25790. } else {
  25791. $sshUrl = 'git@bitbucket.org:' . $match[2] . '.git';
  25792. $this->io->writeError(' No bitbucket authentication configured. Falling back to ssh.');
  25793. $command = call_user_func($commandCallable, $sshUrl);
  25794. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25795. return;
  25796. }
  25797. }
  25798. } elseif (
  25799. preg_match('{^(git)@' . self::getGitLabDomainsRegex($this->config) . ':(.+?)\.git$}i', $url, $match)
  25800. || preg_match('{^(https?)://' . self::getGitLabDomainsRegex($this->config) . '/(.*)}', $url, $match)
  25801. ) {
  25802. if ($match[1] === 'git') {
  25803. $match[1] = 'https';
  25804. }
  25805. if (!$this->io->hasAuthentication($match[2])) {
  25806. $gitLabUtil = new GitLab($this->io, $this->config, $this->process);
  25807. $message = 'Cloning failed, enter your GitLab credentials to access private repos';
  25808. if (!$gitLabUtil->authorizeOAuth($match[2]) && $this->io->isInteractive()) {
  25809. $gitLabUtil->authorizeOAuthInteractively($match[1], $match[2], $message);
  25810. }
  25811. }
  25812. if ($this->io->hasAuthentication($match[2])) {
  25813. $auth = $this->io->getAuthentication($match[2]);
  25814. if ($auth['password'] === 'private-token' || $auth['password'] === 'oauth2' || $auth['password'] === 'gitlab-ci-token') {
  25815. $authUrl = $match[1] . '://' . rawurlencode($auth['password']) . ':' . rawurlencode($auth['username']) . '@' . $match[2] . '/' . $match[3];
  25816. } else {
  25817. $authUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . '/' . $match[3];
  25818. }
  25819. $command = call_user_func($commandCallable, $authUrl);
  25820. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25821. return;
  25822. }
  25823. }
  25824. } elseif ($this->isAuthenticationFailure($url, $match)) {
  25825. if (strpos($match[2], '@')) {
  25826. list($authParts, $match[2]) = explode('@', $match[2], 2);
  25827. }
  25828. $storeAuth = false;
  25829. if ($this->io->hasAuthentication($match[2])) {
  25830. $auth = $this->io->getAuthentication($match[2]);
  25831. } elseif ($this->io->isInteractive()) {
  25832. $defaultUsername = null;
  25833. if (isset($authParts) && $authParts) {
  25834. if (false !== strpos($authParts, ':')) {
  25835. list($defaultUsername, ) = explode(':', $authParts, 2);
  25836. } else {
  25837. $defaultUsername = $authParts;
  25838. }
  25839. }
  25840. $this->io->writeError(' Authentication required (<info>' . $match[2] . '</info>):');
  25841. $auth = array(
  25842. 'username' => $this->io->ask(' Username: ', $defaultUsername),
  25843. 'password' => $this->io->askAndHideAnswer(' Password: '),
  25844. );
  25845. $storeAuth = $this->config->get('store-auths');
  25846. }
  25847. if ($auth) {
  25848. $authUrl = $match[1] . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[2] . $match[3];
  25849. $command = call_user_func($commandCallable, $authUrl);
  25850. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  25851. $this->io->setAuthentication($match[2], $auth['username'], $auth['password']);
  25852. $authHelper = new AuthHelper($this->io, $this->config);
  25853. $authHelper->storeAuth($match[2], $storeAuth);
  25854. return;
  25855. }
  25856. }
  25857. }
  25858. $errorMsg = $this->process->getErrorOutput();
  25859. if ($initialClone) {
  25860. $this->filesystem->removeDirectory($origCwd);
  25861. }
  25862. $this->throwException('Failed to execute ' . $command . "\n\n" . $errorMsg, $url);
  25863. }
  25864. }
  25865. public function syncMirror($url, $dir)
  25866. {
  25867. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25868. try {
  25869. $commandCallable = function ($url) {
  25870. $sanitizedUrl = preg_replace('{://([^@]+?):(.+?)@}', '://', $url);
  25871. 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));
  25872. };
  25873. $this->runCommand($commandCallable, $url, $dir);
  25874. } catch (\Exception $e) {
  25875. return false;
  25876. }
  25877. return true;
  25878. }
  25879. $this->filesystem->removeDirectory($dir);
  25880. $commandCallable = function ($url) use ($dir) {
  25881. return sprintf('git clone --mirror %s %s', ProcessExecutor::escape($url), ProcessExecutor::escape($dir));
  25882. };
  25883. $this->runCommand($commandCallable, $url, $dir, true);
  25884. return true;
  25885. }
  25886. public function fetchRefOrSyncMirror($url, $dir, $ref)
  25887. {
  25888. if ($this->checkRefIsInMirror($url, $dir, $ref)) {
  25889. return true;
  25890. }
  25891. if ($this->syncMirror($url, $dir)) {
  25892. return $this->checkRefIsInMirror($url, $dir, $ref);
  25893. }
  25894. return false;
  25895. }
  25896. private function checkRefIsInMirror($url, $dir, $ref)
  25897. {
  25898. if (is_dir($dir) && 0 === $this->process->execute('git rev-parse --git-dir', $output, $dir) && trim($output) === '.') {
  25899. $escapedRef = ProcessExecutor::escape($ref.'^{commit}');
  25900. $exitCode = $this->process->execute(sprintf('git rev-parse --quiet --verify %s', $escapedRef), $ignoredOutput, $dir);
  25901. if ($exitCode === 0) {
  25902. return true;
  25903. }
  25904. }
  25905. return false;
  25906. }
  25907. private function isAuthenticationFailure($url, &$match)
  25908. {
  25909. if (!preg_match('{^(https?://)([^/]+)(.*)$}i', $url, $match)) {
  25910. return false;
  25911. }
  25912. $authFailures = array(
  25913. 'fatal: Authentication failed',
  25914. 'remote error: Invalid username or password.',
  25915. 'error: 401 Unauthorized',
  25916. 'fatal: unable to access',
  25917. 'fatal: could not read Username',
  25918. );
  25919. $errorOutput = $this->process->getErrorOutput();
  25920. foreach ($authFailures as $authFailure) {
  25921. if (strpos($errorOutput, $authFailure) !== false) {
  25922. return true;
  25923. }
  25924. }
  25925. return false;
  25926. }
  25927. public static function cleanEnv()
  25928. {
  25929. if (PHP_VERSION_ID < 50400 && ini_get('safe_mode') && false === strpos(ini_get('safe_mode_allowed_env_vars'), 'GIT_ASKPASS')) {
  25930. 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');
  25931. }
  25932. if (getenv('GIT_ASKPASS') !== 'echo') {
  25933. putenv('GIT_ASKPASS=echo');
  25934. unset($_SERVER['GIT_ASKPASS']);
  25935. }
  25936. if (getenv('GIT_DIR')) {
  25937. putenv('GIT_DIR');
  25938. unset($_SERVER['GIT_DIR']);
  25939. }
  25940. if (getenv('GIT_WORK_TREE')) {
  25941. putenv('GIT_WORK_TREE');
  25942. unset($_SERVER['GIT_WORK_TREE']);
  25943. }
  25944. if (getenv('LANGUAGE') !== 'C') {
  25945. putenv('LANGUAGE=C');
  25946. }
  25947. putenv("DYLD_LIBRARY_PATH");
  25948. unset($_SERVER['DYLD_LIBRARY_PATH']);
  25949. }
  25950. public static function getGitHubDomainsRegex(Config $config)
  25951. {
  25952. return '(' . implode('|', array_map('preg_quote', $config->get('github-domains'))) . ')';
  25953. }
  25954. public static function getGitLabDomainsRegex(Config $config)
  25955. {
  25956. return '(' . implode('|', array_map('preg_quote', $config->get('gitlab-domains'))) . ')';
  25957. }
  25958. public static function sanitizeUrl($message)
  25959. {
  25960. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  25961. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  25962. return '://***:***@';
  25963. }
  25964. return '://' . $m[1] . ':***@';
  25965. }, $message);
  25966. }
  25967. private function throwException($message, $url)
  25968. {
  25969. clearstatcache();
  25970. if (0 !== $this->process->execute('git --version', $ignoredOutput)) {
  25971. 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()));
  25972. }
  25973. throw new \RuntimeException(self::sanitizeUrl($message));
  25974. }
  25975. public function getVersion()
  25976. {
  25977. if (isset(self::$version)) {
  25978. return self::$version;
  25979. }
  25980. if (0 !== $this->process->execute('git --version', $output)) {
  25981. return;
  25982. }
  25983. if (preg_match('/^git version (\d+(?:\.\d+)+)/m', $output, $matches)) {
  25984. return self::$version = $matches[1];
  25985. }
  25986. }
  25987. }
  25988. <?php
  25989. namespace Composer\Util;
  25990. use Composer\Factory;
  25991. use Composer\IO\IOInterface;
  25992. use Composer\Config;
  25993. use Composer\Downloader\TransportException;
  25994. class GitHub
  25995. {
  25996. protected $io;
  25997. protected $config;
  25998. protected $process;
  25999. protected $remoteFilesystem;
  26000. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26001. {
  26002. $this->io = $io;
  26003. $this->config = $config;
  26004. $this->process = $process ?: new ProcessExecutor($io);
  26005. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26006. }
  26007. public function authorizeOAuth($originUrl)
  26008. {
  26009. if (!in_array($originUrl, $this->config->get('github-domains'))) {
  26010. return false;
  26011. }
  26012. if (0 === $this->process->execute('git config github.accesstoken', $output)) {
  26013. $this->io->setAuthentication($originUrl, trim($output), 'x-oauth-basic');
  26014. return true;
  26015. }
  26016. return false;
  26017. }
  26018. public function authorizeOAuthInteractively($originUrl, $message = null)
  26019. {
  26020. if ($message) {
  26021. $this->io->writeError($message);
  26022. }
  26023. $note = 'Composer';
  26024. if ($this->config->get('github-expose-hostname') === true && 0 === $this->process->execute('hostname', $output)) {
  26025. $note .= ' on ' . trim($output);
  26026. }
  26027. $note .= ' ' . date('Y-m-d Hi');
  26028. $url = 'https://'.$originUrl.'/settings/tokens/new?scopes=repo&description=' . str_replace('%20', '+', rawurlencode($note));
  26029. $this->io->writeError(sprintf('Head to %s', $url));
  26030. $this->io->writeError(sprintf('to retrieve a token. It will be stored in "%s" for future use by Composer.', $this->config->getAuthConfigSource()->getName()));
  26031. $token = trim($this->io->askAndHideAnswer('Token (hidden): '));
  26032. if (!$token) {
  26033. $this->io->writeError('<warning>No token given, aborting.</warning>');
  26034. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  26035. return false;
  26036. }
  26037. $this->io->setAuthentication($originUrl, $token, 'x-oauth-basic');
  26038. try {
  26039. $apiUrl = ('github.com' === $originUrl) ? 'api.github.com/' : $originUrl . '/api/v3/';
  26040. $this->remoteFilesystem->getContents($originUrl, 'https://'. $apiUrl, false, array(
  26041. 'retry-auth-failure' => false,
  26042. ));
  26043. } catch (TransportException $e) {
  26044. if (in_array($e->getCode(), array(403, 401))) {
  26045. $this->io->writeError('<error>Invalid token provided.</error>');
  26046. $this->io->writeError('You can also add it manually later by using "composer config --global --auth github-oauth.github.com <token>"');
  26047. return false;
  26048. }
  26049. throw $e;
  26050. }
  26051. $this->config->getConfigSource()->removeConfigSetting('github-oauth.'.$originUrl);
  26052. $this->config->getAuthConfigSource()->addConfigSetting('github-oauth.'.$originUrl, $token);
  26053. $this->io->writeError('<info>Token stored successfully.</info>');
  26054. return true;
  26055. }
  26056. public function getRateLimit(array $headers)
  26057. {
  26058. $rateLimit = array(
  26059. 'limit' => '?',
  26060. 'reset' => '?',
  26061. );
  26062. foreach ($headers as $header) {
  26063. $header = trim($header);
  26064. if (false === strpos($header, 'X-RateLimit-')) {
  26065. continue;
  26066. }
  26067. list($type, $value) = explode(':', $header, 2);
  26068. switch ($type) {
  26069. case 'X-RateLimit-Limit':
  26070. $rateLimit['limit'] = (int) trim($value);
  26071. break;
  26072. case 'X-RateLimit-Reset':
  26073. $rateLimit['reset'] = date('Y-m-d H:i:s', (int) trim($value));
  26074. break;
  26075. }
  26076. }
  26077. return $rateLimit;
  26078. }
  26079. public function isRateLimited(array $headers)
  26080. {
  26081. foreach ($headers as $header) {
  26082. if (preg_match('{^X-RateLimit-Remaining: *0$}i', trim($header))) {
  26083. return true;
  26084. }
  26085. }
  26086. return false;
  26087. }
  26088. }
  26089. <?php
  26090. namespace Composer\Util;
  26091. use Composer\IO\IOInterface;
  26092. use Composer\Config;
  26093. use Composer\Factory;
  26094. use Composer\Downloader\TransportException;
  26095. use Composer\Json\JsonFile;
  26096. class GitLab
  26097. {
  26098. protected $io;
  26099. protected $config;
  26100. protected $process;
  26101. protected $remoteFilesystem;
  26102. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process = null, RemoteFilesystem $remoteFilesystem = null)
  26103. {
  26104. $this->io = $io;
  26105. $this->config = $config;
  26106. $this->process = $process ?: new ProcessExecutor($io);
  26107. $this->remoteFilesystem = $remoteFilesystem ?: Factory::createRemoteFilesystem($this->io, $config);
  26108. }
  26109. public function authorizeOAuth($originUrl)
  26110. {
  26111. $bcOriginUrl = preg_replace('{:\d+}', '', $originUrl);
  26112. if (!in_array($originUrl, $this->config->get('gitlab-domains'), true) && !in_array($bcOriginUrl, $this->config->get('gitlab-domains'), true)) {
  26113. return false;
  26114. }
  26115. if (0 === $this->process->execute('git config gitlab.accesstoken', $output)) {
  26116. $this->io->setAuthentication($originUrl, trim($output), 'oauth2');
  26117. return true;
  26118. }
  26119. $authTokens = $this->config->get('gitlab-token');
  26120. if (isset($authTokens[$originUrl])) {
  26121. $this->io->setAuthentication($originUrl, $authTokens[$originUrl], 'private-token');
  26122. return true;
  26123. }
  26124. if (isset($authTokens[$bcOriginUrl])) {
  26125. $this->io->setAuthentication($originUrl, $authTokens[$bcOriginUrl], 'private-token');
  26126. return true;
  26127. }
  26128. return false;
  26129. }
  26130. public function authorizeOAuthInteractively($scheme, $originUrl, $message = null)
  26131. {
  26132. if ($message) {
  26133. $this->io->writeError($message);
  26134. }
  26135. $this->io->writeError(sprintf('A token will be created and stored in "%s", your password will never be stored', $this->config->getAuthConfigSource()->getName()));
  26136. $this->io->writeError('To revoke access to this token you can visit '.$originUrl.'/profile/applications');
  26137. $attemptCounter = 0;
  26138. while ($attemptCounter++ < 5) {
  26139. try {
  26140. $response = $this->createToken($scheme, $originUrl);
  26141. } catch (TransportException $e) {
  26142. if (in_array($e->getCode(), array(403, 401))) {
  26143. if (401 === $e->getCode()) {
  26144. $this->io->writeError('Bad credentials.');
  26145. } else {
  26146. $this->io->writeError('Maximum number of login attempts exceeded. Please try again later.');
  26147. }
  26148. $this->io->writeError('You can also manually create a personal token at '.$scheme.'://'.$originUrl.'/profile/personal_access_tokens');
  26149. $this->io->writeError('Add it using "composer config --global --auth gitlab-token.'.$originUrl.' <token>"');
  26150. continue;
  26151. }
  26152. throw $e;
  26153. }
  26154. $this->io->setAuthentication($originUrl, $response['access_token'], 'oauth2');
  26155. $this->config->getAuthConfigSource()->addConfigSetting('gitlab-oauth.'.$originUrl, $response['access_token']);
  26156. return true;
  26157. }
  26158. throw new \RuntimeException('Invalid GitLab credentials 5 times in a row, aborting.');
  26159. }
  26160. private function createToken($scheme, $originUrl)
  26161. {
  26162. $username = $this->io->ask('Username: ');
  26163. $password = $this->io->askAndHideAnswer('Password: ');
  26164. $headers = array('Content-Type: application/x-www-form-urlencoded');
  26165. $apiUrl = $originUrl;
  26166. $data = http_build_query(array(
  26167. 'username' => $username,
  26168. 'password' => $password,
  26169. 'grant_type' => 'password',
  26170. ), null, '&');
  26171. $options = array(
  26172. 'retry-auth-failure' => false,
  26173. 'http' => array(
  26174. 'method' => 'POST',
  26175. 'header' => $headers,
  26176. 'content' => $data,
  26177. ),
  26178. );
  26179. $json = $this->remoteFilesystem->getContents($originUrl, $scheme.'://'.$apiUrl.'/oauth/token', false, $options);
  26180. $this->io->writeError('Token successfully created');
  26181. return JsonFile::parseJson($json);
  26182. }
  26183. }
  26184. <?php
  26185. namespace Composer\Util;
  26186. use Composer\Config;
  26187. use Composer\IO\IOInterface;
  26188. class Hg
  26189. {
  26190. private $io;
  26191. private $config;
  26192. private $process;
  26193. public function __construct(IOInterface $io, Config $config, ProcessExecutor $process)
  26194. {
  26195. $this->io = $io;
  26196. $this->config = $config;
  26197. $this->process = $process;
  26198. }
  26199. public function runCommand($commandCallable, $url, $cwd)
  26200. {
  26201. $this->config->prohibitUrlByConfig($url, $this->io);
  26202. $command = call_user_func($commandCallable, $url);
  26203. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26204. return;
  26205. }
  26206. if (preg_match('{^(https?)://((.+)(?:\:(.+))?@)?([^/]+)(/.*)?}mi', $url, $match) && $this->io->hasAuthentication($match[5])) {
  26207. $auth = $this->io->getAuthentication($match[5]);
  26208. $authenticatedUrl = $match[1] . '://' . rawurlencode($auth['username']) . ':' . rawurlencode($auth['password']) . '@' . $match[5] . (!empty($match[6]) ? $match[6] : null);
  26209. $command = call_user_func($commandCallable, $authenticatedUrl);
  26210. if (0 === $this->process->execute($command, $ignoredOutput, $cwd)) {
  26211. return;
  26212. }
  26213. $error = $this->process->getErrorOutput();
  26214. } else {
  26215. $error = 'The given URL (' . $url . ') does not match the required format (http(s)://(username:password@)example.com/path-to-repository)';
  26216. }
  26217. $this->throwException('Failed to clone ' . $url . ', ' . "\n\n" . $error, $url);
  26218. }
  26219. public static function sanitizeUrl($message)
  26220. {
  26221. return preg_replace_callback('{://(?P<user>[^@]+?):(?P<password>.+?)@}', function ($m) {
  26222. if (preg_match('{^[a-f0-9]{12,}$}', $m[1])) {
  26223. return '://***:***@';
  26224. }
  26225. return '://' . $m[1] . ':***@';
  26226. }, $message);
  26227. }
  26228. private function throwException($message, $url)
  26229. {
  26230. if (0 !== $this->process->execute('hg --version', $ignoredOutput)) {
  26231. 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()));
  26232. }
  26233. throw new \RuntimeException(self::sanitizeUrl($message));
  26234. }
  26235. }
  26236. <?php
  26237. namespace Composer\Util;
  26238. use Composer\XdebugHandler\XdebugHandler;
  26239. class IniHelper
  26240. {
  26241. public static function getAll()
  26242. {
  26243. return XdebugHandler::getAllIniFiles();
  26244. }
  26245. public static function getMessage()
  26246. {
  26247. $paths = self::getAll();
  26248. if (empty($paths[0])) {
  26249. array_shift($paths);
  26250. }
  26251. $ini = array_shift($paths);
  26252. if (empty($ini)) {
  26253. return 'A php.ini file does not exist. You will have to create one.';
  26254. }
  26255. if (!empty($paths)) {
  26256. return 'Your command-line PHP is using multiple ini files. Run `php --ini` to show them.';
  26257. }
  26258. return 'The php.ini used by your command-line PHP is: '.$ini;
  26259. }
  26260. }
  26261. <?php
  26262. namespace Composer\Util;
  26263. class NoProxyPattern
  26264. {
  26265. protected $rules = array();
  26266. public function __construct($pattern)
  26267. {
  26268. $this->rules = preg_split("/[\s,]+/", $pattern);
  26269. }
  26270. public function test($url)
  26271. {
  26272. $host = parse_url($url, PHP_URL_HOST);
  26273. $port = parse_url($url, PHP_URL_PORT);
  26274. if (empty($port)) {
  26275. switch (parse_url($url, PHP_URL_SCHEME)) {
  26276. case 'http':
  26277. $port = 80;
  26278. break;
  26279. case 'https':
  26280. $port = 443;
  26281. break;
  26282. }
  26283. }
  26284. foreach ($this->rules as $rule) {
  26285. if ($rule == '*') {
  26286. return true;
  26287. }
  26288. $match = false;
  26289. list($ruleHost) = explode(':', $rule);
  26290. list($base) = explode('/', $ruleHost);
  26291. if (filter_var($base, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
  26292. if (!isset($ip)) {
  26293. $ip = gethostbyname($host);
  26294. }
  26295. if (strpos($ruleHost, '/') === false) {
  26296. $match = $ip === $ruleHost;
  26297. } else {
  26298. if ($ip === $host) {
  26299. $match = false;
  26300. } else {
  26301. $match = self::inCIDRBlock($ruleHost, $ip);
  26302. }
  26303. }
  26304. } else {
  26305. $haystack = '.' . trim($host, '.') . '.';
  26306. $needle = '.'. trim($ruleHost, '.') .'.';
  26307. $match = stripos(strrev($haystack), strrev($needle)) === 0;
  26308. }
  26309. if ($match && strpos($rule, ':') !== false) {
  26310. list(, $rulePort) = explode(':', $rule);
  26311. if (!empty($rulePort) && $port != $rulePort) {
  26312. $match = false;
  26313. }
  26314. }
  26315. if ($match) {
  26316. return true;
  26317. }
  26318. }
  26319. return false;
  26320. }
  26321. private static function inCIDRBlock($cidr, $ip)
  26322. {
  26323. list($base, $bits) = explode('/', $cidr);
  26324. list($a, $b, $c, $d) = explode('.', $base);
  26325. $i = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26326. $mask = $bits == 0 ? 0 : (~0 << (32 - $bits));
  26327. $low = $i & $mask;
  26328. $high = $i | (~$mask & 0xFFFFFFFF);
  26329. list($a, $b, $c, $d) = explode('.', $ip);
  26330. $check = ($a << 24) + ($b << 16) + ($c << 8) + $d;
  26331. return $check >= $low && $check <= $high;
  26332. }
  26333. }
  26334. <?php
  26335. namespace Composer\Util;
  26336. use Composer\Package\Link;
  26337. use Composer\Package\PackageInterface;
  26338. class PackageSorter
  26339. {
  26340. public static function sortPackages(array $packages) {
  26341. $usageList = array();
  26342. foreach ($packages as $package) {
  26343. foreach (array_merge($package->getRequires(), $package->getDevRequires()) as $link) {
  26344. $target = $link->getTarget();
  26345. $usageList[$target][] = $package->getName();
  26346. }
  26347. }
  26348. $computing = array();
  26349. $computed = array();
  26350. $computeImportance = function ($name) use (&$computeImportance, &$computing, &$computed, $usageList) {
  26351. if (isset($computed[$name])) {
  26352. return $computed[$name];
  26353. }
  26354. if (isset($computing[$name])) {
  26355. return 0;
  26356. }
  26357. $computing[$name] = true;
  26358. $weight = 0;
  26359. if (isset($usageList[$name])) {
  26360. foreach ($usageList[$name] as $user) {
  26361. $weight -= 1 - $computeImportance($user);
  26362. }
  26363. }
  26364. unset($computing[$name]);
  26365. $computed[$name] = $weight;
  26366. return $weight;
  26367. };
  26368. $weightList = array();
  26369. foreach ($packages as $name => $package) {
  26370. $weight = $computeImportance($name);
  26371. $weightList[$name] = $weight;
  26372. }
  26373. $stable_sort = function (&$array) {
  26374. static $transform, $restore;
  26375. $i = 0;
  26376. if (!$transform) {
  26377. $transform = function (&$v, $k) use (&$i) {
  26378. $v = array($v, ++$i, $k, $v);
  26379. };
  26380. $restore = function (&$v) {
  26381. $v = $v[3];
  26382. };
  26383. }
  26384. array_walk($array, $transform);
  26385. asort($array);
  26386. array_walk($array, $restore);
  26387. };
  26388. $stable_sort($weightList);
  26389. $sortedPackages = array();
  26390. foreach (array_keys($weightList) as $name) {
  26391. $sortedPackages[] = $packages[$name];
  26392. }
  26393. return $sortedPackages;
  26394. }
  26395. }
  26396. <?php
  26397. namespace Composer\Util;
  26398. use Composer\IO\IOInterface;
  26399. use Symfony\Component\Process\Process;
  26400. class Perforce
  26401. {
  26402. protected $path;
  26403. protected $p4Depot;
  26404. protected $p4Client;
  26405. protected $p4User;
  26406. protected $p4Password;
  26407. protected $p4Port;
  26408. protected $p4Stream;
  26409. protected $p4ClientSpec;
  26410. protected $p4DepotType;
  26411. protected $p4Branch;
  26412. protected $process;
  26413. protected $uniquePerforceClientName;
  26414. protected $windowsFlag;
  26415. protected $commandResult;
  26416. protected $io;
  26417. protected $filesystem;
  26418. public function __construct($repoConfig, $port, $path, ProcessExecutor $process, $isWindows, IOInterface $io)
  26419. {
  26420. $this->windowsFlag = $isWindows;
  26421. $this->p4Port = $port;
  26422. $this->initializePath($path);
  26423. $this->process = $process;
  26424. $this->initialize($repoConfig);
  26425. $this->io = $io;
  26426. }
  26427. public static function create($repoConfig, $port, $path, ProcessExecutor $process, IOInterface $io)
  26428. {
  26429. return new Perforce($repoConfig, $port, $path, $process, Platform::isWindows(), $io);
  26430. }
  26431. public static function checkServerExists($url, ProcessExecutor $processExecutor)
  26432. {
  26433. $output = null;
  26434. return 0 === $processExecutor->execute('p4 -p ' . ProcessExecutor::escape($url) . ' info -s', $output);
  26435. }
  26436. public function initialize($repoConfig)
  26437. {
  26438. $this->uniquePerforceClientName = $this->generateUniquePerforceClientName();
  26439. if (!$repoConfig) {
  26440. return;
  26441. }
  26442. if (isset($repoConfig['unique_perforce_client_name'])) {
  26443. $this->uniquePerforceClientName = $repoConfig['unique_perforce_client_name'];
  26444. }
  26445. if (isset($repoConfig['depot'])) {
  26446. $this->p4Depot = $repoConfig['depot'];
  26447. }
  26448. if (isset($repoConfig['branch'])) {
  26449. $this->p4Branch = $repoConfig['branch'];
  26450. }
  26451. if (isset($repoConfig['p4user'])) {
  26452. $this->p4User = $repoConfig['p4user'];
  26453. } else {
  26454. $this->p4User = $this->getP4variable('P4USER');
  26455. }
  26456. if (isset($repoConfig['p4password'])) {
  26457. $this->p4Password = $repoConfig['p4password'];
  26458. }
  26459. }
  26460. public function initializeDepotAndBranch($depot, $branch)
  26461. {
  26462. if (isset($depot)) {
  26463. $this->p4Depot = $depot;
  26464. }
  26465. if (isset($branch)) {
  26466. $this->p4Branch = $branch;
  26467. }
  26468. }
  26469. public function generateUniquePerforceClientName()
  26470. {
  26471. return gethostname() . "_" . time();
  26472. }
  26473. public function cleanupClientSpec()
  26474. {
  26475. $client = $this->getClient();
  26476. $task = 'client -d ' . ProcessExecutor::escape($client);
  26477. $useP4Client = false;
  26478. $command = $this->generateP4Command($task, $useP4Client);
  26479. $this->executeCommand($command);
  26480. $clientSpec = $this->getP4ClientSpec();
  26481. $fileSystem = $this->getFilesystem();
  26482. $fileSystem->remove($clientSpec);
  26483. }
  26484. protected function executeCommand($command)
  26485. {
  26486. $this->commandResult = '';
  26487. return $this->process->execute($command, $this->commandResult);
  26488. }
  26489. public function getClient()
  26490. {
  26491. if (!isset($this->p4Client)) {
  26492. $cleanStreamName = str_replace(array('//', '/', '@'), array('', '_', ''), $this->getStream());
  26493. $this->p4Client = 'composer_perforce_' . $this->uniquePerforceClientName . '_' . $cleanStreamName;
  26494. }
  26495. return $this->p4Client;
  26496. }
  26497. protected function getPath()
  26498. {
  26499. return $this->path;
  26500. }
  26501. public function initializePath($path)
  26502. {
  26503. $this->path = $path;
  26504. $fs = $this->getFilesystem();
  26505. $fs->ensureDirectoryExists($path);
  26506. }
  26507. protected function getPort()
  26508. {
  26509. return $this->p4Port;
  26510. }
  26511. public function setStream($stream)
  26512. {
  26513. $this->p4Stream = $stream;
  26514. $index = strrpos($stream, '/');
  26515. if ($index > 2) {
  26516. $this->p4DepotType = 'stream';
  26517. }
  26518. }
  26519. public function isStream()
  26520. {
  26521. return (strcmp($this->p4DepotType, 'stream') === 0);
  26522. }
  26523. public function getStream()
  26524. {
  26525. if (!isset($this->p4Stream)) {
  26526. if ($this->isStream()) {
  26527. $this->p4Stream = '//' . $this->p4Depot . '/' . $this->p4Branch;
  26528. } else {
  26529. $this->p4Stream = '//' . $this->p4Depot;
  26530. }
  26531. }
  26532. return $this->p4Stream;
  26533. }
  26534. public function getStreamWithoutLabel($stream)
  26535. {
  26536. $index = strpos($stream, '@');
  26537. if ($index === false) {
  26538. return $stream;
  26539. }
  26540. return substr($stream, 0, $index);
  26541. }
  26542. public function getP4ClientSpec()
  26543. {
  26544. return $this->path . '/' . $this->getClient() . '.p4.spec';
  26545. }
  26546. public function getUser()
  26547. {
  26548. return $this->p4User;
  26549. }
  26550. public function setUser($user)
  26551. {
  26552. $this->p4User = $user;
  26553. }
  26554. public function queryP4User()
  26555. {
  26556. $this->getUser();
  26557. if (strlen($this->p4User) > 0) {
  26558. return;
  26559. }
  26560. $this->p4User = $this->getP4variable('P4USER');
  26561. if (strlen($this->p4User) > 0) {
  26562. return;
  26563. }
  26564. $this->p4User = $this->io->ask('Enter P4 User:');
  26565. if ($this->windowsFlag) {
  26566. $command = 'p4 set P4USER=' . $this->p4User;
  26567. } else {
  26568. $command = 'export P4USER=' . $this->p4User;
  26569. }
  26570. $this->executeCommand($command);
  26571. }
  26572. protected function getP4variable($name)
  26573. {
  26574. if ($this->windowsFlag) {
  26575. $command = 'p4 set';
  26576. $this->executeCommand($command);
  26577. $result = trim($this->commandResult);
  26578. $resArray = explode(PHP_EOL, $result);
  26579. foreach ($resArray as $line) {
  26580. $fields = explode('=', $line);
  26581. if (strcmp($name, $fields[0]) == 0) {
  26582. $index = strpos($fields[1], ' ');
  26583. if ($index === false) {
  26584. $value = $fields[1];
  26585. } else {
  26586. $value = substr($fields[1], 0, $index);
  26587. }
  26588. $value = trim($value);
  26589. return $value;
  26590. }
  26591. }
  26592. return null;
  26593. }
  26594. $command = 'echo $' . $name;
  26595. $this->executeCommand($command);
  26596. $result = trim($this->commandResult);
  26597. return $result;
  26598. }
  26599. public function queryP4Password()
  26600. {
  26601. if (isset($this->p4Password)) {
  26602. return $this->p4Password;
  26603. }
  26604. $password = $this->getP4variable('P4PASSWD');
  26605. if (strlen($password) <= 0) {
  26606. $password = $this->io->askAndHideAnswer('Enter password for Perforce user ' . $this->getUser() . ': ');
  26607. }
  26608. $this->p4Password = $password;
  26609. return $password;
  26610. }
  26611. public function generateP4Command($command, $useClient = true)
  26612. {
  26613. $p4Command = 'p4 ';
  26614. $p4Command .= '-u ' . $this->getUser() . ' ';
  26615. if ($useClient) {
  26616. $p4Command .= '-c ' . $this->getClient() . ' ';
  26617. }
  26618. $p4Command = $p4Command . '-p ' . $this->getPort() . ' ' . $command;
  26619. return $p4Command;
  26620. }
  26621. public function isLoggedIn()
  26622. {
  26623. $command = $this->generateP4Command('login -s', false);
  26624. $exitCode = $this->executeCommand($command);
  26625. if ($exitCode) {
  26626. $errorOutput = $this->process->getErrorOutput();
  26627. $index = strpos($errorOutput, $this->getUser());
  26628. if ($index === false) {
  26629. $index = strpos($errorOutput, 'p4');
  26630. if ($index === false) {
  26631. return false;
  26632. }
  26633. throw new \Exception('p4 command not found in path: ' . $errorOutput);
  26634. }
  26635. throw new \Exception('Invalid user name: ' . $this->getUser());
  26636. }
  26637. return true;
  26638. }
  26639. public function connectClient()
  26640. {
  26641. $p4CreateClientCommand = $this->generateP4Command(
  26642. 'client -i < ' . str_replace(" ", "\\ ", $this->getP4ClientSpec())
  26643. );
  26644. $this->executeCommand($p4CreateClientCommand);
  26645. }
  26646. public function syncCodeBase($sourceReference)
  26647. {
  26648. $prevDir = getcwd();
  26649. chdir($this->path);
  26650. $p4SyncCommand = $this->generateP4Command('sync -f ');
  26651. if (null !== $sourceReference) {
  26652. $p4SyncCommand .= '@' . $sourceReference;
  26653. }
  26654. $this->executeCommand($p4SyncCommand);
  26655. chdir($prevDir);
  26656. }
  26657. public function writeClientSpecToFile($spec)
  26658. {
  26659. fwrite($spec, 'Client: ' . $this->getClient() . PHP_EOL . PHP_EOL);
  26660. fwrite($spec, 'Update: ' . date('Y/m/d H:i:s') . PHP_EOL . PHP_EOL);
  26661. fwrite($spec, 'Access: ' . date('Y/m/d H:i:s') . PHP_EOL);
  26662. fwrite($spec, 'Owner: ' . $this->getUser() . PHP_EOL . PHP_EOL);
  26663. fwrite($spec, 'Description:' . PHP_EOL);
  26664. fwrite($spec, ' Created by ' . $this->getUser() . ' from composer.' . PHP_EOL . PHP_EOL);
  26665. fwrite($spec, 'Root: ' . $this->getPath() . PHP_EOL . PHP_EOL);
  26666. fwrite($spec, 'Options: noallwrite noclobber nocompress unlocked modtime rmdir' . PHP_EOL . PHP_EOL);
  26667. fwrite($spec, 'SubmitOptions: revertunchanged' . PHP_EOL . PHP_EOL);
  26668. fwrite($spec, 'LineEnd: local' . PHP_EOL . PHP_EOL);
  26669. if ($this->isStream()) {
  26670. fwrite($spec, 'Stream:' . PHP_EOL);
  26671. fwrite($spec, ' ' . $this->getStreamWithoutLabel($this->p4Stream) . PHP_EOL);
  26672. } else {
  26673. fwrite(
  26674. $spec,
  26675. 'View: ' . $this->getStream() . '/... //' . $this->getClient() . '/... ' . PHP_EOL
  26676. );
  26677. }
  26678. }
  26679. public function writeP4ClientSpec()
  26680. {
  26681. $clientSpec = $this->getP4ClientSpec();
  26682. $spec = fopen($clientSpec, 'w');
  26683. try {
  26684. $this->writeClientSpecToFile($spec);
  26685. } catch (\Exception $e) {
  26686. fclose($spec);
  26687. throw $e;
  26688. }
  26689. fclose($spec);
  26690. }
  26691. protected function read($pipe, $name)
  26692. {
  26693. if (feof($pipe)) {
  26694. return;
  26695. }
  26696. $line = fgets($pipe);
  26697. while ($line !== false) {
  26698. $line = fgets($pipe);
  26699. }
  26700. }
  26701. public function windowsLogin($password)
  26702. {
  26703. $command = $this->generateP4Command(' login -a');
  26704. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26705. $process = Process::fromShellCommandline($command, null, null, $password);
  26706. } else {
  26707. $process = new Process($command, null, null, $password);
  26708. }
  26709. return $process->run();
  26710. }
  26711. public function p4Login()
  26712. {
  26713. $this->queryP4User();
  26714. if (!$this->isLoggedIn()) {
  26715. $password = $this->queryP4Password();
  26716. if ($this->windowsFlag) {
  26717. $this->windowsLogin($password);
  26718. } else {
  26719. $command = 'echo ' . ProcessExecutor::escape($password) . ' | ' . $this->generateP4Command(' login -a', false);
  26720. $exitCode = $this->executeCommand($command);
  26721. $result = trim($this->commandResult);
  26722. if ($exitCode) {
  26723. throw new \Exception("Error logging in:" . $this->process->getErrorOutput());
  26724. }
  26725. }
  26726. }
  26727. }
  26728. public function getComposerInformation($identifier)
  26729. {
  26730. $composerFileContent = $this->getFileContent('composer.json', $identifier);
  26731. if (!$composerFileContent) {
  26732. return;
  26733. }
  26734. return json_decode($composerFileContent, true);
  26735. }
  26736. public function getFileContent($file, $identifier)
  26737. {
  26738. $path = $this->getFilePath($file, $identifier);
  26739. $command = $this->generateP4Command(' print ' . ProcessExecutor::escape($path));
  26740. $this->executeCommand($command);
  26741. $result = $this->commandResult;
  26742. if (!trim($result)) {
  26743. return null;
  26744. }
  26745. return $result;
  26746. }
  26747. public function getFilePath($file, $identifier)
  26748. {
  26749. $index = strpos($identifier, '@');
  26750. if ($index === false) {
  26751. $path = $identifier. '/' . $file;
  26752. return $path;
  26753. }
  26754. $path = substr($identifier, 0, $index) . '/' . $file . substr($identifier, $index);
  26755. $command = $this->generateP4Command(' files ' . ProcessExecutor::escape($path), false);
  26756. $this->executeCommand($command);
  26757. $result = $this->commandResult;
  26758. $index2 = strpos($result, 'no such file(s).');
  26759. if ($index2 === false) {
  26760. $index3 = strpos($result, 'change');
  26761. if ($index3 !== false) {
  26762. $phrase = trim(substr($result, $index3));
  26763. $fields = explode(' ', $phrase);
  26764. return substr($identifier, 0, $index) . '/' . $file . '@' . $fields[1];
  26765. }
  26766. }
  26767. return null;
  26768. }
  26769. public function getBranches()
  26770. {
  26771. $possibleBranches = array();
  26772. if (!$this->isStream()) {
  26773. $possibleBranches[$this->p4Branch] = $this->getStream();
  26774. } else {
  26775. $command = $this->generateP4Command('streams '.ProcessExecutor::escape('//' . $this->p4Depot . '/...'));
  26776. $this->executeCommand($command);
  26777. $result = $this->commandResult;
  26778. $resArray = explode(PHP_EOL, $result);
  26779. foreach ($resArray as $line) {
  26780. $resBits = explode(' ', $line);
  26781. if (count($resBits) > 4) {
  26782. $branch = preg_replace('/[^A-Za-z0-9 ]/', '', $resBits[4]);
  26783. $possibleBranches[$branch] = $resBits[1];
  26784. }
  26785. }
  26786. }
  26787. $command = $this->generateP4Command('changes '. ProcessExecutor::escape($this->getStream() . '/...'), false);
  26788. $this->executeCommand($command);
  26789. $result = $this->commandResult;
  26790. $resArray = explode(PHP_EOL, $result);
  26791. $lastCommit = $resArray[0];
  26792. $lastCommitArr = explode(' ', $lastCommit);
  26793. $lastCommitNum = $lastCommitArr[1];
  26794. $branches = array('master' => $possibleBranches[$this->p4Branch] . '@'. $lastCommitNum);
  26795. return $branches;
  26796. }
  26797. public function getTags()
  26798. {
  26799. $command = $this->generateP4Command('labels');
  26800. $this->executeCommand($command);
  26801. $result = $this->commandResult;
  26802. $resArray = explode(PHP_EOL, $result);
  26803. $tags = array();
  26804. foreach ($resArray as $line) {
  26805. if (strpos($line, 'Label') !== false) {
  26806. $fields = explode(' ', $line);
  26807. $tags[$fields[1]] = $this->getStream() . '@' . $fields[1];
  26808. }
  26809. }
  26810. return $tags;
  26811. }
  26812. public function checkStream()
  26813. {
  26814. $command = $this->generateP4Command('depots', false);
  26815. $this->executeCommand($command);
  26816. $result = $this->commandResult;
  26817. $resArray = explode(PHP_EOL, $result);
  26818. foreach ($resArray as $line) {
  26819. if (strpos($line, 'Depot') !== false) {
  26820. $fields = explode(' ', $line);
  26821. if (strcmp($this->p4Depot, $fields[1]) === 0) {
  26822. $this->p4DepotType = $fields[3];
  26823. return $this->isStream();
  26824. }
  26825. }
  26826. }
  26827. return false;
  26828. }
  26829. protected function getChangeList($reference)
  26830. {
  26831. $index = strpos($reference, '@');
  26832. if ($index === false) {
  26833. return null;
  26834. }
  26835. $label = substr($reference, $index);
  26836. $command = $this->generateP4Command(' changes -m1 ' . ProcessExecutor::escape($label));
  26837. $this->executeCommand($command);
  26838. $changes = $this->commandResult;
  26839. if (strpos($changes, 'Change') !== 0) {
  26840. return null;
  26841. }
  26842. $fields = explode(' ', $changes);
  26843. return $fields[1];
  26844. }
  26845. public function getCommitLogs($fromReference, $toReference)
  26846. {
  26847. $fromChangeList = $this->getChangeList($fromReference);
  26848. if ($fromChangeList === null) {
  26849. return null;
  26850. }
  26851. $toChangeList = $this->getChangeList($toReference);
  26852. if ($toChangeList === null) {
  26853. return null;
  26854. }
  26855. $index = strpos($fromReference, '@');
  26856. $main = substr($fromReference, 0, $index) . '/...';
  26857. $command = $this->generateP4Command('filelog ' . ProcessExecutor::escape($main . '@' . $fromChangeList. ',' . $toChangeList));
  26858. $this->executeCommand($command);
  26859. return $this->commandResult;
  26860. }
  26861. public function getFilesystem()
  26862. {
  26863. if (empty($this->filesystem)) {
  26864. $this->filesystem = new Filesystem($this->process);
  26865. }
  26866. return $this->filesystem;
  26867. }
  26868. public function setFilesystem(Filesystem $fs)
  26869. {
  26870. $this->filesystem = $fs;
  26871. }
  26872. }
  26873. <?php
  26874. namespace Composer\Util;
  26875. class Platform
  26876. {
  26877. public static function expandPath($path)
  26878. {
  26879. if (preg_match('#^~[\\/]#', $path)) {
  26880. return self::getUserDirectory() . substr($path, 1);
  26881. }
  26882. return preg_replace_callback('#^(\$|(?P<percent>%))(?P<var>\w++)(?(percent)%)(?P<path>.*)#', function ($matches) {
  26883. if (Platform::isWindows() && $matches['var'] == 'HOME') {
  26884. return (getenv('HOME') ?: getenv('USERPROFILE')) . $matches['path'];
  26885. }
  26886. return getenv($matches['var']) . $matches['path'];
  26887. }, $path);
  26888. }
  26889. public static function getUserDirectory()
  26890. {
  26891. if (false !== ($home = getenv('HOME'))) {
  26892. return $home;
  26893. }
  26894. if (self::isWindows() && false !== ($home = getenv('USERPROFILE'))) {
  26895. return $home;
  26896. }
  26897. if (function_exists('posix_getuid') && function_exists('posix_getpwuid')) {
  26898. $info = posix_getpwuid(posix_getuid());
  26899. return $info['dir'];
  26900. }
  26901. throw new \RuntimeException('Could not determine user directory');
  26902. }
  26903. public static function isWindows()
  26904. {
  26905. return defined('PHP_WINDOWS_VERSION_BUILD');
  26906. }
  26907. public static function strlen($str)
  26908. {
  26909. static $useMbString = null;
  26910. if (null === $useMbString) {
  26911. $useMbString = function_exists('mb_strlen') && ini_get('mbstring.func_overload');
  26912. }
  26913. if ($useMbString) {
  26914. return mb_strlen($str, '8bit');
  26915. }
  26916. return strlen($str);
  26917. }
  26918. }
  26919. <?php
  26920. namespace Composer\Util;
  26921. use Composer\IO\IOInterface;
  26922. use Symfony\Component\Process\Process;
  26923. use Symfony\Component\Process\ProcessUtils;
  26924. class ProcessExecutor
  26925. {
  26926. protected static $timeout = 300;
  26927. protected $captureOutput;
  26928. protected $errorOutput;
  26929. protected $io;
  26930. public function __construct(IOInterface $io = null)
  26931. {
  26932. $this->io = $io;
  26933. }
  26934. public function execute($command, &$output = null, $cwd = null)
  26935. {
  26936. if ($this->io && $this->io->isDebug()) {
  26937. $safeCommand = preg_replace_callback('{://(?P<user>[^:/\s]+):(?P<password>[^@\s/]+)@}i', function ($m) {
  26938. if (preg_match('{^[a-f0-9]{12,}$}', $m['user'])) {
  26939. return '://***:***@';
  26940. }
  26941. return '://'.$m['user'].':***@';
  26942. }, $command);
  26943. $safeCommand = preg_replace("{--password (.*[^\\\\]\') }", '--password \'***\' ', $safeCommand);
  26944. $this->io->writeError('Executing command ('.($cwd ?: 'CWD').'): '.$safeCommand);
  26945. }
  26946. if (null === $cwd && Platform::isWindows() && false !== strpos($command, 'git') && getcwd()) {
  26947. $cwd = realpath(getcwd());
  26948. }
  26949. $this->captureOutput = func_num_args() > 1;
  26950. $this->errorOutput = null;
  26951. if (method_exists('Symfony\Component\Process\Process', 'fromShellCommandline')) {
  26952. $process = Process::fromShellCommandline($command, $cwd, null, null, static::getTimeout());
  26953. } else {
  26954. $process = new Process($command, $cwd, null, null, static::getTimeout());
  26955. }
  26956. $callback = is_callable($output) ? $output : array($this, 'outputHandler');
  26957. $process->run($callback);
  26958. if ($this->captureOutput && !is_callable($output)) {
  26959. $output = $process->getOutput();
  26960. }
  26961. $this->errorOutput = $process->getErrorOutput();
  26962. return $process->getExitCode();
  26963. }
  26964. public function splitLines($output)
  26965. {
  26966. $output = trim($output);
  26967. return ((string) $output === '') ? array() : preg_split('{\r?\n}', $output);
  26968. }
  26969. public function getErrorOutput()
  26970. {
  26971. return $this->errorOutput;
  26972. }
  26973. public function outputHandler($type, $buffer)
  26974. {
  26975. if ($this->captureOutput) {
  26976. return;
  26977. }
  26978. if (null === $this->io) {
  26979. echo $buffer;
  26980. return;
  26981. }
  26982. if (Process::ERR === $type) {
  26983. $this->io->writeError($buffer, false);
  26984. } else {
  26985. $this->io->write($buffer, false);
  26986. }
  26987. }
  26988. public static function getTimeout()
  26989. {
  26990. return static::$timeout;
  26991. }
  26992. public static function setTimeout($timeout)
  26993. {
  26994. static::$timeout = $timeout;
  26995. }
  26996. public static function escape($argument)
  26997. {
  26998. return self::escapeArgument($argument);
  26999. }
  27000. private static function escapeArgument($argument)
  27001. {
  27002. if ('\\' === DIRECTORY_SEPARATOR) {
  27003. if ('' === $argument) {
  27004. return escapeshellarg($argument);
  27005. }
  27006. $escapedArgument = '';
  27007. $quote = false;
  27008. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  27009. if ('"' === $part) {
  27010. $escapedArgument .= '\\"';
  27011. } elseif (self::isSurroundedBy($part, '%')) {
  27012. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  27013. } else {
  27014. if ('\\' === substr($part, -1)) {
  27015. $part .= '\\';
  27016. }
  27017. $quote = true;
  27018. $escapedArgument .= $part;
  27019. }
  27020. }
  27021. if ($quote) {
  27022. $escapedArgument = '"'.$escapedArgument.'"';
  27023. }
  27024. return $escapedArgument;
  27025. }
  27026. return "'".str_replace("'", "'\\''", $argument)."'";
  27027. }
  27028. private static function isSurroundedBy($arg, $char)
  27029. {
  27030. return 2 < strlen($arg) && $char === $arg[0] && $char === $arg[strlen($arg) - 1];
  27031. }
  27032. }
  27033. <?php
  27034. namespace Composer\Util;
  27035. use Composer\Config;
  27036. use Composer\Composer;
  27037. use Composer\Semver\Constraint\Constraint;
  27038. use Composer\Package\Version\VersionParser;
  27039. use Composer\IO\IOInterface;
  27040. use Composer\Downloader\TransportException;
  27041. use Composer\CaBundle\CaBundle;
  27042. use Psr\Log\LoggerInterface;
  27043. class RemoteFilesystem
  27044. {
  27045. private $io;
  27046. private $config;
  27047. private $scheme;
  27048. private $bytesMax;
  27049. private $originUrl;
  27050. private $fileUrl;
  27051. private $fileName;
  27052. private $retry;
  27053. private $progress;
  27054. private $lastProgress;
  27055. private $options = array();
  27056. private $peerCertificateMap = array();
  27057. private $disableTls = false;
  27058. private $retryAuthFailure;
  27059. private $lastHeaders;
  27060. private $storeAuth;
  27061. private $degradedMode = false;
  27062. private $redirects;
  27063. private $maxRedirects = 20;
  27064. public function __construct(IOInterface $io, Config $config = null, array $options = array(), $disableTls = false)
  27065. {
  27066. $this->io = $io;
  27067. if ($disableTls === false) {
  27068. $this->options = $this->getTlsDefaults($options);
  27069. } else {
  27070. $this->disableTls = true;
  27071. }
  27072. $this->options = array_replace_recursive($this->options, $options);
  27073. $this->config = $config;
  27074. }
  27075. public function copy($originUrl, $fileUrl, $fileName, $progress = true, $options = array())
  27076. {
  27077. return $this->get($originUrl, $fileUrl, $options, $fileName, $progress);
  27078. }
  27079. public function getContents($originUrl, $fileUrl, $progress = true, $options = array())
  27080. {
  27081. return $this->get($originUrl, $fileUrl, $options, null, $progress);
  27082. }
  27083. public function getOptions()
  27084. {
  27085. return $this->options;
  27086. }
  27087. public function setOptions(array $options)
  27088. {
  27089. $this->options = array_replace_recursive($this->options, $options);
  27090. }
  27091. public function isTlsDisabled()
  27092. {
  27093. return $this->disableTls === true;
  27094. }
  27095. public function getLastHeaders()
  27096. {
  27097. return $this->lastHeaders;
  27098. }
  27099. public function findHeaderValue(array $headers, $name)
  27100. {
  27101. $value = null;
  27102. foreach ($headers as $header) {
  27103. if (preg_match('{^'.$name.':\s*(.+?)\s*$}i', $header, $match)) {
  27104. $value = $match[1];
  27105. } elseif (preg_match('{^HTTP/}i', $header)) {
  27106. $value = null;
  27107. }
  27108. }
  27109. return $value;
  27110. }
  27111. public function findStatusCode(array $headers)
  27112. {
  27113. $value = null;
  27114. foreach ($headers as $header) {
  27115. if (preg_match('{^HTTP/\S+ (\d+)}i', $header, $match)) {
  27116. $value = (int) $match[1];
  27117. }
  27118. }
  27119. return $value;
  27120. }
  27121. public function findStatusMessage(array $headers)
  27122. {
  27123. $value = null;
  27124. foreach ($headers as $header) {
  27125. if (preg_match('{^HTTP/\S+ \d+}i', $header)) {
  27126. $value = $header;
  27127. }
  27128. }
  27129. return $value;
  27130. }
  27131. protected function get($originUrl, $fileUrl, $additionalOptions = array(), $fileName = null, $progress = true)
  27132. {
  27133. if (strpos($originUrl, '.github.com') === (strlen($originUrl) - 11)) {
  27134. $originUrl = 'github.com';
  27135. }
  27136. if (
  27137. $this->config
  27138. && is_array($this->config->get('gitlab-domains'))
  27139. && false === strpos($originUrl, '/')
  27140. && !in_array($originUrl, $this->config->get('gitlab-domains'))
  27141. ) {
  27142. foreach ($this->config->get('gitlab-domains') as $gitlabDomain) {
  27143. if (0 === strpos($gitlabDomain, $originUrl)) {
  27144. $originUrl = $gitlabDomain;
  27145. break;
  27146. }
  27147. }
  27148. unset($gitlabDomain);
  27149. }
  27150. $this->scheme = parse_url($fileUrl, PHP_URL_SCHEME);
  27151. $this->bytesMax = 0;
  27152. $this->originUrl = $originUrl;
  27153. $this->fileUrl = $fileUrl;
  27154. $this->fileName = $fileName;
  27155. $this->progress = $progress;
  27156. $this->lastProgress = null;
  27157. $this->retryAuthFailure = true;
  27158. $this->lastHeaders = array();
  27159. $this->redirects = 1;
  27160. if (preg_match('{^https?://([^:/]+):([^@/]+)@([^/]+)}i', $fileUrl, $match)) {
  27161. $this->io->setAuthentication($originUrl, rawurldecode($match[1]), rawurldecode($match[2]));
  27162. }
  27163. $tempAdditionalOptions = $additionalOptions;
  27164. if (isset($tempAdditionalOptions['retry-auth-failure'])) {
  27165. $this->retryAuthFailure = (bool) $tempAdditionalOptions['retry-auth-failure'];
  27166. unset($tempAdditionalOptions['retry-auth-failure']);
  27167. }
  27168. $isRedirect = false;
  27169. if (isset($tempAdditionalOptions['redirects'])) {
  27170. $this->redirects = $tempAdditionalOptions['redirects'];
  27171. $isRedirect = true;
  27172. unset($tempAdditionalOptions['redirects']);
  27173. }
  27174. $options = $this->getOptionsForUrl($originUrl, $tempAdditionalOptions);
  27175. unset($tempAdditionalOptions);
  27176. $origFileUrl = $fileUrl;
  27177. if (isset($options['github-token'])) {
  27178. if (preg_match('{^https?://([a-z0-9-]+\.)*github\.com/}', $fileUrl)) {
  27179. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['github-token'];
  27180. }
  27181. unset($options['github-token']);
  27182. }
  27183. if (isset($options['gitlab-token'])) {
  27184. $fileUrl .= (false === strpos($fileUrl, '?') ? '?' : '&') . 'access_token='.$options['gitlab-token'];
  27185. unset($options['gitlab-token']);
  27186. }
  27187. if (isset($options['http'])) {
  27188. $options['http']['ignore_errors'] = true;
  27189. }
  27190. if ($this->degradedMode && substr($fileUrl, 0, 26) === 'http://repo.packagist.org/') {
  27191. $fileUrl = 'http://' . gethostbyname('repo.packagist.org') . substr($fileUrl, 20);
  27192. $degradedPackagist = true;
  27193. }
  27194. $ctx = StreamContextFactory::getContext($fileUrl, $options, array('notification' => array($this, 'callbackGet')));
  27195. $actualContextOptions = stream_context_get_options($ctx);
  27196. $usingProxy = !empty($actualContextOptions['http']['proxy']) ? ' using proxy ' . $actualContextOptions['http']['proxy'] : '';
  27197. $this->io->writeError((substr($origFileUrl, 0, 4) === 'http' ? 'Downloading ' : 'Reading ') . $this->stripCredentialsFromUrl($origFileUrl) . $usingProxy, true, IOInterface::DEBUG);
  27198. unset($origFileUrl, $actualContextOptions);
  27199. if ((!preg_match('{^http://(repo\.)?packagist\.org/p/}', $fileUrl) || (false === strpos($fileUrl, '$') && false === strpos($fileUrl, '%24'))) && empty($degradedPackagist) && $this->config) {
  27200. $this->config->prohibitUrlByConfig($fileUrl, $this->io);
  27201. }
  27202. if ($this->progress && !$isRedirect) {
  27203. $this->io->writeError("Downloading (<comment>connecting...</comment>)", false);
  27204. }
  27205. $errorMessage = '';
  27206. $errorCode = 0;
  27207. $result = false;
  27208. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27209. if ($errorMessage) {
  27210. $errorMessage .= "\n";
  27211. }
  27212. $errorMessage .= preg_replace('{^file_get_contents\(.*?\): }', '', $msg);
  27213. return true;
  27214. });
  27215. try {
  27216. $result = $this->getRemoteContents($originUrl, $fileUrl, $ctx, $http_response_header);
  27217. if (!empty($http_response_header[0])) {
  27218. $statusCode = $this->findStatusCode($http_response_header);
  27219. if ($statusCode >= 400 && $this->findHeaderValue($http_response_header, 'content-type') === 'application/json') {
  27220. self::outputWarnings($this->io, $originUrl, json_decode($result, true));
  27221. }
  27222. if (in_array($statusCode, array(401, 403)) && $this->retryAuthFailure) {
  27223. $this->promptAuthAndRetry($statusCode, $this->findStatusMessage($http_response_header), null, $http_response_header);
  27224. }
  27225. }
  27226. $contentLength = !empty($http_response_header[0]) ? $this->findHeaderValue($http_response_header, 'content-length') : null;
  27227. if ($contentLength && Platform::strlen($result) < $contentLength) {
  27228. $e = new TransportException('Content-Length mismatch, received '.Platform::strlen($result).' bytes out of the expected '.$contentLength);
  27229. $e->setHeaders($http_response_header);
  27230. $e->setStatusCode($this->findStatusCode($http_response_header));
  27231. $e->setResponse($result);
  27232. $this->io->writeError('Content-Length mismatch, received '.Platform::strlen($result).' out of '.$contentLength.' bytes: (' . base64_encode($result).')', true, IOInterface::DEBUG);
  27233. throw $e;
  27234. }
  27235. if (PHP_VERSION_ID < 50600 && !empty($options['ssl']['peer_fingerprint'])) {
  27236. $params = stream_context_get_params($ctx);
  27237. $expectedPeerFingerprint = $options['ssl']['peer_fingerprint'];
  27238. $peerFingerprint = TlsHelper::getCertificateFingerprint($params['options']['ssl']['peer_certificate']);
  27239. if ($expectedPeerFingerprint !== $peerFingerprint) {
  27240. throw new TransportException('Peer fingerprint did not match');
  27241. }
  27242. }
  27243. } catch (\Exception $e) {
  27244. if ($e instanceof TransportException && !empty($http_response_header[0])) {
  27245. $e->setHeaders($http_response_header);
  27246. $e->setStatusCode($this->findStatusCode($http_response_header));
  27247. }
  27248. if ($e instanceof TransportException && $result !== false) {
  27249. $e->setResponse($result);
  27250. }
  27251. $result = false;
  27252. }
  27253. if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
  27254. $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
  27255. }
  27256. restore_error_handler();
  27257. if (isset($e) && !$this->retry) {
  27258. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27259. $this->degradedMode = true;
  27260. $this->io->writeError('');
  27261. $this->io->writeError(array(
  27262. '<error>'.$e->getMessage().'</error>',
  27263. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27264. ));
  27265. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27266. }
  27267. throw $e;
  27268. }
  27269. $statusCode = null;
  27270. $contentType = null;
  27271. $locationHeader = null;
  27272. if (!empty($http_response_header[0])) {
  27273. $statusCode = $this->findStatusCode($http_response_header);
  27274. $contentType = $this->findHeaderValue($http_response_header, 'content-type');
  27275. $locationHeader = $this->findHeaderValue($http_response_header, 'location');
  27276. }
  27277. if ($originUrl === 'bitbucket.org'
  27278. && !$this->isPublicBitBucketDownload($fileUrl)
  27279. && substr($fileUrl, -4) === '.zip'
  27280. && (!$locationHeader || substr($locationHeader, -4) !== '.zip')
  27281. && $contentType && preg_match('{^text/html\b}i', $contentType)
  27282. ) {
  27283. $result = false;
  27284. if ($this->retryAuthFailure) {
  27285. $this->promptAuthAndRetry(401);
  27286. }
  27287. }
  27288. if ($statusCode === 404
  27289. && $this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)
  27290. && false !== strpos($fileUrl, 'archive.zip')
  27291. ) {
  27292. $result = false;
  27293. if ($this->retryAuthFailure) {
  27294. $this->promptAuthAndRetry(401);
  27295. }
  27296. }
  27297. $hasFollowedRedirect = false;
  27298. if ($statusCode >= 300 && $statusCode <= 399 && $statusCode !== 304 && $this->redirects < $this->maxRedirects) {
  27299. $hasFollowedRedirect = true;
  27300. $result = $this->handleRedirect($http_response_header, $additionalOptions, $result);
  27301. }
  27302. if ($statusCode && $statusCode >= 400 && $statusCode <= 599) {
  27303. if (!$this->retry) {
  27304. if ($this->progress && !$this->retry && !$isRedirect) {
  27305. $this->io->overwriteError("Downloading (<error>failed</error>)", false);
  27306. }
  27307. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded ('.$http_response_header[0].')', $statusCode);
  27308. $e->setHeaders($http_response_header);
  27309. $e->setResponse($result);
  27310. $e->setStatusCode($statusCode);
  27311. throw $e;
  27312. }
  27313. $result = false;
  27314. }
  27315. if ($this->progress && !$this->retry && !$isRedirect) {
  27316. $this->io->overwriteError("Downloading (".($result === false ? '<error>failed</error>' : '<comment>100%</comment>').")", false);
  27317. }
  27318. if ($result && extension_loaded('zlib') && substr($fileUrl, 0, 4) === 'http' && !$hasFollowedRedirect) {
  27319. $contentEncoding = $this->findHeaderValue($http_response_header, 'content-encoding');
  27320. $decode = $contentEncoding && 'gzip' === strtolower($contentEncoding);
  27321. if ($decode) {
  27322. try {
  27323. if (PHP_VERSION_ID >= 50400) {
  27324. $result = zlib_decode($result);
  27325. } else {
  27326. $result = file_get_contents('compress.zlib://data:application/octet-stream;base64,'.base64_encode($result));
  27327. }
  27328. if (!$result) {
  27329. throw new TransportException('Failed to decode zlib stream');
  27330. }
  27331. } catch (\Exception $e) {
  27332. if ($this->degradedMode) {
  27333. throw $e;
  27334. }
  27335. $this->degradedMode = true;
  27336. $this->io->writeError(array(
  27337. '',
  27338. '<error>Failed to decode response: '.$e->getMessage().'</error>',
  27339. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27340. ));
  27341. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27342. }
  27343. }
  27344. }
  27345. if (false !== $result && null !== $fileName && !$isRedirect) {
  27346. if ('' === $result) {
  27347. throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
  27348. }
  27349. $errorMessage = '';
  27350. set_error_handler(function ($code, $msg) use (&$errorMessage) {
  27351. if ($errorMessage) {
  27352. $errorMessage .= "\n";
  27353. }
  27354. $errorMessage .= preg_replace('{^file_put_contents\(.*?\): }', '', $msg);
  27355. return true;
  27356. });
  27357. $result = (bool) file_put_contents($fileName, $result);
  27358. restore_error_handler();
  27359. if (false === $result) {
  27360. throw new TransportException('The "'.$this->fileUrl.'" file could not be written to '.$fileName.': '.$errorMessage);
  27361. }
  27362. }
  27363. if (false === $result && false !== strpos($errorMessage, 'Peer certificate') && PHP_VERSION_ID < 50600) {
  27364. if (CaBundle::isOpensslParseSafe()) {
  27365. $certDetails = $this->getCertificateCnAndFp($this->fileUrl, $options);
  27366. if ($certDetails) {
  27367. $this->peerCertificateMap[$this->getUrlAuthority($this->fileUrl)] = $certDetails;
  27368. $this->retry = true;
  27369. }
  27370. } else {
  27371. $this->io->writeError('');
  27372. $this->io->writeError(sprintf(
  27373. '<error>Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.</error>',
  27374. PHP_VERSION
  27375. ));
  27376. }
  27377. }
  27378. if ($this->retry) {
  27379. $this->retry = false;
  27380. $result = $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27381. if ($this->storeAuth && $this->config) {
  27382. $authHelper = new AuthHelper($this->io, $this->config);
  27383. $authHelper->storeAuth($this->originUrl, $this->storeAuth);
  27384. $this->storeAuth = false;
  27385. }
  27386. return $result;
  27387. }
  27388. if (false === $result) {
  27389. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded: '.$errorMessage, $errorCode);
  27390. if (!empty($http_response_header[0])) {
  27391. $e->setHeaders($http_response_header);
  27392. }
  27393. if (!$this->degradedMode && false !== strpos($e->getMessage(), 'Operation timed out')) {
  27394. $this->degradedMode = true;
  27395. $this->io->writeError('');
  27396. $this->io->writeError(array(
  27397. '<error>'.$e->getMessage().'</error>',
  27398. '<error>Retrying with degraded mode, check https://getcomposer.org/doc/articles/troubleshooting.md#degraded-mode for more info</error>',
  27399. ));
  27400. return $this->get($this->originUrl, $this->fileUrl, $additionalOptions, $this->fileName, $this->progress);
  27401. }
  27402. throw $e;
  27403. }
  27404. if (!empty($http_response_header[0])) {
  27405. $this->lastHeaders = $http_response_header;
  27406. }
  27407. return $result;
  27408. }
  27409. protected function getRemoteContents($originUrl, $fileUrl, $context, array &$responseHeaders = null)
  27410. {
  27411. try {
  27412. $e = null;
  27413. $result = file_get_contents($fileUrl, false, $context);
  27414. } catch (\Throwable $e) {
  27415. } catch (\Exception $e) {
  27416. }
  27417. $responseHeaders = isset($http_response_header) ? $http_response_header : array();
  27418. if (null !== $e) {
  27419. throw $e;
  27420. }
  27421. return $result;
  27422. }
  27423. protected function callbackGet($notificationCode, $severity, $message, $messageCode, $bytesTransferred, $bytesMax)
  27424. {
  27425. switch ($notificationCode) {
  27426. case STREAM_NOTIFY_FAILURE:
  27427. if (400 === $messageCode) {
  27428. throw new TransportException("The '" . $this->fileUrl . "' URL could not be accessed: " . $message, $messageCode);
  27429. }
  27430. break;
  27431. case STREAM_NOTIFY_FILE_SIZE_IS:
  27432. $this->bytesMax = $bytesMax;
  27433. break;
  27434. case STREAM_NOTIFY_PROGRESS:
  27435. if ($this->bytesMax > 0 && $this->progress) {
  27436. $progression = min(100, round($bytesTransferred / $this->bytesMax * 100));
  27437. if ((0 === $progression % 5) && 100 !== $progression && $progression !== $this->lastProgress) {
  27438. $this->lastProgress = $progression;
  27439. $this->io->overwriteError("Downloading (<comment>$progression%</comment>)", false);
  27440. }
  27441. }
  27442. break;
  27443. default:
  27444. break;
  27445. }
  27446. }
  27447. protected function promptAuthAndRetry($httpStatus, $reason = null, $warning = null, $headers = array())
  27448. {
  27449. if ($this->config && in_array($this->originUrl, $this->config->get('github-domains'), true)) {
  27450. $gitHubUtil = new GitHub($this->io, $this->config, null);
  27451. $message = "\n";
  27452. $rateLimited = $gitHubUtil->isRateLimited($headers);
  27453. if ($rateLimited) {
  27454. $rateLimit = $gitHubUtil->getRateLimit($headers);
  27455. if ($this->io->hasAuthentication($this->originUrl)) {
  27456. $message = 'Review your configured GitHub OAuth token or enter a new one to go over the API rate limit.';
  27457. } else {
  27458. $message = 'Create a GitHub OAuth token to go over the API rate limit.';
  27459. }
  27460. $message = sprintf(
  27461. '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.',
  27462. $rateLimit['limit'],
  27463. $rateLimit['reset']
  27464. )."\n";
  27465. } else {
  27466. $message .= 'Could not fetch '.$this->fileUrl.', please ';
  27467. if ($this->io->hasAuthentication($this->originUrl)) {
  27468. $message .= 'review your configured GitHub OAuth token or enter a new one to access private repos';
  27469. } else {
  27470. $message .= 'create a GitHub OAuth token to access private repos';
  27471. }
  27472. }
  27473. if (!$gitHubUtil->authorizeOAuth($this->originUrl)
  27474. && (!$this->io->isInteractive() || !$gitHubUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27475. ) {
  27476. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27477. }
  27478. } elseif ($this->config && in_array($this->originUrl, $this->config->get('gitlab-domains'), true)) {
  27479. $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');
  27480. $gitLabUtil = new GitLab($this->io, $this->config, null);
  27481. if ($this->io->hasAuthentication($this->originUrl) && ($auth = $this->io->getAuthentication($this->originUrl)) && in_array($auth['password'], array('gitlab-ci-token', 'private-token'), true)) {
  27482. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27483. }
  27484. if (!$gitLabUtil->authorizeOAuth($this->originUrl)
  27485. && (!$this->io->isInteractive() || !$gitLabUtil->authorizeOAuthInteractively($this->scheme, $this->originUrl, $message))
  27486. ) {
  27487. throw new TransportException('Could not authenticate against '.$this->originUrl, 401);
  27488. }
  27489. } elseif ($this->config && $this->originUrl === 'bitbucket.org') {
  27490. $askForOAuthToken = true;
  27491. if ($this->io->hasAuthentication($this->originUrl)) {
  27492. $auth = $this->io->getAuthentication($this->originUrl);
  27493. if ($auth['username'] !== 'x-token-auth') {
  27494. $bitbucketUtil = new Bitbucket($this->io, $this->config);
  27495. $accessToken = $bitbucketUtil->requestToken($this->originUrl, $auth['username'], $auth['password']);
  27496. if (!empty($accessToken)) {
  27497. $this->io->setAuthentication($this->originUrl, 'x-token-auth', $accessToken);
  27498. $askForOAuthToken = false;
  27499. }
  27500. } else {
  27501. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27502. }
  27503. }
  27504. if ($askForOAuthToken) {
  27505. $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');
  27506. $bitBucketUtil = new Bitbucket($this->io, $this->config);
  27507. if (! $bitBucketUtil->authorizeOAuth($this->originUrl)
  27508. && (! $this->io->isInteractive() || !$bitBucketUtil->authorizeOAuthInteractively($this->originUrl, $message))
  27509. ) {
  27510. throw new TransportException('Could not authenticate against ' . $this->originUrl, 401);
  27511. }
  27512. }
  27513. } else {
  27514. if ($httpStatus === 404) {
  27515. return;
  27516. }
  27517. if (!$this->io->isInteractive()) {
  27518. if ($httpStatus === 401) {
  27519. $message = "The '" . $this->fileUrl . "' URL required authentication.\nYou must be using the interactive console to authenticate";
  27520. }
  27521. if ($httpStatus === 403) {
  27522. $message = "The '" . $this->fileUrl . "' URL could not be accessed: " . $reason;
  27523. }
  27524. throw new TransportException($message, $httpStatus);
  27525. }
  27526. if ($this->io->hasAuthentication($this->originUrl)) {
  27527. throw new TransportException("Invalid credentials for '" . $this->fileUrl . "', aborting.", $httpStatus);
  27528. }
  27529. $this->io->writeError(' Authentication required (<info>'.$this->originUrl.'</info>):');
  27530. $username = $this->io->ask(' Username: ');
  27531. $password = $this->io->askAndHideAnswer(' Password: ');
  27532. $this->io->setAuthentication($this->originUrl, $username, $password);
  27533. $this->storeAuth = $this->config->get('store-auths');
  27534. }
  27535. $this->retry = true;
  27536. throw new TransportException('RETRY');
  27537. }
  27538. protected function getOptionsForUrl($originUrl, $additionalOptions)
  27539. {
  27540. $tlsOptions = array();
  27541. if ($this->disableTls === false && PHP_VERSION_ID < 50600 && !stream_is_local($this->fileUrl)) {
  27542. $host = parse_url($this->fileUrl, PHP_URL_HOST);
  27543. if (PHP_VERSION_ID < 50304) {
  27544. if ($host === 'github.com' || $host === 'api.github.com') {
  27545. $host = '*.github.com';
  27546. }
  27547. }
  27548. $tlsOptions['ssl']['CN_match'] = $host;
  27549. $tlsOptions['ssl']['SNI_server_name'] = $host;
  27550. $urlAuthority = $this->getUrlAuthority($this->fileUrl);
  27551. if (isset($this->peerCertificateMap[$urlAuthority])) {
  27552. $certMap = $this->peerCertificateMap[$urlAuthority];
  27553. $this->io->writeError('', true, IOInterface::DEBUG);
  27554. $this->io->writeError(sprintf(
  27555. 'Using <info>%s</info> as CN for subjectAltName enabled host <info>%s</info>',
  27556. $certMap['cn'],
  27557. $urlAuthority
  27558. ), true, IOInterface::DEBUG);
  27559. $tlsOptions['ssl']['CN_match'] = $certMap['cn'];
  27560. $tlsOptions['ssl']['peer_fingerprint'] = $certMap['fp'];
  27561. } elseif (!CaBundle::isOpensslParseSafe() && $host === 'repo.packagist.org') {
  27562. $tlsOptions['ssl']['CN_match'] = 'packagist.org';
  27563. }
  27564. }
  27565. $headers = array();
  27566. if (extension_loaded('zlib')) {
  27567. $headers[] = 'Accept-Encoding: gzip';
  27568. }
  27569. $options = array_replace_recursive($this->options, $tlsOptions, $additionalOptions);
  27570. if (!$this->degradedMode) {
  27571. $options['http']['protocol_version'] = 1.1;
  27572. $headers[] = 'Connection: close';
  27573. }
  27574. if ($this->io->hasAuthentication($originUrl)) {
  27575. $auth = $this->io->getAuthentication($originUrl);
  27576. if ('github.com' === $originUrl && 'x-oauth-basic' === $auth['password']) {
  27577. $options['github-token'] = $auth['username'];
  27578. } elseif ($this->config && in_array($originUrl, $this->config->get('gitlab-domains'), true)) {
  27579. if ($auth['password'] === 'oauth2') {
  27580. $headers[] = 'Authorization: Bearer '.$auth['username'];
  27581. } elseif ($auth['password'] === 'private-token' || $auth['password'] === 'gitlab-ci-token') {
  27582. $headers[] = 'PRIVATE-TOKEN: '.$auth['username'];
  27583. }
  27584. } elseif ('bitbucket.org' === $originUrl
  27585. && $this->fileUrl !== Bitbucket::OAUTH2_ACCESS_TOKEN_URL && 'x-token-auth' === $auth['username']
  27586. ) {
  27587. if (!$this->isPublicBitBucketDownload($this->fileUrl)) {
  27588. $headers[] = 'Authorization: Bearer ' . $auth['password'];
  27589. }
  27590. } else {
  27591. $authStr = base64_encode($auth['username'] . ':' . $auth['password']);
  27592. $headers[] = 'Authorization: Basic '.$authStr;
  27593. }
  27594. }
  27595. $options['http']['follow_location'] = 0;
  27596. if (isset($options['http']['header']) && !is_array($options['http']['header'])) {
  27597. $options['http']['header'] = explode("\r\n", trim($options['http']['header'], "\r\n"));
  27598. }
  27599. foreach ($headers as $header) {
  27600. $options['http']['header'][] = $header;
  27601. }
  27602. return $options;
  27603. }
  27604. private function handleRedirect(array $http_response_header, array $additionalOptions, $result)
  27605. {
  27606. if ($locationHeader = $this->findHeaderValue($http_response_header, 'location')) {
  27607. if (parse_url($locationHeader, PHP_URL_SCHEME)) {
  27608. $targetUrl = $locationHeader;
  27609. } elseif (parse_url($locationHeader, PHP_URL_HOST)) {
  27610. $targetUrl = $this->scheme.':'.$locationHeader;
  27611. } elseif ('/' === $locationHeader[0]) {
  27612. $urlHost = parse_url($this->fileUrl, PHP_URL_HOST);
  27613. $targetUrl = preg_replace('{^(.+(?://|@)'.preg_quote($urlHost).'(?::\d+)?)(?:[/\?].*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27614. } else {
  27615. $targetUrl = preg_replace('{^(.+/)[^/?]*(?:\?.*)?$}', '\1'.$locationHeader, $this->fileUrl);
  27616. }
  27617. }
  27618. if (!empty($targetUrl)) {
  27619. $this->redirects++;
  27620. $this->io->writeError('', true, IOInterface::DEBUG);
  27621. $this->io->writeError(sprintf('Following redirect (%u) %s', $this->redirects, $this->stripCredentialsFromUrl($targetUrl)), true, IOInterface::DEBUG);
  27622. $additionalOptions['redirects'] = $this->redirects;
  27623. return $this->get(parse_url($targetUrl, PHP_URL_HOST), $targetUrl, $additionalOptions, $this->fileName, $this->progress);
  27624. }
  27625. if (!$this->retry) {
  27626. $e = new TransportException('The "'.$this->fileUrl.'" file could not be downloaded, got redirect without Location ('.$http_response_header[0].')');
  27627. $e->setHeaders($http_response_header);
  27628. $e->setResponse($result);
  27629. throw $e;
  27630. }
  27631. return false;
  27632. }
  27633. private function getTlsDefaults(array $options)
  27634. {
  27635. $ciphers = implode(':', array(
  27636. 'ECDHE-RSA-AES128-GCM-SHA256',
  27637. 'ECDHE-ECDSA-AES128-GCM-SHA256',
  27638. 'ECDHE-RSA-AES256-GCM-SHA384',
  27639. 'ECDHE-ECDSA-AES256-GCM-SHA384',
  27640. 'DHE-RSA-AES128-GCM-SHA256',
  27641. 'DHE-DSS-AES128-GCM-SHA256',
  27642. 'kEDH+AESGCM',
  27643. 'ECDHE-RSA-AES128-SHA256',
  27644. 'ECDHE-ECDSA-AES128-SHA256',
  27645. 'ECDHE-RSA-AES128-SHA',
  27646. 'ECDHE-ECDSA-AES128-SHA',
  27647. 'ECDHE-RSA-AES256-SHA384',
  27648. 'ECDHE-ECDSA-AES256-SHA384',
  27649. 'ECDHE-RSA-AES256-SHA',
  27650. 'ECDHE-ECDSA-AES256-SHA',
  27651. 'DHE-RSA-AES128-SHA256',
  27652. 'DHE-RSA-AES128-SHA',
  27653. 'DHE-DSS-AES128-SHA256',
  27654. 'DHE-RSA-AES256-SHA256',
  27655. 'DHE-DSS-AES256-SHA',
  27656. 'DHE-RSA-AES256-SHA',
  27657. 'AES128-GCM-SHA256',
  27658. 'AES256-GCM-SHA384',
  27659. 'AES128-SHA256',
  27660. 'AES256-SHA256',
  27661. 'AES128-SHA',
  27662. 'AES256-SHA',
  27663. 'AES',
  27664. 'CAMELLIA',
  27665. 'DES-CBC3-SHA',
  27666. '!aNULL',
  27667. '!eNULL',
  27668. '!EXPORT',
  27669. '!DES',
  27670. '!RC4',
  27671. '!MD5',
  27672. '!PSK',
  27673. '!aECDH',
  27674. '!EDH-DSS-DES-CBC3-SHA',
  27675. '!EDH-RSA-DES-CBC3-SHA',
  27676. '!KRB5-DES-CBC3-SHA',
  27677. ));
  27678. $defaults = array(
  27679. 'ssl' => array(
  27680. 'ciphers' => $ciphers,
  27681. 'verify_peer' => true,
  27682. 'verify_depth' => 7,
  27683. 'SNI_enabled' => true,
  27684. 'capture_peer_cert' => true,
  27685. ),
  27686. );
  27687. if (isset($options['ssl'])) {
  27688. $defaults['ssl'] = array_replace_recursive($defaults['ssl'], $options['ssl']);
  27689. }
  27690. $caBundleLogger = $this->io instanceof LoggerInterface ? $this->io : null;
  27691. if (!isset($defaults['ssl']['cafile']) && !isset($defaults['ssl']['capath'])) {
  27692. $result = CaBundle::getSystemCaRootBundlePath($caBundleLogger);
  27693. if (is_dir($result)) {
  27694. $defaults['ssl']['capath'] = $result;
  27695. } else {
  27696. $defaults['ssl']['cafile'] = $result;
  27697. }
  27698. }
  27699. if (isset($defaults['ssl']['cafile']) && (!is_readable($defaults['ssl']['cafile']) || !CaBundle::validateCaFile($defaults['ssl']['cafile'], $caBundleLogger))) {
  27700. throw new TransportException('The configured cafile was not valid or could not be read.');
  27701. }
  27702. if (isset($defaults['ssl']['capath']) && (!is_dir($defaults['ssl']['capath']) || !is_readable($defaults['ssl']['capath']))) {
  27703. throw new TransportException('The configured capath was not valid or could not be read.');
  27704. }
  27705. if (PHP_VERSION_ID >= 50413) {
  27706. $defaults['ssl']['disable_compression'] = true;
  27707. }
  27708. return $defaults;
  27709. }
  27710. private function getCertificateCnAndFp($url, $options)
  27711. {
  27712. if (PHP_VERSION_ID >= 50600) {
  27713. throw new \BadMethodCallException(sprintf(
  27714. '%s must not be used on PHP >= 5.6',
  27715. __METHOD__
  27716. ));
  27717. }
  27718. $context = StreamContextFactory::getContext($url, $options, array('options' => array(
  27719. 'ssl' => array(
  27720. 'capture_peer_cert' => true,
  27721. 'verify_peer' => false,
  27722. ), ),
  27723. ));
  27724. if (false === $handle = @fopen($url, 'rb', false, $context)) {
  27725. return;
  27726. }
  27727. fclose($handle);
  27728. $handle = null;
  27729. $params = stream_context_get_params($context);
  27730. if (!empty($params['options']['ssl']['peer_certificate'])) {
  27731. $peerCertificate = $params['options']['ssl']['peer_certificate'];
  27732. if (TlsHelper::checkCertificateHost($peerCertificate, parse_url($url, PHP_URL_HOST), $commonName)) {
  27733. return array(
  27734. 'cn' => $commonName,
  27735. 'fp' => TlsHelper::getCertificateFingerprint($peerCertificate),
  27736. );
  27737. }
  27738. }
  27739. }
  27740. private function getUrlAuthority($url)
  27741. {
  27742. $defaultPorts = array(
  27743. 'ftp' => 21,
  27744. 'http' => 80,
  27745. 'https' => 443,
  27746. 'ssh2.sftp' => 22,
  27747. 'ssh2.scp' => 22,
  27748. );
  27749. $scheme = parse_url($url, PHP_URL_SCHEME);
  27750. if (!isset($defaultPorts[$scheme])) {
  27751. throw new \InvalidArgumentException(sprintf(
  27752. 'Could not get default port for unknown scheme: %s',
  27753. $scheme
  27754. ));
  27755. }
  27756. $defaultPort = $defaultPorts[$scheme];
  27757. $port = parse_url($url, PHP_URL_PORT) ?: $defaultPort;
  27758. return parse_url($url, PHP_URL_HOST).':'.$port;
  27759. }
  27760. private function isPublicBitBucketDownload($urlToBitBucketFile)
  27761. {
  27762. $domain = parse_url($urlToBitBucketFile, PHP_URL_HOST);
  27763. if (strpos($domain, 'bitbucket.org') === false) {
  27764. return true;
  27765. }
  27766. $path = parse_url($urlToBitBucketFile, PHP_URL_PATH);
  27767. $pathParts = explode('/', $path);
  27768. return count($pathParts) >= 4 && $pathParts[3] == 'downloads';
  27769. }
  27770. public static function outputWarnings(IOInterface $io, $url, $data)
  27771. {
  27772. foreach (array('warning', 'info') as $type) {
  27773. if (empty($data[$type])) {
  27774. continue;
  27775. }
  27776. if (!empty($data[$type . '-versions'])) {
  27777. $versionParser = new VersionParser();
  27778. $constraint = $versionParser->parseConstraints($data[$type . '-versions']);
  27779. $composer = new Constraint('==', $versionParser->normalize(Composer::getVersion()));
  27780. if (!$constraint->matches($composer)) {
  27781. continue;
  27782. }
  27783. }
  27784. $io->writeError('<'.$type.'>'.ucfirst($type).' from '.$url.': '.$data[$type].'</'.$type.'>');
  27785. }
  27786. }
  27787. public static function getOrigin($urlOrPath)
  27788. {
  27789. $hostPort = parse_url($urlOrPath, PHP_URL_HOST);
  27790. if (!$hostPort) {
  27791. return $urlOrPath;
  27792. }
  27793. if (parse_url($urlOrPath, PHP_URL_PORT)) {
  27794. $hostPort .= ':'.parse_url($urlOrPath, PHP_URL_PORT);
  27795. }
  27796. return $hostPort;
  27797. }
  27798. private function stripCredentialsFromUrl($url)
  27799. {
  27800. return preg_replace('{([&?]access_token=)[^&]+}', '$1***', $url);
  27801. }
  27802. }
  27803. <?php
  27804. namespace Composer\Util;
  27805. class Silencer
  27806. {
  27807. private static $stack = array();
  27808. public static function suppress($mask = null)
  27809. {
  27810. if (!isset($mask)) {
  27811. $mask = E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE | E_DEPRECATED | E_USER_DEPRECATED | E_STRICT;
  27812. }
  27813. $old = error_reporting();
  27814. self::$stack[] = $old;
  27815. error_reporting($old & ~$mask);
  27816. return $old;
  27817. }
  27818. public static function restore()
  27819. {
  27820. if (!empty(self::$stack)) {
  27821. error_reporting(array_pop(self::$stack));
  27822. }
  27823. }
  27824. public static function call($callable )
  27825. {
  27826. try {
  27827. self::suppress();
  27828. $result = call_user_func_array($callable, array_slice(func_get_args(), 1));
  27829. self::restore();
  27830. return $result;
  27831. } catch (\Exception $e) {
  27832. self::restore();
  27833. throw $e;
  27834. }
  27835. }
  27836. }
  27837. <?php
  27838. namespace Composer\Util;
  27839. use Composer\Spdx\SpdxLicenses;
  27840. trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
  27841. class SpdxLicense extends SpdxLicenses
  27842. {
  27843. }
  27844. <?php
  27845. namespace Composer\Util;
  27846. use Composer\Composer;
  27847. final class StreamContextFactory
  27848. {
  27849. public static function getContext($url, array $defaultOptions = array(), array $defaultParams = array())
  27850. {
  27851. $options = array('http' => array(
  27852. 'follow_location' => 1,
  27853. 'max_redirects' => 20,
  27854. ));
  27855. if ((PHP_SAPI === 'cli' || PHP_SAPI === 'phpdbg') && (!empty($_SERVER['HTTP_PROXY']) || !empty($_SERVER['http_proxy']))) {
  27856. $proxy = parse_url(!empty($_SERVER['http_proxy']) ? $_SERVER['http_proxy'] : $_SERVER['HTTP_PROXY']);
  27857. }
  27858. if (!empty($_SERVER['CGI_HTTP_PROXY'])) {
  27859. $proxy = parse_url($_SERVER['CGI_HTTP_PROXY']);
  27860. }
  27861. if (preg_match('{^https://}i', $url) && (!empty($_SERVER['HTTPS_PROXY']) || !empty($_SERVER['https_proxy']))) {
  27862. $proxy = parse_url(!empty($_SERVER['https_proxy']) ? $_SERVER['https_proxy'] : $_SERVER['HTTPS_PROXY']);
  27863. }
  27864. if (!empty($_SERVER['NO_PROXY']) || !empty($_SERVER['no_proxy']) && parse_url($url, PHP_URL_HOST)) {
  27865. $pattern = new NoProxyPattern(!empty($_SERVER['no_proxy']) ? $_SERVER['no_proxy'] : $_SERVER['NO_PROXY']);
  27866. if ($pattern->test($url)) {
  27867. unset($proxy);
  27868. }
  27869. }
  27870. if (!empty($proxy)) {
  27871. $proxyURL = isset($proxy['scheme']) ? $proxy['scheme'] . '://' : '';
  27872. $proxyURL .= isset($proxy['host']) ? $proxy['host'] : '';
  27873. if (isset($proxy['port'])) {
  27874. $proxyURL .= ":" . $proxy['port'];
  27875. } elseif ('http://' == substr($proxyURL, 0, 7)) {
  27876. $proxyURL .= ":80";
  27877. } elseif ('https://' == substr($proxyURL, 0, 8)) {
  27878. $proxyURL .= ":443";
  27879. }
  27880. $proxyURL = str_replace(array('http://', 'https://'), array('tcp://', 'ssl://'), $proxyURL);
  27881. if (0 === strpos($proxyURL, 'ssl:') && !extension_loaded('openssl')) {
  27882. throw new \RuntimeException('You must enable the openssl extension to use a proxy over https');
  27883. }
  27884. $options['http']['proxy'] = $proxyURL;
  27885. switch (parse_url($url, PHP_URL_SCHEME)) {
  27886. case 'http':
  27887. $reqFullUriEnv = getenv('HTTP_PROXY_REQUEST_FULLURI');
  27888. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27889. $options['http']['request_fulluri'] = true;
  27890. }
  27891. break;
  27892. case 'https':
  27893. $reqFullUriEnv = getenv('HTTPS_PROXY_REQUEST_FULLURI');
  27894. if ($reqFullUriEnv === false || $reqFullUriEnv === '' || (strtolower($reqFullUriEnv) !== 'false' && (bool) $reqFullUriEnv)) {
  27895. $options['http']['request_fulluri'] = true;
  27896. }
  27897. break;
  27898. }
  27899. if ('https' === parse_url($url, PHP_URL_SCHEME)) {
  27900. $options['ssl']['SNI_enabled'] = true;
  27901. if (PHP_VERSION_ID < 50600) {
  27902. $options['ssl']['SNI_server_name'] = parse_url($url, PHP_URL_HOST);
  27903. }
  27904. }
  27905. if (isset($proxy['user'])) {
  27906. $auth = rawurldecode($proxy['user']);
  27907. if (isset($proxy['pass'])) {
  27908. $auth .= ':' . rawurldecode($proxy['pass']);
  27909. }
  27910. $auth = base64_encode($auth);
  27911. if (isset($defaultOptions['http']['header'])) {
  27912. if (is_string($defaultOptions['http']['header'])) {
  27913. $defaultOptions['http']['header'] = array($defaultOptions['http']['header']);
  27914. }
  27915. $defaultOptions['http']['header'][] = "Proxy-Authorization: Basic {$auth}";
  27916. } else {
  27917. $options['http']['header'] = array("Proxy-Authorization: Basic {$auth}");
  27918. }
  27919. }
  27920. }
  27921. $options = array_replace_recursive($options, $defaultOptions);
  27922. if (isset($options['http']['header'])) {
  27923. $options['http']['header'] = self::fixHttpHeaderField($options['http']['header']);
  27924. }
  27925. if (defined('HHVM_VERSION')) {
  27926. $phpVersion = 'HHVM ' . HHVM_VERSION;
  27927. } else {
  27928. $phpVersion = 'PHP ' . PHP_MAJOR_VERSION . '.' . PHP_MINOR_VERSION . '.' . PHP_RELEASE_VERSION;
  27929. }
  27930. if (!isset($options['http']['header']) || false === stripos(implode('', $options['http']['header']), 'user-agent')) {
  27931. $options['http']['header'][] = sprintf(
  27932. 'User-Agent: Composer/%s (%s; %s; %s%s)',
  27933. Composer::getVersion(),
  27934. function_exists('php_uname') ? php_uname('s') : 'Unknown',
  27935. function_exists('php_uname') ? php_uname('r') : 'Unknown',
  27936. $phpVersion,
  27937. getenv('CI') ? '; CI' : ''
  27938. );
  27939. }
  27940. return stream_context_create($options, $defaultParams);
  27941. }
  27942. private static function fixHttpHeaderField($header)
  27943. {
  27944. if (!is_array($header)) {
  27945. $header = explode("\r\n", $header);
  27946. }
  27947. uasort($header, function ($el) {
  27948. return stripos($el, 'content-type') === 0 ? 1 : -1;
  27949. });
  27950. return $header;
  27951. }
  27952. }
  27953. <?php
  27954. namespace Composer\Util;
  27955. use Composer\Config;
  27956. use Composer\IO\IOInterface;
  27957. class Svn
  27958. {
  27959. const MAX_QTY_AUTH_TRIES = 5;
  27960. protected $credentials;
  27961. protected $hasAuth;
  27962. protected $io;
  27963. protected $url;
  27964. protected $cacheCredentials = true;
  27965. protected $process;
  27966. protected $qtyAuthTries = 0;
  27967. protected $config;
  27968. private static $version;
  27969. public function __construct($url, IOInterface $io, Config $config, ProcessExecutor $process = null)
  27970. {
  27971. $this->url = $url;
  27972. $this->io = $io;
  27973. $this->config = $config;
  27974. $this->process = $process ?: new ProcessExecutor($io);
  27975. }
  27976. public static function cleanEnv()
  27977. {
  27978. putenv("DYLD_LIBRARY_PATH");
  27979. unset($_SERVER['DYLD_LIBRARY_PATH']);
  27980. }
  27981. public function execute($command, $url, $cwd = null, $path = null, $verbose = false)
  27982. {
  27983. $this->config->prohibitUrlByConfig($url, $this->io);
  27984. return $this->executeWithAuthRetry($command, $cwd, $url, $path, $verbose);
  27985. }
  27986. public function executeLocal($command, $path, $cwd = null, $verbose = false)
  27987. {
  27988. return $this->executeWithAuthRetry($command, $cwd, '', $path, $verbose);
  27989. }
  27990. private function executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose)
  27991. {
  27992. $command = $this->getCommand($svnCommand, $url, $path);
  27993. $output = null;
  27994. $io = $this->io;
  27995. $handler = function ($type, $buffer) use (&$output, $io, $verbose) {
  27996. if ($type !== 'out') {
  27997. return;
  27998. }
  27999. if ('Redirecting to URL ' === substr($buffer, 0, 19)) {
  28000. return;
  28001. }
  28002. $output .= $buffer;
  28003. if ($verbose) {
  28004. $io->writeError($buffer, false);
  28005. }
  28006. };
  28007. $status = $this->process->execute($command, $handler, $cwd);
  28008. if (0 === $status) {
  28009. return $output;
  28010. }
  28011. $errorOutput = $this->process->getErrorOutput();
  28012. $fullOutput = implode("\n", array($output, $errorOutput));
  28013. if (false === stripos($fullOutput, 'Could not authenticate to server:')
  28014. && false === stripos($fullOutput, 'authorization failed')
  28015. && false === stripos($fullOutput, 'svn: E170001:')
  28016. && false === stripos($fullOutput, 'svn: E215004:')) {
  28017. throw new \RuntimeException($fullOutput);
  28018. }
  28019. if (!$this->hasAuth()) {
  28020. $this->doAuthDance();
  28021. }
  28022. if ($this->qtyAuthTries++ < self::MAX_QTY_AUTH_TRIES) {
  28023. return $this->executeWithAuthRetry($svnCommand, $cwd, $url, $path, $verbose);
  28024. }
  28025. throw new \RuntimeException(
  28026. 'wrong credentials provided ('.$fullOutput.')'
  28027. );
  28028. }
  28029. public function setCacheCredentials($cacheCredentials)
  28030. {
  28031. $this->cacheCredentials = $cacheCredentials;
  28032. }
  28033. protected function doAuthDance()
  28034. {
  28035. if (!$this->io->isInteractive()) {
  28036. throw new \RuntimeException(
  28037. 'can not ask for authentication in non interactive mode'
  28038. );
  28039. }
  28040. $this->io->writeError("The Subversion server ({$this->url}) requested credentials:");
  28041. $this->hasAuth = true;
  28042. $this->credentials['username'] = $this->io->ask("Username: ");
  28043. $this->credentials['password'] = $this->io->askAndHideAnswer("Password: ");
  28044. $this->cacheCredentials = $this->io->askConfirmation("Should Subversion cache these credentials? (yes/no) ", true);
  28045. return $this;
  28046. }
  28047. protected function getCommand($cmd, $url, $path = null)
  28048. {
  28049. $cmd = sprintf(
  28050. '%s %s%s %s',
  28051. $cmd,
  28052. '--non-interactive ',
  28053. $this->getCredentialString(),
  28054. ProcessExecutor::escape($url)
  28055. );
  28056. if ($path) {
  28057. $cmd .= ' ' . ProcessExecutor::escape($path);
  28058. }
  28059. return $cmd;
  28060. }
  28061. protected function getCredentialString()
  28062. {
  28063. if (!$this->hasAuth()) {
  28064. return '';
  28065. }
  28066. return sprintf(
  28067. ' %s--username %s --password %s ',
  28068. $this->getAuthCache(),
  28069. ProcessExecutor::escape($this->getUsername()),
  28070. ProcessExecutor::escape($this->getPassword())
  28071. );
  28072. }
  28073. protected function getPassword()
  28074. {
  28075. if ($this->credentials === null) {
  28076. throw new \LogicException("No svn auth detected.");
  28077. }
  28078. return isset($this->credentials['password']) ? $this->credentials['password'] : '';
  28079. }
  28080. protected function getUsername()
  28081. {
  28082. if ($this->credentials === null) {
  28083. throw new \LogicException("No svn auth detected.");
  28084. }
  28085. return $this->credentials['username'];
  28086. }
  28087. protected function hasAuth()
  28088. {
  28089. if (null !== $this->hasAuth) {
  28090. return $this->hasAuth;
  28091. }
  28092. if (false === $this->createAuthFromConfig()) {
  28093. $this->createAuthFromUrl();
  28094. }
  28095. return $this->hasAuth;
  28096. }
  28097. protected function getAuthCache()
  28098. {
  28099. return $this->cacheCredentials ? '' : '--no-auth-cache ';
  28100. }
  28101. private function createAuthFromConfig()
  28102. {
  28103. if (!$this->config->has('http-basic')) {
  28104. return $this->hasAuth = false;
  28105. }
  28106. $authConfig = $this->config->get('http-basic');
  28107. $host = parse_url($this->url, PHP_URL_HOST);
  28108. if (isset($authConfig[$host])) {
  28109. $this->credentials['username'] = $authConfig[$host]['username'];
  28110. $this->credentials['password'] = $authConfig[$host]['password'];
  28111. return $this->hasAuth = true;
  28112. }
  28113. return $this->hasAuth = false;
  28114. }
  28115. private function createAuthFromUrl()
  28116. {
  28117. $uri = parse_url($this->url);
  28118. if (empty($uri['user'])) {
  28119. return $this->hasAuth = false;
  28120. }
  28121. $this->credentials['username'] = $uri['user'];
  28122. if (!empty($uri['pass'])) {
  28123. $this->credentials['password'] = $uri['pass'];
  28124. }
  28125. return $this->hasAuth = true;
  28126. }
  28127. public function binaryVersion()
  28128. {
  28129. if (!self::$version) {
  28130. if (0 === $this->process->execute('svn --version', $output)) {
  28131. if (preg_match('{(\d+(?:\.\d+)+)}', $output, $match)) {
  28132. self::$version = $match[1];
  28133. }
  28134. }
  28135. }
  28136. return self::$version;
  28137. }
  28138. }
  28139. <?php
  28140. namespace Composer\Util;
  28141. use Composer\CaBundle\CaBundle;
  28142. final class TlsHelper
  28143. {
  28144. public static function checkCertificateHost($certificate, $hostname, &$cn = null)
  28145. {
  28146. $names = self::getCertificateNames($certificate);
  28147. if (empty($names)) {
  28148. return false;
  28149. }
  28150. $combinedNames = array_merge($names['san'], array($names['cn']));
  28151. $hostname = strtolower($hostname);
  28152. foreach ($combinedNames as $certName) {
  28153. $matcher = self::certNameMatcher($certName);
  28154. if ($matcher && $matcher($hostname)) {
  28155. $cn = $names['cn'];
  28156. return true;
  28157. }
  28158. }
  28159. return false;
  28160. }
  28161. public static function getCertificateNames($certificate)
  28162. {
  28163. if (is_array($certificate)) {
  28164. $info = $certificate;
  28165. } elseif (CaBundle::isOpensslParseSafe()) {
  28166. $info = openssl_x509_parse($certificate, false);
  28167. }
  28168. if (!isset($info['subject']['commonName'])) {
  28169. return null;
  28170. }
  28171. $commonName = strtolower($info['subject']['commonName']);
  28172. $subjectAltNames = array();
  28173. if (isset($info['extensions']['subjectAltName'])) {
  28174. $subjectAltNames = preg_split('{\s*,\s*}', $info['extensions']['subjectAltName']);
  28175. $subjectAltNames = array_filter(array_map(function ($name) {
  28176. if (0 === strpos($name, 'DNS:')) {
  28177. return strtolower(ltrim(substr($name, 4)));
  28178. }
  28179. return null;
  28180. }, $subjectAltNames));
  28181. $subjectAltNames = array_values($subjectAltNames);
  28182. }
  28183. return array(
  28184. 'cn' => $commonName,
  28185. 'san' => $subjectAltNames,
  28186. );
  28187. }
  28188. public static function getCertificateFingerprint($certificate)
  28189. {
  28190. $pubkeydetails = openssl_pkey_get_details(openssl_get_publickey($certificate));
  28191. $pubkeypem = $pubkeydetails['key'];
  28192. $start = '-----BEGIN PUBLIC KEY-----';
  28193. $end = '-----END PUBLIC KEY-----';
  28194. $pemtrim = substr($pubkeypem, strpos($pubkeypem, $start) + strlen($start), (strlen($pubkeypem) - strpos($pubkeypem, $end)) * (-1));
  28195. $der = base64_decode($pemtrim);
  28196. return sha1($der);
  28197. }
  28198. public static function isOpensslParseSafe()
  28199. {
  28200. return CaBundle::isOpensslParseSafe();
  28201. }
  28202. private static function certNameMatcher($certName)
  28203. {
  28204. $wildcards = substr_count($certName, '*');
  28205. if (0 === $wildcards) {
  28206. return function ($hostname) use ($certName) {
  28207. return $hostname === $certName;
  28208. };
  28209. }
  28210. if (1 === $wildcards) {
  28211. $components = explode('.', $certName);
  28212. if (3 > count($components)) {
  28213. return;
  28214. }
  28215. $firstComponent = $components[0];
  28216. if ('*' !== $firstComponent[strlen($firstComponent) - 1]) {
  28217. return;
  28218. }
  28219. $wildcardRegex = preg_quote($certName);
  28220. $wildcardRegex = str_replace('\\*', '[a-z0-9-]+', $wildcardRegex);
  28221. $wildcardRegex = "{^{$wildcardRegex}$}";
  28222. return function ($hostname) use ($wildcardRegex) {
  28223. return 1 === preg_match($wildcardRegex, $hostname);
  28224. };
  28225. }
  28226. }
  28227. }
  28228. <?php
  28229. namespace Composer\Util;
  28230. use Composer\Config;
  28231. class Url
  28232. {
  28233. public static function updateDistReference(Config $config, $url, $ref)
  28234. {
  28235. $host = parse_url($url, PHP_URL_HOST);
  28236. if ($host === 'api.github.com' || $host === 'github.com' || $host === 'www.github.com') {
  28237. if (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/(zip|tar)ball/(.+)$}i', $url, $match)) {
  28238. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28239. } elseif (preg_match('{^https?://(?:www\.)?github\.com/([^/]+)/([^/]+)/archive/.+\.(zip|tar)(?:\.gz)?$}i', $url, $match)) {
  28240. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28241. } elseif (preg_match('{^https?://api\.github\.com/repos/([^/]+)/([^/]+)/(zip|tar)ball(?:/.+)?$}i', $url, $match)) {
  28242. $url = 'https://api.github.com/repos/' . $match[1] . '/'. $match[2] . '/' . $match[3] . 'ball/' . $ref;
  28243. }
  28244. } elseif ($host === 'bitbucket.org' || $host === 'www.bitbucket.org') {
  28245. if (preg_match('{^https?://(?:www\.)?bitbucket\.org/([^/]+)/([^/]+)/get/(.+)\.(zip|tar\.gz|tar\.bz2)$}i', $url, $match)) {
  28246. $url = 'https://bitbucket.org/' . $match[1] . '/'. $match[2] . '/get/' . $ref . '.' . $match[4];
  28247. }
  28248. } elseif ($host === 'gitlab.com' || $host === 'www.gitlab.com') {
  28249. if (preg_match('{^https?://(?:www\.)?gitlab\.com/api/v[34]/projects/([^/]+)/repository/archive\.(zip|tar\.gz|tar\.bz2|tar)\?sha=.+$}i', $url, $match)) {
  28250. $url = 'https://gitlab.com/api/v4/projects/' . $match[1] . '/repository/archive.' . $match[2] . '?sha=' . $ref;
  28251. }
  28252. } elseif (in_array($host, $config->get('github-domains'), true)) {
  28253. $url = preg_replace('{(/repos/[^/]+/[^/]+/(zip|tar)ball)(?:/.+)?$}i', '$1/'.$ref, $url);
  28254. } elseif (in_array($host, $config->get('gitlab-domains'), true)) {
  28255. $url = preg_replace('{(/api/v[34]/projects/[^/]+/repository/archive\.(?:zip|tar\.gz|tar\.bz2|tar)\?sha=).+$}i', '${1}'.$ref, $url);
  28256. }
  28257. return $url;
  28258. }
  28259. }
  28260. <?php
  28261. namespace Composer\Util;
  28262. class Zip
  28263. {
  28264. public static function getComposerJson($pathToZip)
  28265. {
  28266. if (!extension_loaded('zip')) {
  28267. throw new \RuntimeException('The Zip Util requires PHP\'s zip extension');
  28268. }
  28269. $zip = new \ZipArchive();
  28270. if ($zip->open($pathToZip) !== true) {
  28271. return null;
  28272. }
  28273. if (0 == $zip->numFiles) {
  28274. $zip->close();
  28275. return null;
  28276. }
  28277. $foundFileIndex = self::locateFile($zip, 'composer.json');
  28278. if (false === $foundFileIndex) {
  28279. $zip->close();
  28280. return null;
  28281. }
  28282. $content = null;
  28283. $configurationFileName = $zip->getNameIndex($foundFileIndex);
  28284. $stream = $zip->getStream($configurationFileName);
  28285. if (false !== $stream) {
  28286. $content = stream_get_contents($stream);
  28287. }
  28288. $zip->close();
  28289. return $content;
  28290. }
  28291. private static function locateFile(\ZipArchive $zip, $filename)
  28292. {
  28293. $indexOfShortestMatch = false;
  28294. $lengthOfShortestMatch = -1;
  28295. for ($i = 0; $i < $zip->numFiles; $i++) {
  28296. $stat = $zip->statIndex($i);
  28297. if (strcmp(basename($stat['name']), $filename) === 0) {
  28298. $directoryName = dirname($stat['name']);
  28299. if ($directoryName === '.') {
  28300. return $i;
  28301. }
  28302. if (strpos($directoryName, '\\') !== false ||
  28303. strpos($directoryName, '/') !== false) {
  28304. continue;
  28305. }
  28306. $length = strlen($stat['name']);
  28307. if ($indexOfShortestMatch === false || $length < $lengthOfShortestMatch) {
  28308. $contents = $zip->getFromIndex($i);
  28309. if ($contents !== false) {
  28310. $indexOfShortestMatch = $i;
  28311. $lengthOfShortestMatch = $length;
  28312. }
  28313. }
  28314. }
  28315. }
  28316. return $indexOfShortestMatch;
  28317. }
  28318. }
  28319. <?php
  28320. namespace Composer;
  28321. use Symfony\Component\Console\Output\OutputInterface;
  28322. trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
  28323. class XdebugHandler extends XdebugHandler\XdebugHandler
  28324. {
  28325. const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
  28326. const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
  28327. public function __construct(OutputInterface $output)
  28328. {
  28329. parent::__construct('composer', '--ansi');
  28330. }
  28331. }
  28332. <?php
  28333. function includeIfExists($file)
  28334. {
  28335. return file_exists($file) ? include $file : false;
  28336. }
  28337. if ((!$loader = includeIfExists(__DIR__.'/../vendor/autoload.php')) && (!$loader = includeIfExists(__DIR__.'/../../../autoload.php'))) {
  28338. echo 'You must set up the project dependencies using `composer install`'.PHP_EOL.
  28339. 'See https://getcomposer.org/download/ for instructions on installing Composer'.PHP_EOL;
  28340. exit(1);
  28341. }
  28342. return $loader;
  28343. <?php
  28344. /*
  28345. * This file is part of Composer.
  28346. *
  28347. * (c) Nils Adermann <naderman@naderman.de>
  28348. * Jordi Boggiano <j.boggiano@seld.be>
  28349. *
  28350. * For the full copyright and license information, please view the LICENSE
  28351. * file that was distributed with this source code.
  28352. */
  28353. namespace Composer\Autoload;
  28354. /**
  28355. * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
  28356. *
  28357. * $loader = new \Composer\Autoload\ClassLoader();
  28358. *
  28359. * // register classes with namespaces
  28360. * $loader->add('Symfony\Component', __DIR__.'/component');
  28361. * $loader->add('Symfony', __DIR__.'/framework');
  28362. *
  28363. * // activate the autoloader
  28364. * $loader->register();
  28365. *
  28366. * // to enable searching the include path (eg. for PEAR packages)
  28367. * $loader->setUseIncludePath(true);
  28368. *
  28369. * In this example, if you try to use a class in the Symfony\Component
  28370. * namespace or one of its children (Symfony\Component\Console for instance),
  28371. * the autoloader will first look for the class under the component/
  28372. * directory, and it will then fallback to the framework/ directory if not
  28373. * found before giving up.
  28374. *
  28375. * This class is loosely based on the Symfony UniversalClassLoader.
  28376. *
  28377. * @author Fabien Potencier <fabien@symfony.com>
  28378. * @author Jordi Boggiano <j.boggiano@seld.be>
  28379. * @see http://www.php-fig.org/psr/psr-0/
  28380. * @see http://www.php-fig.org/psr/psr-4/
  28381. */
  28382. class ClassLoader
  28383. {
  28384. // PSR-4
  28385. private $prefixLengthsPsr4 = array();
  28386. private $prefixDirsPsr4 = array();
  28387. private $fallbackDirsPsr4 = array();
  28388. // PSR-0
  28389. private $prefixesPsr0 = array();
  28390. private $fallbackDirsPsr0 = array();
  28391. private $useIncludePath = false;
  28392. private $classMap = array();
  28393. private $classMapAuthoritative = false;
  28394. private $missingClasses = array();
  28395. private $apcuPrefix;
  28396. public function getPrefixes()
  28397. {
  28398. if (!empty($this->prefixesPsr0)) {
  28399. return call_user_func_array('array_merge', $this->prefixesPsr0);
  28400. }
  28401. return array();
  28402. }
  28403. public function getPrefixesPsr4()
  28404. {
  28405. return $this->prefixDirsPsr4;
  28406. }
  28407. public function getFallbackDirs()
  28408. {
  28409. return $this->fallbackDirsPsr0;
  28410. }
  28411. public function getFallbackDirsPsr4()
  28412. {
  28413. return $this->fallbackDirsPsr4;
  28414. }
  28415. public function getClassMap()
  28416. {
  28417. return $this->classMap;
  28418. }
  28419. /**
  28420. * @param array $classMap Class to filename map
  28421. */
  28422. public function addClassMap(array $classMap)
  28423. {
  28424. if ($this->classMap) {
  28425. $this->classMap = array_merge($this->classMap, $classMap);
  28426. } else {
  28427. $this->classMap = $classMap;
  28428. }
  28429. }
  28430. /**
  28431. * Registers a set of PSR-0 directories for a given prefix, either
  28432. * appending or prepending to the ones previously set for this prefix.
  28433. *
  28434. * @param string $prefix The prefix
  28435. * @param array|string $paths The PSR-0 root directories
  28436. * @param bool $prepend Whether to prepend the directories
  28437. */
  28438. public function add($prefix, $paths, $prepend = false)
  28439. {
  28440. if (!$prefix) {
  28441. if ($prepend) {
  28442. $this->fallbackDirsPsr0 = array_merge(
  28443. (array) $paths,
  28444. $this->fallbackDirsPsr0
  28445. );
  28446. } else {
  28447. $this->fallbackDirsPsr0 = array_merge(
  28448. $this->fallbackDirsPsr0,
  28449. (array) $paths
  28450. );
  28451. }
  28452. return;
  28453. }
  28454. $first = $prefix[0];
  28455. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  28456. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  28457. return;
  28458. }
  28459. if ($prepend) {
  28460. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28461. (array) $paths,
  28462. $this->prefixesPsr0[$first][$prefix]
  28463. );
  28464. } else {
  28465. $this->prefixesPsr0[$first][$prefix] = array_merge(
  28466. $this->prefixesPsr0[$first][$prefix],
  28467. (array) $paths
  28468. );
  28469. }
  28470. }
  28471. /**
  28472. * Registers a set of PSR-4 directories for a given namespace, either
  28473. * appending or prepending to the ones previously set for this namespace.
  28474. *
  28475. * @param string $prefix The prefix/namespace, with trailing '\\'
  28476. * @param array|string $paths The PSR-4 base directories
  28477. * @param bool $prepend Whether to prepend the directories
  28478. *
  28479. * @throws \InvalidArgumentException
  28480. */
  28481. public function addPsr4($prefix, $paths, $prepend = false)
  28482. {
  28483. if (!$prefix) {
  28484. // Register directories for the root namespace.
  28485. if ($prepend) {
  28486. $this->fallbackDirsPsr4 = array_merge(
  28487. (array) $paths,
  28488. $this->fallbackDirsPsr4
  28489. );
  28490. } else {
  28491. $this->fallbackDirsPsr4 = array_merge(
  28492. $this->fallbackDirsPsr4,
  28493. (array) $paths
  28494. );
  28495. }
  28496. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  28497. // Register directories for a new namespace.
  28498. $length = strlen($prefix);
  28499. if ('\\' !== $prefix[$length - 1]) {
  28500. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28501. }
  28502. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28503. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28504. } elseif ($prepend) {
  28505. // Prepend directories for an already registered namespace.
  28506. $this->prefixDirsPsr4[$prefix] = array_merge(
  28507. (array) $paths,
  28508. $this->prefixDirsPsr4[$prefix]
  28509. );
  28510. } else {
  28511. // Append directories for an already registered namespace.
  28512. $this->prefixDirsPsr4[$prefix] = array_merge(
  28513. $this->prefixDirsPsr4[$prefix],
  28514. (array) $paths
  28515. );
  28516. }
  28517. }
  28518. /**
  28519. * Registers a set of PSR-0 directories for a given prefix,
  28520. * replacing any others previously set for this prefix.
  28521. *
  28522. * @param string $prefix The prefix
  28523. * @param array|string $paths The PSR-0 base directories
  28524. */
  28525. public function set($prefix, $paths)
  28526. {
  28527. if (!$prefix) {
  28528. $this->fallbackDirsPsr0 = (array) $paths;
  28529. } else {
  28530. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  28531. }
  28532. }
  28533. /**
  28534. * Registers a set of PSR-4 directories for a given namespace,
  28535. * replacing any others previously set for this namespace.
  28536. *
  28537. * @param string $prefix The prefix/namespace, with trailing '\\'
  28538. * @param array|string $paths The PSR-4 base directories
  28539. *
  28540. * @throws \InvalidArgumentException
  28541. */
  28542. public function setPsr4($prefix, $paths)
  28543. {
  28544. if (!$prefix) {
  28545. $this->fallbackDirsPsr4 = (array) $paths;
  28546. } else {
  28547. $length = strlen($prefix);
  28548. if ('\\' !== $prefix[$length - 1]) {
  28549. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  28550. }
  28551. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  28552. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  28553. }
  28554. }
  28555. /**
  28556. * Turns on searching the include path for class files.
  28557. *
  28558. * @param bool $useIncludePath
  28559. */
  28560. public function setUseIncludePath($useIncludePath)
  28561. {
  28562. $this->useIncludePath = $useIncludePath;
  28563. }
  28564. /**
  28565. * Can be used to check if the autoloader uses the include path to check
  28566. * for classes.
  28567. *
  28568. * @return bool
  28569. */
  28570. public function getUseIncludePath()
  28571. {
  28572. return $this->useIncludePath;
  28573. }
  28574. /**
  28575. * Turns off searching the prefix and fallback directories for classes
  28576. * that have not been registered with the class map.
  28577. *
  28578. * @param bool $classMapAuthoritative
  28579. */
  28580. public function setClassMapAuthoritative($classMapAuthoritative)
  28581. {
  28582. $this->classMapAuthoritative = $classMapAuthoritative;
  28583. }
  28584. /**
  28585. * Should class lookup fail if not found in the current class map?
  28586. *
  28587. * @return bool
  28588. */
  28589. public function isClassMapAuthoritative()
  28590. {
  28591. return $this->classMapAuthoritative;
  28592. }
  28593. /**
  28594. * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
  28595. *
  28596. * @param string|null $apcuPrefix
  28597. */
  28598. public function setApcuPrefix($apcuPrefix)
  28599. {
  28600. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  28601. }
  28602. /**
  28603. * The APCu prefix in use, or null if APCu caching is not enabled.
  28604. *
  28605. * @return string|null
  28606. */
  28607. public function getApcuPrefix()
  28608. {
  28609. return $this->apcuPrefix;
  28610. }
  28611. /**
  28612. * Registers this instance as an autoloader.
  28613. *
  28614. * @param bool $prepend Whether to prepend the autoloader or not
  28615. */
  28616. public function register($prepend = false)
  28617. {
  28618. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  28619. }
  28620. /**
  28621. * Unregisters this instance as an autoloader.
  28622. */
  28623. public function unregister()
  28624. {
  28625. spl_autoload_unregister(array($this, 'loadClass'));
  28626. }
  28627. /**
  28628. * Loads the given class or interface.
  28629. *
  28630. * @param string $class The name of the class
  28631. * @return bool|null True if loaded, null otherwise
  28632. */
  28633. public function loadClass($class)
  28634. {
  28635. if ($file = $this->findFile($class)) {
  28636. includeFile($file);
  28637. return true;
  28638. }
  28639. }
  28640. /**
  28641. * Finds the path to the file where the class is defined.
  28642. *
  28643. * @param string $class The name of the class
  28644. *
  28645. * @return string|false The path if found, false otherwise
  28646. */
  28647. public function findFile($class)
  28648. {
  28649. // class map lookup
  28650. if (isset($this->classMap[$class])) {
  28651. return $this->classMap[$class];
  28652. }
  28653. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  28654. return false;
  28655. }
  28656. if (null !== $this->apcuPrefix) {
  28657. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  28658. if ($hit) {
  28659. return $file;
  28660. }
  28661. }
  28662. $file = $this->findFileWithExtension($class, '.php');
  28663. // Search for Hack files if we are running on HHVM
  28664. if (false === $file && defined('HHVM_VERSION')) {
  28665. $file = $this->findFileWithExtension($class, '.hh');
  28666. }
  28667. if (null !== $this->apcuPrefix) {
  28668. apcu_add($this->apcuPrefix.$class, $file);
  28669. }
  28670. if (false === $file) {
  28671. // Remember that this class does not exist.
  28672. $this->missingClasses[$class] = true;
  28673. }
  28674. return $file;
  28675. }
  28676. private function findFileWithExtension($class, $ext)
  28677. {
  28678. // PSR-4 lookup
  28679. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  28680. $first = $class[0];
  28681. if (isset($this->prefixLengthsPsr4[$first])) {
  28682. $subPath = $class;
  28683. while (false !== $lastPos = strrpos($subPath, '\\')) {
  28684. $subPath = substr($subPath, 0, $lastPos);
  28685. $search = $subPath . '\\';
  28686. if (isset($this->prefixDirsPsr4[$search])) {
  28687. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  28688. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  28689. if (file_exists($file = $dir . $pathEnd)) {
  28690. return $file;
  28691. }
  28692. }
  28693. }
  28694. }
  28695. }
  28696. // PSR-4 fallback dirs
  28697. foreach ($this->fallbackDirsPsr4 as $dir) {
  28698. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  28699. return $file;
  28700. }
  28701. }
  28702. // PSR-0 lookup
  28703. if (false !== $pos = strrpos($class, '\\')) {
  28704. // namespaced class name
  28705. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  28706. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  28707. } else {
  28708. // PEAR-like class name
  28709. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  28710. }
  28711. if (isset($this->prefixesPsr0[$first])) {
  28712. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  28713. if (0 === strpos($class, $prefix)) {
  28714. foreach ($dirs as $dir) {
  28715. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28716. return $file;
  28717. }
  28718. }
  28719. }
  28720. }
  28721. }
  28722. // PSR-0 fallback dirs
  28723. foreach ($this->fallbackDirsPsr0 as $dir) {
  28724. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  28725. return $file;
  28726. }
  28727. }
  28728. // PSR-0 include paths.
  28729. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  28730. return $file;
  28731. }
  28732. return false;
  28733. }
  28734. }
  28735. /**
  28736. * Scope isolated include.
  28737. *
  28738. * Prevents access to $this/self from included files.
  28739. */
  28740. function includeFile($file)
  28741. {
  28742. include $file;
  28743. }
  28744. {
  28745. "$schema": "http://json-schema.org/draft-04/schema#",
  28746. "description": "A representation of packages metadata.",
  28747. "type": "object",
  28748. "oneOf": [
  28749. { "required": [ "packages" ] },
  28750. { "required": [ "providers" ] },
  28751. { "required": [ "provider-includes", "providers-url" ] }
  28752. ],
  28753. "properties": {
  28754. "packages": {
  28755. "type": ["object", "array"],
  28756. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28757. "additionalProperties": { "$ref": "#/definitions/versions" }
  28758. },
  28759. "providers-url": {
  28760. "type": "string",
  28761. "description": "Endpoint to retrieve provider data from, e.g. '/p/%package%$%hash%.json'."
  28762. },
  28763. "provider-includes": {
  28764. "type": "object",
  28765. "description": "A hashmap of provider listings.",
  28766. "additionalProperties": { "$ref": "#/definitions/provider" }
  28767. },
  28768. "providers": {
  28769. "type": "object",
  28770. "description": "A hashmap of package names in the form of <vendor>/<name>.",
  28771. "additionalProperties": { "$ref": "#/definitions/provider" }
  28772. },
  28773. "notify-batch": {
  28774. "type": "string",
  28775. "description": "Endpoint to call after multiple packages have been installed, e.g. '/downloads/'."
  28776. },
  28777. "search": {
  28778. "type": "string",
  28779. "description": "Endpoint that provides search capabilities, e.g. '/search.json?q=%query%&type=%type%'."
  28780. },
  28781. "warning": {
  28782. "type": "string",
  28783. "description": "A message that will be output by Composer as a warning when this source is consulted."
  28784. }
  28785. },
  28786. "definitions": {
  28787. "versions": {
  28788. "type": "object",
  28789. "description": "A hashmap of versions and their metadata.",
  28790. "additionalProperties": { "$ref": "#/definitions/version" }
  28791. },
  28792. "version": {
  28793. "type": "object",
  28794. "oneOf": [
  28795. { "$ref": "#/definitions/package" },
  28796. { "$ref": "#/definitions/metapackage" }
  28797. ]
  28798. },
  28799. "package-base": {
  28800. "properties": {
  28801. "name": { "type": "string" },
  28802. "type": { "type": "string" },
  28803. "version": { "type": "string" },
  28804. "version_normalized": {
  28805. "type": "string",
  28806. "description": "Normalized version, optional but can save computational time on client side."
  28807. },
  28808. "autoload": { "type": "object" },
  28809. "require": { "type": "object" },
  28810. "replace": { "type": "object" },
  28811. "conflict": { "type": "object" },
  28812. "provide": { "type": "object" },
  28813. "time": { "type": "string" }
  28814. },
  28815. "additionalProperties": true
  28816. },
  28817. "package": {
  28818. "allOf": [
  28819. { "$ref": "#/definitions/package-base" },
  28820. {
  28821. "properties": {
  28822. "dist": { "type": "object" },
  28823. "source": { "type": "object" }
  28824. }
  28825. },
  28826. { "oneOf": [
  28827. { "required": [ "name", "version", "source" ] },
  28828. { "required": [ "name", "version", "dist" ] }
  28829. ] }
  28830. ]
  28831. },
  28832. "metapackage": {
  28833. "allOf": [
  28834. { "$ref": "#/definitions/package-base" },
  28835. {
  28836. "properties": {
  28837. "type": { "type": "string", "enum": [ "metapackage" ] }
  28838. },
  28839. "required": [ "name", "version", "type" ]
  28840. }
  28841. ]
  28842. },
  28843. "provider": {
  28844. "type": "object",
  28845. "properties": {
  28846. "sha256": {
  28847. "type": "string",
  28848. "description": "Hash value that can be used to validate the resource."
  28849. }
  28850. }
  28851. }
  28852. }
  28853. }
  28854. {
  28855. "$schema": "http://json-schema.org/draft-04/schema#",
  28856. "name": "Package",
  28857. "type": "object",
  28858. "additionalProperties": false,
  28859. "required": [ "name", "description" ],
  28860. "properties": {
  28861. "name": {
  28862. "type": "string",
  28863. "description": "Package name, including 'vendor-name/' prefix."
  28864. },
  28865. "type": {
  28866. "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.",
  28867. "type": "string",
  28868. "pattern": "^[a-z0-9-]+$"
  28869. },
  28870. "target-dir": {
  28871. "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.",
  28872. "type": "string"
  28873. },
  28874. "description": {
  28875. "type": "string",
  28876. "description": "Short package description."
  28877. },
  28878. "keywords": {
  28879. "type": "array",
  28880. "items": {
  28881. "type": "string",
  28882. "description": "A tag/keyword that this package relates to."
  28883. }
  28884. },
  28885. "homepage": {
  28886. "type": "string",
  28887. "description": "Homepage URL for the project.",
  28888. "format": "uri"
  28889. },
  28890. "readme": {
  28891. "type": "string",
  28892. "description": "Relative path to the readme document."
  28893. },
  28894. "version": {
  28895. "type": "string",
  28896. "description": "Package version, see https://getcomposer.org/doc/04-schema.md#version for more info on valid schemes.",
  28897. "pattern": "^v?\\d+(((\\.\\d+)?\\.\\d+)?\\.\\d+)?"
  28898. },
  28899. "time": {
  28900. "type": "string",
  28901. "description": "Package release date, in 'YYYY-MM-DD', 'YYYY-MM-DD HH:MM:SS' or 'YYYY-MM-DDTHH:MM:SSZ' format."
  28902. },
  28903. "license": {
  28904. "type": ["string", "array"],
  28905. "description": "License name. Or an array of license names."
  28906. },
  28907. "authors": {
  28908. "$ref": "#/definitions/authors"
  28909. },
  28910. "require": {
  28911. "type": "object",
  28912. "description": "This is a hash of package name (keys) and version constraints (values) that are required to run this package.",
  28913. "additionalProperties": {
  28914. "type": "string"
  28915. }
  28916. },
  28917. "replace": {
  28918. "type": "object",
  28919. "description": "This is a hash of package name (keys) and version constraints (values) that can be replaced by this package.",
  28920. "additionalProperties": {
  28921. "type": "string"
  28922. }
  28923. },
  28924. "conflict": {
  28925. "type": "object",
  28926. "description": "This is a hash of package name (keys) and version constraints (values) that conflict with this package.",
  28927. "additionalProperties": {
  28928. "type": "string"
  28929. }
  28930. },
  28931. "provide": {
  28932. "type": "object",
  28933. "description": "This is a hash of package name (keys) and version constraints (values) that this package provides in addition to this package's name.",
  28934. "additionalProperties": {
  28935. "type": "string"
  28936. }
  28937. },
  28938. "require-dev": {
  28939. "type": "object",
  28940. "description": "This is a hash of package name (keys) and version constraints (values) that this package requires for developing it (testing tools and such).",
  28941. "additionalProperties": {
  28942. "type": "string"
  28943. }
  28944. },
  28945. "suggest": {
  28946. "type": "object",
  28947. "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).",
  28948. "additionalProperties": {
  28949. "type": "string"
  28950. }
  28951. },
  28952. "config": {
  28953. "type": "object",
  28954. "description": "Composer options.",
  28955. "properties": {
  28956. "process-timeout": {
  28957. "type": "integer",
  28958. "description": "The timeout in seconds for process executions, defaults to 300 (5mins)."
  28959. },
  28960. "use-include-path": {
  28961. "type": "boolean",
  28962. "description": "If true, the Composer autoloader will also look for classes in the PHP include path."
  28963. },
  28964. "preferred-install": {
  28965. "type": ["string", "object"],
  28966. "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\"}."
  28967. },
  28968. "notify-on-install": {
  28969. "type": "boolean",
  28970. "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."
  28971. },
  28972. "github-protocols": {
  28973. "type": "array",
  28974. "description": "A list of protocols to use for github.com clones, in priority order, defaults to [\"git\", \"https\", \"http\"].",
  28975. "items": {
  28976. "type": "string"
  28977. }
  28978. },
  28979. "github-oauth": {
  28980. "type": "object",
  28981. "description": "A hash of domain name => github API oauth tokens, typically {\"github.com\":\"<token>\"}.",
  28982. "additionalProperties": {
  28983. "type": "string"
  28984. }
  28985. },
  28986. "gitlab-oauth": {
  28987. "type": "object",
  28988. "description": "A hash of domain name => gitlab API oauth tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28989. "additionalProperties": {
  28990. "type": "string"
  28991. }
  28992. },
  28993. "gitlab-token": {
  28994. "type": "object",
  28995. "description": "A hash of domain name => gitlab private tokens, typically {\"gitlab.com\":\"<token>\"}.",
  28996. "additionalProperties": true
  28997. },
  28998. "disable-tls": {
  28999. "type": "boolean",
  29000. "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."
  29001. },
  29002. "secure-http": {
  29003. "type": "boolean",
  29004. "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."
  29005. },
  29006. "cafile": {
  29007. "type": "string",
  29008. "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."
  29009. },
  29010. "capath": {
  29011. "type": "string",
  29012. "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."
  29013. },
  29014. "http-basic": {
  29015. "type": "object",
  29016. "description": "A hash of domain name => {\"username\": \"...\", \"password\": \"...\"}.",
  29017. "additionalProperties": {
  29018. "type": "object",
  29019. "required": ["username", "password"],
  29020. "properties": {
  29021. "username": {
  29022. "type": "string",
  29023. "description": "The username used for HTTP Basic authentication"
  29024. },
  29025. "password": {
  29026. "type": "string",
  29027. "description": "The password used for HTTP Basic authentication"
  29028. }
  29029. }
  29030. }
  29031. },
  29032. "store-auths": {
  29033. "type": ["string", "boolean"],
  29034. "description": "What to do after prompting for authentication, one of: true (store), false (do not store) or \"prompt\" (ask every time), defaults to prompt."
  29035. },
  29036. "platform": {
  29037. "type": "object",
  29038. "description": "This is a hash of package name (keys) and version (values) that will be used to mock the platform packages on this machine.",
  29039. "additionalProperties": {
  29040. "type": "string"
  29041. }
  29042. },
  29043. "vendor-dir": {
  29044. "type": "string",
  29045. "description": "The location where all packages are installed, defaults to \"vendor\"."
  29046. },
  29047. "bin-dir": {
  29048. "type": "string",
  29049. "description": "The location where all binaries are linked, defaults to \"vendor/bin\"."
  29050. },
  29051. "data-dir": {
  29052. "type": "string",
  29053. "description": "The location where old phar files are stored, defaults to \"$home\" except on XDG Base Directory compliant unixes."
  29054. },
  29055. "cache-dir": {
  29056. "type": "string",
  29057. "description": "The location where all caches are located, defaults to \"~/.composer/cache\" on *nix and \"%LOCALAPPDATA%\\Composer\" on windows."
  29058. },
  29059. "cache-files-dir": {
  29060. "type": "string",
  29061. "description": "The location where files (zip downloads) are cached, defaults to \"{$cache-dir}/files\"."
  29062. },
  29063. "cache-repo-dir": {
  29064. "type": "string",
  29065. "description": "The location where repo (git/hg repo clones) are cached, defaults to \"{$cache-dir}/repo\"."
  29066. },
  29067. "cache-vcs-dir": {
  29068. "type": "string",
  29069. "description": "The location where vcs infos (git clones, github api calls, etc. when reading vcs repos) are cached, defaults to \"{$cache-dir}/vcs\"."
  29070. },
  29071. "cache-ttl": {
  29072. "type": "integer",
  29073. "description": "The default cache time-to-live, defaults to 15552000 (6 months)."
  29074. },
  29075. "cache-files-ttl": {
  29076. "type": "integer",
  29077. "description": "The cache time-to-live for files, defaults to the value of cache-ttl."
  29078. },
  29079. "cache-files-maxsize": {
  29080. "type": ["string", "integer"],
  29081. "description": "The cache max size for the files cache, defaults to \"300MiB\"."
  29082. },
  29083. "bin-compat": {
  29084. "enum": ["auto", "full"],
  29085. "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
  29086. },
  29087. "discard-changes": {
  29088. "type": ["string", "boolean"],
  29089. "description": "The default style of handling dirty updates, defaults to false and can be any of true, false or \"stash\"."
  29090. },
  29091. "autoloader-suffix": {
  29092. "type": "string",
  29093. "description": "Optional string to be used as a suffix for the generated Composer autoloader. When null a random one will be generated."
  29094. },
  29095. "optimize-autoloader": {
  29096. "type": "boolean",
  29097. "description": "Always optimize when dumping the autoloader."
  29098. },
  29099. "prepend-autoloader": {
  29100. "type": "boolean",
  29101. "description": "If false, the composer autoloader will not be prepended to existing autoloaders, defaults to true."
  29102. },
  29103. "classmap-authoritative": {
  29104. "type": "boolean",
  29105. "description": "If true, the composer autoloader will not scan the filesystem for classes that are not found in the class map, defaults to false."
  29106. },
  29107. "apcu-autoloader": {
  29108. "type": "boolean",
  29109. "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."
  29110. },
  29111. "github-domains": {
  29112. "type": "array",
  29113. "description": "A list of domains to use in github mode. This is used for GitHub Enterprise setups, defaults to [\"github.com\"].",
  29114. "items": {
  29115. "type": "string"
  29116. }
  29117. },
  29118. "github-expose-hostname": {
  29119. "type": "boolean",
  29120. "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."
  29121. },
  29122. "gitlab-domains": {
  29123. "type": "array",
  29124. "description": "A list of domains to use in gitlab mode. This is used for custom GitLab setups, defaults to [\"gitlab.com\"].",
  29125. "items": {
  29126. "type": "string"
  29127. }
  29128. },
  29129. "use-github-api": {
  29130. "type": "boolean",
  29131. "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."
  29132. },
  29133. "archive-format": {
  29134. "type": "string",
  29135. "description": "The default archiving format when not provided on cli, defaults to \"tar\"."
  29136. },
  29137. "archive-dir": {
  29138. "type": "string",
  29139. "description": "The default archive path when not provided on cli, defaults to \".\"."
  29140. },
  29141. "htaccess-protect": {
  29142. "type": "boolean",
  29143. "description": "Defaults to true. If set to false, Composer will not create .htaccess files in the composer home, cache, and data directories."
  29144. },
  29145. "sort-packages": {
  29146. "type": "boolean",
  29147. "description": "Defaults to false. If set to true, Composer will sort packages when adding/updating a new dependency."
  29148. }
  29149. }
  29150. },
  29151. "extra": {
  29152. "type": ["object", "array"],
  29153. "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.",
  29154. "additionalProperties": true
  29155. },
  29156. "autoload": {
  29157. "$ref": "#/definitions/autoload"
  29158. },
  29159. "autoload-dev": {
  29160. "type": "object",
  29161. "description": "Description of additional autoload rules for development purpose (eg. a test suite).",
  29162. "properties": {
  29163. "psr-0": {
  29164. "type": "object",
  29165. "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.",
  29166. "additionalProperties": {
  29167. "type": ["string", "array"],
  29168. "items": {
  29169. "type": "string"
  29170. }
  29171. }
  29172. },
  29173. "psr-4": {
  29174. "type": "object",
  29175. "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.",
  29176. "additionalProperties": {
  29177. "type": ["string", "array"],
  29178. "items": {
  29179. "type": "string"
  29180. }
  29181. }
  29182. },
  29183. "classmap": {
  29184. "type": "array",
  29185. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29186. },
  29187. "files": {
  29188. "type": "array",
  29189. "description": "This is an array of files that are always required on every request."
  29190. }
  29191. }
  29192. },
  29193. "archive": {
  29194. "type": ["object"],
  29195. "description": "Options for creating package archives for distribution.",
  29196. "properties": {
  29197. "exclude": {
  29198. "type": "array",
  29199. "description": "A list of patterns for paths to exclude or include if prefixed with an exclamation mark."
  29200. }
  29201. }
  29202. },
  29203. "repositories": {
  29204. "type": ["object", "array"],
  29205. "description": "A set of additional repositories where packages can be found.",
  29206. "additionalProperties": {
  29207. "oneOf": [
  29208. { "$ref": "#/definitions/repository" },
  29209. { "type": "boolean", "enum": [false] }
  29210. ]
  29211. },
  29212. "items": {
  29213. "oneOf": [
  29214. { "$ref": "#/definitions/repository" },
  29215. {
  29216. "type": "object",
  29217. "additionalProperties": { "type": "boolean", "enum": [false] },
  29218. "minProperties": 1,
  29219. "maxProperties": 1
  29220. }
  29221. ]
  29222. }
  29223. },
  29224. "minimum-stability": {
  29225. "type": ["string"],
  29226. "description": "The minimum stability the packages must have to be install-able. Possible values are: dev, alpha, beta, RC, stable.",
  29227. "pattern": "^dev|alpha|beta|rc|RC|stable$"
  29228. },
  29229. "prefer-stable": {
  29230. "type": ["boolean"],
  29231. "description": "If set to true, stable packages will be preferred to dev packages when possible, even if the minimum-stability allows unstable packages."
  29232. },
  29233. "bin": {
  29234. "type": ["string", "array"],
  29235. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29236. "items": {
  29237. "type": "string"
  29238. }
  29239. },
  29240. "include-path": {
  29241. "type": ["array"],
  29242. "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.",
  29243. "items": {
  29244. "type": "string"
  29245. }
  29246. },
  29247. "scripts": {
  29248. "type": ["object"],
  29249. "description": "Script listeners that will be executed before/after some events.",
  29250. "properties": {
  29251. "pre-install-cmd": {
  29252. "type": ["array", "string"],
  29253. "description": "Occurs before the install command is executed, contains one or more Class::method callables or shell commands."
  29254. },
  29255. "post-install-cmd": {
  29256. "type": ["array", "string"],
  29257. "description": "Occurs after the install command is executed, contains one or more Class::method callables or shell commands."
  29258. },
  29259. "pre-update-cmd": {
  29260. "type": ["array", "string"],
  29261. "description": "Occurs before the update command is executed, contains one or more Class::method callables or shell commands."
  29262. },
  29263. "post-update-cmd": {
  29264. "type": ["array", "string"],
  29265. "description": "Occurs after the update command is executed, contains one or more Class::method callables or shell commands."
  29266. },
  29267. "pre-status-cmd": {
  29268. "type": ["array", "string"],
  29269. "description": "Occurs before the status command is executed, contains one or more Class::method callables or shell commands."
  29270. },
  29271. "post-status-cmd": {
  29272. "type": ["array", "string"],
  29273. "description": "Occurs after the status command is executed, contains one or more Class::method callables or shell commands."
  29274. },
  29275. "pre-package-install": {
  29276. "type": ["array", "string"],
  29277. "description": "Occurs before a package is installed, contains one or more Class::method callables or shell commands."
  29278. },
  29279. "post-package-install": {
  29280. "type": ["array", "string"],
  29281. "description": "Occurs after a package is installed, contains one or more Class::method callables or shell commands."
  29282. },
  29283. "pre-package-update": {
  29284. "type": ["array", "string"],
  29285. "description": "Occurs before a package is updated, contains one or more Class::method callables or shell commands."
  29286. },
  29287. "post-package-update": {
  29288. "type": ["array", "string"],
  29289. "description": "Occurs after a package is updated, contains one or more Class::method callables or shell commands."
  29290. },
  29291. "pre-package-uninstall": {
  29292. "type": ["array", "string"],
  29293. "description": "Occurs before a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29294. },
  29295. "post-package-uninstall": {
  29296. "type": ["array", "string"],
  29297. "description": "Occurs after a package has been uninstalled, contains one or more Class::method callables or shell commands."
  29298. },
  29299. "pre-autoload-dump": {
  29300. "type": ["array", "string"],
  29301. "description": "Occurs before the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29302. },
  29303. "post-autoload-dump": {
  29304. "type": ["array", "string"],
  29305. "description": "Occurs after the autoloader is dumped, contains one or more Class::method callables or shell commands."
  29306. },
  29307. "post-root-package-install": {
  29308. "type": ["array", "string"],
  29309. "description": "Occurs after the root-package is installed, contains one or more Class::method callables or shell commands."
  29310. },
  29311. "post-create-project-cmd": {
  29312. "type": ["array", "string"],
  29313. "description": "Occurs after the create-project command is executed, contains one or more Class::method callables or shell commands."
  29314. }
  29315. }
  29316. },
  29317. "scripts-descriptions": {
  29318. "type": ["object"],
  29319. "description": "Descriptions for custom commands, shown in console help.",
  29320. "additionalProperties": {
  29321. "type": "string"
  29322. }
  29323. },
  29324. "support": {
  29325. "type": "object",
  29326. "properties": {
  29327. "email": {
  29328. "type": "string",
  29329. "description": "Email address for support.",
  29330. "format": "email"
  29331. },
  29332. "issues": {
  29333. "type": "string",
  29334. "description": "URL to the issue tracker.",
  29335. "format": "uri"
  29336. },
  29337. "forum": {
  29338. "type": "string",
  29339. "description": "URL to the forum.",
  29340. "format": "uri"
  29341. },
  29342. "wiki": {
  29343. "type": "string",
  29344. "description": "URL to the wiki.",
  29345. "format": "uri"
  29346. },
  29347. "irc": {
  29348. "type": "string",
  29349. "description": "IRC channel for support, as irc://server/channel.",
  29350. "format": "uri"
  29351. },
  29352. "chat": {
  29353. "type": "string",
  29354. "description": "URL to the support chat.",
  29355. "format": "uri"
  29356. },
  29357. "source": {
  29358. "type": "string",
  29359. "description": "URL to browse or download the sources.",
  29360. "format": "uri"
  29361. },
  29362. "docs": {
  29363. "type": "string",
  29364. "description": "URL to the documentation.",
  29365. "format": "uri"
  29366. },
  29367. "rss": {
  29368. "type": "string",
  29369. "description": "URL to the RSS feed.",
  29370. "format": "uri"
  29371. }
  29372. }
  29373. },
  29374. "non-feature-branches": {
  29375. "type": ["array"],
  29376. "description": "A set of string or regex patterns for non-numeric branch names that will not be handled as feature branches.",
  29377. "items": {
  29378. "type": "string"
  29379. }
  29380. },
  29381. "abandoned": {
  29382. "type": ["boolean", "string"],
  29383. "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."
  29384. },
  29385. "_comment": {
  29386. "type": ["array", "string"],
  29387. "description": "A key to store comments in"
  29388. }
  29389. },
  29390. "definitions": {
  29391. "authors": {
  29392. "type": "array",
  29393. "description": "List of authors that contributed to the package. This is typically the main maintainers, not the full list.",
  29394. "items": {
  29395. "type": "object",
  29396. "additionalProperties": false,
  29397. "required": [ "name"],
  29398. "properties": {
  29399. "name": {
  29400. "type": "string",
  29401. "description": "Full name of the author."
  29402. },
  29403. "email": {
  29404. "type": "string",
  29405. "description": "Email address of the author.",
  29406. "format": "email"
  29407. },
  29408. "homepage": {
  29409. "type": "string",
  29410. "description": "Homepage URL for the author.",
  29411. "format": "uri"
  29412. },
  29413. "role": {
  29414. "type": "string",
  29415. "description": "Author's role in the project."
  29416. }
  29417. }
  29418. }
  29419. },
  29420. "autoload": {
  29421. "type": "object",
  29422. "description": "Description of how the package can be autoloaded.",
  29423. "properties": {
  29424. "psr-0": {
  29425. "type": "object",
  29426. "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.",
  29427. "additionalProperties": {
  29428. "type": ["string", "array"],
  29429. "items": {
  29430. "type": "string"
  29431. }
  29432. }
  29433. },
  29434. "psr-4": {
  29435. "type": "object",
  29436. "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.",
  29437. "additionalProperties": {
  29438. "type": ["string", "array"],
  29439. "items": {
  29440. "type": "string"
  29441. }
  29442. }
  29443. },
  29444. "classmap": {
  29445. "type": "array",
  29446. "description": "This is an array of directories that contain classes to be included in the class-map generation process."
  29447. },
  29448. "files": {
  29449. "type": "array",
  29450. "description": "This is an array of files that are always required on every request."
  29451. },
  29452. "exclude-from-classmap": {
  29453. "type": "array",
  29454. "description": "This is an array of patterns to exclude from autoload classmap generation. (e.g. \"exclude-from-classmap\": [\"/test/\", \"/tests/\", \"/Tests/\"]"
  29455. }
  29456. }
  29457. },
  29458. "repository": {
  29459. "type": "object",
  29460. "oneOf": [
  29461. { "$ref": "#/definitions/composer-repository" },
  29462. { "$ref": "#/definitions/vcs-repository" },
  29463. { "$ref": "#/definitions/path-repository" },
  29464. { "$ref": "#/definitions/artifact-repository" },
  29465. { "$ref": "#/definitions/pear-repository" },
  29466. { "$ref": "#/definitions/package-repository" }
  29467. ]
  29468. },
  29469. "composer-repository": {
  29470. "type": "object",
  29471. "required": ["type", "url"],
  29472. "properties": {
  29473. "type": { "type": "string", "enum": ["composer"] },
  29474. "url": { "type": "string" },
  29475. "options": {
  29476. "type": "object",
  29477. "additionalProperties": true
  29478. },
  29479. "allow_ssl_downgrade": { "type": "boolean" },
  29480. "force-lazy-providers": { "type": "boolean" }
  29481. }
  29482. },
  29483. "vcs-repository": {
  29484. "type": "object",
  29485. "required": ["type", "url"],
  29486. "properties": {
  29487. "type": { "type": "string", "enum": ["vcs", "github", "git", "gitlab", "git-bitbucket", "hg", "hg-bitbucket", "fossil", "perforce", "svn"] },
  29488. "url": { "type": "string" },
  29489. "no-api": { "type": "boolean" },
  29490. "secure-http": { "type": "boolean" },
  29491. "svn-cache-credentials": { "type": "boolean" },
  29492. "trunk-path": { "type": ["string", "boolean"] },
  29493. "branches-path": { "type": ["string", "boolean"] },
  29494. "tags-path": { "type": ["string", "boolean"] },
  29495. "package-path": { "type": "string" },
  29496. "depot": { "type": "string" },
  29497. "branch": { "type": "string" },
  29498. "unique_perforce_client_name": { "type": "string" },
  29499. "p4user": { "type": "string" },
  29500. "p4password": { "type": "string" }
  29501. }
  29502. },
  29503. "path-repository": {
  29504. "type": "object",
  29505. "required": ["type", "url"],
  29506. "properties": {
  29507. "type": { "type": "string", "enum": ["path"] },
  29508. "url": { "type": "string" },
  29509. "options": {
  29510. "type": "object",
  29511. "properties": {
  29512. "symlink": { "type": ["boolean", "null"] }
  29513. },
  29514. "additionalProperties": true
  29515. }
  29516. }
  29517. },
  29518. "artifact-repository": {
  29519. "type": "object",
  29520. "required": ["type", "url"],
  29521. "properties": {
  29522. "type": { "type": "string", "enum": ["artifact"] },
  29523. "url": { "type": "string" }
  29524. }
  29525. },
  29526. "pear-repository": {
  29527. "type": "object",
  29528. "required": ["type", "url"],
  29529. "properties": {
  29530. "type": { "type": "string", "enum": ["pear"] },
  29531. "url": { "type": "string" },
  29532. "vendor-alias": { "type": "string" }
  29533. }
  29534. },
  29535. "package-repository": {
  29536. "type": "object",
  29537. "required": ["type", "package"],
  29538. "properties": {
  29539. "type": { "type": "string", "enum": ["package"] },
  29540. "package": {
  29541. "oneOf": [
  29542. { "$ref": "#/definitions/inline-package" },
  29543. {
  29544. "type": "array",
  29545. "items": { "$ref": "#/definitions/inline-package" }
  29546. }
  29547. ]
  29548. }
  29549. }
  29550. },
  29551. "inline-package": {
  29552. "type": "object",
  29553. "required": ["name", "version"],
  29554. "properties": {
  29555. "name": {
  29556. "type": "string",
  29557. "description": "Package name, including 'vendor-name/' prefix."
  29558. },
  29559. "type": {
  29560. "type": "string"
  29561. },
  29562. "target-dir": {
  29563. "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.",
  29564. "type": "string"
  29565. },
  29566. "description": {
  29567. "type": "string"
  29568. },
  29569. "keywords": {
  29570. "type": "array",
  29571. "items": {
  29572. "type": "string"
  29573. }
  29574. },
  29575. "homepage": {
  29576. "type": "string",
  29577. "format": "uri"
  29578. },
  29579. "version": {
  29580. "type": "string"
  29581. },
  29582. "time": {
  29583. "type": "string"
  29584. },
  29585. "license": {
  29586. "type": [
  29587. "string",
  29588. "array"
  29589. ]
  29590. },
  29591. "authors": {
  29592. "$ref": "#/definitions/authors"
  29593. },
  29594. "require": {
  29595. "type": "object",
  29596. "additionalProperties": {
  29597. "type": "string"
  29598. }
  29599. },
  29600. "replace": {
  29601. "type": "object",
  29602. "additionalProperties": {
  29603. "type": "string"
  29604. }
  29605. },
  29606. "conflict": {
  29607. "type": "object",
  29608. "additionalProperties": {
  29609. "type": "string"
  29610. }
  29611. },
  29612. "provide": {
  29613. "type": "object",
  29614. "additionalProperties": {
  29615. "type": "string"
  29616. }
  29617. },
  29618. "require-dev": {
  29619. "type": "object",
  29620. "additionalProperties": {
  29621. "type": "string"
  29622. }
  29623. },
  29624. "suggest": {
  29625. "type": "object",
  29626. "additionalProperties": {
  29627. "type": "string"
  29628. }
  29629. },
  29630. "extra": {
  29631. "type": ["object", "array"],
  29632. "additionalProperties": true
  29633. },
  29634. "autoload": {
  29635. "$ref": "#/definitions/autoload"
  29636. },
  29637. "archive": {
  29638. "type": ["object"],
  29639. "properties": {
  29640. "exclude": {
  29641. "type": "array"
  29642. }
  29643. }
  29644. },
  29645. "bin": {
  29646. "type": ["string", "array"],
  29647. "description": "A set of files, or a single file, that should be treated as binaries and symlinked into bin-dir (from config).",
  29648. "items": {
  29649. "type": "string"
  29650. }
  29651. },
  29652. "include-path": {
  29653. "type": ["array"],
  29654. "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.",
  29655. "items": {
  29656. "type": "string"
  29657. }
  29658. },
  29659. "source": {
  29660. "type": "object",
  29661. "required": ["type", "url", "reference"],
  29662. "properties": {
  29663. "type": {
  29664. "type": "string"
  29665. },
  29666. "url": {
  29667. "type": "string"
  29668. },
  29669. "reference": {
  29670. "type": "string"
  29671. },
  29672. "mirrors": {
  29673. "type": "array"
  29674. }
  29675. }
  29676. },
  29677. "dist": {
  29678. "type": "object",
  29679. "required": ["type", "url"],
  29680. "properties": {
  29681. "type": {
  29682. "type": "string"
  29683. },
  29684. "url": {
  29685. "type": "string"
  29686. },
  29687. "reference": {
  29688. "type": "string"
  29689. },
  29690. "shasum": {
  29691. "type": "string"
  29692. },
  29693. "mirrors": {
  29694. "type": "array"
  29695. }
  29696. }
  29697. }
  29698. },
  29699. "additionalProperties": true
  29700. }
  29701. }
  29702. }
  29703. {
  29704. "389-exception": [
  29705. "389 Directory Server Exception"
  29706. ],
  29707. "Autoconf-exception-2.0": [
  29708. "Autoconf exception 2.0"
  29709. ],
  29710. "Autoconf-exception-3.0": [
  29711. "Autoconf exception 3.0"
  29712. ],
  29713. "Bison-exception-2.2": [
  29714. "Bison exception 2.2"
  29715. ],
  29716. "Bootloader-exception": [
  29717. "Bootloader Distribution Exception"
  29718. ],
  29719. "Classpath-exception-2.0": [
  29720. "Classpath exception 2.0"
  29721. ],
  29722. "CLISP-exception-2.0": [
  29723. "CLISP exception 2.0"
  29724. ],
  29725. "DigiRule-FOSS-exception": [
  29726. "DigiRule FOSS License Exception"
  29727. ],
  29728. "eCos-exception-2.0": [
  29729. "eCos exception 2.0"
  29730. ],
  29731. "Fawkes-Runtime-exception": [
  29732. "Fawkes Runtime Exception"
  29733. ],
  29734. "FLTK-exception": [
  29735. "FLTK exception"
  29736. ],
  29737. "Font-exception-2.0": [
  29738. "Font exception 2.0"
  29739. ],
  29740. "freertos-exception-2.0": [
  29741. "FreeRTOS Exception 2.0"
  29742. ],
  29743. "GCC-exception-2.0": [
  29744. "GCC Runtime Library exception 2.0"
  29745. ],
  29746. "GCC-exception-3.1": [
  29747. "GCC Runtime Library exception 3.1"
  29748. ],
  29749. "gnu-javamail-exception": [
  29750. "GNU JavaMail exception"
  29751. ],
  29752. "GPL-CC-1.0": [
  29753. "GPL Cooperation Commitment 1.0"
  29754. ],
  29755. "i2p-gpl-java-exception": [
  29756. "i2p GPL+Java Exception"
  29757. ],
  29758. "Libtool-exception": [
  29759. "Libtool Exception"
  29760. ],
  29761. "Linux-syscall-note": [
  29762. "Linux Syscall Note"
  29763. ],
  29764. "LLVM-exception": [
  29765. "LLVM Exception"
  29766. ],
  29767. "LZMA-exception": [
  29768. "LZMA exception"
  29769. ],
  29770. "mif-exception": [
  29771. "Macros and Inline Functions Exception"
  29772. ],
  29773. "Nokia-Qt-exception-1.1": [
  29774. "Nokia Qt LGPL exception 1.1"
  29775. ],
  29776. "OCaml-LGPL-linking-exception": [
  29777. "OCaml LGPL Linking Exception"
  29778. ],
  29779. "OCCT-exception-1.0": [
  29780. "Open CASCADE Exception 1.0"
  29781. ],
  29782. "OpenJDK-assembly-exception-1.0": [
  29783. "OpenJDK Assembly exception 1.0"
  29784. ],
  29785. "openvpn-openssl-exception": [
  29786. "OpenVPN OpenSSL Exception"
  29787. ],
  29788. "PS-or-PDF-font-exception-20170817": [
  29789. "PS/PDF font exception (2017-08-17)"
  29790. ],
  29791. "Qt-GPL-exception-1.0": [
  29792. "Qt GPL exception 1.0"
  29793. ],
  29794. "Qt-LGPL-exception-1.1": [
  29795. "Qt LGPL exception 1.1"
  29796. ],
  29797. "Qwt-exception-1.0": [
  29798. "Qwt exception 1.0"
  29799. ],
  29800. "Swift-exception": [
  29801. "Swift Exception"
  29802. ],
  29803. "u-boot-exception-2.0": [
  29804. "U-Boot exception 2.0"
  29805. ],
  29806. "Universal-FOSS-exception-1.0": [
  29807. "Universal FOSS Exception, Version 1.0"
  29808. ],
  29809. "WxWindows-exception-3.1": [
  29810. "WxWindows Library Exception 3.1"
  29811. ]
  29812. }{
  29813. "0BSD": [
  29814. "BSD Zero Clause License",
  29815. true,
  29816. false
  29817. ],
  29818. "AAL": [
  29819. "Attribution Assurance License",
  29820. true,
  29821. false
  29822. ],
  29823. "Abstyles": [
  29824. "Abstyles License",
  29825. false,
  29826. false
  29827. ],
  29828. "Adobe-2006": [
  29829. "Adobe Systems Incorporated Source Code License Agreement",
  29830. false,
  29831. false
  29832. ],
  29833. "Adobe-Glyph": [
  29834. "Adobe Glyph List License",
  29835. false,
  29836. false
  29837. ],
  29838. "ADSL": [
  29839. "Amazon Digital Services License",
  29840. false,
  29841. false
  29842. ],
  29843. "AFL-1.1": [
  29844. "Academic Free License v1.1",
  29845. true,
  29846. false
  29847. ],
  29848. "AFL-1.2": [
  29849. "Academic Free License v1.2",
  29850. true,
  29851. false
  29852. ],
  29853. "AFL-2.0": [
  29854. "Academic Free License v2.0",
  29855. true,
  29856. false
  29857. ],
  29858. "AFL-2.1": [
  29859. "Academic Free License v2.1",
  29860. true,
  29861. false
  29862. ],
  29863. "AFL-3.0": [
  29864. "Academic Free License v3.0",
  29865. true,
  29866. false
  29867. ],
  29868. "Afmparse": [
  29869. "Afmparse License",
  29870. false,
  29871. false
  29872. ],
  29873. "AGPL-1.0": [
  29874. "Affero General Public License v1.0",
  29875. false,
  29876. true
  29877. ],
  29878. "AGPL-1.0-only": [
  29879. "Affero General Public License v1.0 only",
  29880. false,
  29881. false
  29882. ],
  29883. "AGPL-1.0-or-later": [
  29884. "Affero General Public License v1.0 or later",
  29885. false,
  29886. false
  29887. ],
  29888. "AGPL-3.0": [
  29889. "GNU Affero General Public License v3.0",
  29890. true,
  29891. true
  29892. ],
  29893. "AGPL-3.0-only": [
  29894. "GNU Affero General Public License v3.0 only",
  29895. true,
  29896. false
  29897. ],
  29898. "AGPL-3.0-or-later": [
  29899. "GNU Affero General Public License v3.0 or later",
  29900. true,
  29901. false
  29902. ],
  29903. "Aladdin": [
  29904. "Aladdin Free Public License",
  29905. false,
  29906. false
  29907. ],
  29908. "AMDPLPA": [
  29909. "AMD's plpa_map.c License",
  29910. false,
  29911. false
  29912. ],
  29913. "AML": [
  29914. "Apple MIT License",
  29915. false,
  29916. false
  29917. ],
  29918. "AMPAS": [
  29919. "Academy of Motion Picture Arts and Sciences BSD",
  29920. false,
  29921. false
  29922. ],
  29923. "ANTLR-PD": [
  29924. "ANTLR Software Rights Notice",
  29925. false,
  29926. false
  29927. ],
  29928. "Apache-1.0": [
  29929. "Apache License 1.0",
  29930. false,
  29931. false
  29932. ],
  29933. "Apache-1.1": [
  29934. "Apache License 1.1",
  29935. true,
  29936. false
  29937. ],
  29938. "Apache-2.0": [
  29939. "Apache License 2.0",
  29940. true,
  29941. false
  29942. ],
  29943. "APAFML": [
  29944. "Adobe Postscript AFM License",
  29945. false,
  29946. false
  29947. ],
  29948. "APL-1.0": [
  29949. "Adaptive Public License 1.0",
  29950. true,
  29951. false
  29952. ],
  29953. "APSL-1.0": [
  29954. "Apple Public Source License 1.0",
  29955. true,
  29956. false
  29957. ],
  29958. "APSL-1.1": [
  29959. "Apple Public Source License 1.1",
  29960. true,
  29961. false
  29962. ],
  29963. "APSL-1.2": [
  29964. "Apple Public Source License 1.2",
  29965. true,
  29966. false
  29967. ],
  29968. "APSL-2.0": [
  29969. "Apple Public Source License 2.0",
  29970. true,
  29971. false
  29972. ],
  29973. "Artistic-1.0": [
  29974. "Artistic License 1.0",
  29975. true,
  29976. false
  29977. ],
  29978. "Artistic-1.0-cl8": [
  29979. "Artistic License 1.0 w/clause 8",
  29980. true,
  29981. false
  29982. ],
  29983. "Artistic-1.0-Perl": [
  29984. "Artistic License 1.0 (Perl)",
  29985. true,
  29986. false
  29987. ],
  29988. "Artistic-2.0": [
  29989. "Artistic License 2.0",
  29990. true,
  29991. false
  29992. ],
  29993. "Bahyph": [
  29994. "Bahyph License",
  29995. false,
  29996. false
  29997. ],
  29998. "Barr": [
  29999. "Barr License",
  30000. false,
  30001. false
  30002. ],
  30003. "Beerware": [
  30004. "Beerware License",
  30005. false,
  30006. false
  30007. ],
  30008. "BitTorrent-1.0": [
  30009. "BitTorrent Open Source License v1.0",
  30010. false,
  30011. false
  30012. ],
  30013. "BitTorrent-1.1": [
  30014. "BitTorrent Open Source License v1.1",
  30015. false,
  30016. false
  30017. ],
  30018. "blessing": [
  30019. "SQLite Blessing",
  30020. false,
  30021. false
  30022. ],
  30023. "BlueOak-1.0.0": [
  30024. "Blue Oak Model License 1.0.0",
  30025. false,
  30026. false
  30027. ],
  30028. "Borceux": [
  30029. "Borceux license",
  30030. false,
  30031. false
  30032. ],
  30033. "BSD-1-Clause": [
  30034. "BSD 1-Clause License",
  30035. false,
  30036. false
  30037. ],
  30038. "BSD-2-Clause": [
  30039. "BSD 2-Clause \"Simplified\" License",
  30040. true,
  30041. false
  30042. ],
  30043. "BSD-2-Clause-FreeBSD": [
  30044. "BSD 2-Clause FreeBSD License",
  30045. false,
  30046. false
  30047. ],
  30048. "BSD-2-Clause-NetBSD": [
  30049. "BSD 2-Clause NetBSD License",
  30050. false,
  30051. false
  30052. ],
  30053. "BSD-2-Clause-Patent": [
  30054. "BSD-2-Clause Plus Patent License",
  30055. true,
  30056. false
  30057. ],
  30058. "BSD-3-Clause": [
  30059. "BSD 3-Clause \"New\" or \"Revised\" License",
  30060. true,
  30061. false
  30062. ],
  30063. "BSD-3-Clause-Attribution": [
  30064. "BSD with attribution",
  30065. false,
  30066. false
  30067. ],
  30068. "BSD-3-Clause-Clear": [
  30069. "BSD 3-Clause Clear License",
  30070. false,
  30071. false
  30072. ],
  30073. "BSD-3-Clause-LBNL": [
  30074. "Lawrence Berkeley National Labs BSD variant license",
  30075. true,
  30076. false
  30077. ],
  30078. "BSD-3-Clause-No-Nuclear-License": [
  30079. "BSD 3-Clause No Nuclear License",
  30080. false,
  30081. false
  30082. ],
  30083. "BSD-3-Clause-No-Nuclear-License-2014": [
  30084. "BSD 3-Clause No Nuclear License 2014",
  30085. false,
  30086. false
  30087. ],
  30088. "BSD-3-Clause-No-Nuclear-Warranty": [
  30089. "BSD 3-Clause No Nuclear Warranty",
  30090. false,
  30091. false
  30092. ],
  30093. "BSD-3-Clause-Open-MPI": [
  30094. "BSD 3-Clause Open MPI variant",
  30095. false,
  30096. false
  30097. ],
  30098. "BSD-4-Clause": [
  30099. "BSD 4-Clause \"Original\" or \"Old\" License",
  30100. false,
  30101. false
  30102. ],
  30103. "BSD-4-Clause-UC": [
  30104. "BSD-4-Clause (University of California-Specific)",
  30105. false,
  30106. false
  30107. ],
  30108. "BSD-Protection": [
  30109. "BSD Protection License",
  30110. false,
  30111. false
  30112. ],
  30113. "BSD-Source-Code": [
  30114. "BSD Source Code Attribution",
  30115. false,
  30116. false
  30117. ],
  30118. "BSL-1.0": [
  30119. "Boost Software License 1.0",
  30120. true,
  30121. false
  30122. ],
  30123. "bzip2-1.0.5": [
  30124. "bzip2 and libbzip2 License v1.0.5",
  30125. false,
  30126. false
  30127. ],
  30128. "bzip2-1.0.6": [
  30129. "bzip2 and libbzip2 License v1.0.6",
  30130. false,
  30131. false
  30132. ],
  30133. "Caldera": [
  30134. "Caldera License",
  30135. false,
  30136. false
  30137. ],
  30138. "CATOSL-1.1": [
  30139. "Computer Associates Trusted Open Source License 1.1",
  30140. true,
  30141. false
  30142. ],
  30143. "CC-BY-1.0": [
  30144. "Creative Commons Attribution 1.0 Generic",
  30145. false,
  30146. false
  30147. ],
  30148. "CC-BY-2.0": [
  30149. "Creative Commons Attribution 2.0 Generic",
  30150. false,
  30151. false
  30152. ],
  30153. "CC-BY-2.5": [
  30154. "Creative Commons Attribution 2.5 Generic",
  30155. false,
  30156. false
  30157. ],
  30158. "CC-BY-3.0": [
  30159. "Creative Commons Attribution 3.0 Unported",
  30160. false,
  30161. false
  30162. ],
  30163. "CC-BY-4.0": [
  30164. "Creative Commons Attribution 4.0 International",
  30165. false,
  30166. false
  30167. ],
  30168. "CC-BY-NC-1.0": [
  30169. "Creative Commons Attribution Non Commercial 1.0 Generic",
  30170. false,
  30171. false
  30172. ],
  30173. "CC-BY-NC-2.0": [
  30174. "Creative Commons Attribution Non Commercial 2.0 Generic",
  30175. false,
  30176. false
  30177. ],
  30178. "CC-BY-NC-2.5": [
  30179. "Creative Commons Attribution Non Commercial 2.5 Generic",
  30180. false,
  30181. false
  30182. ],
  30183. "CC-BY-NC-3.0": [
  30184. "Creative Commons Attribution Non Commercial 3.0 Unported",
  30185. false,
  30186. false
  30187. ],
  30188. "CC-BY-NC-4.0": [
  30189. "Creative Commons Attribution Non Commercial 4.0 International",
  30190. false,
  30191. false
  30192. ],
  30193. "CC-BY-NC-ND-1.0": [
  30194. "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic",
  30195. false,
  30196. false
  30197. ],
  30198. "CC-BY-NC-ND-2.0": [
  30199. "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic",
  30200. false,
  30201. false
  30202. ],
  30203. "CC-BY-NC-ND-2.5": [
  30204. "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic",
  30205. false,
  30206. false
  30207. ],
  30208. "CC-BY-NC-ND-3.0": [
  30209. "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported",
  30210. false,
  30211. false
  30212. ],
  30213. "CC-BY-NC-ND-4.0": [
  30214. "Creative Commons Attribution Non Commercial No Derivatives 4.0 International",
  30215. false,
  30216. false
  30217. ],
  30218. "CC-BY-NC-SA-1.0": [
  30219. "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic",
  30220. false,
  30221. false
  30222. ],
  30223. "CC-BY-NC-SA-2.0": [
  30224. "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic",
  30225. false,
  30226. false
  30227. ],
  30228. "CC-BY-NC-SA-2.5": [
  30229. "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic",
  30230. false,
  30231. false
  30232. ],
  30233. "CC-BY-NC-SA-3.0": [
  30234. "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported",
  30235. false,
  30236. false
  30237. ],
  30238. "CC-BY-NC-SA-4.0": [
  30239. "Creative Commons Attribution Non Commercial Share Alike 4.0 International",
  30240. false,
  30241. false
  30242. ],
  30243. "CC-BY-ND-1.0": [
  30244. "Creative Commons Attribution No Derivatives 1.0 Generic",
  30245. false,
  30246. false
  30247. ],
  30248. "CC-BY-ND-2.0": [
  30249. "Creative Commons Attribution No Derivatives 2.0 Generic",
  30250. false,
  30251. false
  30252. ],
  30253. "CC-BY-ND-2.5": [
  30254. "Creative Commons Attribution No Derivatives 2.5 Generic",
  30255. false,
  30256. false
  30257. ],
  30258. "CC-BY-ND-3.0": [
  30259. "Creative Commons Attribution No Derivatives 3.0 Unported",
  30260. false,
  30261. false
  30262. ],
  30263. "CC-BY-ND-4.0": [
  30264. "Creative Commons Attribution No Derivatives 4.0 International",
  30265. false,
  30266. false
  30267. ],
  30268. "CC-BY-SA-1.0": [
  30269. "Creative Commons Attribution Share Alike 1.0 Generic",
  30270. false,
  30271. false
  30272. ],
  30273. "CC-BY-SA-2.0": [
  30274. "Creative Commons Attribution Share Alike 2.0 Generic",
  30275. false,
  30276. false
  30277. ],
  30278. "CC-BY-SA-2.5": [
  30279. "Creative Commons Attribution Share Alike 2.5 Generic",
  30280. false,
  30281. false
  30282. ],
  30283. "CC-BY-SA-3.0": [
  30284. "Creative Commons Attribution Share Alike 3.0 Unported",
  30285. false,
  30286. false
  30287. ],
  30288. "CC-BY-SA-4.0": [
  30289. "Creative Commons Attribution Share Alike 4.0 International",
  30290. false,
  30291. false
  30292. ],
  30293. "CC-PDDC": [
  30294. "Creative Commons Public Domain Dedication and Certification",
  30295. false,
  30296. false
  30297. ],
  30298. "CC0-1.0": [
  30299. "Creative Commons Zero v1.0 Universal",
  30300. false,
  30301. false
  30302. ],
  30303. "CDDL-1.0": [
  30304. "Common Development and Distribution License 1.0",
  30305. true,
  30306. false
  30307. ],
  30308. "CDDL-1.1": [
  30309. "Common Development and Distribution License 1.1",
  30310. false,
  30311. false
  30312. ],
  30313. "CDLA-Permissive-1.0": [
  30314. "Community Data License Agreement Permissive 1.0",
  30315. false,
  30316. false
  30317. ],
  30318. "CDLA-Sharing-1.0": [
  30319. "Community Data License Agreement Sharing 1.0",
  30320. false,
  30321. false
  30322. ],
  30323. "CECILL-1.0": [
  30324. "CeCILL Free Software License Agreement v1.0",
  30325. false,
  30326. false
  30327. ],
  30328. "CECILL-1.1": [
  30329. "CeCILL Free Software License Agreement v1.1",
  30330. false,
  30331. false
  30332. ],
  30333. "CECILL-2.0": [
  30334. "CeCILL Free Software License Agreement v2.0",
  30335. false,
  30336. false
  30337. ],
  30338. "CECILL-2.1": [
  30339. "CeCILL Free Software License Agreement v2.1",
  30340. true,
  30341. false
  30342. ],
  30343. "CECILL-B": [
  30344. "CeCILL-B Free Software License Agreement",
  30345. false,
  30346. false
  30347. ],
  30348. "CECILL-C": [
  30349. "CeCILL-C Free Software License Agreement",
  30350. false,
  30351. false
  30352. ],
  30353. "CERN-OHL-1.1": [
  30354. "CERN Open Hardware License v1.1",
  30355. false,
  30356. false
  30357. ],
  30358. "CERN-OHL-1.2": [
  30359. "CERN Open Hardware Licence v1.2",
  30360. false,
  30361. false
  30362. ],
  30363. "ClArtistic": [
  30364. "Clarified Artistic License",
  30365. false,
  30366. false
  30367. ],
  30368. "CNRI-Jython": [
  30369. "CNRI Jython License",
  30370. false,
  30371. false
  30372. ],
  30373. "CNRI-Python": [
  30374. "CNRI Python License",
  30375. true,
  30376. false
  30377. ],
  30378. "CNRI-Python-GPL-Compatible": [
  30379. "CNRI Python Open Source GPL Compatible License Agreement",
  30380. false,
  30381. false
  30382. ],
  30383. "Condor-1.1": [
  30384. "Condor Public License v1.1",
  30385. false,
  30386. false
  30387. ],
  30388. "copyleft-next-0.3.0": [
  30389. "copyleft-next 0.3.0",
  30390. false,
  30391. false
  30392. ],
  30393. "copyleft-next-0.3.1": [
  30394. "copyleft-next 0.3.1",
  30395. false,
  30396. false
  30397. ],
  30398. "CPAL-1.0": [
  30399. "Common Public Attribution License 1.0",
  30400. true,
  30401. false
  30402. ],
  30403. "CPL-1.0": [
  30404. "Common Public License 1.0",
  30405. true,
  30406. false
  30407. ],
  30408. "CPOL-1.02": [
  30409. "Code Project Open License 1.02",
  30410. false,
  30411. false
  30412. ],
  30413. "Crossword": [
  30414. "Crossword License",
  30415. false,
  30416. false
  30417. ],
  30418. "CrystalStacker": [
  30419. "CrystalStacker License",
  30420. false,
  30421. false
  30422. ],
  30423. "CUA-OPL-1.0": [
  30424. "CUA Office Public License v1.0",
  30425. true,
  30426. false
  30427. ],
  30428. "Cube": [
  30429. "Cube License",
  30430. false,
  30431. false
  30432. ],
  30433. "curl": [
  30434. "curl License",
  30435. false,
  30436. false
  30437. ],
  30438. "D-FSL-1.0": [
  30439. "Deutsche Freie Software Lizenz",
  30440. false,
  30441. false
  30442. ],
  30443. "diffmark": [
  30444. "diffmark license",
  30445. false,
  30446. false
  30447. ],
  30448. "DOC": [
  30449. "DOC License",
  30450. false,
  30451. false
  30452. ],
  30453. "Dotseqn": [
  30454. "Dotseqn License",
  30455. false,
  30456. false
  30457. ],
  30458. "DSDP": [
  30459. "DSDP License",
  30460. false,
  30461. false
  30462. ],
  30463. "dvipdfm": [
  30464. "dvipdfm License",
  30465. false,
  30466. false
  30467. ],
  30468. "ECL-1.0": [
  30469. "Educational Community License v1.0",
  30470. true,
  30471. false
  30472. ],
  30473. "ECL-2.0": [
  30474. "Educational Community License v2.0",
  30475. true,
  30476. false
  30477. ],
  30478. "eCos-2.0": [
  30479. "eCos license version 2.0",
  30480. false,
  30481. true
  30482. ],
  30483. "EFL-1.0": [
  30484. "Eiffel Forum License v1.0",
  30485. true,
  30486. false
  30487. ],
  30488. "EFL-2.0": [
  30489. "Eiffel Forum License v2.0",
  30490. true,
  30491. false
  30492. ],
  30493. "eGenix": [
  30494. "eGenix.com Public License 1.1.0",
  30495. false,
  30496. false
  30497. ],
  30498. "Entessa": [
  30499. "Entessa Public License v1.0",
  30500. true,
  30501. false
  30502. ],
  30503. "EPL-1.0": [
  30504. "Eclipse Public License 1.0",
  30505. true,
  30506. false
  30507. ],
  30508. "EPL-2.0": [
  30509. "Eclipse Public License 2.0",
  30510. true,
  30511. false
  30512. ],
  30513. "ErlPL-1.1": [
  30514. "Erlang Public License v1.1",
  30515. false,
  30516. false
  30517. ],
  30518. "EUDatagrid": [
  30519. "EU DataGrid Software License",
  30520. true,
  30521. false
  30522. ],
  30523. "EUPL-1.0": [
  30524. "European Union Public License 1.0",
  30525. false,
  30526. false
  30527. ],
  30528. "EUPL-1.1": [
  30529. "European Union Public License 1.1",
  30530. true,
  30531. false
  30532. ],
  30533. "EUPL-1.2": [
  30534. "European Union Public License 1.2",
  30535. true,
  30536. false
  30537. ],
  30538. "Eurosym": [
  30539. "Eurosym License",
  30540. false,
  30541. false
  30542. ],
  30543. "Fair": [
  30544. "Fair License",
  30545. true,
  30546. false
  30547. ],
  30548. "Frameworx-1.0": [
  30549. "Frameworx Open License 1.0",
  30550. true,
  30551. false
  30552. ],
  30553. "FreeImage": [
  30554. "FreeImage Public License v1.0",
  30555. false,
  30556. false
  30557. ],
  30558. "FSFAP": [
  30559. "FSF All Permissive License",
  30560. false,
  30561. false
  30562. ],
  30563. "FSFUL": [
  30564. "FSF Unlimited License",
  30565. false,
  30566. false
  30567. ],
  30568. "FSFULLR": [
  30569. "FSF Unlimited License (with License Retention)",
  30570. false,
  30571. false
  30572. ],
  30573. "FTL": [
  30574. "Freetype Project License",
  30575. false,
  30576. false
  30577. ],
  30578. "GFDL-1.1": [
  30579. "GNU Free Documentation License v1.1",
  30580. false,
  30581. true
  30582. ],
  30583. "GFDL-1.1-only": [
  30584. "GNU Free Documentation License v1.1 only",
  30585. false,
  30586. false
  30587. ],
  30588. "GFDL-1.1-or-later": [
  30589. "GNU Free Documentation License v1.1 or later",
  30590. false,
  30591. false
  30592. ],
  30593. "GFDL-1.2": [
  30594. "GNU Free Documentation License v1.2",
  30595. false,
  30596. true
  30597. ],
  30598. "GFDL-1.2-only": [
  30599. "GNU Free Documentation License v1.2 only",
  30600. false,
  30601. false
  30602. ],
  30603. "GFDL-1.2-or-later": [
  30604. "GNU Free Documentation License v1.2 or later",
  30605. false,
  30606. false
  30607. ],
  30608. "GFDL-1.3": [
  30609. "GNU Free Documentation License v1.3",
  30610. false,
  30611. true
  30612. ],
  30613. "GFDL-1.3-only": [
  30614. "GNU Free Documentation License v1.3 only",
  30615. false,
  30616. false
  30617. ],
  30618. "GFDL-1.3-or-later": [
  30619. "GNU Free Documentation License v1.3 or later",
  30620. false,
  30621. false
  30622. ],
  30623. "Giftware": [
  30624. "Giftware License",
  30625. false,
  30626. false
  30627. ],
  30628. "GL2PS": [
  30629. "GL2PS License",
  30630. false,
  30631. false
  30632. ],
  30633. "Glide": [
  30634. "3dfx Glide License",
  30635. false,
  30636. false
  30637. ],
  30638. "Glulxe": [
  30639. "Glulxe License",
  30640. false,
  30641. false
  30642. ],
  30643. "gnuplot": [
  30644. "gnuplot License",
  30645. false,
  30646. false
  30647. ],
  30648. "GPL-1.0": [
  30649. "GNU General Public License v1.0 only",
  30650. false,
  30651. true
  30652. ],
  30653. "GPL-1.0+": [
  30654. "GNU General Public License v1.0 or later",
  30655. false,
  30656. true
  30657. ],
  30658. "GPL-1.0-only": [
  30659. "GNU General Public License v1.0 only",
  30660. false,
  30661. false
  30662. ],
  30663. "GPL-1.0-or-later": [
  30664. "GNU General Public License v1.0 or later",
  30665. false,
  30666. false
  30667. ],
  30668. "GPL-2.0": [
  30669. "GNU General Public License v2.0 only",
  30670. true,
  30671. true
  30672. ],
  30673. "GPL-2.0+": [
  30674. "GNU General Public License v2.0 or later",
  30675. true,
  30676. true
  30677. ],
  30678. "GPL-2.0-only": [
  30679. "GNU General Public License v2.0 only",
  30680. true,
  30681. false
  30682. ],
  30683. "GPL-2.0-or-later": [
  30684. "GNU General Public License v2.0 or later",
  30685. true,
  30686. false
  30687. ],
  30688. "GPL-2.0-with-autoconf-exception": [
  30689. "GNU General Public License v2.0 w/Autoconf exception",
  30690. false,
  30691. true
  30692. ],
  30693. "GPL-2.0-with-bison-exception": [
  30694. "GNU General Public License v2.0 w/Bison exception",
  30695. false,
  30696. true
  30697. ],
  30698. "GPL-2.0-with-classpath-exception": [
  30699. "GNU General Public License v2.0 w/Classpath exception",
  30700. false,
  30701. true
  30702. ],
  30703. "GPL-2.0-with-font-exception": [
  30704. "GNU General Public License v2.0 w/Font exception",
  30705. false,
  30706. true
  30707. ],
  30708. "GPL-2.0-with-GCC-exception": [
  30709. "GNU General Public License v2.0 w/GCC Runtime Library exception",
  30710. false,
  30711. true
  30712. ],
  30713. "GPL-3.0": [
  30714. "GNU General Public License v3.0 only",
  30715. true,
  30716. true
  30717. ],
  30718. "GPL-3.0+": [
  30719. "GNU General Public License v3.0 or later",
  30720. true,
  30721. true
  30722. ],
  30723. "GPL-3.0-only": [
  30724. "GNU General Public License v3.0 only",
  30725. true,
  30726. false
  30727. ],
  30728. "GPL-3.0-or-later": [
  30729. "GNU General Public License v3.0 or later",
  30730. true,
  30731. false
  30732. ],
  30733. "GPL-3.0-with-autoconf-exception": [
  30734. "GNU General Public License v3.0 w/Autoconf exception",
  30735. false,
  30736. true
  30737. ],
  30738. "GPL-3.0-with-GCC-exception": [
  30739. "GNU General Public License v3.0 w/GCC Runtime Library exception",
  30740. true,
  30741. true
  30742. ],
  30743. "gSOAP-1.3b": [
  30744. "gSOAP Public License v1.3b",
  30745. false,
  30746. false
  30747. ],
  30748. "HaskellReport": [
  30749. "Haskell Language Report License",
  30750. false,
  30751. false
  30752. ],
  30753. "HPND": [
  30754. "Historical Permission Notice and Disclaimer",
  30755. true,
  30756. false
  30757. ],
  30758. "HPND-sell-variant": [
  30759. "Historical Permission Notice and Disclaimer - sell variant",
  30760. false,
  30761. false
  30762. ],
  30763. "IBM-pibs": [
  30764. "IBM PowerPC Initialization and Boot Software",
  30765. false,
  30766. false
  30767. ],
  30768. "ICU": [
  30769. "ICU License",
  30770. false,
  30771. false
  30772. ],
  30773. "IJG": [
  30774. "Independent JPEG Group License",
  30775. false,
  30776. false
  30777. ],
  30778. "ImageMagick": [
  30779. "ImageMagick License",
  30780. false,
  30781. false
  30782. ],
  30783. "iMatix": [
  30784. "iMatix Standard Function Library Agreement",
  30785. false,
  30786. false
  30787. ],
  30788. "Imlib2": [
  30789. "Imlib2 License",
  30790. false,
  30791. false
  30792. ],
  30793. "Info-ZIP": [
  30794. "Info-ZIP License",
  30795. false,
  30796. false
  30797. ],
  30798. "Intel": [
  30799. "Intel Open Source License",
  30800. true,
  30801. false
  30802. ],
  30803. "Intel-ACPI": [
  30804. "Intel ACPI Software License Agreement",
  30805. false,
  30806. false
  30807. ],
  30808. "Interbase-1.0": [
  30809. "Interbase Public License v1.0",
  30810. false,
  30811. false
  30812. ],
  30813. "IPA": [
  30814. "IPA Font License",
  30815. true,
  30816. false
  30817. ],
  30818. "IPL-1.0": [
  30819. "IBM Public License v1.0",
  30820. true,
  30821. false
  30822. ],
  30823. "ISC": [
  30824. "ISC License",
  30825. true,
  30826. false
  30827. ],
  30828. "JasPer-2.0": [
  30829. "JasPer License",
  30830. false,
  30831. false
  30832. ],
  30833. "JPNIC": [
  30834. "Japan Network Information Center License",
  30835. false,
  30836. false
  30837. ],
  30838. "JSON": [
  30839. "JSON License",
  30840. false,
  30841. false
  30842. ],
  30843. "LAL-1.2": [
  30844. "Licence Art Libre 1.2",
  30845. false,
  30846. false
  30847. ],
  30848. "LAL-1.3": [
  30849. "Licence Art Libre 1.3",
  30850. false,
  30851. false
  30852. ],
  30853. "Latex2e": [
  30854. "Latex2e License",
  30855. false,
  30856. false
  30857. ],
  30858. "Leptonica": [
  30859. "Leptonica License",
  30860. false,
  30861. false
  30862. ],
  30863. "LGPL-2.0": [
  30864. "GNU Library General Public License v2 only",
  30865. true,
  30866. true
  30867. ],
  30868. "LGPL-2.0+": [
  30869. "GNU Library General Public License v2 or later",
  30870. true,
  30871. true
  30872. ],
  30873. "LGPL-2.0-only": [
  30874. "GNU Library General Public License v2 only",
  30875. true,
  30876. false
  30877. ],
  30878. "LGPL-2.0-or-later": [
  30879. "GNU Library General Public License v2 or later",
  30880. true,
  30881. false
  30882. ],
  30883. "LGPL-2.1": [
  30884. "GNU Lesser General Public License v2.1 only",
  30885. true,
  30886. true
  30887. ],
  30888. "LGPL-2.1+": [
  30889. "GNU Library General Public License v2.1 or later",
  30890. true,
  30891. true
  30892. ],
  30893. "LGPL-2.1-only": [
  30894. "GNU Lesser General Public License v2.1 only",
  30895. true,
  30896. false
  30897. ],
  30898. "LGPL-2.1-or-later": [
  30899. "GNU Lesser General Public License v2.1 or later",
  30900. true,
  30901. false
  30902. ],
  30903. "LGPL-3.0": [
  30904. "GNU Lesser General Public License v3.0 only",
  30905. true,
  30906. true
  30907. ],
  30908. "LGPL-3.0+": [
  30909. "GNU Lesser General Public License v3.0 or later",
  30910. true,
  30911. true
  30912. ],
  30913. "LGPL-3.0-only": [
  30914. "GNU Lesser General Public License v3.0 only",
  30915. true,
  30916. false
  30917. ],
  30918. "LGPL-3.0-or-later": [
  30919. "GNU Lesser General Public License v3.0 or later",
  30920. true,
  30921. false
  30922. ],
  30923. "LGPLLR": [
  30924. "Lesser General Public License For Linguistic Resources",
  30925. false,
  30926. false
  30927. ],
  30928. "Libpng": [
  30929. "libpng License",
  30930. false,
  30931. false
  30932. ],
  30933. "libpng-2.0": [
  30934. "PNG Reference Library version 2",
  30935. false,
  30936. false
  30937. ],
  30938. "libtiff": [
  30939. "libtiff License",
  30940. false,
  30941. false
  30942. ],
  30943. "LiLiQ-P-1.1": [
  30944. "Licence Libre du Qu\u00e9bec \u2013 Permissive version 1.1",
  30945. true,
  30946. false
  30947. ],
  30948. "LiLiQ-R-1.1": [
  30949. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 version 1.1",
  30950. true,
  30951. false
  30952. ],
  30953. "LiLiQ-Rplus-1.1": [
  30954. "Licence Libre du Qu\u00e9bec \u2013 R\u00e9ciprocit\u00e9 forte version 1.1",
  30955. true,
  30956. false
  30957. ],
  30958. "Linux-OpenIB": [
  30959. "Linux Kernel Variant of OpenIB.org license",
  30960. false,
  30961. false
  30962. ],
  30963. "LPL-1.0": [
  30964. "Lucent Public License Version 1.0",
  30965. true,
  30966. false
  30967. ],
  30968. "LPL-1.02": [
  30969. "Lucent Public License v1.02",
  30970. true,
  30971. false
  30972. ],
  30973. "LPPL-1.0": [
  30974. "LaTeX Project Public License v1.0",
  30975. false,
  30976. false
  30977. ],
  30978. "LPPL-1.1": [
  30979. "LaTeX Project Public License v1.1",
  30980. false,
  30981. false
  30982. ],
  30983. "LPPL-1.2": [
  30984. "LaTeX Project Public License v1.2",
  30985. false,
  30986. false
  30987. ],
  30988. "LPPL-1.3a": [
  30989. "LaTeX Project Public License v1.3a",
  30990. false,
  30991. false
  30992. ],
  30993. "LPPL-1.3c": [
  30994. "LaTeX Project Public License v1.3c",
  30995. true,
  30996. false
  30997. ],
  30998. "MakeIndex": [
  30999. "MakeIndex License",
  31000. false,
  31001. false
  31002. ],
  31003. "MirOS": [
  31004. "MirOS License",
  31005. true,
  31006. false
  31007. ],
  31008. "MIT": [
  31009. "MIT License",
  31010. true,
  31011. false
  31012. ],
  31013. "MIT-0": [
  31014. "MIT No Attribution",
  31015. true,
  31016. false
  31017. ],
  31018. "MIT-advertising": [
  31019. "Enlightenment License (e16)",
  31020. false,
  31021. false
  31022. ],
  31023. "MIT-CMU": [
  31024. "CMU License",
  31025. false,
  31026. false
  31027. ],
  31028. "MIT-enna": [
  31029. "enna License",
  31030. false,
  31031. false
  31032. ],
  31033. "MIT-feh": [
  31034. "feh License",
  31035. false,
  31036. false
  31037. ],
  31038. "MITNFA": [
  31039. "MIT +no-false-attribs license",
  31040. false,
  31041. false
  31042. ],
  31043. "Motosoto": [
  31044. "Motosoto License",
  31045. true,
  31046. false
  31047. ],
  31048. "mpich2": [
  31049. "mpich2 License",
  31050. false,
  31051. false
  31052. ],
  31053. "MPL-1.0": [
  31054. "Mozilla Public License 1.0",
  31055. true,
  31056. false
  31057. ],
  31058. "MPL-1.1": [
  31059. "Mozilla Public License 1.1",
  31060. true,
  31061. false
  31062. ],
  31063. "MPL-2.0": [
  31064. "Mozilla Public License 2.0",
  31065. true,
  31066. false
  31067. ],
  31068. "MPL-2.0-no-copyleft-exception": [
  31069. "Mozilla Public License 2.0 (no copyleft exception)",
  31070. true,
  31071. false
  31072. ],
  31073. "MS-PL": [
  31074. "Microsoft Public License",
  31075. true,
  31076. false
  31077. ],
  31078. "MS-RL": [
  31079. "Microsoft Reciprocal License",
  31080. true,
  31081. false
  31082. ],
  31083. "MTLL": [
  31084. "Matrix Template Library License",
  31085. false,
  31086. false
  31087. ],
  31088. "Multics": [
  31089. "Multics License",
  31090. true,
  31091. false
  31092. ],
  31093. "Mup": [
  31094. "Mup License",
  31095. false,
  31096. false
  31097. ],
  31098. "NASA-1.3": [
  31099. "NASA Open Source Agreement 1.3",
  31100. true,
  31101. false
  31102. ],
  31103. "Naumen": [
  31104. "Naumen Public License",
  31105. true,
  31106. false
  31107. ],
  31108. "NBPL-1.0": [
  31109. "Net Boolean Public License v1",
  31110. false,
  31111. false
  31112. ],
  31113. "NCSA": [
  31114. "University of Illinois/NCSA Open Source License",
  31115. true,
  31116. false
  31117. ],
  31118. "Net-SNMP": [
  31119. "Net-SNMP License",
  31120. false,
  31121. false
  31122. ],
  31123. "NetCDF": [
  31124. "NetCDF license",
  31125. false,
  31126. false
  31127. ],
  31128. "Newsletr": [
  31129. "Newsletr License",
  31130. false,
  31131. false
  31132. ],
  31133. "NGPL": [
  31134. "Nethack General Public License",
  31135. true,
  31136. false
  31137. ],
  31138. "NLOD-1.0": [
  31139. "Norwegian Licence for Open Government Data",
  31140. false,
  31141. false
  31142. ],
  31143. "NLPL": [
  31144. "No Limit Public License",
  31145. false,
  31146. false
  31147. ],
  31148. "Nokia": [
  31149. "Nokia Open Source License",
  31150. true,
  31151. false
  31152. ],
  31153. "NOSL": [
  31154. "Netizen Open Source License",
  31155. false,
  31156. false
  31157. ],
  31158. "Noweb": [
  31159. "Noweb License",
  31160. false,
  31161. false
  31162. ],
  31163. "NPL-1.0": [
  31164. "Netscape Public License v1.0",
  31165. false,
  31166. false
  31167. ],
  31168. "NPL-1.1": [
  31169. "Netscape Public License v1.1",
  31170. false,
  31171. false
  31172. ],
  31173. "NPOSL-3.0": [
  31174. "Non-Profit Open Software License 3.0",
  31175. true,
  31176. false
  31177. ],
  31178. "NRL": [
  31179. "NRL License",
  31180. false,
  31181. false
  31182. ],
  31183. "NTP": [
  31184. "NTP License",
  31185. true,
  31186. false
  31187. ],
  31188. "Nunit": [
  31189. "Nunit License",
  31190. false,
  31191. true
  31192. ],
  31193. "OCCT-PL": [
  31194. "Open CASCADE Technology Public License",
  31195. false,
  31196. false
  31197. ],
  31198. "OCLC-2.0": [
  31199. "OCLC Research Public License 2.0",
  31200. true,
  31201. false
  31202. ],
  31203. "ODbL-1.0": [
  31204. "ODC Open Database License v1.0",
  31205. false,
  31206. false
  31207. ],
  31208. "ODC-By-1.0": [
  31209. "Open Data Commons Attribution License v1.0",
  31210. false,
  31211. false
  31212. ],
  31213. "OFL-1.0": [
  31214. "SIL Open Font License 1.0",
  31215. false,
  31216. false
  31217. ],
  31218. "OFL-1.1": [
  31219. "SIL Open Font License 1.1",
  31220. true,
  31221. false
  31222. ],
  31223. "OGL-UK-1.0": [
  31224. "Open Government Licence v1.0",
  31225. false,
  31226. false
  31227. ],
  31228. "OGL-UK-2.0": [
  31229. "Open Government Licence v2.0",
  31230. false,
  31231. false
  31232. ],
  31233. "OGL-UK-3.0": [
  31234. "Open Government Licence v3.0",
  31235. false,
  31236. false
  31237. ],
  31238. "OGTSL": [
  31239. "Open Group Test Suite License",
  31240. true,
  31241. false
  31242. ],
  31243. "OLDAP-1.1": [
  31244. "Open LDAP Public License v1.1",
  31245. false,
  31246. false
  31247. ],
  31248. "OLDAP-1.2": [
  31249. "Open LDAP Public License v1.2",
  31250. false,
  31251. false
  31252. ],
  31253. "OLDAP-1.3": [
  31254. "Open LDAP Public License v1.3",
  31255. false,
  31256. false
  31257. ],
  31258. "OLDAP-1.4": [
  31259. "Open LDAP Public License v1.4",
  31260. false,
  31261. false
  31262. ],
  31263. "OLDAP-2.0": [
  31264. "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)",
  31265. false,
  31266. false
  31267. ],
  31268. "OLDAP-2.0.1": [
  31269. "Open LDAP Public License v2.0.1",
  31270. false,
  31271. false
  31272. ],
  31273. "OLDAP-2.1": [
  31274. "Open LDAP Public License v2.1",
  31275. false,
  31276. false
  31277. ],
  31278. "OLDAP-2.2": [
  31279. "Open LDAP Public License v2.2",
  31280. false,
  31281. false
  31282. ],
  31283. "OLDAP-2.2.1": [
  31284. "Open LDAP Public License v2.2.1",
  31285. false,
  31286. false
  31287. ],
  31288. "OLDAP-2.2.2": [
  31289. "Open LDAP Public License 2.2.2",
  31290. false,
  31291. false
  31292. ],
  31293. "OLDAP-2.3": [
  31294. "Open LDAP Public License v2.3",
  31295. false,
  31296. false
  31297. ],
  31298. "OLDAP-2.4": [
  31299. "Open LDAP Public License v2.4",
  31300. false,
  31301. false
  31302. ],
  31303. "OLDAP-2.5": [
  31304. "Open LDAP Public License v2.5",
  31305. false,
  31306. false
  31307. ],
  31308. "OLDAP-2.6": [
  31309. "Open LDAP Public License v2.6",
  31310. false,
  31311. false
  31312. ],
  31313. "OLDAP-2.7": [
  31314. "Open LDAP Public License v2.7",
  31315. false,
  31316. false
  31317. ],
  31318. "OLDAP-2.8": [
  31319. "Open LDAP Public License v2.8",
  31320. false,
  31321. false
  31322. ],
  31323. "OML": [
  31324. "Open Market License",
  31325. false,
  31326. false
  31327. ],
  31328. "OpenSSL": [
  31329. "OpenSSL License",
  31330. false,
  31331. false
  31332. ],
  31333. "OPL-1.0": [
  31334. "Open Public License v1.0",
  31335. false,
  31336. false
  31337. ],
  31338. "OSET-PL-2.1": [
  31339. "OSET Public License version 2.1",
  31340. true,
  31341. false
  31342. ],
  31343. "OSL-1.0": [
  31344. "Open Software License 1.0",
  31345. true,
  31346. false
  31347. ],
  31348. "OSL-1.1": [
  31349. "Open Software License 1.1",
  31350. false,
  31351. false
  31352. ],
  31353. "OSL-2.0": [
  31354. "Open Software License 2.0",
  31355. true,
  31356. false
  31357. ],
  31358. "OSL-2.1": [
  31359. "Open Software License 2.1",
  31360. true,
  31361. false
  31362. ],
  31363. "OSL-3.0": [
  31364. "Open Software License 3.0",
  31365. true,
  31366. false
  31367. ],
  31368. "Parity-6.0.0": [
  31369. "The Parity Public License 6.0.0",
  31370. false,
  31371. false
  31372. ],
  31373. "PDDL-1.0": [
  31374. "ODC Public Domain Dedication & License 1.0",
  31375. false,
  31376. false
  31377. ],
  31378. "PHP-3.0": [
  31379. "PHP License v3.0",
  31380. true,
  31381. false
  31382. ],
  31383. "PHP-3.01": [
  31384. "PHP License v3.01",
  31385. false,
  31386. false
  31387. ],
  31388. "Plexus": [
  31389. "Plexus Classworlds License",
  31390. false,
  31391. false
  31392. ],
  31393. "PostgreSQL": [
  31394. "PostgreSQL License",
  31395. true,
  31396. false
  31397. ],
  31398. "psfrag": [
  31399. "psfrag License",
  31400. false,
  31401. false
  31402. ],
  31403. "psutils": [
  31404. "psutils License",
  31405. false,
  31406. false
  31407. ],
  31408. "Python-2.0": [
  31409. "Python License 2.0",
  31410. true,
  31411. false
  31412. ],
  31413. "Qhull": [
  31414. "Qhull License",
  31415. false,
  31416. false
  31417. ],
  31418. "QPL-1.0": [
  31419. "Q Public License 1.0",
  31420. true,
  31421. false
  31422. ],
  31423. "Rdisc": [
  31424. "Rdisc License",
  31425. false,
  31426. false
  31427. ],
  31428. "RHeCos-1.1": [
  31429. "Red Hat eCos Public License v1.1",
  31430. false,
  31431. false
  31432. ],
  31433. "RPL-1.1": [
  31434. "Reciprocal Public License 1.1",
  31435. true,
  31436. false
  31437. ],
  31438. "RPL-1.5": [
  31439. "Reciprocal Public License 1.5",
  31440. true,
  31441. false
  31442. ],
  31443. "RPSL-1.0": [
  31444. "RealNetworks Public Source License v1.0",
  31445. true,
  31446. false
  31447. ],
  31448. "RSA-MD": [
  31449. "RSA Message-Digest License",
  31450. false,
  31451. false
  31452. ],
  31453. "RSCPL": [
  31454. "Ricoh Source Code Public License",
  31455. true,
  31456. false
  31457. ],
  31458. "Ruby": [
  31459. "Ruby License",
  31460. false,
  31461. false
  31462. ],
  31463. "SAX-PD": [
  31464. "Sax Public Domain Notice",
  31465. false,
  31466. false
  31467. ],
  31468. "Saxpath": [
  31469. "Saxpath License",
  31470. false,
  31471. false
  31472. ],
  31473. "SCEA": [
  31474. "SCEA Shared Source License",
  31475. false,
  31476. false
  31477. ],
  31478. "Sendmail": [
  31479. "Sendmail License",
  31480. false,
  31481. false
  31482. ],
  31483. "Sendmail-8.23": [
  31484. "Sendmail License 8.23",
  31485. false,
  31486. false
  31487. ],
  31488. "SGI-B-1.0": [
  31489. "SGI Free Software License B v1.0",
  31490. false,
  31491. false
  31492. ],
  31493. "SGI-B-1.1": [
  31494. "SGI Free Software License B v1.1",
  31495. false,
  31496. false
  31497. ],
  31498. "SGI-B-2.0": [
  31499. "SGI Free Software License B v2.0",
  31500. false,
  31501. false
  31502. ],
  31503. "SHL-0.5": [
  31504. "Solderpad Hardware License v0.5",
  31505. false,
  31506. false
  31507. ],
  31508. "SHL-0.51": [
  31509. "Solderpad Hardware License, Version 0.51",
  31510. false,
  31511. false
  31512. ],
  31513. "SimPL-2.0": [
  31514. "Simple Public License 2.0",
  31515. true,
  31516. false
  31517. ],
  31518. "SISSL": [
  31519. "Sun Industry Standards Source License v1.1",
  31520. true,
  31521. false
  31522. ],
  31523. "SISSL-1.2": [
  31524. "Sun Industry Standards Source License v1.2",
  31525. false,
  31526. false
  31527. ],
  31528. "Sleepycat": [
  31529. "Sleepycat License",
  31530. true,
  31531. false
  31532. ],
  31533. "SMLNJ": [
  31534. "Standard ML of New Jersey License",
  31535. false,
  31536. false
  31537. ],
  31538. "SMPPL": [
  31539. "Secure Messaging Protocol Public License",
  31540. false,
  31541. false
  31542. ],
  31543. "SNIA": [
  31544. "SNIA Public License 1.1",
  31545. false,
  31546. false
  31547. ],
  31548. "Spencer-86": [
  31549. "Spencer License 86",
  31550. false,
  31551. false
  31552. ],
  31553. "Spencer-94": [
  31554. "Spencer License 94",
  31555. false,
  31556. false
  31557. ],
  31558. "Spencer-99": [
  31559. "Spencer License 99",
  31560. false,
  31561. false
  31562. ],
  31563. "SPL-1.0": [
  31564. "Sun Public License v1.0",
  31565. true,
  31566. false
  31567. ],
  31568. "SSPL-1.0": [
  31569. "Server Side Public License, v 1",
  31570. false,
  31571. false
  31572. ],
  31573. "StandardML-NJ": [
  31574. "Standard ML of New Jersey License",
  31575. false,
  31576. true
  31577. ],
  31578. "SugarCRM-1.1.3": [
  31579. "SugarCRM Public License v1.1.3",
  31580. false,
  31581. false
  31582. ],
  31583. "SWL": [
  31584. "Scheme Widget Library (SWL) Software License Agreement",
  31585. false,
  31586. false
  31587. ],
  31588. "TAPR-OHL-1.0": [
  31589. "TAPR Open Hardware License v1.0",
  31590. false,
  31591. false
  31592. ],
  31593. "TCL": [
  31594. "TCL/TK License",
  31595. false,
  31596. false
  31597. ],
  31598. "TCP-wrappers": [
  31599. "TCP Wrappers License",
  31600. false,
  31601. false
  31602. ],
  31603. "TMate": [
  31604. "TMate Open Source License",
  31605. false,
  31606. false
  31607. ],
  31608. "TORQUE-1.1": [
  31609. "TORQUE v2.5+ Software License v1.1",
  31610. false,
  31611. false
  31612. ],
  31613. "TOSL": [
  31614. "Trusster Open Source License",
  31615. false,
  31616. false
  31617. ],
  31618. "TU-Berlin-1.0": [
  31619. "Technische Universitaet Berlin License 1.0",
  31620. false,
  31621. false
  31622. ],
  31623. "TU-Berlin-2.0": [
  31624. "Technische Universitaet Berlin License 2.0",
  31625. false,
  31626. false
  31627. ],
  31628. "Unicode-DFS-2015": [
  31629. "Unicode License Agreement - Data Files and Software (2015)",
  31630. false,
  31631. false
  31632. ],
  31633. "Unicode-DFS-2016": [
  31634. "Unicode License Agreement - Data Files and Software (2016)",
  31635. false,
  31636. false
  31637. ],
  31638. "Unicode-TOU": [
  31639. "Unicode Terms of Use",
  31640. false,
  31641. false
  31642. ],
  31643. "Unlicense": [
  31644. "The Unlicense",
  31645. false,
  31646. false
  31647. ],
  31648. "UPL-1.0": [
  31649. "Universal Permissive License v1.0",
  31650. true,
  31651. false
  31652. ],
  31653. "Vim": [
  31654. "Vim License",
  31655. false,
  31656. false
  31657. ],
  31658. "VOSTROM": [
  31659. "VOSTROM Public License for Open Source",
  31660. false,
  31661. false
  31662. ],
  31663. "VSL-1.0": [
  31664. "Vovida Software License v1.0",
  31665. true,
  31666. false
  31667. ],
  31668. "W3C": [
  31669. "W3C Software Notice and License (2002-12-31)",
  31670. true,
  31671. false
  31672. ],
  31673. "W3C-19980720": [
  31674. "W3C Software Notice and License (1998-07-20)",
  31675. false,
  31676. false
  31677. ],
  31678. "W3C-20150513": [
  31679. "W3C Software Notice and Document License (2015-05-13)",
  31680. false,
  31681. false
  31682. ],
  31683. "Watcom-1.0": [
  31684. "Sybase Open Watcom Public License 1.0",
  31685. true,
  31686. false
  31687. ],
  31688. "Wsuipa": [
  31689. "Wsuipa License",
  31690. false,
  31691. false
  31692. ],
  31693. "WTFPL": [
  31694. "Do What The F*ck You Want To Public License",
  31695. false,
  31696. false
  31697. ],
  31698. "wxWindows": [
  31699. "wxWindows Library License",
  31700. false,
  31701. true
  31702. ],
  31703. "X11": [
  31704. "X11 License",
  31705. false,
  31706. false
  31707. ],
  31708. "Xerox": [
  31709. "Xerox License",
  31710. false,
  31711. false
  31712. ],
  31713. "XFree86-1.1": [
  31714. "XFree86 License 1.1",
  31715. false,
  31716. false
  31717. ],
  31718. "xinetd": [
  31719. "xinetd License",
  31720. false,
  31721. false
  31722. ],
  31723. "Xnet": [
  31724. "X.Net License",
  31725. true,
  31726. false
  31727. ],
  31728. "xpp": [
  31729. "XPP License",
  31730. false,
  31731. false
  31732. ],
  31733. "XSkat": [
  31734. "XSkat License",
  31735. false,
  31736. false
  31737. ],
  31738. "YPL-1.0": [
  31739. "Yahoo! Public License v1.0",
  31740. false,
  31741. false
  31742. ],
  31743. "YPL-1.1": [
  31744. "Yahoo! Public License v1.1",
  31745. false,
  31746. false
  31747. ],
  31748. "Zed": [
  31749. "Zed License",
  31750. false,
  31751. false
  31752. ],
  31753. "Zend-2.0": [
  31754. "Zend License v2.0",
  31755. false,
  31756. false
  31757. ],
  31758. "Zimbra-1.3": [
  31759. "Zimbra Public License v1.3",
  31760. false,
  31761. false
  31762. ],
  31763. "Zimbra-1.4": [
  31764. "Zimbra Public License v1.4",
  31765. false,
  31766. false
  31767. ],
  31768. "Zlib": [
  31769. "zlib License",
  31770. true,
  31771. false
  31772. ],
  31773. "zlib-acknowledgement": [
  31774. "zlib/libpng License with Acknowledgement",
  31775. false,
  31776. false
  31777. ],
  31778. "ZPL-1.1": [
  31779. "Zope Public License 1.1",
  31780. false,
  31781. false
  31782. ],
  31783. "ZPL-2.0": [
  31784. "Zope Public License 2.0",
  31785. true,
  31786. false
  31787. ],
  31788. "ZPL-2.1": [
  31789. "Zope Public License 2.1",
  31790. false,
  31791. false
  31792. ]
  31793. }MZ��������ÿÿ��¸�������@�����������������������������������è���º�´ Í!¸LÍ!This program cannot be run in DOS mode.
  31794. $�������Æ,Í;§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��������à�  ��
  31795. ���������8������ ����@����������������������`�����?œ���@�����������������������������"��P����@�� �������������������P��p���!�����������������������������8!��@������������ ��Ø���������������������������.text��� ������
  31796. ����������������� ��`.rdata����� ���
  31797. �����������������@��@.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
  31798. 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
  31799. 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
  31800. 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">
  31801. <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
  31802. <security>
  31803. <requestedPrivileges>
  31804. <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
  31805. </requestedPrivileges>
  31806. </security>
  31807. </trustInfo>
  31808. <dependency>
  31809. <dependentAssembly>
  31810. <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
  31811. </dependentAssembly>
  31812. </dependency>
  31813. </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
  31814. namespace Symfony\Component\Console;
  31815. use Symfony\Component\Console\Command\Command;
  31816. use Symfony\Component\Console\Command\HelpCommand;
  31817. use Symfony\Component\Console\Command\ListCommand;
  31818. use Symfony\Component\Console\Descriptor\TextDescriptor;
  31819. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  31820. use Symfony\Component\Console\Event\ConsoleCommandEvent;
  31821. use Symfony\Component\Console\Event\ConsoleExceptionEvent;
  31822. use Symfony\Component\Console\Event\ConsoleTerminateEvent;
  31823. use Symfony\Component\Console\Exception\CommandNotFoundException;
  31824. use Symfony\Component\Console\Exception\ExceptionInterface;
  31825. use Symfony\Component\Console\Exception\LogicException;
  31826. use Symfony\Component\Console\Formatter\OutputFormatter;
  31827. use Symfony\Component\Console\Helper\DebugFormatterHelper;
  31828. use Symfony\Component\Console\Helper\DialogHelper;
  31829. use Symfony\Component\Console\Helper\FormatterHelper;
  31830. use Symfony\Component\Console\Helper\Helper;
  31831. use Symfony\Component\Console\Helper\HelperSet;
  31832. use Symfony\Component\Console\Helper\ProcessHelper;
  31833. use Symfony\Component\Console\Helper\ProgressHelper;
  31834. use Symfony\Component\Console\Helper\QuestionHelper;
  31835. use Symfony\Component\Console\Helper\TableHelper;
  31836. use Symfony\Component\Console\Input\ArgvInput;
  31837. use Symfony\Component\Console\Input\ArrayInput;
  31838. use Symfony\Component\Console\Input\InputArgument;
  31839. use Symfony\Component\Console\Input\InputAwareInterface;
  31840. use Symfony\Component\Console\Input\InputDefinition;
  31841. use Symfony\Component\Console\Input\InputInterface;
  31842. use Symfony\Component\Console\Input\InputOption;
  31843. use Symfony\Component\Console\Output\BufferedOutput;
  31844. use Symfony\Component\Console\Output\ConsoleOutput;
  31845. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  31846. use Symfony\Component\Console\Output\OutputInterface;
  31847. use Symfony\Component\Debug\Exception\FatalThrowableError;
  31848. use Symfony\Component\EventDispatcher\EventDispatcherInterface;
  31849. class Application
  31850. {
  31851. private $commands = array();
  31852. private $wantHelps = false;
  31853. private $runningCommand;
  31854. private $name;
  31855. private $version;
  31856. private $catchExceptions = true;
  31857. private $autoExit = true;
  31858. private $definition;
  31859. private $helperSet;
  31860. private $dispatcher;
  31861. private $terminalDimensions;
  31862. private $defaultCommand;
  31863. private $initialized;
  31864. public function __construct($name = 'UNKNOWN', $version = 'UNKNOWN')
  31865. {
  31866. $this->name = $name;
  31867. $this->version = $version;
  31868. $this->defaultCommand = 'list';
  31869. }
  31870. public function setDispatcher(EventDispatcherInterface $dispatcher)
  31871. {
  31872. $this->dispatcher = $dispatcher;
  31873. }
  31874. public function run(InputInterface $input = null, OutputInterface $output = null)
  31875. {
  31876. if (null === $input) {
  31877. $input = new ArgvInput();
  31878. }
  31879. if (null === $output) {
  31880. $output = new ConsoleOutput();
  31881. }
  31882. $this->configureIO($input, $output);
  31883. try {
  31884. $e = null;
  31885. $exitCode = $this->doRun($input, $output);
  31886. } catch (\Exception $e) {
  31887. }
  31888. if (null !== $e) {
  31889. if (!$this->catchExceptions) {
  31890. throw $e;
  31891. }
  31892. if ($output instanceof ConsoleOutputInterface) {
  31893. $this->renderException($e, $output->getErrorOutput());
  31894. } else {
  31895. $this->renderException($e, $output);
  31896. }
  31897. $exitCode = $this->getExitCodeForThrowable($e);
  31898. }
  31899. if ($this->autoExit) {
  31900. if ($exitCode > 255) {
  31901. $exitCode = 255;
  31902. }
  31903. exit($exitCode);
  31904. }
  31905. return $exitCode;
  31906. }
  31907. public function doRun(InputInterface $input, OutputInterface $output)
  31908. {
  31909. if (true === $input->hasParameterOption(array('--version', '-V'))) {
  31910. $output->writeln($this->getLongVersion());
  31911. return 0;
  31912. }
  31913. $name = $this->getCommandName($input);
  31914. if (true === $input->hasParameterOption(array('--help', '-h'))) {
  31915. if (!$name) {
  31916. $name = 'help';
  31917. $input = new ArrayInput(array('command' => 'help'));
  31918. } else {
  31919. $this->wantHelps = true;
  31920. }
  31921. }
  31922. if (!$name) {
  31923. $name = $this->defaultCommand;
  31924. $definition = $this->getDefinition();
  31925. $definition->setArguments(array_merge(
  31926. $definition->getArguments(),
  31927. array(
  31928. 'command' => new InputArgument('command', InputArgument::OPTIONAL, $definition->getArgument('command')->getDescription(), $name),
  31929. )
  31930. ));
  31931. }
  31932. $this->runningCommand = null;
  31933. $command = $this->find($name);
  31934. $this->runningCommand = $command;
  31935. $exitCode = $this->doRunCommand($command, $input, $output);
  31936. $this->runningCommand = null;
  31937. return $exitCode;
  31938. }
  31939. public function setHelperSet(HelperSet $helperSet)
  31940. {
  31941. $this->helperSet = $helperSet;
  31942. }
  31943. public function getHelperSet()
  31944. {
  31945. if (!$this->helperSet) {
  31946. $this->helperSet = $this->getDefaultHelperSet();
  31947. }
  31948. return $this->helperSet;
  31949. }
  31950. public function setDefinition(InputDefinition $definition)
  31951. {
  31952. $this->definition = $definition;
  31953. }
  31954. public function getDefinition()
  31955. {
  31956. if (!$this->definition) {
  31957. $this->definition = $this->getDefaultInputDefinition();
  31958. }
  31959. return $this->definition;
  31960. }
  31961. public function getHelp()
  31962. {
  31963. return $this->getLongVersion();
  31964. }
  31965. public function setCatchExceptions($boolean)
  31966. {
  31967. $this->catchExceptions = (bool) $boolean;
  31968. }
  31969. public function setAutoExit($boolean)
  31970. {
  31971. $this->autoExit = (bool) $boolean;
  31972. }
  31973. public function getName()
  31974. {
  31975. return $this->name;
  31976. }
  31977. public function setName($name)
  31978. {
  31979. $this->name = $name;
  31980. }
  31981. public function getVersion()
  31982. {
  31983. return $this->version;
  31984. }
  31985. public function setVersion($version)
  31986. {
  31987. $this->version = $version;
  31988. }
  31989. public function getLongVersion()
  31990. {
  31991. if ('UNKNOWN' !== $this->getName()) {
  31992. if ('UNKNOWN' !== $this->getVersion()) {
  31993. return sprintf('<info>%s</info> version <comment>%s</comment>', $this->getName(), $this->getVersion());
  31994. }
  31995. return sprintf('<info>%s</info>', $this->getName());
  31996. }
  31997. return '<info>Console Tool</info>';
  31998. }
  31999. public function register($name)
  32000. {
  32001. return $this->add(new Command($name));
  32002. }
  32003. public function addCommands(array $commands)
  32004. {
  32005. foreach ($commands as $command) {
  32006. $this->add($command);
  32007. }
  32008. }
  32009. public function add(Command $command)
  32010. {
  32011. $this->init();
  32012. $command->setApplication($this);
  32013. if (!$command->isEnabled()) {
  32014. $command->setApplication(null);
  32015. return;
  32016. }
  32017. if (null === $command->getDefinition()) {
  32018. throw new LogicException(sprintf('Command class "%s" is not correctly initialized. You probably forgot to call the parent constructor.', \get_class($command)));
  32019. }
  32020. $this->commands[$command->getName()] = $command;
  32021. foreach ($command->getAliases() as $alias) {
  32022. $this->commands[$alias] = $command;
  32023. }
  32024. return $command;
  32025. }
  32026. public function get($name)
  32027. {
  32028. $this->init();
  32029. if (!isset($this->commands[$name])) {
  32030. throw new CommandNotFoundException(sprintf('The command "%s" does not exist.', $name));
  32031. }
  32032. $command = $this->commands[$name];
  32033. if ($this->wantHelps) {
  32034. $this->wantHelps = false;
  32035. $helpCommand = $this->get('help');
  32036. $helpCommand->setCommand($command);
  32037. return $helpCommand;
  32038. }
  32039. return $command;
  32040. }
  32041. public function has($name)
  32042. {
  32043. $this->init();
  32044. return isset($this->commands[$name]);
  32045. }
  32046. public function getNamespaces()
  32047. {
  32048. $namespaces = array();
  32049. foreach ($this->all() as $command) {
  32050. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($command->getName()));
  32051. foreach ($command->getAliases() as $alias) {
  32052. $namespaces = array_merge($namespaces, $this->extractAllNamespaces($alias));
  32053. }
  32054. }
  32055. return array_values(array_unique(array_filter($namespaces)));
  32056. }
  32057. public function findNamespace($namespace)
  32058. {
  32059. $allNamespaces = $this->getNamespaces();
  32060. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $namespace);
  32061. $namespaces = preg_grep('{^'.$expr.'}', $allNamespaces);
  32062. if (empty($namespaces)) {
  32063. $message = sprintf('There are no commands defined in the "%s" namespace.', $namespace);
  32064. if ($alternatives = $this->findAlternatives($namespace, $allNamespaces)) {
  32065. if (1 == \count($alternatives)) {
  32066. $message .= "\n\nDid you mean this?\n ";
  32067. } else {
  32068. $message .= "\n\nDid you mean one of these?\n ";
  32069. }
  32070. $message .= implode("\n ", $alternatives);
  32071. }
  32072. throw new CommandNotFoundException($message, $alternatives);
  32073. }
  32074. $exact = \in_array($namespace, $namespaces, true);
  32075. if (\count($namespaces) > 1 && !$exact) {
  32076. throw new CommandNotFoundException(sprintf('The namespace "%s" is ambiguous (%s).', $namespace, $this->getAbbreviationSuggestions(array_values($namespaces))), array_values($namespaces));
  32077. }
  32078. return $exact ? $namespace : reset($namespaces);
  32079. }
  32080. public function find($name)
  32081. {
  32082. $this->init();
  32083. $aliases = array();
  32084. $allCommands = array_keys($this->commands);
  32085. $expr = preg_replace_callback('{([^:]+|)}', function ($matches) { return preg_quote($matches[1]).'[^:]*'; }, $name);
  32086. $commands = preg_grep('{^'.$expr.'}', $allCommands);
  32087. if (empty($commands) || \count(preg_grep('{^'.$expr.'$}', $commands)) < 1) {
  32088. if (false !== $pos = strrpos($name, ':')) {
  32089. $this->findNamespace(substr($name, 0, $pos));
  32090. }
  32091. $message = sprintf('Command "%s" is not defined.', $name);
  32092. if ($alternatives = $this->findAlternatives($name, $allCommands)) {
  32093. if (1 == \count($alternatives)) {
  32094. $message .= "\n\nDid you mean this?\n ";
  32095. } else {
  32096. $message .= "\n\nDid you mean one of these?\n ";
  32097. }
  32098. $message .= implode("\n ", $alternatives);
  32099. }
  32100. throw new CommandNotFoundException($message, $alternatives);
  32101. }
  32102. if (\count($commands) > 1) {
  32103. $commandList = $this->commands;
  32104. $commands = array_filter($commands, function ($nameOrAlias) use ($commandList, $commands, &$aliases) {
  32105. $commandName = $commandList[$nameOrAlias]->getName();
  32106. $aliases[$nameOrAlias] = $commandName;
  32107. return $commandName === $nameOrAlias || !\in_array($commandName, $commands);
  32108. });
  32109. }
  32110. $exact = \in_array($name, $commands, true) || isset($aliases[$name]);
  32111. if (!$exact && \count($commands) > 1) {
  32112. $suggestions = $this->getAbbreviationSuggestions(array_values($commands));
  32113. throw new CommandNotFoundException(sprintf('Command "%s" is ambiguous (%s).', $name, $suggestions), array_values($commands));
  32114. }
  32115. return $this->get($exact ? $name : reset($commands));
  32116. }
  32117. public function all($namespace = null)
  32118. {
  32119. $this->init();
  32120. if (null === $namespace) {
  32121. return $this->commands;
  32122. }
  32123. $commands = array();
  32124. foreach ($this->commands as $name => $command) {
  32125. if ($namespace === $this->extractNamespace($name, substr_count($namespace, ':') + 1)) {
  32126. $commands[$name] = $command;
  32127. }
  32128. }
  32129. return $commands;
  32130. }
  32131. public static function getAbbreviations($names)
  32132. {
  32133. $abbrevs = array();
  32134. foreach ($names as $name) {
  32135. for ($len = \strlen($name); $len > 0; --$len) {
  32136. $abbrev = substr($name, 0, $len);
  32137. $abbrevs[$abbrev][] = $name;
  32138. }
  32139. }
  32140. return $abbrevs;
  32141. }
  32142. public function asText($namespace = null, $raw = false)
  32143. {
  32144. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32145. $descriptor = new TextDescriptor();
  32146. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, !$raw);
  32147. $descriptor->describe($output, $this, array('namespace' => $namespace, 'raw_output' => true));
  32148. return $output->fetch();
  32149. }
  32150. public function asXml($namespace = null, $asDom = false)
  32151. {
  32152. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32153. $descriptor = new XmlDescriptor();
  32154. if ($asDom) {
  32155. return $descriptor->getApplicationDocument($this, $namespace);
  32156. }
  32157. $output = new BufferedOutput();
  32158. $descriptor->describe($output, $this, array('namespace' => $namespace));
  32159. return $output->fetch();
  32160. }
  32161. public function renderException($e, $output)
  32162. {
  32163. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32164. do {
  32165. $title = sprintf(' [%s] ', \get_class($e));
  32166. $len = Helper::strlen($title);
  32167. $width = $this->getTerminalWidth() ? $this->getTerminalWidth() - 1 : PHP_INT_MAX;
  32168. if (\defined('HHVM_VERSION') && $width > 1 << 31) {
  32169. $width = 1 << 31;
  32170. }
  32171. $lines = array();
  32172. foreach (preg_split('/\r?\n/', trim($e->getMessage())) as $line) {
  32173. foreach ($this->splitStringByWidth($line, $width - 4) as $line) {
  32174. $lineLength = Helper::strlen($line) + 4;
  32175. $lines[] = array($line, $lineLength);
  32176. $len = max($lineLength, $len);
  32177. }
  32178. }
  32179. $messages = array();
  32180. $messages[] = $emptyLine = sprintf('<error>%s</error>', str_repeat(' ', $len));
  32181. $messages[] = sprintf('<error>%s%s</error>', $title, str_repeat(' ', max(0, $len - Helper::strlen($title))));
  32182. foreach ($lines as $line) {
  32183. $messages[] = sprintf('<error> %s %s</error>', OutputFormatter::escape($line[0]), str_repeat(' ', $len - $line[1]));
  32184. }
  32185. $messages[] = $emptyLine;
  32186. $messages[] = '';
  32187. $output->writeln($messages, OutputInterface::VERBOSITY_QUIET);
  32188. if (OutputInterface::VERBOSITY_VERBOSE <= $output->getVerbosity()) {
  32189. $output->writeln('<comment>Exception trace:</comment>', OutputInterface::VERBOSITY_QUIET);
  32190. $trace = $e->getTrace();
  32191. array_unshift($trace, array(
  32192. 'function' => '',
  32193. 'file' => null !== $e->getFile() ? $e->getFile() : 'n/a',
  32194. 'line' => null !== $e->getLine() ? $e->getLine() : 'n/a',
  32195. 'args' => array(),
  32196. ));
  32197. for ($i = 0, $count = \count($trace); $i < $count; ++$i) {
  32198. $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
  32199. $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
  32200. $function = $trace[$i]['function'];
  32201. $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
  32202. $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
  32203. $output->writeln(sprintf(' %s%s%s() at <info>%s:%s</info>', $class, $type, $function, $file, $line), OutputInterface::VERBOSITY_QUIET);
  32204. }
  32205. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32206. }
  32207. } while ($e = $e->getPrevious());
  32208. if (null !== $this->runningCommand) {
  32209. $output->writeln(sprintf('<info>%s</info>', sprintf($this->runningCommand->getSynopsis(), $this->getName())), OutputInterface::VERBOSITY_QUIET);
  32210. $output->writeln('', OutputInterface::VERBOSITY_QUIET);
  32211. }
  32212. }
  32213. protected function getTerminalWidth()
  32214. {
  32215. $dimensions = $this->getTerminalDimensions();
  32216. return $dimensions[0];
  32217. }
  32218. protected function getTerminalHeight()
  32219. {
  32220. $dimensions = $this->getTerminalDimensions();
  32221. return $dimensions[1];
  32222. }
  32223. public function getTerminalDimensions()
  32224. {
  32225. if ($this->terminalDimensions) {
  32226. return $this->terminalDimensions;
  32227. }
  32228. if ('\\' === \DIRECTORY_SEPARATOR) {
  32229. if (preg_match('/^(\d+)x\d+ \(\d+x(\d+)\)$/', trim(getenv('ANSICON')), $matches)) {
  32230. return array((int) $matches[1], (int) $matches[2]);
  32231. }
  32232. if (preg_match('/^(\d+)x(\d+)$/', $this->getConsoleMode(), $matches)) {
  32233. return array((int) $matches[1], (int) $matches[2]);
  32234. }
  32235. }
  32236. if ($sttyString = $this->getSttyColumns()) {
  32237. if (preg_match('/rows.(\d+);.columns.(\d+);/i', $sttyString, $matches)) {
  32238. return array((int) $matches[2], (int) $matches[1]);
  32239. }
  32240. if (preg_match('/;.(\d+).rows;.(\d+).columns/i', $sttyString, $matches)) {
  32241. return array((int) $matches[2], (int) $matches[1]);
  32242. }
  32243. }
  32244. return array(null, null);
  32245. }
  32246. public function setTerminalDimensions($width, $height)
  32247. {
  32248. $this->terminalDimensions = array($width, $height);
  32249. return $this;
  32250. }
  32251. protected function configureIO(InputInterface $input, OutputInterface $output)
  32252. {
  32253. if (true === $input->hasParameterOption(array('--ansi'))) {
  32254. $output->setDecorated(true);
  32255. } elseif (true === $input->hasParameterOption(array('--no-ansi'))) {
  32256. $output->setDecorated(false);
  32257. }
  32258. if (true === $input->hasParameterOption(array('--no-interaction', '-n'))) {
  32259. $input->setInteractive(false);
  32260. } elseif (\function_exists('posix_isatty') && $this->getHelperSet()->has('question')) {
  32261. $inputStream = $this->getHelperSet()->get('question')->getInputStream();
  32262. if (!@posix_isatty($inputStream) && false === getenv('SHELL_INTERACTIVE')) {
  32263. $input->setInteractive(false);
  32264. }
  32265. }
  32266. if (true === $input->hasParameterOption(array('--quiet', '-q'))) {
  32267. $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
  32268. $input->setInteractive(false);
  32269. } else {
  32270. if ($input->hasParameterOption('-vvv') || $input->hasParameterOption('--verbose=3') || 3 === $input->getParameterOption('--verbose')) {
  32271. $output->setVerbosity(OutputInterface::VERBOSITY_DEBUG);
  32272. } elseif ($input->hasParameterOption('-vv') || $input->hasParameterOption('--verbose=2') || 2 === $input->getParameterOption('--verbose')) {
  32273. $output->setVerbosity(OutputInterface::VERBOSITY_VERY_VERBOSE);
  32274. } elseif ($input->hasParameterOption('-v') || $input->hasParameterOption('--verbose=1') || $input->hasParameterOption('--verbose') || $input->getParameterOption('--verbose')) {
  32275. $output->setVerbosity(OutputInterface::VERBOSITY_VERBOSE);
  32276. }
  32277. }
  32278. }
  32279. protected function doRunCommand(Command $command, InputInterface $input, OutputInterface $output)
  32280. {
  32281. foreach ($command->getHelperSet() as $helper) {
  32282. if ($helper instanceof InputAwareInterface) {
  32283. $helper->setInput($input);
  32284. }
  32285. }
  32286. if (null === $this->dispatcher) {
  32287. return $command->run($input, $output);
  32288. }
  32289. try {
  32290. $command->mergeApplicationDefinition();
  32291. $input->bind($command->getDefinition());
  32292. } catch (ExceptionInterface $e) {
  32293. }
  32294. $event = new ConsoleCommandEvent($command, $input, $output);
  32295. $e = null;
  32296. try {
  32297. $this->dispatcher->dispatch(ConsoleEvents::COMMAND, $event);
  32298. if ($event->commandShouldRun()) {
  32299. $exitCode = $command->run($input, $output);
  32300. } else {
  32301. $exitCode = ConsoleCommandEvent::RETURN_CODE_DISABLED;
  32302. }
  32303. } catch (\Exception $e) {
  32304. } catch (\Throwable $e) {
  32305. }
  32306. if (null !== $e) {
  32307. $x = $e instanceof \Exception ? $e : new FatalThrowableError($e);
  32308. $event = new ConsoleExceptionEvent($command, $input, $output, $x, $x->getCode());
  32309. $this->dispatcher->dispatch(ConsoleEvents::EXCEPTION, $event);
  32310. if ($x !== $event->getException()) {
  32311. $e = $event->getException();
  32312. }
  32313. $exitCode = $this->getExitCodeForThrowable($e);
  32314. }
  32315. $event = new ConsoleTerminateEvent($command, $input, $output, $exitCode);
  32316. $this->dispatcher->dispatch(ConsoleEvents::TERMINATE, $event);
  32317. if (null !== $e) {
  32318. throw $e;
  32319. }
  32320. return $event->getExitCode();
  32321. }
  32322. protected function getCommandName(InputInterface $input)
  32323. {
  32324. return $input->getFirstArgument();
  32325. }
  32326. protected function getDefaultInputDefinition()
  32327. {
  32328. return new InputDefinition(array(
  32329. new InputArgument('command', InputArgument::REQUIRED, 'The command to execute'),
  32330. new InputOption('--help', '-h', InputOption::VALUE_NONE, 'Display this help message'),
  32331. new InputOption('--quiet', '-q', InputOption::VALUE_NONE, 'Do not output any message'),
  32332. 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'),
  32333. new InputOption('--version', '-V', InputOption::VALUE_NONE, 'Display this application version'),
  32334. new InputOption('--ansi', '', InputOption::VALUE_NONE, 'Force ANSI output'),
  32335. new InputOption('--no-ansi', '', InputOption::VALUE_NONE, 'Disable ANSI output'),
  32336. new InputOption('--no-interaction', '-n', InputOption::VALUE_NONE, 'Do not ask any interactive question'),
  32337. ));
  32338. }
  32339. protected function getDefaultCommands()
  32340. {
  32341. return array(new HelpCommand(), new ListCommand());
  32342. }
  32343. protected function getDefaultHelperSet()
  32344. {
  32345. return new HelperSet(array(
  32346. new FormatterHelper(),
  32347. new DialogHelper(false),
  32348. new ProgressHelper(false),
  32349. new TableHelper(false),
  32350. new DebugFormatterHelper(),
  32351. new ProcessHelper(),
  32352. new QuestionHelper(),
  32353. ));
  32354. }
  32355. private function getSttyColumns()
  32356. {
  32357. if (!\function_exists('proc_open')) {
  32358. return;
  32359. }
  32360. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32361. $process = proc_open('stty -a | grep columns', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32362. if (\is_resource($process)) {
  32363. $info = stream_get_contents($pipes[1]);
  32364. fclose($pipes[1]);
  32365. fclose($pipes[2]);
  32366. proc_close($process);
  32367. return $info;
  32368. }
  32369. }
  32370. private function getConsoleMode()
  32371. {
  32372. if (!\function_exists('proc_open')) {
  32373. return;
  32374. }
  32375. $descriptorspec = array(1 => array('pipe', 'w'), 2 => array('pipe', 'w'));
  32376. $process = proc_open('mode CON', $descriptorspec, $pipes, null, null, array('suppress_errors' => true));
  32377. if (\is_resource($process)) {
  32378. $info = stream_get_contents($pipes[1]);
  32379. fclose($pipes[1]);
  32380. fclose($pipes[2]);
  32381. proc_close($process);
  32382. if (preg_match('/--------+\r?\n.+?(\d+)\r?\n.+?(\d+)\r?\n/', $info, $matches)) {
  32383. return $matches[2].'x'.$matches[1];
  32384. }
  32385. }
  32386. }
  32387. private function getAbbreviationSuggestions($abbrevs)
  32388. {
  32389. return sprintf('%s, %s%s', $abbrevs[0], $abbrevs[1], \count($abbrevs) > 2 ? sprintf(' and %d more', \count($abbrevs) - 2) : '');
  32390. }
  32391. public function extractNamespace($name, $limit = null)
  32392. {
  32393. $parts = explode(':', $name);
  32394. array_pop($parts);
  32395. return implode(':', null === $limit ? $parts : \array_slice($parts, 0, $limit));
  32396. }
  32397. private function findAlternatives($name, $collection)
  32398. {
  32399. $threshold = 1e3;
  32400. $alternatives = array();
  32401. $collectionParts = array();
  32402. foreach ($collection as $item) {
  32403. $collectionParts[$item] = explode(':', $item);
  32404. }
  32405. foreach (explode(':', $name) as $i => $subname) {
  32406. foreach ($collectionParts as $collectionName => $parts) {
  32407. $exists = isset($alternatives[$collectionName]);
  32408. if (!isset($parts[$i]) && $exists) {
  32409. $alternatives[$collectionName] += $threshold;
  32410. continue;
  32411. } elseif (!isset($parts[$i])) {
  32412. continue;
  32413. }
  32414. $lev = levenshtein($subname, $parts[$i]);
  32415. if ($lev <= \strlen($subname) / 3 || '' !== $subname && false !== strpos($parts[$i], $subname)) {
  32416. $alternatives[$collectionName] = $exists ? $alternatives[$collectionName] + $lev : $lev;
  32417. } elseif ($exists) {
  32418. $alternatives[$collectionName] += $threshold;
  32419. }
  32420. }
  32421. }
  32422. foreach ($collection as $item) {
  32423. $lev = levenshtein($name, $item);
  32424. if ($lev <= \strlen($name) / 3 || false !== strpos($item, $name)) {
  32425. $alternatives[$item] = isset($alternatives[$item]) ? $alternatives[$item] - $lev : $lev;
  32426. }
  32427. }
  32428. $alternatives = array_filter($alternatives, function ($lev) use ($threshold) { return $lev < 2 * $threshold; });
  32429. asort($alternatives);
  32430. return array_keys($alternatives);
  32431. }
  32432. public function setDefaultCommand($commandName)
  32433. {
  32434. $this->defaultCommand = $commandName;
  32435. }
  32436. private function splitStringByWidth($string, $width)
  32437. {
  32438. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  32439. return str_split($string, $width);
  32440. }
  32441. $utf8String = mb_convert_encoding($string, 'utf8', $encoding);
  32442. $lines = array();
  32443. $line = '';
  32444. foreach (preg_split('//u', $utf8String) as $char) {
  32445. if (mb_strwidth($line.$char, 'utf8') <= $width) {
  32446. $line .= $char;
  32447. continue;
  32448. }
  32449. $lines[] = str_pad($line, $width);
  32450. $line = $char;
  32451. }
  32452. $lines[] = \count($lines) ? str_pad($line, $width) : $line;
  32453. mb_convert_variables($encoding, 'utf8', $lines);
  32454. return $lines;
  32455. }
  32456. private function extractAllNamespaces($name)
  32457. {
  32458. $parts = explode(':', $name, -1);
  32459. $namespaces = array();
  32460. foreach ($parts as $part) {
  32461. if (\count($namespaces)) {
  32462. $namespaces[] = end($namespaces).':'.$part;
  32463. } else {
  32464. $namespaces[] = $part;
  32465. }
  32466. }
  32467. return $namespaces;
  32468. }
  32469. private function init()
  32470. {
  32471. if ($this->initialized) {
  32472. return;
  32473. }
  32474. $this->initialized = true;
  32475. foreach ($this->getDefaultCommands() as $command) {
  32476. $this->add($command);
  32477. }
  32478. }
  32479. private function getExitCodeForThrowable($throwable)
  32480. {
  32481. $exitCode = $throwable->getCode();
  32482. if (is_numeric($exitCode)) {
  32483. $exitCode = (int) $exitCode;
  32484. if (0 === $exitCode) {
  32485. $exitCode = 1;
  32486. }
  32487. } else {
  32488. $exitCode = 1;
  32489. }
  32490. return $exitCode;
  32491. }
  32492. }
  32493. <?php
  32494. namespace Symfony\Component\Console\Command;
  32495. use Symfony\Component\Console\Application;
  32496. use Symfony\Component\Console\Descriptor\TextDescriptor;
  32497. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  32498. use Symfony\Component\Console\Exception\ExceptionInterface;
  32499. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32500. use Symfony\Component\Console\Exception\LogicException;
  32501. use Symfony\Component\Console\Helper\HelperSet;
  32502. use Symfony\Component\Console\Input\InputArgument;
  32503. use Symfony\Component\Console\Input\InputDefinition;
  32504. use Symfony\Component\Console\Input\InputInterface;
  32505. use Symfony\Component\Console\Input\InputOption;
  32506. use Symfony\Component\Console\Output\BufferedOutput;
  32507. use Symfony\Component\Console\Output\OutputInterface;
  32508. class Command
  32509. {
  32510. private $application;
  32511. private $name;
  32512. private $processTitle;
  32513. private $aliases = array();
  32514. private $definition;
  32515. private $help;
  32516. private $description;
  32517. private $ignoreValidationErrors = false;
  32518. private $applicationDefinitionMerged = false;
  32519. private $applicationDefinitionMergedWithArgs = false;
  32520. private $code;
  32521. private $synopsis = array();
  32522. private $usages = array();
  32523. private $helperSet;
  32524. public function __construct($name = null)
  32525. {
  32526. $this->definition = new InputDefinition();
  32527. if (null !== $name) {
  32528. $this->setName($name);
  32529. }
  32530. $this->configure();
  32531. if (!$this->name) {
  32532. throw new LogicException(sprintf('The command defined in "%s" cannot have an empty name.', \get_class($this)));
  32533. }
  32534. }
  32535. public function ignoreValidationErrors()
  32536. {
  32537. $this->ignoreValidationErrors = true;
  32538. }
  32539. public function setApplication(Application $application = null)
  32540. {
  32541. $this->application = $application;
  32542. if ($application) {
  32543. $this->setHelperSet($application->getHelperSet());
  32544. } else {
  32545. $this->helperSet = null;
  32546. }
  32547. }
  32548. public function setHelperSet(HelperSet $helperSet)
  32549. {
  32550. $this->helperSet = $helperSet;
  32551. }
  32552. public function getHelperSet()
  32553. {
  32554. return $this->helperSet;
  32555. }
  32556. public function getApplication()
  32557. {
  32558. return $this->application;
  32559. }
  32560. public function isEnabled()
  32561. {
  32562. return true;
  32563. }
  32564. protected function configure()
  32565. {
  32566. }
  32567. protected function execute(InputInterface $input, OutputInterface $output)
  32568. {
  32569. throw new LogicException('You must override the execute() method in the concrete command class.');
  32570. }
  32571. protected function interact(InputInterface $input, OutputInterface $output)
  32572. {
  32573. }
  32574. protected function initialize(InputInterface $input, OutputInterface $output)
  32575. {
  32576. }
  32577. public function run(InputInterface $input, OutputInterface $output)
  32578. {
  32579. $this->getSynopsis(true);
  32580. $this->getSynopsis(false);
  32581. $this->mergeApplicationDefinition();
  32582. try {
  32583. $input->bind($this->definition);
  32584. } catch (ExceptionInterface $e) {
  32585. if (!$this->ignoreValidationErrors) {
  32586. throw $e;
  32587. }
  32588. }
  32589. $this->initialize($input, $output);
  32590. if (null !== $this->processTitle) {
  32591. if (\function_exists('cli_set_process_title')) {
  32592. if (!@cli_set_process_title($this->processTitle)) {
  32593. if ('Darwin' === PHP_OS) {
  32594. $output->writeln('<comment>Running "cli_set_process_title" as an unprivileged user is not supported on MacOS.</comment>', OutputInterface::VERBOSITY_VERY_VERBOSE);
  32595. } else {
  32596. cli_set_process_title($this->processTitle);
  32597. }
  32598. }
  32599. } elseif (\function_exists('setproctitle')) {
  32600. setproctitle($this->processTitle);
  32601. } elseif (OutputInterface::VERBOSITY_VERY_VERBOSE === $output->getVerbosity()) {
  32602. $output->writeln('<comment>Install the proctitle PECL to be able to change the process title.</comment>');
  32603. }
  32604. }
  32605. if ($input->isInteractive()) {
  32606. $this->interact($input, $output);
  32607. }
  32608. if ($input->hasArgument('command') && null === $input->getArgument('command')) {
  32609. $input->setArgument('command', $this->getName());
  32610. }
  32611. $input->validate();
  32612. if ($this->code) {
  32613. $statusCode = \call_user_func($this->code, $input, $output);
  32614. } else {
  32615. $statusCode = $this->execute($input, $output);
  32616. }
  32617. return is_numeric($statusCode) ? (int) $statusCode : 0;
  32618. }
  32619. public function setCode($code)
  32620. {
  32621. if (!\is_callable($code)) {
  32622. throw new InvalidArgumentException('Invalid callable provided to Command::setCode.');
  32623. }
  32624. if (\PHP_VERSION_ID >= 50400 && $code instanceof \Closure) {
  32625. $r = new \ReflectionFunction($code);
  32626. if (null === $r->getClosureThis()) {
  32627. if (\PHP_VERSION_ID < 70000) {
  32628. $code = @\Closure::bind($code, $this);
  32629. } else {
  32630. $code = \Closure::bind($code, $this);
  32631. }
  32632. }
  32633. }
  32634. $this->code = $code;
  32635. return $this;
  32636. }
  32637. public function mergeApplicationDefinition($mergeArgs = true)
  32638. {
  32639. if (null === $this->application || (true === $this->applicationDefinitionMerged && ($this->applicationDefinitionMergedWithArgs || !$mergeArgs))) {
  32640. return;
  32641. }
  32642. $this->definition->addOptions($this->application->getDefinition()->getOptions());
  32643. $this->applicationDefinitionMerged = true;
  32644. if ($mergeArgs) {
  32645. $currentArguments = $this->definition->getArguments();
  32646. $this->definition->setArguments($this->application->getDefinition()->getArguments());
  32647. $this->definition->addArguments($currentArguments);
  32648. $this->applicationDefinitionMergedWithArgs = true;
  32649. }
  32650. }
  32651. public function setDefinition($definition)
  32652. {
  32653. if ($definition instanceof InputDefinition) {
  32654. $this->definition = $definition;
  32655. } else {
  32656. $this->definition->setDefinition($definition);
  32657. }
  32658. $this->applicationDefinitionMerged = false;
  32659. return $this;
  32660. }
  32661. public function getDefinition()
  32662. {
  32663. return $this->definition;
  32664. }
  32665. public function getNativeDefinition()
  32666. {
  32667. return $this->getDefinition();
  32668. }
  32669. public function addArgument($name, $mode = null, $description = '', $default = null)
  32670. {
  32671. $this->definition->addArgument(new InputArgument($name, $mode, $description, $default));
  32672. return $this;
  32673. }
  32674. public function addOption($name, $shortcut = null, $mode = null, $description = '', $default = null)
  32675. {
  32676. $this->definition->addOption(new InputOption($name, $shortcut, $mode, $description, $default));
  32677. return $this;
  32678. }
  32679. public function setName($name)
  32680. {
  32681. $this->validateName($name);
  32682. $this->name = $name;
  32683. return $this;
  32684. }
  32685. public function setProcessTitle($title)
  32686. {
  32687. $this->processTitle = $title;
  32688. return $this;
  32689. }
  32690. public function getName()
  32691. {
  32692. return $this->name;
  32693. }
  32694. public function setDescription($description)
  32695. {
  32696. $this->description = $description;
  32697. return $this;
  32698. }
  32699. public function getDescription()
  32700. {
  32701. return $this->description;
  32702. }
  32703. public function setHelp($help)
  32704. {
  32705. $this->help = $help;
  32706. return $this;
  32707. }
  32708. public function getHelp()
  32709. {
  32710. return $this->help;
  32711. }
  32712. public function getProcessedHelp()
  32713. {
  32714. $name = $this->name;
  32715. $placeholders = array(
  32716. '%command.name%',
  32717. '%command.full_name%',
  32718. );
  32719. $replacements = array(
  32720. $name,
  32721. $_SERVER['PHP_SELF'].' '.$name,
  32722. );
  32723. return str_replace($placeholders, $replacements, $this->getHelp() ?: $this->getDescription());
  32724. }
  32725. public function setAliases($aliases)
  32726. {
  32727. if (!\is_array($aliases) && !$aliases instanceof \Traversable) {
  32728. throw new InvalidArgumentException('$aliases must be an array or an instance of \Traversable');
  32729. }
  32730. foreach ($aliases as $alias) {
  32731. $this->validateName($alias);
  32732. }
  32733. $this->aliases = $aliases;
  32734. return $this;
  32735. }
  32736. public function getAliases()
  32737. {
  32738. return $this->aliases;
  32739. }
  32740. public function getSynopsis($short = false)
  32741. {
  32742. $key = $short ? 'short' : 'long';
  32743. if (!isset($this->synopsis[$key])) {
  32744. $this->synopsis[$key] = trim(sprintf('%s %s', $this->name, $this->definition->getSynopsis($short)));
  32745. }
  32746. return $this->synopsis[$key];
  32747. }
  32748. public function addUsage($usage)
  32749. {
  32750. if (0 !== strpos($usage, $this->name)) {
  32751. $usage = sprintf('%s %s', $this->name, $usage);
  32752. }
  32753. $this->usages[] = $usage;
  32754. return $this;
  32755. }
  32756. public function getUsages()
  32757. {
  32758. return $this->usages;
  32759. }
  32760. public function getHelper($name)
  32761. {
  32762. if (null === $this->helperSet) {
  32763. 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));
  32764. }
  32765. return $this->helperSet->get($name);
  32766. }
  32767. public function asText()
  32768. {
  32769. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32770. $descriptor = new TextDescriptor();
  32771. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  32772. $descriptor->describe($output, $this, array('raw_output' => true));
  32773. return $output->fetch();
  32774. }
  32775. public function asXml($asDom = false)
  32776. {
  32777. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  32778. $descriptor = new XmlDescriptor();
  32779. if ($asDom) {
  32780. return $descriptor->getCommandDocument($this);
  32781. }
  32782. $output = new BufferedOutput();
  32783. $descriptor->describe($output, $this);
  32784. return $output->fetch();
  32785. }
  32786. private function validateName($name)
  32787. {
  32788. if (!preg_match('/^[^\:]++(\:[^\:]++)*$/', $name)) {
  32789. throw new InvalidArgumentException(sprintf('Command name "%s" is invalid.', $name));
  32790. }
  32791. }
  32792. }
  32793. <?php
  32794. namespace Symfony\Component\Console\Command;
  32795. use Symfony\Component\Console\Helper\DescriptorHelper;
  32796. use Symfony\Component\Console\Input\InputArgument;
  32797. use Symfony\Component\Console\Input\InputInterface;
  32798. use Symfony\Component\Console\Input\InputOption;
  32799. use Symfony\Component\Console\Output\OutputInterface;
  32800. class HelpCommand extends Command
  32801. {
  32802. private $command;
  32803. protected function configure()
  32804. {
  32805. $this->ignoreValidationErrors();
  32806. $this
  32807. ->setName('help')
  32808. ->setDefinition(array(
  32809. new InputArgument('command_name', InputArgument::OPTIONAL, 'The command name', 'help'),
  32810. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output help as XML'),
  32811. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32812. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command help'),
  32813. ))
  32814. ->setDescription('Displays help for a command')
  32815. ->setHelp(<<<'EOF'
  32816. The <info>%command.name%</info> command displays help for a given command:
  32817. <info>php %command.full_name% list</info>
  32818. You can also output the help in other formats by using the <comment>--format</comment> option:
  32819. <info>php %command.full_name% --format=xml list</info>
  32820. To display the list of available commands, please use the <info>list</info> command.
  32821. EOF
  32822. )
  32823. ;
  32824. }
  32825. public function setCommand(Command $command)
  32826. {
  32827. $this->command = $command;
  32828. }
  32829. protected function execute(InputInterface $input, OutputInterface $output)
  32830. {
  32831. if (null === $this->command) {
  32832. $this->command = $this->getApplication()->find($input->getArgument('command_name'));
  32833. }
  32834. if ($input->getOption('xml')) {
  32835. @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);
  32836. $input->setOption('format', 'xml');
  32837. }
  32838. $helper = new DescriptorHelper();
  32839. $helper->describe($output, $this->command, array(
  32840. 'format' => $input->getOption('format'),
  32841. 'raw_text' => $input->getOption('raw'),
  32842. ));
  32843. $this->command = null;
  32844. }
  32845. }
  32846. <?php
  32847. namespace Symfony\Component\Console\Command;
  32848. use Symfony\Component\Console\Helper\DescriptorHelper;
  32849. use Symfony\Component\Console\Input\InputArgument;
  32850. use Symfony\Component\Console\Input\InputDefinition;
  32851. use Symfony\Component\Console\Input\InputInterface;
  32852. use Symfony\Component\Console\Input\InputOption;
  32853. use Symfony\Component\Console\Output\OutputInterface;
  32854. class ListCommand extends Command
  32855. {
  32856. protected function configure()
  32857. {
  32858. $this
  32859. ->setName('list')
  32860. ->setDefinition($this->createDefinition())
  32861. ->setDescription('Lists commands')
  32862. ->setHelp(<<<'EOF'
  32863. The <info>%command.name%</info> command lists all commands:
  32864. <info>php %command.full_name%</info>
  32865. You can also display the commands for a specific namespace:
  32866. <info>php %command.full_name% test</info>
  32867. You can also output the information in other formats by using the <comment>--format</comment> option:
  32868. <info>php %command.full_name% --format=xml</info>
  32869. It's also possible to get raw list of commands (useful for embedding command runner):
  32870. <info>php %command.full_name% --raw</info>
  32871. EOF
  32872. )
  32873. ;
  32874. }
  32875. public function getNativeDefinition()
  32876. {
  32877. return $this->createDefinition();
  32878. }
  32879. protected function execute(InputInterface $input, OutputInterface $output)
  32880. {
  32881. if ($input->getOption('xml')) {
  32882. @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);
  32883. $input->setOption('format', 'xml');
  32884. }
  32885. $helper = new DescriptorHelper();
  32886. $helper->describe($output, $this->getApplication(), array(
  32887. 'format' => $input->getOption('format'),
  32888. 'raw_text' => $input->getOption('raw'),
  32889. 'namespace' => $input->getArgument('namespace'),
  32890. ));
  32891. }
  32892. private function createDefinition()
  32893. {
  32894. return new InputDefinition(array(
  32895. new InputArgument('namespace', InputArgument::OPTIONAL, 'The namespace name'),
  32896. new InputOption('xml', null, InputOption::VALUE_NONE, 'To output list as XML'),
  32897. new InputOption('raw', null, InputOption::VALUE_NONE, 'To output raw command list'),
  32898. new InputOption('format', null, InputOption::VALUE_REQUIRED, 'The output format (txt, xml, json, or md)', 'txt'),
  32899. ));
  32900. }
  32901. }
  32902. <?php
  32903. namespace Symfony\Component\Console;
  32904. final class ConsoleEvents
  32905. {
  32906. const COMMAND = 'console.command';
  32907. const TERMINATE = 'console.terminate';
  32908. const EXCEPTION = 'console.exception';
  32909. }
  32910. <?php
  32911. namespace Symfony\Component\Console\Descriptor;
  32912. use Symfony\Component\Console\Application;
  32913. use Symfony\Component\Console\Command\Command;
  32914. use Symfony\Component\Console\Exception\CommandNotFoundException;
  32915. class ApplicationDescription
  32916. {
  32917. const GLOBAL_NAMESPACE = '_global';
  32918. private $application;
  32919. private $namespace;
  32920. private $namespaces;
  32921. private $commands;
  32922. private $aliases;
  32923. public function __construct(Application $application, $namespace = null)
  32924. {
  32925. $this->application = $application;
  32926. $this->namespace = $namespace;
  32927. }
  32928. public function getNamespaces()
  32929. {
  32930. if (null === $this->namespaces) {
  32931. $this->inspectApplication();
  32932. }
  32933. return $this->namespaces;
  32934. }
  32935. public function getCommands()
  32936. {
  32937. if (null === $this->commands) {
  32938. $this->inspectApplication();
  32939. }
  32940. return $this->commands;
  32941. }
  32942. public function getCommand($name)
  32943. {
  32944. if (!isset($this->commands[$name]) && !isset($this->aliases[$name])) {
  32945. throw new CommandNotFoundException(sprintf('Command %s does not exist.', $name));
  32946. }
  32947. return isset($this->commands[$name]) ? $this->commands[$name] : $this->aliases[$name];
  32948. }
  32949. private function inspectApplication()
  32950. {
  32951. $this->commands = array();
  32952. $this->namespaces = array();
  32953. $all = $this->application->all($this->namespace ? $this->application->findNamespace($this->namespace) : null);
  32954. foreach ($this->sortCommands($all) as $namespace => $commands) {
  32955. $names = array();
  32956. foreach ($commands as $name => $command) {
  32957. if (!$command->getName()) {
  32958. continue;
  32959. }
  32960. if ($command->getName() === $name) {
  32961. $this->commands[$name] = $command;
  32962. } else {
  32963. $this->aliases[$name] = $command;
  32964. }
  32965. $names[] = $name;
  32966. }
  32967. $this->namespaces[$namespace] = array('id' => $namespace, 'commands' => $names);
  32968. }
  32969. }
  32970. private function sortCommands(array $commands)
  32971. {
  32972. $namespacedCommands = array();
  32973. $globalCommands = array();
  32974. foreach ($commands as $name => $command) {
  32975. $key = $this->application->extractNamespace($name, 1);
  32976. if (!$key) {
  32977. $globalCommands['_global'][$name] = $command;
  32978. } else {
  32979. $namespacedCommands[$key][$name] = $command;
  32980. }
  32981. }
  32982. ksort($namespacedCommands);
  32983. $namespacedCommands = array_merge($globalCommands, $namespacedCommands);
  32984. foreach ($namespacedCommands as &$commandsSet) {
  32985. ksort($commandsSet);
  32986. }
  32987. unset($commandsSet);
  32988. return $namespacedCommands;
  32989. }
  32990. }
  32991. <?php
  32992. namespace Symfony\Component\Console\Descriptor;
  32993. use Symfony\Component\Console\Application;
  32994. use Symfony\Component\Console\Command\Command;
  32995. use Symfony\Component\Console\Exception\InvalidArgumentException;
  32996. use Symfony\Component\Console\Input\InputArgument;
  32997. use Symfony\Component\Console\Input\InputDefinition;
  32998. use Symfony\Component\Console\Input\InputOption;
  32999. use Symfony\Component\Console\Output\OutputInterface;
  33000. abstract class Descriptor implements DescriptorInterface
  33001. {
  33002. private $output;
  33003. public function describe(OutputInterface $output, $object, array $options = array())
  33004. {
  33005. $this->output = $output;
  33006. switch (true) {
  33007. case $object instanceof InputArgument:
  33008. $this->describeInputArgument($object, $options);
  33009. break;
  33010. case $object instanceof InputOption:
  33011. $this->describeInputOption($object, $options);
  33012. break;
  33013. case $object instanceof InputDefinition:
  33014. $this->describeInputDefinition($object, $options);
  33015. break;
  33016. case $object instanceof Command:
  33017. $this->describeCommand($object, $options);
  33018. break;
  33019. case $object instanceof Application:
  33020. $this->describeApplication($object, $options);
  33021. break;
  33022. default:
  33023. throw new InvalidArgumentException(sprintf('Object of type "%s" is not describable.', \get_class($object)));
  33024. }
  33025. }
  33026. protected function write($content, $decorated = false)
  33027. {
  33028. $this->output->write($content, false, $decorated ? OutputInterface::OUTPUT_NORMAL : OutputInterface::OUTPUT_RAW);
  33029. }
  33030. abstract protected function describeInputArgument(InputArgument $argument, array $options = array());
  33031. abstract protected function describeInputOption(InputOption $option, array $options = array());
  33032. abstract protected function describeInputDefinition(InputDefinition $definition, array $options = array());
  33033. abstract protected function describeCommand(Command $command, array $options = array());
  33034. abstract protected function describeApplication(Application $application, array $options = array());
  33035. }
  33036. <?php
  33037. namespace Symfony\Component\Console\Descriptor;
  33038. use Symfony\Component\Console\Output\OutputInterface;
  33039. interface DescriptorInterface
  33040. {
  33041. public function describe(OutputInterface $output, $object, array $options = array());
  33042. }
  33043. <?php
  33044. namespace Symfony\Component\Console\Descriptor;
  33045. use Symfony\Component\Console\Application;
  33046. use Symfony\Component\Console\Command\Command;
  33047. use Symfony\Component\Console\Input\InputArgument;
  33048. use Symfony\Component\Console\Input\InputDefinition;
  33049. use Symfony\Component\Console\Input\InputOption;
  33050. class JsonDescriptor extends Descriptor
  33051. {
  33052. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33053. {
  33054. $this->writeData($this->getInputArgumentData($argument), $options);
  33055. }
  33056. protected function describeInputOption(InputOption $option, array $options = array())
  33057. {
  33058. $this->writeData($this->getInputOptionData($option), $options);
  33059. }
  33060. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33061. {
  33062. $this->writeData($this->getInputDefinitionData($definition), $options);
  33063. }
  33064. protected function describeCommand(Command $command, array $options = array())
  33065. {
  33066. $this->writeData($this->getCommandData($command), $options);
  33067. }
  33068. protected function describeApplication(Application $application, array $options = array())
  33069. {
  33070. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33071. $description = new ApplicationDescription($application, $describedNamespace);
  33072. $commands = array();
  33073. foreach ($description->getCommands() as $command) {
  33074. $commands[] = $this->getCommandData($command);
  33075. }
  33076. $data = $describedNamespace
  33077. ? array('commands' => $commands, 'namespace' => $describedNamespace)
  33078. : array('commands' => $commands, 'namespaces' => array_values($description->getNamespaces()));
  33079. $this->writeData($data, $options);
  33080. }
  33081. private function writeData(array $data, array $options)
  33082. {
  33083. $this->write(json_encode($data, isset($options['json_encoding']) ? $options['json_encoding'] : 0));
  33084. }
  33085. private function getInputArgumentData(InputArgument $argument)
  33086. {
  33087. return array(
  33088. 'name' => $argument->getName(),
  33089. 'is_required' => $argument->isRequired(),
  33090. 'is_array' => $argument->isArray(),
  33091. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $argument->getDescription()),
  33092. 'default' => INF === $argument->getDefault() ? 'INF' : $argument->getDefault(),
  33093. );
  33094. }
  33095. private function getInputOptionData(InputOption $option)
  33096. {
  33097. return array(
  33098. 'name' => '--'.$option->getName(),
  33099. 'shortcut' => $option->getShortcut() ? '-'.str_replace('|', '|-', $option->getShortcut()) : '',
  33100. 'accept_value' => $option->acceptValue(),
  33101. 'is_value_required' => $option->isValueRequired(),
  33102. 'is_multiple' => $option->isArray(),
  33103. 'description' => preg_replace('/\s*[\r\n]\s*/', ' ', $option->getDescription()),
  33104. 'default' => INF === $option->getDefault() ? 'INF' : $option->getDefault(),
  33105. );
  33106. }
  33107. private function getInputDefinitionData(InputDefinition $definition)
  33108. {
  33109. $inputArguments = array();
  33110. foreach ($definition->getArguments() as $name => $argument) {
  33111. $inputArguments[$name] = $this->getInputArgumentData($argument);
  33112. }
  33113. $inputOptions = array();
  33114. foreach ($definition->getOptions() as $name => $option) {
  33115. $inputOptions[$name] = $this->getInputOptionData($option);
  33116. }
  33117. return array('arguments' => $inputArguments, 'options' => $inputOptions);
  33118. }
  33119. private function getCommandData(Command $command)
  33120. {
  33121. $command->getSynopsis();
  33122. $command->mergeApplicationDefinition(false);
  33123. return array(
  33124. 'name' => $command->getName(),
  33125. 'usage' => array_merge(array($command->getSynopsis()), $command->getUsages(), $command->getAliases()),
  33126. 'description' => $command->getDescription(),
  33127. 'help' => $command->getProcessedHelp(),
  33128. 'definition' => $this->getInputDefinitionData($command->getNativeDefinition()),
  33129. );
  33130. }
  33131. }
  33132. <?php
  33133. namespace Symfony\Component\Console\Descriptor;
  33134. use Symfony\Component\Console\Application;
  33135. use Symfony\Component\Console\Command\Command;
  33136. use Symfony\Component\Console\Helper\Helper;
  33137. use Symfony\Component\Console\Input\InputArgument;
  33138. use Symfony\Component\Console\Input\InputDefinition;
  33139. use Symfony\Component\Console\Input\InputOption;
  33140. class MarkdownDescriptor extends Descriptor
  33141. {
  33142. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33143. {
  33144. $this->write(
  33145. '**'.$argument->getName().':**'."\n\n"
  33146. .'* Name: '.($argument->getName() ?: '<none>')."\n"
  33147. .'* Is required: '.($argument->isRequired() ? 'yes' : 'no')."\n"
  33148. .'* Is array: '.($argument->isArray() ? 'yes' : 'no')."\n"
  33149. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $argument->getDescription() ?: '<none>')."\n"
  33150. .'* Default: `'.str_replace("\n", '', var_export($argument->getDefault(), true)).'`'
  33151. );
  33152. }
  33153. protected function describeInputOption(InputOption $option, array $options = array())
  33154. {
  33155. $this->write(
  33156. '**'.$option->getName().':**'."\n\n"
  33157. .'* Name: `--'.$option->getName().'`'."\n"
  33158. .'* Shortcut: '.($option->getShortcut() ? '`-'.str_replace('|', '|-', $option->getShortcut()).'`' : '<none>')."\n"
  33159. .'* Accept value: '.($option->acceptValue() ? 'yes' : 'no')."\n"
  33160. .'* Is value required: '.($option->isValueRequired() ? 'yes' : 'no')."\n"
  33161. .'* Is multiple: '.($option->isArray() ? 'yes' : 'no')."\n"
  33162. .'* Description: '.preg_replace('/\s*[\r\n]\s*/', "\n ", $option->getDescription() ?: '<none>')."\n"
  33163. .'* Default: `'.str_replace("\n", '', var_export($option->getDefault(), true)).'`'
  33164. );
  33165. }
  33166. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33167. {
  33168. if ($showArguments = \count($definition->getArguments()) > 0) {
  33169. $this->write('### Arguments:');
  33170. foreach ($definition->getArguments() as $argument) {
  33171. $this->write("\n\n");
  33172. $this->write($this->describeInputArgument($argument));
  33173. }
  33174. }
  33175. if (\count($definition->getOptions()) > 0) {
  33176. if ($showArguments) {
  33177. $this->write("\n\n");
  33178. }
  33179. $this->write('### Options:');
  33180. foreach ($definition->getOptions() as $option) {
  33181. $this->write("\n\n");
  33182. $this->write($this->describeInputOption($option));
  33183. }
  33184. }
  33185. }
  33186. protected function describeCommand(Command $command, array $options = array())
  33187. {
  33188. $command->getSynopsis();
  33189. $command->mergeApplicationDefinition(false);
  33190. $this->write(
  33191. $command->getName()."\n"
  33192. .str_repeat('-', Helper::strlen($command->getName()))."\n\n"
  33193. .'* Description: '.($command->getDescription() ?: '<none>')."\n"
  33194. .'* Usage:'."\n\n"
  33195. .array_reduce(array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()), function ($carry, $usage) {
  33196. return $carry.' * `'.$usage.'`'."\n";
  33197. })
  33198. );
  33199. if ($help = $command->getProcessedHelp()) {
  33200. $this->write("\n");
  33201. $this->write($help);
  33202. }
  33203. if ($command->getNativeDefinition()) {
  33204. $this->write("\n\n");
  33205. $this->describeInputDefinition($command->getNativeDefinition());
  33206. }
  33207. }
  33208. protected function describeApplication(Application $application, array $options = array())
  33209. {
  33210. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33211. $description = new ApplicationDescription($application, $describedNamespace);
  33212. $this->write($application->getName()."\n".str_repeat('=', Helper::strlen($application->getName())));
  33213. foreach ($description->getNamespaces() as $namespace) {
  33214. if (ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33215. $this->write("\n\n");
  33216. $this->write('**'.$namespace['id'].':**');
  33217. }
  33218. $this->write("\n\n");
  33219. $this->write(implode("\n", array_map(function ($commandName) {
  33220. return '* '.$commandName;
  33221. }, $namespace['commands'])));
  33222. }
  33223. foreach ($description->getCommands() as $command) {
  33224. $this->write("\n\n");
  33225. $this->write($this->describeCommand($command));
  33226. }
  33227. }
  33228. }
  33229. <?php
  33230. namespace Symfony\Component\Console\Descriptor;
  33231. use Symfony\Component\Console\Application;
  33232. use Symfony\Component\Console\Command\Command;
  33233. use Symfony\Component\Console\Formatter\OutputFormatter;
  33234. use Symfony\Component\Console\Helper\Helper;
  33235. use Symfony\Component\Console\Input\InputArgument;
  33236. use Symfony\Component\Console\Input\InputDefinition;
  33237. use Symfony\Component\Console\Input\InputOption;
  33238. class TextDescriptor extends Descriptor
  33239. {
  33240. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33241. {
  33242. if (null !== $argument->getDefault() && (!\is_array($argument->getDefault()) || \count($argument->getDefault()))) {
  33243. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($argument->getDefault()));
  33244. } else {
  33245. $default = '';
  33246. }
  33247. $totalWidth = isset($options['total_width']) ? $options['total_width'] : Helper::strlen($argument->getName());
  33248. $spacingWidth = $totalWidth - \strlen($argument->getName());
  33249. $this->writeText(sprintf(' <info>%s</info> %s%s%s',
  33250. $argument->getName(),
  33251. str_repeat(' ', $spacingWidth),
  33252. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $argument->getDescription()),
  33253. $default
  33254. ), $options);
  33255. }
  33256. protected function describeInputOption(InputOption $option, array $options = array())
  33257. {
  33258. if ($option->acceptValue() && null !== $option->getDefault() && (!\is_array($option->getDefault()) || \count($option->getDefault()))) {
  33259. $default = sprintf('<comment> [default: %s]</comment>', $this->formatDefaultValue($option->getDefault()));
  33260. } else {
  33261. $default = '';
  33262. }
  33263. $value = '';
  33264. if ($option->acceptValue()) {
  33265. $value = '='.strtoupper($option->getName());
  33266. if ($option->isValueOptional()) {
  33267. $value = '['.$value.']';
  33268. }
  33269. }
  33270. $totalWidth = isset($options['total_width']) ? $options['total_width'] : $this->calculateTotalWidthForOptions(array($option));
  33271. $synopsis = sprintf('%s%s',
  33272. $option->getShortcut() ? sprintf('-%s, ', $option->getShortcut()) : ' ',
  33273. sprintf('--%s%s', $option->getName(), $value)
  33274. );
  33275. $spacingWidth = $totalWidth - Helper::strlen($synopsis);
  33276. $this->writeText(sprintf(' <info>%s</info> %s%s%s%s',
  33277. $synopsis,
  33278. str_repeat(' ', $spacingWidth),
  33279. preg_replace('/\s*[\r\n]\s*/', "\n".str_repeat(' ', $totalWidth + 4), $option->getDescription()),
  33280. $default,
  33281. $option->isArray() ? '<comment> (multiple values allowed)</comment>' : ''
  33282. ), $options);
  33283. }
  33284. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33285. {
  33286. $totalWidth = $this->calculateTotalWidthForOptions($definition->getOptions());
  33287. foreach ($definition->getArguments() as $argument) {
  33288. $totalWidth = max($totalWidth, Helper::strlen($argument->getName()));
  33289. }
  33290. if ($definition->getArguments()) {
  33291. $this->writeText('<comment>Arguments:</comment>', $options);
  33292. $this->writeText("\n");
  33293. foreach ($definition->getArguments() as $argument) {
  33294. $this->describeInputArgument($argument, array_merge($options, array('total_width' => $totalWidth)));
  33295. $this->writeText("\n");
  33296. }
  33297. }
  33298. if ($definition->getArguments() && $definition->getOptions()) {
  33299. $this->writeText("\n");
  33300. }
  33301. if ($definition->getOptions()) {
  33302. $laterOptions = array();
  33303. $this->writeText('<comment>Options:</comment>', $options);
  33304. foreach ($definition->getOptions() as $option) {
  33305. if (\strlen($option->getShortcut()) > 1) {
  33306. $laterOptions[] = $option;
  33307. continue;
  33308. }
  33309. $this->writeText("\n");
  33310. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33311. }
  33312. foreach ($laterOptions as $option) {
  33313. $this->writeText("\n");
  33314. $this->describeInputOption($option, array_merge($options, array('total_width' => $totalWidth)));
  33315. }
  33316. }
  33317. }
  33318. protected function describeCommand(Command $command, array $options = array())
  33319. {
  33320. $command->getSynopsis(true);
  33321. $command->getSynopsis(false);
  33322. $command->mergeApplicationDefinition(false);
  33323. $this->writeText('<comment>Usage:</comment>', $options);
  33324. foreach (array_merge(array($command->getSynopsis(true)), $command->getAliases(), $command->getUsages()) as $usage) {
  33325. $this->writeText("\n");
  33326. $this->writeText(' '.OutputFormatter::escape($usage), $options);
  33327. }
  33328. $this->writeText("\n");
  33329. $definition = $command->getNativeDefinition();
  33330. if ($definition->getOptions() || $definition->getArguments()) {
  33331. $this->writeText("\n");
  33332. $this->describeInputDefinition($definition, $options);
  33333. $this->writeText("\n");
  33334. }
  33335. if ($help = $command->getProcessedHelp()) {
  33336. $this->writeText("\n");
  33337. $this->writeText('<comment>Help:</comment>', $options);
  33338. $this->writeText("\n");
  33339. $this->writeText(' '.str_replace("\n", "\n ", $help), $options);
  33340. $this->writeText("\n");
  33341. }
  33342. }
  33343. protected function describeApplication(Application $application, array $options = array())
  33344. {
  33345. $describedNamespace = isset($options['namespace']) ? $options['namespace'] : null;
  33346. $description = new ApplicationDescription($application, $describedNamespace);
  33347. if (isset($options['raw_text']) && $options['raw_text']) {
  33348. $width = $this->getColumnWidth($description->getCommands());
  33349. foreach ($description->getCommands() as $command) {
  33350. $this->writeText(sprintf("%-{$width}s %s", $command->getName(), $command->getDescription()), $options);
  33351. $this->writeText("\n");
  33352. }
  33353. } else {
  33354. if ('' != $help = $application->getHelp()) {
  33355. $this->writeText("$help\n\n", $options);
  33356. }
  33357. $this->writeText("<comment>Usage:</comment>\n", $options);
  33358. $this->writeText(" command [options] [arguments]\n\n", $options);
  33359. $this->describeInputDefinition(new InputDefinition($application->getDefinition()->getOptions()), $options);
  33360. $this->writeText("\n");
  33361. $this->writeText("\n");
  33362. $width = $this->getColumnWidth($description->getCommands());
  33363. if ($describedNamespace) {
  33364. $this->writeText(sprintf('<comment>Available commands for the "%s" namespace:</comment>', $describedNamespace), $options);
  33365. } else {
  33366. $this->writeText('<comment>Available commands:</comment>', $options);
  33367. }
  33368. foreach ($description->getNamespaces() as $namespace) {
  33369. if (!$describedNamespace && ApplicationDescription::GLOBAL_NAMESPACE !== $namespace['id']) {
  33370. $this->writeText("\n");
  33371. $this->writeText(' <comment>'.$namespace['id'].'</comment>', $options);
  33372. }
  33373. foreach ($namespace['commands'] as $name) {
  33374. $this->writeText("\n");
  33375. $spacingWidth = $width - Helper::strlen($name);
  33376. $this->writeText(sprintf(' <info>%s</info>%s%s', $name, str_repeat(' ', $spacingWidth), $description->getCommand($name)->getDescription()), $options);
  33377. }
  33378. }
  33379. $this->writeText("\n");
  33380. }
  33381. }
  33382. private function writeText($content, array $options = array())
  33383. {
  33384. $this->write(
  33385. isset($options['raw_text']) && $options['raw_text'] ? strip_tags($content) : $content,
  33386. isset($options['raw_output']) ? !$options['raw_output'] : true
  33387. );
  33388. }
  33389. private function formatDefaultValue($default)
  33390. {
  33391. if (INF === $default) {
  33392. return 'INF';
  33393. }
  33394. if (\is_string($default)) {
  33395. $default = OutputFormatter::escape($default);
  33396. } elseif (\is_array($default)) {
  33397. foreach ($default as $key => $value) {
  33398. if (\is_string($value)) {
  33399. $default[$key] = OutputFormatter::escape($value);
  33400. }
  33401. }
  33402. }
  33403. if (\PHP_VERSION_ID < 50400) {
  33404. return str_replace(array('\/', '\\\\'), array('/', '\\'), json_encode($default));
  33405. }
  33406. return str_replace('\\\\', '\\', json_encode($default, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
  33407. }
  33408. private function getColumnWidth(array $commands)
  33409. {
  33410. $widths = array();
  33411. foreach ($commands as $command) {
  33412. $widths[] = Helper::strlen($command->getName());
  33413. foreach ($command->getAliases() as $alias) {
  33414. $widths[] = Helper::strlen($alias);
  33415. }
  33416. }
  33417. return max($widths) + 2;
  33418. }
  33419. private function calculateTotalWidthForOptions(array $options)
  33420. {
  33421. $totalWidth = 0;
  33422. foreach ($options as $option) {
  33423. $nameLength = 1 + max(\strlen($option->getShortcut()), 1) + 4 + Helper::strlen($option->getName());
  33424. if ($option->acceptValue()) {
  33425. $valueLength = 1 + Helper::strlen($option->getName());
  33426. $valueLength += $option->isValueOptional() ? 2 : 0;
  33427. $nameLength += $valueLength;
  33428. }
  33429. $totalWidth = max($totalWidth, $nameLength);
  33430. }
  33431. return $totalWidth;
  33432. }
  33433. }
  33434. <?php
  33435. namespace Symfony\Component\Console\Descriptor;
  33436. use Symfony\Component\Console\Application;
  33437. use Symfony\Component\Console\Command\Command;
  33438. use Symfony\Component\Console\Input\InputArgument;
  33439. use Symfony\Component\Console\Input\InputDefinition;
  33440. use Symfony\Component\Console\Input\InputOption;
  33441. class XmlDescriptor extends Descriptor
  33442. {
  33443. public function getInputDefinitionDocument(InputDefinition $definition)
  33444. {
  33445. $dom = new \DOMDocument('1.0', 'UTF-8');
  33446. $dom->appendChild($definitionXML = $dom->createElement('definition'));
  33447. $definitionXML->appendChild($argumentsXML = $dom->createElement('arguments'));
  33448. foreach ($definition->getArguments() as $argument) {
  33449. $this->appendDocument($argumentsXML, $this->getInputArgumentDocument($argument));
  33450. }
  33451. $definitionXML->appendChild($optionsXML = $dom->createElement('options'));
  33452. foreach ($definition->getOptions() as $option) {
  33453. $this->appendDocument($optionsXML, $this->getInputOptionDocument($option));
  33454. }
  33455. return $dom;
  33456. }
  33457. public function getCommandDocument(Command $command)
  33458. {
  33459. $dom = new \DOMDocument('1.0', 'UTF-8');
  33460. $dom->appendChild($commandXML = $dom->createElement('command'));
  33461. $command->getSynopsis();
  33462. $command->mergeApplicationDefinition(false);
  33463. $commandXML->setAttribute('id', $command->getName());
  33464. $commandXML->setAttribute('name', $command->getName());
  33465. $commandXML->appendChild($usagesXML = $dom->createElement('usages'));
  33466. foreach (array_merge(array($command->getSynopsis()), $command->getAliases(), $command->getUsages()) as $usage) {
  33467. $usagesXML->appendChild($dom->createElement('usage', $usage));
  33468. }
  33469. $commandXML->appendChild($descriptionXML = $dom->createElement('description'));
  33470. $descriptionXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getDescription())));
  33471. $commandXML->appendChild($helpXML = $dom->createElement('help'));
  33472. $helpXML->appendChild($dom->createTextNode(str_replace("\n", "\n ", $command->getProcessedHelp())));
  33473. $definitionXML = $this->getInputDefinitionDocument($command->getNativeDefinition());
  33474. $this->appendDocument($commandXML, $definitionXML->getElementsByTagName('definition')->item(0));
  33475. return $dom;
  33476. }
  33477. public function getApplicationDocument(Application $application, $namespace = null)
  33478. {
  33479. $dom = new \DOMDocument('1.0', 'UTF-8');
  33480. $dom->appendChild($rootXml = $dom->createElement('symfony'));
  33481. if ('UNKNOWN' !== $application->getName()) {
  33482. $rootXml->setAttribute('name', $application->getName());
  33483. if ('UNKNOWN' !== $application->getVersion()) {
  33484. $rootXml->setAttribute('version', $application->getVersion());
  33485. }
  33486. }
  33487. $rootXml->appendChild($commandsXML = $dom->createElement('commands'));
  33488. $description = new ApplicationDescription($application, $namespace);
  33489. if ($namespace) {
  33490. $commandsXML->setAttribute('namespace', $namespace);
  33491. }
  33492. foreach ($description->getCommands() as $command) {
  33493. $this->appendDocument($commandsXML, $this->getCommandDocument($command));
  33494. }
  33495. if (!$namespace) {
  33496. $rootXml->appendChild($namespacesXML = $dom->createElement('namespaces'));
  33497. foreach ($description->getNamespaces() as $namespaceDescription) {
  33498. $namespacesXML->appendChild($namespaceArrayXML = $dom->createElement('namespace'));
  33499. $namespaceArrayXML->setAttribute('id', $namespaceDescription['id']);
  33500. foreach ($namespaceDescription['commands'] as $name) {
  33501. $namespaceArrayXML->appendChild($commandXML = $dom->createElement('command'));
  33502. $commandXML->appendChild($dom->createTextNode($name));
  33503. }
  33504. }
  33505. }
  33506. return $dom;
  33507. }
  33508. protected function describeInputArgument(InputArgument $argument, array $options = array())
  33509. {
  33510. $this->writeDocument($this->getInputArgumentDocument($argument));
  33511. }
  33512. protected function describeInputOption(InputOption $option, array $options = array())
  33513. {
  33514. $this->writeDocument($this->getInputOptionDocument($option));
  33515. }
  33516. protected function describeInputDefinition(InputDefinition $definition, array $options = array())
  33517. {
  33518. $this->writeDocument($this->getInputDefinitionDocument($definition));
  33519. }
  33520. protected function describeCommand(Command $command, array $options = array())
  33521. {
  33522. $this->writeDocument($this->getCommandDocument($command));
  33523. }
  33524. protected function describeApplication(Application $application, array $options = array())
  33525. {
  33526. $this->writeDocument($this->getApplicationDocument($application, isset($options['namespace']) ? $options['namespace'] : null));
  33527. }
  33528. private function appendDocument(\DOMNode $parentNode, \DOMNode $importedParent)
  33529. {
  33530. foreach ($importedParent->childNodes as $childNode) {
  33531. $parentNode->appendChild($parentNode->ownerDocument->importNode($childNode, true));
  33532. }
  33533. }
  33534. private function writeDocument(\DOMDocument $dom)
  33535. {
  33536. $dom->formatOutput = true;
  33537. $this->write($dom->saveXML());
  33538. }
  33539. private function getInputArgumentDocument(InputArgument $argument)
  33540. {
  33541. $dom = new \DOMDocument('1.0', 'UTF-8');
  33542. $dom->appendChild($objectXML = $dom->createElement('argument'));
  33543. $objectXML->setAttribute('name', $argument->getName());
  33544. $objectXML->setAttribute('is_required', $argument->isRequired() ? 1 : 0);
  33545. $objectXML->setAttribute('is_array', $argument->isArray() ? 1 : 0);
  33546. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33547. $descriptionXML->appendChild($dom->createTextNode($argument->getDescription()));
  33548. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33549. $defaults = \is_array($argument->getDefault()) ? $argument->getDefault() : (\is_bool($argument->getDefault()) ? array(var_export($argument->getDefault(), true)) : ($argument->getDefault() ? array($argument->getDefault()) : array()));
  33550. foreach ($defaults as $default) {
  33551. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33552. $defaultXML->appendChild($dom->createTextNode($default));
  33553. }
  33554. return $dom;
  33555. }
  33556. private function getInputOptionDocument(InputOption $option)
  33557. {
  33558. $dom = new \DOMDocument('1.0', 'UTF-8');
  33559. $dom->appendChild($objectXML = $dom->createElement('option'));
  33560. $objectXML->setAttribute('name', '--'.$option->getName());
  33561. $pos = strpos($option->getShortcut(), '|');
  33562. if (false !== $pos) {
  33563. $objectXML->setAttribute('shortcut', '-'.substr($option->getShortcut(), 0, $pos));
  33564. $objectXML->setAttribute('shortcuts', '-'.str_replace('|', '|-', $option->getShortcut()));
  33565. } else {
  33566. $objectXML->setAttribute('shortcut', $option->getShortcut() ? '-'.$option->getShortcut() : '');
  33567. }
  33568. $objectXML->setAttribute('accept_value', $option->acceptValue() ? 1 : 0);
  33569. $objectXML->setAttribute('is_value_required', $option->isValueRequired() ? 1 : 0);
  33570. $objectXML->setAttribute('is_multiple', $option->isArray() ? 1 : 0);
  33571. $objectXML->appendChild($descriptionXML = $dom->createElement('description'));
  33572. $descriptionXML->appendChild($dom->createTextNode($option->getDescription()));
  33573. if ($option->acceptValue()) {
  33574. $defaults = \is_array($option->getDefault()) ? $option->getDefault() : (\is_bool($option->getDefault()) ? array(var_export($option->getDefault(), true)) : ($option->getDefault() ? array($option->getDefault()) : array()));
  33575. $objectXML->appendChild($defaultsXML = $dom->createElement('defaults'));
  33576. if (!empty($defaults)) {
  33577. foreach ($defaults as $default) {
  33578. $defaultsXML->appendChild($defaultXML = $dom->createElement('default'));
  33579. $defaultXML->appendChild($dom->createTextNode($default));
  33580. }
  33581. }
  33582. }
  33583. return $dom;
  33584. }
  33585. }
  33586. <?php
  33587. namespace Symfony\Component\Console\Event;
  33588. class ConsoleCommandEvent extends ConsoleEvent
  33589. {
  33590. const RETURN_CODE_DISABLED = 113;
  33591. private $commandShouldRun = true;
  33592. public function disableCommand()
  33593. {
  33594. return $this->commandShouldRun = false;
  33595. }
  33596. public function enableCommand()
  33597. {
  33598. return $this->commandShouldRun = true;
  33599. }
  33600. public function commandShouldRun()
  33601. {
  33602. return $this->commandShouldRun;
  33603. }
  33604. }
  33605. <?php
  33606. namespace Symfony\Component\Console\Event;
  33607. use Symfony\Component\Console\Command\Command;
  33608. use Symfony\Component\Console\Input\InputInterface;
  33609. use Symfony\Component\Console\Output\OutputInterface;
  33610. use Symfony\Component\EventDispatcher\Event;
  33611. class ConsoleEvent extends Event
  33612. {
  33613. protected $command;
  33614. private $input;
  33615. private $output;
  33616. public function __construct(Command $command, InputInterface $input, OutputInterface $output)
  33617. {
  33618. $this->command = $command;
  33619. $this->input = $input;
  33620. $this->output = $output;
  33621. }
  33622. public function getCommand()
  33623. {
  33624. return $this->command;
  33625. }
  33626. public function getInput()
  33627. {
  33628. return $this->input;
  33629. }
  33630. public function getOutput()
  33631. {
  33632. return $this->output;
  33633. }
  33634. }
  33635. <?php
  33636. namespace Symfony\Component\Console\Event;
  33637. use Symfony\Component\Console\Command\Command;
  33638. use Symfony\Component\Console\Input\InputInterface;
  33639. use Symfony\Component\Console\Output\OutputInterface;
  33640. class ConsoleExceptionEvent extends ConsoleEvent
  33641. {
  33642. private $exception;
  33643. private $exitCode;
  33644. public function __construct(Command $command, InputInterface $input, OutputInterface $output, \Exception $exception, $exitCode)
  33645. {
  33646. parent::__construct($command, $input, $output);
  33647. $this->setException($exception);
  33648. $this->exitCode = (int) $exitCode;
  33649. }
  33650. public function getException()
  33651. {
  33652. return $this->exception;
  33653. }
  33654. public function setException(\Exception $exception)
  33655. {
  33656. $this->exception = $exception;
  33657. }
  33658. public function getExitCode()
  33659. {
  33660. return $this->exitCode;
  33661. }
  33662. }
  33663. <?php
  33664. namespace Symfony\Component\Console\Event;
  33665. use Symfony\Component\Console\Command\Command;
  33666. use Symfony\Component\Console\Input\InputInterface;
  33667. use Symfony\Component\Console\Output\OutputInterface;
  33668. class ConsoleTerminateEvent extends ConsoleEvent
  33669. {
  33670. private $exitCode;
  33671. public function __construct(Command $command, InputInterface $input, OutputInterface $output, $exitCode)
  33672. {
  33673. parent::__construct($command, $input, $output);
  33674. $this->setExitCode($exitCode);
  33675. }
  33676. public function setExitCode($exitCode)
  33677. {
  33678. $this->exitCode = (int) $exitCode;
  33679. }
  33680. public function getExitCode()
  33681. {
  33682. return $this->exitCode;
  33683. }
  33684. }
  33685. <?php
  33686. namespace Symfony\Component\Console\Exception;
  33687. class CommandNotFoundException extends \InvalidArgumentException implements ExceptionInterface
  33688. {
  33689. private $alternatives;
  33690. public function __construct($message, array $alternatives = array(), $code = 0, \Exception $previous = null)
  33691. {
  33692. parent::__construct($message, $code, $previous);
  33693. $this->alternatives = $alternatives;
  33694. }
  33695. public function getAlternatives()
  33696. {
  33697. return $this->alternatives;
  33698. }
  33699. }
  33700. <?php
  33701. namespace Symfony\Component\Console\Exception;
  33702. interface ExceptionInterface
  33703. {
  33704. }
  33705. <?php
  33706. namespace Symfony\Component\Console\Exception;
  33707. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  33708. {
  33709. }
  33710. <?php
  33711. namespace Symfony\Component\Console\Exception;
  33712. class InvalidOptionException extends \InvalidArgumentException implements ExceptionInterface
  33713. {
  33714. }
  33715. <?php
  33716. namespace Symfony\Component\Console\Exception;
  33717. class LogicException extends \LogicException implements ExceptionInterface
  33718. {
  33719. }
  33720. <?php
  33721. namespace Symfony\Component\Console\Exception;
  33722. class RuntimeException extends \RuntimeException implements ExceptionInterface
  33723. {
  33724. }
  33725. <?php
  33726. namespace Symfony\Component\Console\Formatter;
  33727. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33728. class OutputFormatter implements OutputFormatterInterface
  33729. {
  33730. private $decorated;
  33731. private $styles = array();
  33732. private $styleStack;
  33733. public static function escape($text)
  33734. {
  33735. $text = preg_replace('/([^\\\\]?)</', '$1\\<', $text);
  33736. return self::escapeTrailingBackslash($text);
  33737. }
  33738. public static function escapeTrailingBackslash($text)
  33739. {
  33740. if ('\\' === substr($text, -1)) {
  33741. $len = \strlen($text);
  33742. $text = rtrim($text, '\\');
  33743. $text = str_replace("\0", '', $text);
  33744. $text .= str_repeat("\0", $len - \strlen($text));
  33745. }
  33746. return $text;
  33747. }
  33748. public function __construct($decorated = false, array $styles = array())
  33749. {
  33750. $this->decorated = (bool) $decorated;
  33751. $this->setStyle('error', new OutputFormatterStyle('white', 'red'));
  33752. $this->setStyle('info', new OutputFormatterStyle('green'));
  33753. $this->setStyle('comment', new OutputFormatterStyle('yellow'));
  33754. $this->setStyle('question', new OutputFormatterStyle('black', 'cyan'));
  33755. foreach ($styles as $name => $style) {
  33756. $this->setStyle($name, $style);
  33757. }
  33758. $this->styleStack = new OutputFormatterStyleStack();
  33759. }
  33760. public function setDecorated($decorated)
  33761. {
  33762. $this->decorated = (bool) $decorated;
  33763. }
  33764. public function isDecorated()
  33765. {
  33766. return $this->decorated;
  33767. }
  33768. public function setStyle($name, OutputFormatterStyleInterface $style)
  33769. {
  33770. $this->styles[strtolower($name)] = $style;
  33771. }
  33772. public function hasStyle($name)
  33773. {
  33774. return isset($this->styles[strtolower($name)]);
  33775. }
  33776. public function getStyle($name)
  33777. {
  33778. if (!$this->hasStyle($name)) {
  33779. throw new InvalidArgumentException(sprintf('Undefined style: %s', $name));
  33780. }
  33781. return $this->styles[strtolower($name)];
  33782. }
  33783. public function format($message)
  33784. {
  33785. $message = (string) $message;
  33786. $offset = 0;
  33787. $output = '';
  33788. $tagRegex = '[a-z][a-z0-9_=;-]*+';
  33789. preg_match_all("#<(($tagRegex) | /($tagRegex)?)>#ix", $message, $matches, PREG_OFFSET_CAPTURE);
  33790. foreach ($matches[0] as $i => $match) {
  33791. $pos = $match[1];
  33792. $text = $match[0];
  33793. if (0 != $pos && '\\' == $message[$pos - 1]) {
  33794. continue;
  33795. }
  33796. $output .= $this->applyCurrentStyle(substr($message, $offset, $pos - $offset));
  33797. $offset = $pos + \strlen($text);
  33798. if ($open = '/' != $text[1]) {
  33799. $tag = $matches[1][$i][0];
  33800. } else {
  33801. $tag = isset($matches[3][$i][0]) ? $matches[3][$i][0] : '';
  33802. }
  33803. if (!$open && !$tag) {
  33804. $this->styleStack->pop();
  33805. } elseif (false === $style = $this->createStyleFromString(strtolower($tag))) {
  33806. $output .= $this->applyCurrentStyle($text);
  33807. } elseif ($open) {
  33808. $this->styleStack->push($style);
  33809. } else {
  33810. $this->styleStack->pop($style);
  33811. }
  33812. }
  33813. $output .= $this->applyCurrentStyle(substr($message, $offset));
  33814. if (false !== strpos($output, "\0")) {
  33815. return strtr($output, array("\0" => '\\', '\\<' => '<'));
  33816. }
  33817. return str_replace('\\<', '<', $output);
  33818. }
  33819. public function getStyleStack()
  33820. {
  33821. return $this->styleStack;
  33822. }
  33823. private function createStyleFromString($string)
  33824. {
  33825. if (isset($this->styles[$string])) {
  33826. return $this->styles[$string];
  33827. }
  33828. if (!preg_match_all('/([^=]+)=([^;]+)(;|$)/', strtolower($string), $matches, PREG_SET_ORDER)) {
  33829. return false;
  33830. }
  33831. $style = new OutputFormatterStyle();
  33832. foreach ($matches as $match) {
  33833. array_shift($match);
  33834. if ('fg' == $match[0]) {
  33835. $style->setForeground($match[1]);
  33836. } elseif ('bg' == $match[0]) {
  33837. $style->setBackground($match[1]);
  33838. } else {
  33839. try {
  33840. $style->setOption($match[1]);
  33841. } catch (\InvalidArgumentException $e) {
  33842. return false;
  33843. }
  33844. }
  33845. }
  33846. return $style;
  33847. }
  33848. private function applyCurrentStyle($text)
  33849. {
  33850. return $this->isDecorated() && \strlen($text) > 0 ? $this->styleStack->getCurrent()->apply($text) : $text;
  33851. }
  33852. }
  33853. <?php
  33854. namespace Symfony\Component\Console\Formatter;
  33855. interface OutputFormatterInterface
  33856. {
  33857. public function setDecorated($decorated);
  33858. public function isDecorated();
  33859. public function setStyle($name, OutputFormatterStyleInterface $style);
  33860. public function hasStyle($name);
  33861. public function getStyle($name);
  33862. public function format($message);
  33863. }
  33864. <?php
  33865. namespace Symfony\Component\Console\Formatter;
  33866. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33867. class OutputFormatterStyle implements OutputFormatterStyleInterface
  33868. {
  33869. private static $availableForegroundColors = array(
  33870. 'black' => array('set' => 30, 'unset' => 39),
  33871. 'red' => array('set' => 31, 'unset' => 39),
  33872. 'green' => array('set' => 32, 'unset' => 39),
  33873. 'yellow' => array('set' => 33, 'unset' => 39),
  33874. 'blue' => array('set' => 34, 'unset' => 39),
  33875. 'magenta' => array('set' => 35, 'unset' => 39),
  33876. 'cyan' => array('set' => 36, 'unset' => 39),
  33877. 'white' => array('set' => 37, 'unset' => 39),
  33878. 'default' => array('set' => 39, 'unset' => 39),
  33879. );
  33880. private static $availableBackgroundColors = array(
  33881. 'black' => array('set' => 40, 'unset' => 49),
  33882. 'red' => array('set' => 41, 'unset' => 49),
  33883. 'green' => array('set' => 42, 'unset' => 49),
  33884. 'yellow' => array('set' => 43, 'unset' => 49),
  33885. 'blue' => array('set' => 44, 'unset' => 49),
  33886. 'magenta' => array('set' => 45, 'unset' => 49),
  33887. 'cyan' => array('set' => 46, 'unset' => 49),
  33888. 'white' => array('set' => 47, 'unset' => 49),
  33889. 'default' => array('set' => 49, 'unset' => 49),
  33890. );
  33891. private static $availableOptions = array(
  33892. 'bold' => array('set' => 1, 'unset' => 22),
  33893. 'underscore' => array('set' => 4, 'unset' => 24),
  33894. 'blink' => array('set' => 5, 'unset' => 25),
  33895. 'reverse' => array('set' => 7, 'unset' => 27),
  33896. 'conceal' => array('set' => 8, 'unset' => 28),
  33897. );
  33898. private $foreground;
  33899. private $background;
  33900. private $options = array();
  33901. public function __construct($foreground = null, $background = null, array $options = array())
  33902. {
  33903. if (null !== $foreground) {
  33904. $this->setForeground($foreground);
  33905. }
  33906. if (null !== $background) {
  33907. $this->setBackground($background);
  33908. }
  33909. if (\count($options)) {
  33910. $this->setOptions($options);
  33911. }
  33912. }
  33913. public function setForeground($color = null)
  33914. {
  33915. if (null === $color) {
  33916. $this->foreground = null;
  33917. return;
  33918. }
  33919. if (!isset(static::$availableForegroundColors[$color])) {
  33920. throw new InvalidArgumentException(sprintf('Invalid foreground color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableForegroundColors))));
  33921. }
  33922. $this->foreground = static::$availableForegroundColors[$color];
  33923. }
  33924. public function setBackground($color = null)
  33925. {
  33926. if (null === $color) {
  33927. $this->background = null;
  33928. return;
  33929. }
  33930. if (!isset(static::$availableBackgroundColors[$color])) {
  33931. throw new InvalidArgumentException(sprintf('Invalid background color specified: "%s". Expected one of (%s)', $color, implode(', ', array_keys(static::$availableBackgroundColors))));
  33932. }
  33933. $this->background = static::$availableBackgroundColors[$color];
  33934. }
  33935. public function setOption($option)
  33936. {
  33937. if (!isset(static::$availableOptions[$option])) {
  33938. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33939. }
  33940. if (!\in_array(static::$availableOptions[$option], $this->options)) {
  33941. $this->options[] = static::$availableOptions[$option];
  33942. }
  33943. }
  33944. public function unsetOption($option)
  33945. {
  33946. if (!isset(static::$availableOptions[$option])) {
  33947. throw new InvalidArgumentException(sprintf('Invalid option specified: "%s". Expected one of (%s)', $option, implode(', ', array_keys(static::$availableOptions))));
  33948. }
  33949. $pos = array_search(static::$availableOptions[$option], $this->options);
  33950. if (false !== $pos) {
  33951. unset($this->options[$pos]);
  33952. }
  33953. }
  33954. public function setOptions(array $options)
  33955. {
  33956. $this->options = array();
  33957. foreach ($options as $option) {
  33958. $this->setOption($option);
  33959. }
  33960. }
  33961. public function apply($text)
  33962. {
  33963. $setCodes = array();
  33964. $unsetCodes = array();
  33965. if (null !== $this->foreground) {
  33966. $setCodes[] = $this->foreground['set'];
  33967. $unsetCodes[] = $this->foreground['unset'];
  33968. }
  33969. if (null !== $this->background) {
  33970. $setCodes[] = $this->background['set'];
  33971. $unsetCodes[] = $this->background['unset'];
  33972. }
  33973. if (\count($this->options)) {
  33974. foreach ($this->options as $option) {
  33975. $setCodes[] = $option['set'];
  33976. $unsetCodes[] = $option['unset'];
  33977. }
  33978. }
  33979. if (0 === \count($setCodes)) {
  33980. return $text;
  33981. }
  33982. return sprintf("\033[%sm%s\033[%sm", implode(';', $setCodes), $text, implode(';', $unsetCodes));
  33983. }
  33984. }
  33985. <?php
  33986. namespace Symfony\Component\Console\Formatter;
  33987. interface OutputFormatterStyleInterface
  33988. {
  33989. public function setForeground($color = null);
  33990. public function setBackground($color = null);
  33991. public function setOption($option);
  33992. public function unsetOption($option);
  33993. public function setOptions(array $options);
  33994. public function apply($text);
  33995. }
  33996. <?php
  33997. namespace Symfony\Component\Console\Formatter;
  33998. use Symfony\Component\Console\Exception\InvalidArgumentException;
  33999. class OutputFormatterStyleStack
  34000. {
  34001. private $styles;
  34002. private $emptyStyle;
  34003. public function __construct(OutputFormatterStyleInterface $emptyStyle = null)
  34004. {
  34005. $this->emptyStyle = $emptyStyle ?: new OutputFormatterStyle();
  34006. $this->reset();
  34007. }
  34008. public function reset()
  34009. {
  34010. $this->styles = array();
  34011. }
  34012. public function push(OutputFormatterStyleInterface $style)
  34013. {
  34014. $this->styles[] = $style;
  34015. }
  34016. public function pop(OutputFormatterStyleInterface $style = null)
  34017. {
  34018. if (empty($this->styles)) {
  34019. return $this->emptyStyle;
  34020. }
  34021. if (null === $style) {
  34022. return array_pop($this->styles);
  34023. }
  34024. foreach (array_reverse($this->styles, true) as $index => $stackedStyle) {
  34025. if ($style->apply('') === $stackedStyle->apply('')) {
  34026. $this->styles = \array_slice($this->styles, 0, $index);
  34027. return $stackedStyle;
  34028. }
  34029. }
  34030. throw new InvalidArgumentException('Incorrectly nested style tag found.');
  34031. }
  34032. public function getCurrent()
  34033. {
  34034. if (empty($this->styles)) {
  34035. return $this->emptyStyle;
  34036. }
  34037. return $this->styles[\count($this->styles) - 1];
  34038. }
  34039. public function setEmptyStyle(OutputFormatterStyleInterface $emptyStyle)
  34040. {
  34041. $this->emptyStyle = $emptyStyle;
  34042. return $this;
  34043. }
  34044. public function getEmptyStyle()
  34045. {
  34046. return $this->emptyStyle;
  34047. }
  34048. }
  34049. <?php
  34050. namespace Symfony\Component\Console\Helper;
  34051. class DebugFormatterHelper extends Helper
  34052. {
  34053. private $colors = array('black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white', 'default');
  34054. private $started = array();
  34055. private $count = -1;
  34056. public function start($id, $message, $prefix = 'RUN')
  34057. {
  34058. $this->started[$id] = array('border' => ++$this->count % \count($this->colors));
  34059. return sprintf("%s<bg=blue;fg=white> %s </> <fg=blue>%s</>\n", $this->getBorder($id), $prefix, $message);
  34060. }
  34061. public function progress($id, $buffer, $error = false, $prefix = 'OUT', $errorPrefix = 'ERR')
  34062. {
  34063. $message = '';
  34064. if ($error) {
  34065. if (isset($this->started[$id]['out'])) {
  34066. $message .= "\n";
  34067. unset($this->started[$id]['out']);
  34068. }
  34069. if (!isset($this->started[$id]['err'])) {
  34070. $message .= sprintf('%s<bg=red;fg=white> %s </> ', $this->getBorder($id), $errorPrefix);
  34071. $this->started[$id]['err'] = true;
  34072. }
  34073. $message .= str_replace("\n", sprintf("\n%s<bg=red;fg=white> %s </> ", $this->getBorder($id), $errorPrefix), $buffer);
  34074. } else {
  34075. if (isset($this->started[$id]['err'])) {
  34076. $message .= "\n";
  34077. unset($this->started[$id]['err']);
  34078. }
  34079. if (!isset($this->started[$id]['out'])) {
  34080. $message .= sprintf('%s<bg=green;fg=white> %s </> ', $this->getBorder($id), $prefix);
  34081. $this->started[$id]['out'] = true;
  34082. }
  34083. $message .= str_replace("\n", sprintf("\n%s<bg=green;fg=white> %s </> ", $this->getBorder($id), $prefix), $buffer);
  34084. }
  34085. return $message;
  34086. }
  34087. public function stop($id, $message, $successful, $prefix = 'RES')
  34088. {
  34089. $trailingEOL = isset($this->started[$id]['out']) || isset($this->started[$id]['err']) ? "\n" : '';
  34090. if ($successful) {
  34091. return sprintf("%s%s<bg=green;fg=white> %s </> <fg=green>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34092. }
  34093. $message = sprintf("%s%s<bg=red;fg=white> %s </> <fg=red>%s</>\n", $trailingEOL, $this->getBorder($id), $prefix, $message);
  34094. unset($this->started[$id]['out'], $this->started[$id]['err']);
  34095. return $message;
  34096. }
  34097. private function getBorder($id)
  34098. {
  34099. return sprintf('<bg=%s> </>', $this->colors[$this->started[$id]['border']]);
  34100. }
  34101. public function getName()
  34102. {
  34103. return 'debug_formatter';
  34104. }
  34105. }
  34106. <?php
  34107. namespace Symfony\Component\Console\Helper;
  34108. use Symfony\Component\Console\Descriptor\DescriptorInterface;
  34109. use Symfony\Component\Console\Descriptor\JsonDescriptor;
  34110. use Symfony\Component\Console\Descriptor\MarkdownDescriptor;
  34111. use Symfony\Component\Console\Descriptor\TextDescriptor;
  34112. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  34113. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34114. use Symfony\Component\Console\Output\OutputInterface;
  34115. class DescriptorHelper extends Helper
  34116. {
  34117. private $descriptors = array();
  34118. public function __construct()
  34119. {
  34120. $this
  34121. ->register('txt', new TextDescriptor())
  34122. ->register('xml', new XmlDescriptor())
  34123. ->register('json', new JsonDescriptor())
  34124. ->register('md', new MarkdownDescriptor())
  34125. ;
  34126. }
  34127. public function describe(OutputInterface $output, $object, array $options = array())
  34128. {
  34129. $options = array_merge(array(
  34130. 'raw_text' => false,
  34131. 'format' => 'txt',
  34132. ), $options);
  34133. if (!isset($this->descriptors[$options['format']])) {
  34134. throw new InvalidArgumentException(sprintf('Unsupported format "%s".', $options['format']));
  34135. }
  34136. $descriptor = $this->descriptors[$options['format']];
  34137. $descriptor->describe($output, $object, $options);
  34138. }
  34139. public function register($format, DescriptorInterface $descriptor)
  34140. {
  34141. $this->descriptors[$format] = $descriptor;
  34142. return $this;
  34143. }
  34144. public function getName()
  34145. {
  34146. return 'descriptor';
  34147. }
  34148. }
  34149. <?php
  34150. namespace Symfony\Component\Console\Helper;
  34151. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34152. use Symfony\Component\Console\Exception\RuntimeException;
  34153. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  34154. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34155. use Symfony\Component\Console\Output\OutputInterface;
  34156. class DialogHelper extends InputAwareHelper
  34157. {
  34158. private $inputStream;
  34159. private static $shell;
  34160. private static $stty;
  34161. public function __construct($triggerDeprecationError = true)
  34162. {
  34163. if ($triggerDeprecationError) {
  34164. @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);
  34165. }
  34166. }
  34167. public function select(OutputInterface $output, $question, $choices, $default = null, $attempts = false, $errorMessage = 'Value "%s" is invalid', $multiselect = false)
  34168. {
  34169. if ($output instanceof ConsoleOutputInterface) {
  34170. $output = $output->getErrorOutput();
  34171. }
  34172. $width = max(array_map('strlen', array_keys($choices)));
  34173. $messages = (array) $question;
  34174. foreach ($choices as $key => $value) {
  34175. $messages[] = sprintf(" [<info>%-{$width}s</info>] %s", $key, $value);
  34176. }
  34177. $output->writeln($messages);
  34178. $result = $this->askAndValidate($output, '> ', function ($picked) use ($choices, $errorMessage, $multiselect) {
  34179. $selectedChoices = str_replace(' ', '', $picked);
  34180. if ($multiselect) {
  34181. if (!preg_match('/^[a-zA-Z0-9_-]+(?:,[a-zA-Z0-9_-]+)*$/', $selectedChoices, $matches)) {
  34182. throw new InvalidArgumentException(sprintf($errorMessage, $picked));
  34183. }
  34184. $selectedChoices = explode(',', $selectedChoices);
  34185. } else {
  34186. $selectedChoices = array($picked);
  34187. }
  34188. $multiselectChoices = array();
  34189. foreach ($selectedChoices as $value) {
  34190. if (empty($choices[$value])) {
  34191. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  34192. }
  34193. $multiselectChoices[] = $value;
  34194. }
  34195. if ($multiselect) {
  34196. return $multiselectChoices;
  34197. }
  34198. return $picked;
  34199. }, $attempts, $default);
  34200. return $result;
  34201. }
  34202. public function ask(OutputInterface $output, $question, $default = null, array $autocomplete = null)
  34203. {
  34204. if ($this->input && !$this->input->isInteractive()) {
  34205. return $default;
  34206. }
  34207. if ($output instanceof ConsoleOutputInterface) {
  34208. $output = $output->getErrorOutput();
  34209. }
  34210. $output->write($question);
  34211. $inputStream = $this->inputStream ?: STDIN;
  34212. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  34213. $ret = fgets($inputStream, 4096);
  34214. if (false === $ret) {
  34215. throw new RuntimeException('Aborted');
  34216. }
  34217. $ret = trim($ret);
  34218. } else {
  34219. $ret = '';
  34220. $i = 0;
  34221. $ofs = -1;
  34222. $matches = $autocomplete;
  34223. $numMatches = \count($matches);
  34224. $sttyMode = shell_exec('stty -g');
  34225. shell_exec('stty -icanon -echo');
  34226. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  34227. while (!feof($inputStream)) {
  34228. $c = fread($inputStream, 1);
  34229. if ("\177" === $c) {
  34230. if (0 === $numMatches && 0 !== $i) {
  34231. --$i;
  34232. $output->write("\033[1D");
  34233. }
  34234. if (0 === $i) {
  34235. $ofs = -1;
  34236. $matches = $autocomplete;
  34237. $numMatches = \count($matches);
  34238. } else {
  34239. $numMatches = 0;
  34240. }
  34241. $ret = substr($ret, 0, $i);
  34242. } elseif ("\033" === $c) {
  34243. $c .= fread($inputStream, 2);
  34244. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  34245. if ('A' === $c[2] && -1 === $ofs) {
  34246. $ofs = 0;
  34247. }
  34248. if (0 === $numMatches) {
  34249. continue;
  34250. }
  34251. $ofs += ('A' === $c[2]) ? -1 : 1;
  34252. $ofs = ($numMatches + $ofs) % $numMatches;
  34253. }
  34254. } elseif (\ord($c) < 32) {
  34255. if ("\t" === $c || "\n" === $c) {
  34256. if ($numMatches > 0 && -1 !== $ofs) {
  34257. $ret = $matches[$ofs];
  34258. $output->write(substr($ret, $i));
  34259. $i = \strlen($ret);
  34260. }
  34261. if ("\n" === $c) {
  34262. $output->write($c);
  34263. break;
  34264. }
  34265. $numMatches = 0;
  34266. }
  34267. continue;
  34268. } else {
  34269. $output->write($c);
  34270. $ret .= $c;
  34271. ++$i;
  34272. $numMatches = 0;
  34273. $ofs = 0;
  34274. foreach ($autocomplete as $value) {
  34275. if (0 === strpos($value, $ret) && $i !== \strlen($value)) {
  34276. $matches[$numMatches++] = $value;
  34277. }
  34278. }
  34279. }
  34280. $output->write("\033[K");
  34281. if ($numMatches > 0 && -1 !== $ofs) {
  34282. $output->write("\0337");
  34283. $output->write('<hl>'.substr($matches[$ofs], $i).'</hl>');
  34284. $output->write("\0338");
  34285. }
  34286. }
  34287. shell_exec(sprintf('stty %s', $sttyMode));
  34288. }
  34289. return \strlen($ret) > 0 ? $ret : $default;
  34290. }
  34291. public function askConfirmation(OutputInterface $output, $question, $default = true)
  34292. {
  34293. $answer = 'z';
  34294. while ($answer && !\in_array(strtolower($answer[0]), array('y', 'n'))) {
  34295. $answer = $this->ask($output, $question);
  34296. }
  34297. if (false === $default) {
  34298. return $answer && 'y' == strtolower($answer[0]);
  34299. }
  34300. return !$answer || 'y' == strtolower($answer[0]);
  34301. }
  34302. public function askHiddenResponse(OutputInterface $output, $question, $fallback = true)
  34303. {
  34304. if ($output instanceof ConsoleOutputInterface) {
  34305. $output = $output->getErrorOutput();
  34306. }
  34307. if ('\\' === \DIRECTORY_SEPARATOR) {
  34308. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  34309. if ('phar:' === substr(__FILE__, 0, 5)) {
  34310. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  34311. copy($exe, $tmpExe);
  34312. $exe = $tmpExe;
  34313. }
  34314. $output->write($question);
  34315. $value = rtrim(shell_exec($exe));
  34316. $output->writeln('');
  34317. if (isset($tmpExe)) {
  34318. unlink($tmpExe);
  34319. }
  34320. return $value;
  34321. }
  34322. if ($this->hasSttyAvailable()) {
  34323. $output->write($question);
  34324. $sttyMode = shell_exec('stty -g');
  34325. shell_exec('stty -echo');
  34326. $value = fgets($this->inputStream ?: STDIN, 4096);
  34327. shell_exec(sprintf('stty %s', $sttyMode));
  34328. if (false === $value) {
  34329. throw new RuntimeException('Aborted');
  34330. }
  34331. $value = trim($value);
  34332. $output->writeln('');
  34333. return $value;
  34334. }
  34335. if (false !== $shell = $this->getShell()) {
  34336. $output->write($question);
  34337. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  34338. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  34339. $value = rtrim(shell_exec($command));
  34340. $output->writeln('');
  34341. return $value;
  34342. }
  34343. if ($fallback) {
  34344. return $this->ask($output, $question);
  34345. }
  34346. throw new RuntimeException('Unable to hide the response');
  34347. }
  34348. public function askAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $default = null, array $autocomplete = null)
  34349. {
  34350. $that = $this;
  34351. $interviewer = function () use ($output, $question, $default, $autocomplete, $that) {
  34352. return $that->ask($output, $question, $default, $autocomplete);
  34353. };
  34354. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34355. }
  34356. public function askHiddenResponseAndValidate(OutputInterface $output, $question, $validator, $attempts = false, $fallback = true)
  34357. {
  34358. $that = $this;
  34359. $interviewer = function () use ($output, $question, $fallback, $that) {
  34360. return $that->askHiddenResponse($output, $question, $fallback);
  34361. };
  34362. return $this->validateAttempts($interviewer, $output, $validator, $attempts);
  34363. }
  34364. public function setInputStream($stream)
  34365. {
  34366. $this->inputStream = $stream;
  34367. }
  34368. public function getInputStream()
  34369. {
  34370. return $this->inputStream;
  34371. }
  34372. public function getName()
  34373. {
  34374. return 'dialog';
  34375. }
  34376. private function getShell()
  34377. {
  34378. if (null !== self::$shell) {
  34379. return self::$shell;
  34380. }
  34381. self::$shell = false;
  34382. if (file_exists('/usr/bin/env')) {
  34383. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  34384. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  34385. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  34386. self::$shell = $sh;
  34387. break;
  34388. }
  34389. }
  34390. }
  34391. return self::$shell;
  34392. }
  34393. private function hasSttyAvailable()
  34394. {
  34395. if (null !== self::$stty) {
  34396. return self::$stty;
  34397. }
  34398. exec('stty 2>&1', $output, $exitcode);
  34399. return self::$stty = 0 === $exitcode;
  34400. }
  34401. private function validateAttempts($interviewer, OutputInterface $output, $validator, $attempts)
  34402. {
  34403. if ($output instanceof ConsoleOutputInterface) {
  34404. $output = $output->getErrorOutput();
  34405. }
  34406. $e = null;
  34407. while (false === $attempts || $attempts--) {
  34408. if (null !== $e) {
  34409. $output->writeln($this->getHelperSet()->get('formatter')->formatBlock($e->getMessage(), 'error'));
  34410. }
  34411. try {
  34412. return \call_user_func($validator, $interviewer());
  34413. } catch (\Exception $e) {
  34414. }
  34415. }
  34416. throw $e;
  34417. }
  34418. }
  34419. <?php
  34420. namespace Symfony\Component\Console\Helper;
  34421. use Symfony\Component\Console\Formatter\OutputFormatter;
  34422. class FormatterHelper extends Helper
  34423. {
  34424. public function formatSection($section, $message, $style = 'info')
  34425. {
  34426. return sprintf('<%s>[%s]</%s> %s', $style, $section, $style, $message);
  34427. }
  34428. public function formatBlock($messages, $style, $large = false)
  34429. {
  34430. if (!\is_array($messages)) {
  34431. $messages = array($messages);
  34432. }
  34433. $len = 0;
  34434. $lines = array();
  34435. foreach ($messages as $message) {
  34436. $message = OutputFormatter::escape($message);
  34437. $lines[] = sprintf($large ? ' %s ' : ' %s ', $message);
  34438. $len = max($this->strlen($message) + ($large ? 4 : 2), $len);
  34439. }
  34440. $messages = $large ? array(str_repeat(' ', $len)) : array();
  34441. for ($i = 0; isset($lines[$i]); ++$i) {
  34442. $messages[] = $lines[$i].str_repeat(' ', $len - $this->strlen($lines[$i]));
  34443. }
  34444. if ($large) {
  34445. $messages[] = str_repeat(' ', $len);
  34446. }
  34447. for ($i = 0; isset($messages[$i]); ++$i) {
  34448. $messages[$i] = sprintf('<%s>%s</%s>', $style, $messages[$i], $style);
  34449. }
  34450. return implode("\n", $messages);
  34451. }
  34452. public function getName()
  34453. {
  34454. return 'formatter';
  34455. }
  34456. }
  34457. <?php
  34458. namespace Symfony\Component\Console\Helper;
  34459. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  34460. abstract class Helper implements HelperInterface
  34461. {
  34462. protected $helperSet = null;
  34463. public function setHelperSet(HelperSet $helperSet = null)
  34464. {
  34465. $this->helperSet = $helperSet;
  34466. }
  34467. public function getHelperSet()
  34468. {
  34469. return $this->helperSet;
  34470. }
  34471. public static function strlen($string)
  34472. {
  34473. if (false === $encoding = mb_detect_encoding($string, null, true)) {
  34474. return \strlen($string);
  34475. }
  34476. return mb_strwidth($string, $encoding);
  34477. }
  34478. public static function formatTime($secs)
  34479. {
  34480. static $timeFormats = array(
  34481. array(0, '< 1 sec'),
  34482. array(1, '1 sec'),
  34483. array(2, 'secs', 1),
  34484. array(60, '1 min'),
  34485. array(120, 'mins', 60),
  34486. array(3600, '1 hr'),
  34487. array(7200, 'hrs', 3600),
  34488. array(86400, '1 day'),
  34489. array(172800, 'days', 86400),
  34490. );
  34491. foreach ($timeFormats as $index => $format) {
  34492. if ($secs >= $format[0]) {
  34493. if ((isset($timeFormats[$index + 1]) && $secs < $timeFormats[$index + 1][0])
  34494. || $index == \count($timeFormats) - 1
  34495. ) {
  34496. if (2 == \count($format)) {
  34497. return $format[1];
  34498. }
  34499. return floor($secs / $format[2]).' '.$format[1];
  34500. }
  34501. }
  34502. }
  34503. }
  34504. public static function formatMemory($memory)
  34505. {
  34506. if ($memory >= 1024 * 1024 * 1024) {
  34507. return sprintf('%.1f GiB', $memory / 1024 / 1024 / 1024);
  34508. }
  34509. if ($memory >= 1024 * 1024) {
  34510. return sprintf('%.1f MiB', $memory / 1024 / 1024);
  34511. }
  34512. if ($memory >= 1024) {
  34513. return sprintf('%d KiB', $memory / 1024);
  34514. }
  34515. return sprintf('%d B', $memory);
  34516. }
  34517. public static function strlenWithoutDecoration(OutputFormatterInterface $formatter, $string)
  34518. {
  34519. return self::strlen(self::removeDecoration($formatter, $string));
  34520. }
  34521. public static function removeDecoration(OutputFormatterInterface $formatter, $string)
  34522. {
  34523. $isDecorated = $formatter->isDecorated();
  34524. $formatter->setDecorated(false);
  34525. $string = $formatter->format($string);
  34526. $string = preg_replace("/\033\[[^m]*m/", '', $string);
  34527. $formatter->setDecorated($isDecorated);
  34528. return $string;
  34529. }
  34530. }
  34531. <?php
  34532. namespace Symfony\Component\Console\Helper;
  34533. interface HelperInterface
  34534. {
  34535. public function setHelperSet(HelperSet $helperSet = null);
  34536. public function getHelperSet();
  34537. public function getName();
  34538. }
  34539. <?php
  34540. namespace Symfony\Component\Console\Helper;
  34541. use Symfony\Component\Console\Command\Command;
  34542. use Symfony\Component\Console\Exception\InvalidArgumentException;
  34543. class HelperSet implements \IteratorAggregate
  34544. {
  34545. private $helpers = array();
  34546. private $command;
  34547. public function __construct(array $helpers = array())
  34548. {
  34549. foreach ($helpers as $alias => $helper) {
  34550. $this->set($helper, \is_int($alias) ? null : $alias);
  34551. }
  34552. }
  34553. public function set(HelperInterface $helper, $alias = null)
  34554. {
  34555. $this->helpers[$helper->getName()] = $helper;
  34556. if (null !== $alias) {
  34557. $this->helpers[$alias] = $helper;
  34558. }
  34559. $helper->setHelperSet($this);
  34560. }
  34561. public function has($name)
  34562. {
  34563. return isset($this->helpers[$name]);
  34564. }
  34565. public function get($name)
  34566. {
  34567. if (!$this->has($name)) {
  34568. throw new InvalidArgumentException(sprintf('The helper "%s" is not defined.', $name));
  34569. }
  34570. if ('dialog' === $name && $this->helpers[$name] instanceof DialogHelper) {
  34571. @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);
  34572. } elseif ('progress' === $name && $this->helpers[$name] instanceof ProgressHelper) {
  34573. @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);
  34574. } elseif ('table' === $name && $this->helpers[$name] instanceof TableHelper) {
  34575. @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);
  34576. }
  34577. return $this->helpers[$name];
  34578. }
  34579. public function setCommand(Command $command = null)
  34580. {
  34581. $this->command = $command;
  34582. }
  34583. public function getCommand()
  34584. {
  34585. return $this->command;
  34586. }
  34587. public function getIterator()
  34588. {
  34589. return new \ArrayIterator($this->helpers);
  34590. }
  34591. }
  34592. <?php
  34593. namespace Symfony\Component\Console\Helper;
  34594. use Symfony\Component\Console\Input\InputAwareInterface;
  34595. use Symfony\Component\Console\Input\InputInterface;
  34596. abstract class InputAwareHelper extends Helper implements InputAwareInterface
  34597. {
  34598. protected $input;
  34599. public function setInput(InputInterface $input)
  34600. {
  34601. $this->input = $input;
  34602. }
  34603. }
  34604. <?php
  34605. namespace Symfony\Component\Console\Helper;
  34606. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34607. use Symfony\Component\Console\Output\OutputInterface;
  34608. use Symfony\Component\Process\Exception\ProcessFailedException;
  34609. use Symfony\Component\Process\Process;
  34610. use Symfony\Component\Process\ProcessBuilder;
  34611. class ProcessHelper extends Helper
  34612. {
  34613. public function run(OutputInterface $output, $cmd, $error = null, $callback = null, $verbosity = OutputInterface::VERBOSITY_VERY_VERBOSE)
  34614. {
  34615. if ($output instanceof ConsoleOutputInterface) {
  34616. $output = $output->getErrorOutput();
  34617. }
  34618. $formatter = $this->getHelperSet()->get('debug_formatter');
  34619. if (\is_array($cmd)) {
  34620. $process = ProcessBuilder::create($cmd)->getProcess();
  34621. } elseif ($cmd instanceof Process) {
  34622. $process = $cmd;
  34623. } else {
  34624. $process = new Process($cmd);
  34625. }
  34626. if ($verbosity <= $output->getVerbosity()) {
  34627. $output->write($formatter->start(spl_object_hash($process), $this->escapeString($process->getCommandLine())));
  34628. }
  34629. if ($output->isDebug()) {
  34630. $callback = $this->wrapCallback($output, $process, $callback);
  34631. }
  34632. $process->run($callback);
  34633. if ($verbosity <= $output->getVerbosity()) {
  34634. $message = $process->isSuccessful() ? 'Command ran successfully' : sprintf('%s Command did not run successfully', $process->getExitCode());
  34635. $output->write($formatter->stop(spl_object_hash($process), $message, $process->isSuccessful()));
  34636. }
  34637. if (!$process->isSuccessful() && null !== $error) {
  34638. $output->writeln(sprintf('<error>%s</error>', $this->escapeString($error)));
  34639. }
  34640. return $process;
  34641. }
  34642. public function mustRun(OutputInterface $output, $cmd, $error = null, $callback = null)
  34643. {
  34644. $process = $this->run($output, $cmd, $error, $callback);
  34645. if (!$process->isSuccessful()) {
  34646. throw new ProcessFailedException($process);
  34647. }
  34648. return $process;
  34649. }
  34650. public function wrapCallback(OutputInterface $output, Process $process, $callback = null)
  34651. {
  34652. if ($output instanceof ConsoleOutputInterface) {
  34653. $output = $output->getErrorOutput();
  34654. }
  34655. $formatter = $this->getHelperSet()->get('debug_formatter');
  34656. $that = $this;
  34657. return function ($type, $buffer) use ($output, $process, $callback, $formatter, $that) {
  34658. $output->write($formatter->progress(spl_object_hash($process), $that->escapeString($buffer), Process::ERR === $type));
  34659. if (null !== $callback) {
  34660. \call_user_func($callback, $type, $buffer);
  34661. }
  34662. };
  34663. }
  34664. public function escapeString($str)
  34665. {
  34666. return str_replace('<', '\\<', $str);
  34667. }
  34668. public function getName()
  34669. {
  34670. return 'process';
  34671. }
  34672. }
  34673. <?php
  34674. namespace Symfony\Component\Console\Helper;
  34675. use Symfony\Component\Console\Exception\LogicException;
  34676. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  34677. use Symfony\Component\Console\Output\OutputInterface;
  34678. class ProgressBar
  34679. {
  34680. private $barWidth = 28;
  34681. private $barChar;
  34682. private $emptyBarChar = '-';
  34683. private $progressChar = '>';
  34684. private $format;
  34685. private $internalFormat;
  34686. private $redrawFreq = 1;
  34687. private $output;
  34688. private $step = 0;
  34689. private $max;
  34690. private $startTime;
  34691. private $stepWidth;
  34692. private $percent = 0.0;
  34693. private $formatLineCount;
  34694. private $messages = array();
  34695. private $overwrite = true;
  34696. private $firstRun = true;
  34697. private static $formatters;
  34698. private static $formats;
  34699. public function __construct(OutputInterface $output, $max = 0)
  34700. {
  34701. if ($output instanceof ConsoleOutputInterface) {
  34702. $output = $output->getErrorOutput();
  34703. }
  34704. $this->output = $output;
  34705. $this->setMaxSteps($max);
  34706. if (!$this->output->isDecorated()) {
  34707. $this->overwrite = false;
  34708. $this->setRedrawFrequency($max / 10);
  34709. }
  34710. $this->startTime = time();
  34711. }
  34712. public static function setPlaceholderFormatterDefinition($name, $callable)
  34713. {
  34714. if (!self::$formatters) {
  34715. self::$formatters = self::initPlaceholderFormatters();
  34716. }
  34717. self::$formatters[$name] = $callable;
  34718. }
  34719. public static function getPlaceholderFormatterDefinition($name)
  34720. {
  34721. if (!self::$formatters) {
  34722. self::$formatters = self::initPlaceholderFormatters();
  34723. }
  34724. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  34725. }
  34726. public static function setFormatDefinition($name, $format)
  34727. {
  34728. if (!self::$formats) {
  34729. self::$formats = self::initFormats();
  34730. }
  34731. self::$formats[$name] = $format;
  34732. }
  34733. public static function getFormatDefinition($name)
  34734. {
  34735. if (!self::$formats) {
  34736. self::$formats = self::initFormats();
  34737. }
  34738. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  34739. }
  34740. public function setMessage($message, $name = 'message')
  34741. {
  34742. $this->messages[$name] = $message;
  34743. }
  34744. public function getMessage($name = 'message')
  34745. {
  34746. return $this->messages[$name];
  34747. }
  34748. public function getStartTime()
  34749. {
  34750. return $this->startTime;
  34751. }
  34752. public function getMaxSteps()
  34753. {
  34754. return $this->max;
  34755. }
  34756. public function getStep()
  34757. {
  34758. @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);
  34759. return $this->getProgress();
  34760. }
  34761. public function getProgress()
  34762. {
  34763. return $this->step;
  34764. }
  34765. public function getStepWidth()
  34766. {
  34767. return $this->stepWidth;
  34768. }
  34769. public function getProgressPercent()
  34770. {
  34771. return $this->percent;
  34772. }
  34773. public function setBarWidth($size)
  34774. {
  34775. $this->barWidth = (int) $size;
  34776. }
  34777. public function getBarWidth()
  34778. {
  34779. return $this->barWidth;
  34780. }
  34781. public function setBarCharacter($char)
  34782. {
  34783. $this->barChar = $char;
  34784. }
  34785. public function getBarCharacter()
  34786. {
  34787. if (null === $this->barChar) {
  34788. return $this->max ? '=' : $this->emptyBarChar;
  34789. }
  34790. return $this->barChar;
  34791. }
  34792. public function setEmptyBarCharacter($char)
  34793. {
  34794. $this->emptyBarChar = $char;
  34795. }
  34796. public function getEmptyBarCharacter()
  34797. {
  34798. return $this->emptyBarChar;
  34799. }
  34800. public function setProgressCharacter($char)
  34801. {
  34802. $this->progressChar = $char;
  34803. }
  34804. public function getProgressCharacter()
  34805. {
  34806. return $this->progressChar;
  34807. }
  34808. public function setFormat($format)
  34809. {
  34810. $this->format = null;
  34811. $this->internalFormat = $format;
  34812. }
  34813. public function setRedrawFrequency($freq)
  34814. {
  34815. $this->redrawFreq = max((int) $freq, 1);
  34816. }
  34817. public function start($max = null)
  34818. {
  34819. $this->startTime = time();
  34820. $this->step = 0;
  34821. $this->percent = 0.0;
  34822. if (null !== $max) {
  34823. $this->setMaxSteps($max);
  34824. }
  34825. $this->display();
  34826. }
  34827. public function advance($step = 1)
  34828. {
  34829. $this->setProgress($this->step + $step);
  34830. }
  34831. public function setCurrent($step)
  34832. {
  34833. @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);
  34834. $this->setProgress($step);
  34835. }
  34836. public function setOverwrite($overwrite)
  34837. {
  34838. $this->overwrite = (bool) $overwrite;
  34839. }
  34840. public function setProgress($step)
  34841. {
  34842. $step = (int) $step;
  34843. if ($step < $this->step) {
  34844. throw new LogicException('You can\'t regress the progress bar.');
  34845. }
  34846. if ($this->max && $step > $this->max) {
  34847. $this->max = $step;
  34848. }
  34849. $prevPeriod = (int) ($this->step / $this->redrawFreq);
  34850. $currPeriod = (int) ($step / $this->redrawFreq);
  34851. $this->step = $step;
  34852. $this->percent = $this->max ? (float) $this->step / $this->max : 0;
  34853. if ($prevPeriod !== $currPeriod || $this->max === $step) {
  34854. $this->display();
  34855. }
  34856. }
  34857. public function finish()
  34858. {
  34859. if (!$this->max) {
  34860. $this->max = $this->step;
  34861. }
  34862. if ($this->step === $this->max && !$this->overwrite) {
  34863. return;
  34864. }
  34865. $this->setProgress($this->max);
  34866. }
  34867. public function display()
  34868. {
  34869. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  34870. return;
  34871. }
  34872. if (null === $this->format) {
  34873. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34874. }
  34875. $self = $this;
  34876. $output = $this->output;
  34877. $messages = $this->messages;
  34878. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self, $output, $messages) {
  34879. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  34880. $text = \call_user_func($formatter, $self, $output);
  34881. } elseif (isset($messages[$matches[1]])) {
  34882. $text = $messages[$matches[1]];
  34883. } else {
  34884. return $matches[0];
  34885. }
  34886. if (isset($matches[2])) {
  34887. $text = sprintf('%'.$matches[2], $text);
  34888. }
  34889. return $text;
  34890. }, $this->format));
  34891. }
  34892. public function clear()
  34893. {
  34894. if (!$this->overwrite) {
  34895. return;
  34896. }
  34897. if (null === $this->format) {
  34898. $this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
  34899. }
  34900. $this->overwrite('');
  34901. }
  34902. private function setRealFormat($format)
  34903. {
  34904. if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
  34905. $this->format = self::getFormatDefinition($format.'_nomax');
  34906. } elseif (null !== self::getFormatDefinition($format)) {
  34907. $this->format = self::getFormatDefinition($format);
  34908. } else {
  34909. $this->format = $format;
  34910. }
  34911. $this->formatLineCount = substr_count($this->format, "\n");
  34912. }
  34913. private function setMaxSteps($max)
  34914. {
  34915. $this->max = max(0, (int) $max);
  34916. $this->stepWidth = $this->max ? Helper::strlen($this->max) : 4;
  34917. }
  34918. private function overwrite($message)
  34919. {
  34920. if ($this->overwrite) {
  34921. if (!$this->firstRun) {
  34922. $this->output->write("\x0D");
  34923. $this->output->write("\x1B[2K");
  34924. if ($this->formatLineCount > 0) {
  34925. $this->output->write(str_repeat("\x1B[1A\x1B[2K", $this->formatLineCount));
  34926. }
  34927. }
  34928. } elseif ($this->step > 0) {
  34929. $this->output->writeln('');
  34930. }
  34931. $this->firstRun = false;
  34932. $this->output->write($message);
  34933. }
  34934. private function determineBestFormat()
  34935. {
  34936. switch ($this->output->getVerbosity()) {
  34937. case OutputInterface::VERBOSITY_VERBOSE:
  34938. return $this->max ? 'verbose' : 'verbose_nomax';
  34939. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  34940. return $this->max ? 'very_verbose' : 'very_verbose_nomax';
  34941. case OutputInterface::VERBOSITY_DEBUG:
  34942. return $this->max ? 'debug' : 'debug_nomax';
  34943. default:
  34944. return $this->max ? 'normal' : 'normal_nomax';
  34945. }
  34946. }
  34947. private static function initPlaceholderFormatters()
  34948. {
  34949. return array(
  34950. 'bar' => function (ProgressBar $bar, OutputInterface $output) {
  34951. $completeBars = floor($bar->getMaxSteps() > 0 ? $bar->getProgressPercent() * $bar->getBarWidth() : $bar->getProgress() % $bar->getBarWidth());
  34952. $display = str_repeat($bar->getBarCharacter(), $completeBars);
  34953. if ($completeBars < $bar->getBarWidth()) {
  34954. $emptyBars = $bar->getBarWidth() - $completeBars - Helper::strlenWithoutDecoration($output->getFormatter(), $bar->getProgressCharacter());
  34955. $display .= $bar->getProgressCharacter().str_repeat($bar->getEmptyBarCharacter(), $emptyBars);
  34956. }
  34957. return $display;
  34958. },
  34959. 'elapsed' => function (ProgressBar $bar) {
  34960. return Helper::formatTime(time() - $bar->getStartTime());
  34961. },
  34962. 'remaining' => function (ProgressBar $bar) {
  34963. if (!$bar->getMaxSteps()) {
  34964. throw new LogicException('Unable to display the remaining time if the maximum number of steps is not set.');
  34965. }
  34966. if (!$bar->getProgress()) {
  34967. $remaining = 0;
  34968. } else {
  34969. $remaining = round((time() - $bar->getStartTime()) / $bar->getProgress() * ($bar->getMaxSteps() - $bar->getProgress()));
  34970. }
  34971. return Helper::formatTime($remaining);
  34972. },
  34973. 'estimated' => function (ProgressBar $bar) {
  34974. if (!$bar->getMaxSteps()) {
  34975. throw new LogicException('Unable to display the estimated time if the maximum number of steps is not set.');
  34976. }
  34977. if (!$bar->getProgress()) {
  34978. $estimated = 0;
  34979. } else {
  34980. $estimated = round((time() - $bar->getStartTime()) / $bar->getProgress() * $bar->getMaxSteps());
  34981. }
  34982. return Helper::formatTime($estimated);
  34983. },
  34984. 'memory' => function (ProgressBar $bar) {
  34985. return Helper::formatMemory(memory_get_usage(true));
  34986. },
  34987. 'current' => function (ProgressBar $bar) {
  34988. return str_pad($bar->getProgress(), $bar->getStepWidth(), ' ', STR_PAD_LEFT);
  34989. },
  34990. 'max' => function (ProgressBar $bar) {
  34991. return $bar->getMaxSteps();
  34992. },
  34993. 'percent' => function (ProgressBar $bar) {
  34994. return floor($bar->getProgressPercent() * 100);
  34995. },
  34996. );
  34997. }
  34998. private static function initFormats()
  34999. {
  35000. return array(
  35001. 'normal' => ' %current%/%max% [%bar%] %percent:3s%%',
  35002. 'normal_nomax' => ' %current% [%bar%]',
  35003. 'verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%',
  35004. 'verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  35005. 'very_verbose' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s%',
  35006. 'very_verbose_nomax' => ' %current% [%bar%] %elapsed:6s%',
  35007. 'debug' => ' %current%/%max% [%bar%] %percent:3s%% %elapsed:6s%/%estimated:-6s% %memory:6s%',
  35008. 'debug_nomax' => ' %current% [%bar%] %elapsed:6s% %memory:6s%',
  35009. );
  35010. }
  35011. }
  35012. <?php
  35013. namespace Symfony\Component\Console\Helper;
  35014. use Symfony\Component\Console\Exception\LogicException;
  35015. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35016. use Symfony\Component\Console\Output\NullOutput;
  35017. use Symfony\Component\Console\Output\OutputInterface;
  35018. class ProgressHelper extends Helper
  35019. {
  35020. const FORMAT_QUIET = ' %percent%%';
  35021. const FORMAT_NORMAL = ' %current%/%max% [%bar%] %percent%%';
  35022. const FORMAT_VERBOSE = ' %current%/%max% [%bar%] %percent%% Elapsed: %elapsed%';
  35023. const FORMAT_QUIET_NOMAX = ' %current%';
  35024. const FORMAT_NORMAL_NOMAX = ' %current% [%bar%]';
  35025. const FORMAT_VERBOSE_NOMAX = ' %current% [%bar%] Elapsed: %elapsed%';
  35026. private $barWidth = 28;
  35027. private $barChar = '=';
  35028. private $emptyBarChar = '-';
  35029. private $progressChar = '>';
  35030. private $format = null;
  35031. private $redrawFreq = 1;
  35032. private $lastMessagesLength;
  35033. private $barCharOriginal;
  35034. private $output;
  35035. private $current;
  35036. private $max;
  35037. private $startTime;
  35038. private $defaultFormatVars = array(
  35039. 'current',
  35040. 'max',
  35041. 'bar',
  35042. 'percent',
  35043. 'elapsed',
  35044. );
  35045. private $formatVars;
  35046. private $widths = array(
  35047. 'current' => 4,
  35048. 'max' => 4,
  35049. 'percent' => 3,
  35050. 'elapsed' => 6,
  35051. );
  35052. private $timeFormats = array(
  35053. array(0, '???'),
  35054. array(2, '1 sec'),
  35055. array(59, 'secs', 1),
  35056. array(60, '1 min'),
  35057. array(3600, 'mins', 60),
  35058. array(5400, '1 hr'),
  35059. array(86400, 'hrs', 3600),
  35060. array(129600, '1 day'),
  35061. array(604800, 'days', 86400),
  35062. );
  35063. public function __construct($triggerDeprecationError = true)
  35064. {
  35065. if ($triggerDeprecationError) {
  35066. @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);
  35067. }
  35068. }
  35069. public function setBarWidth($size)
  35070. {
  35071. $this->barWidth = (int) $size;
  35072. }
  35073. public function setBarCharacter($char)
  35074. {
  35075. $this->barChar = $char;
  35076. }
  35077. public function setEmptyBarCharacter($char)
  35078. {
  35079. $this->emptyBarChar = $char;
  35080. }
  35081. public function setProgressCharacter($char)
  35082. {
  35083. $this->progressChar = $char;
  35084. }
  35085. public function setFormat($format)
  35086. {
  35087. $this->format = $format;
  35088. }
  35089. public function setRedrawFrequency($freq)
  35090. {
  35091. $this->redrawFreq = (int) $freq;
  35092. }
  35093. public function start(OutputInterface $output, $max = null)
  35094. {
  35095. if ($output instanceof ConsoleOutputInterface) {
  35096. $output = $output->getErrorOutput();
  35097. }
  35098. $this->startTime = time();
  35099. $this->current = 0;
  35100. $this->max = (int) $max;
  35101. $this->output = $output->isDecorated() ? $output : new NullOutput();
  35102. $this->lastMessagesLength = 0;
  35103. $this->barCharOriginal = '';
  35104. if (null === $this->format) {
  35105. switch ($output->getVerbosity()) {
  35106. case OutputInterface::VERBOSITY_QUIET:
  35107. $this->format = self::FORMAT_QUIET_NOMAX;
  35108. if ($this->max > 0) {
  35109. $this->format = self::FORMAT_QUIET;
  35110. }
  35111. break;
  35112. case OutputInterface::VERBOSITY_VERBOSE:
  35113. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35114. case OutputInterface::VERBOSITY_DEBUG:
  35115. $this->format = self::FORMAT_VERBOSE_NOMAX;
  35116. if ($this->max > 0) {
  35117. $this->format = self::FORMAT_VERBOSE;
  35118. }
  35119. break;
  35120. default:
  35121. $this->format = self::FORMAT_NORMAL_NOMAX;
  35122. if ($this->max > 0) {
  35123. $this->format = self::FORMAT_NORMAL;
  35124. }
  35125. break;
  35126. }
  35127. }
  35128. $this->initialize();
  35129. }
  35130. public function advance($step = 1, $redraw = false)
  35131. {
  35132. $this->setCurrent($this->current + $step, $redraw);
  35133. }
  35134. public function setCurrent($current, $redraw = false)
  35135. {
  35136. if (null === $this->startTime) {
  35137. throw new LogicException('You must start the progress bar before calling setCurrent().');
  35138. }
  35139. $current = (int) $current;
  35140. if ($current < $this->current) {
  35141. throw new LogicException('You can\'t regress the progress bar');
  35142. }
  35143. if (0 === $this->current) {
  35144. $redraw = true;
  35145. }
  35146. $prevPeriod = (int) ($this->current / $this->redrawFreq);
  35147. $this->current = $current;
  35148. $currPeriod = (int) ($this->current / $this->redrawFreq);
  35149. if ($redraw || $prevPeriod !== $currPeriod || $this->max === $this->current) {
  35150. $this->display();
  35151. }
  35152. }
  35153. public function display($finish = false)
  35154. {
  35155. if (null === $this->startTime) {
  35156. throw new LogicException('You must start the progress bar before calling display().');
  35157. }
  35158. $message = $this->format;
  35159. foreach ($this->generate($finish) as $name => $value) {
  35160. $message = str_replace("%{$name}%", $value, $message);
  35161. }
  35162. $this->overwrite($this->output, $message);
  35163. }
  35164. public function clear()
  35165. {
  35166. $this->overwrite($this->output, '');
  35167. }
  35168. public function finish()
  35169. {
  35170. if (null === $this->startTime) {
  35171. throw new LogicException('You must start the progress bar before calling finish().');
  35172. }
  35173. if (null !== $this->startTime) {
  35174. if (!$this->max) {
  35175. $this->barChar = $this->barCharOriginal;
  35176. $this->display(true);
  35177. }
  35178. $this->startTime = null;
  35179. $this->output->writeln('');
  35180. $this->output = null;
  35181. }
  35182. }
  35183. private function initialize()
  35184. {
  35185. $this->formatVars = array();
  35186. foreach ($this->defaultFormatVars as $var) {
  35187. if (false !== strpos($this->format, "%{$var}%")) {
  35188. $this->formatVars[$var] = true;
  35189. }
  35190. }
  35191. if ($this->max > 0) {
  35192. $this->widths['max'] = $this->strlen($this->max);
  35193. $this->widths['current'] = $this->widths['max'];
  35194. } else {
  35195. $this->barCharOriginal = $this->barChar;
  35196. $this->barChar = $this->emptyBarChar;
  35197. }
  35198. }
  35199. private function generate($finish = false)
  35200. {
  35201. $vars = array();
  35202. $percent = 0;
  35203. if ($this->max > 0) {
  35204. $percent = (float) $this->current / $this->max;
  35205. }
  35206. if (isset($this->formatVars['bar'])) {
  35207. if ($this->max > 0) {
  35208. $completeBars = floor($percent * $this->barWidth);
  35209. } else {
  35210. if (!$finish) {
  35211. $completeBars = floor($this->current % $this->barWidth);
  35212. } else {
  35213. $completeBars = $this->barWidth;
  35214. }
  35215. }
  35216. $emptyBars = $this->barWidth - $completeBars - $this->strlen($this->progressChar);
  35217. $bar = str_repeat($this->barChar, $completeBars);
  35218. if ($completeBars < $this->barWidth) {
  35219. $bar .= $this->progressChar;
  35220. $bar .= str_repeat($this->emptyBarChar, $emptyBars);
  35221. }
  35222. $vars['bar'] = $bar;
  35223. }
  35224. if (isset($this->formatVars['elapsed'])) {
  35225. $elapsed = time() - $this->startTime;
  35226. $vars['elapsed'] = str_pad($this->humaneTime($elapsed), $this->widths['elapsed'], ' ', STR_PAD_LEFT);
  35227. }
  35228. if (isset($this->formatVars['current'])) {
  35229. $vars['current'] = str_pad($this->current, $this->widths['current'], ' ', STR_PAD_LEFT);
  35230. }
  35231. if (isset($this->formatVars['max'])) {
  35232. $vars['max'] = $this->max;
  35233. }
  35234. if (isset($this->formatVars['percent'])) {
  35235. $vars['percent'] = str_pad(floor($percent * 100), $this->widths['percent'], ' ', STR_PAD_LEFT);
  35236. }
  35237. return $vars;
  35238. }
  35239. private function humaneTime($secs)
  35240. {
  35241. $text = '';
  35242. foreach ($this->timeFormats as $format) {
  35243. if ($secs < $format[0]) {
  35244. if (2 == \count($format)) {
  35245. $text = $format[1];
  35246. break;
  35247. } else {
  35248. $text = ceil($secs / $format[2]).' '.$format[1];
  35249. break;
  35250. }
  35251. }
  35252. }
  35253. return $text;
  35254. }
  35255. private function overwrite(OutputInterface $output, $message)
  35256. {
  35257. $length = $this->strlen($message);
  35258. if (null !== $this->lastMessagesLength && $this->lastMessagesLength > $length) {
  35259. $message = str_pad($message, $this->lastMessagesLength, "\x20", STR_PAD_RIGHT);
  35260. }
  35261. $output->write("\x0D");
  35262. $output->write($message);
  35263. $this->lastMessagesLength = $this->strlen($message);
  35264. }
  35265. public function getName()
  35266. {
  35267. return 'progress';
  35268. }
  35269. }
  35270. <?php
  35271. namespace Symfony\Component\Console\Helper;
  35272. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35273. use Symfony\Component\Console\Exception\LogicException;
  35274. use Symfony\Component\Console\Output\OutputInterface;
  35275. class ProgressIndicator
  35276. {
  35277. private $output;
  35278. private $startTime;
  35279. private $format;
  35280. private $message;
  35281. private $indicatorValues;
  35282. private $indicatorCurrent;
  35283. private $indicatorChangeInterval;
  35284. private $indicatorUpdateTime;
  35285. private $started = false;
  35286. private static $formatters;
  35287. private static $formats;
  35288. public function __construct(OutputInterface $output, $format = null, $indicatorChangeInterval = 100, $indicatorValues = null)
  35289. {
  35290. $this->output = $output;
  35291. if (null === $format) {
  35292. $format = $this->determineBestFormat();
  35293. }
  35294. if (null === $indicatorValues) {
  35295. $indicatorValues = array('-', '\\', '|', '/');
  35296. }
  35297. $indicatorValues = array_values($indicatorValues);
  35298. if (2 > \count($indicatorValues)) {
  35299. throw new InvalidArgumentException('Must have at least 2 indicator value characters.');
  35300. }
  35301. $this->format = self::getFormatDefinition($format);
  35302. $this->indicatorChangeInterval = $indicatorChangeInterval;
  35303. $this->indicatorValues = $indicatorValues;
  35304. $this->startTime = time();
  35305. }
  35306. public function setMessage($message)
  35307. {
  35308. $this->message = $message;
  35309. $this->display();
  35310. }
  35311. public function getMessage()
  35312. {
  35313. return $this->message;
  35314. }
  35315. public function getStartTime()
  35316. {
  35317. return $this->startTime;
  35318. }
  35319. public function getCurrentValue()
  35320. {
  35321. return $this->indicatorValues[$this->indicatorCurrent % \count($this->indicatorValues)];
  35322. }
  35323. public function start($message)
  35324. {
  35325. if ($this->started) {
  35326. throw new LogicException('Progress indicator already started.');
  35327. }
  35328. $this->message = $message;
  35329. $this->started = true;
  35330. $this->startTime = time();
  35331. $this->indicatorUpdateTime = $this->getCurrentTimeInMilliseconds() + $this->indicatorChangeInterval;
  35332. $this->indicatorCurrent = 0;
  35333. $this->display();
  35334. }
  35335. public function advance()
  35336. {
  35337. if (!$this->started) {
  35338. throw new LogicException('Progress indicator has not yet been started.');
  35339. }
  35340. if (!$this->output->isDecorated()) {
  35341. return;
  35342. }
  35343. $currentTime = $this->getCurrentTimeInMilliseconds();
  35344. if ($currentTime < $this->indicatorUpdateTime) {
  35345. return;
  35346. }
  35347. $this->indicatorUpdateTime = $currentTime + $this->indicatorChangeInterval;
  35348. ++$this->indicatorCurrent;
  35349. $this->display();
  35350. }
  35351. public function finish($message)
  35352. {
  35353. if (!$this->started) {
  35354. throw new LogicException('Progress indicator has not yet been started.');
  35355. }
  35356. $this->message = $message;
  35357. $this->display();
  35358. $this->output->writeln('');
  35359. $this->started = false;
  35360. }
  35361. public static function getFormatDefinition($name)
  35362. {
  35363. if (!self::$formats) {
  35364. self::$formats = self::initFormats();
  35365. }
  35366. return isset(self::$formats[$name]) ? self::$formats[$name] : null;
  35367. }
  35368. public static function setPlaceholderFormatterDefinition($name, $callable)
  35369. {
  35370. if (!self::$formatters) {
  35371. self::$formatters = self::initPlaceholderFormatters();
  35372. }
  35373. self::$formatters[$name] = $callable;
  35374. }
  35375. public static function getPlaceholderFormatterDefinition($name)
  35376. {
  35377. if (!self::$formatters) {
  35378. self::$formatters = self::initPlaceholderFormatters();
  35379. }
  35380. return isset(self::$formatters[$name]) ? self::$formatters[$name] : null;
  35381. }
  35382. private function display()
  35383. {
  35384. if (OutputInterface::VERBOSITY_QUIET === $this->output->getVerbosity()) {
  35385. return;
  35386. }
  35387. $self = $this;
  35388. $this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) use ($self) {
  35389. if ($formatter = $self::getPlaceholderFormatterDefinition($matches[1])) {
  35390. return \call_user_func($formatter, $self);
  35391. }
  35392. return $matches[0];
  35393. }, $this->format));
  35394. }
  35395. private function determineBestFormat()
  35396. {
  35397. switch ($this->output->getVerbosity()) {
  35398. case OutputInterface::VERBOSITY_VERBOSE:
  35399. return $this->output->isDecorated() ? 'verbose' : 'verbose_no_ansi';
  35400. case OutputInterface::VERBOSITY_VERY_VERBOSE:
  35401. case OutputInterface::VERBOSITY_DEBUG:
  35402. return $this->output->isDecorated() ? 'very_verbose' : 'very_verbose_no_ansi';
  35403. default:
  35404. return $this->output->isDecorated() ? 'normal' : 'normal_no_ansi';
  35405. }
  35406. }
  35407. private function overwrite($message)
  35408. {
  35409. if ($this->output->isDecorated()) {
  35410. $this->output->write("\x0D\x1B[2K");
  35411. $this->output->write($message);
  35412. } else {
  35413. $this->output->writeln($message);
  35414. }
  35415. }
  35416. private function getCurrentTimeInMilliseconds()
  35417. {
  35418. return round(microtime(true) * 1000);
  35419. }
  35420. private static function initPlaceholderFormatters()
  35421. {
  35422. return array(
  35423. 'indicator' => function (ProgressIndicator $indicator) {
  35424. return $indicator->getCurrentValue();
  35425. },
  35426. 'message' => function (ProgressIndicator $indicator) {
  35427. return $indicator->getMessage();
  35428. },
  35429. 'elapsed' => function (ProgressIndicator $indicator) {
  35430. return Helper::formatTime(time() - $indicator->getStartTime());
  35431. },
  35432. 'memory' => function () {
  35433. return Helper::formatMemory(memory_get_usage(true));
  35434. },
  35435. );
  35436. }
  35437. private static function initFormats()
  35438. {
  35439. return array(
  35440. 'normal' => ' %indicator% %message%',
  35441. 'normal_no_ansi' => ' %message%',
  35442. 'verbose' => ' %indicator% %message% (%elapsed:6s%)',
  35443. 'verbose_no_ansi' => ' %message% (%elapsed:6s%)',
  35444. 'very_verbose' => ' %indicator% %message% (%elapsed:6s%, %memory:6s%)',
  35445. 'very_verbose_no_ansi' => ' %message% (%elapsed:6s%, %memory:6s%)',
  35446. );
  35447. }
  35448. }
  35449. <?php
  35450. namespace Symfony\Component\Console\Helper;
  35451. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35452. use Symfony\Component\Console\Exception\RuntimeException;
  35453. use Symfony\Component\Console\Formatter\OutputFormatter;
  35454. use Symfony\Component\Console\Formatter\OutputFormatterStyle;
  35455. use Symfony\Component\Console\Input\InputInterface;
  35456. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  35457. use Symfony\Component\Console\Output\OutputInterface;
  35458. use Symfony\Component\Console\Question\ChoiceQuestion;
  35459. use Symfony\Component\Console\Question\Question;
  35460. class QuestionHelper extends Helper
  35461. {
  35462. private $inputStream;
  35463. private static $shell;
  35464. private static $stty;
  35465. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35466. {
  35467. if ($output instanceof ConsoleOutputInterface) {
  35468. $output = $output->getErrorOutput();
  35469. }
  35470. if (!$input->isInteractive()) {
  35471. $default = $question->getDefault();
  35472. if (null !== $default && $question instanceof ChoiceQuestion) {
  35473. $choices = $question->getChoices();
  35474. if (!$question->isMultiselect()) {
  35475. return isset($choices[$default]) ? $choices[$default] : $default;
  35476. }
  35477. $default = explode(',', $default);
  35478. foreach ($default as $k => $v) {
  35479. $v = trim($v);
  35480. $default[$k] = isset($choices[$v]) ? $choices[$v] : $v;
  35481. }
  35482. }
  35483. return $default;
  35484. }
  35485. if (!$question->getValidator()) {
  35486. return $this->doAsk($output, $question);
  35487. }
  35488. $that = $this;
  35489. $interviewer = function () use ($output, $question, $that) {
  35490. return $that->doAsk($output, $question);
  35491. };
  35492. return $this->validateAttempts($interviewer, $output, $question);
  35493. }
  35494. public function setInputStream($stream)
  35495. {
  35496. if (!\is_resource($stream)) {
  35497. throw new InvalidArgumentException('Input stream must be a valid resource.');
  35498. }
  35499. $this->inputStream = $stream;
  35500. }
  35501. public function getInputStream()
  35502. {
  35503. return $this->inputStream;
  35504. }
  35505. public function getName()
  35506. {
  35507. return 'question';
  35508. }
  35509. public function doAsk(OutputInterface $output, Question $question)
  35510. {
  35511. $this->writePrompt($output, $question);
  35512. $inputStream = $this->inputStream ?: STDIN;
  35513. $autocomplete = $question->getAutocompleterValues();
  35514. if (null === $autocomplete || !$this->hasSttyAvailable()) {
  35515. $ret = false;
  35516. if ($question->isHidden()) {
  35517. try {
  35518. $ret = trim($this->getHiddenResponse($output, $inputStream));
  35519. } catch (RuntimeException $e) {
  35520. if (!$question->isHiddenFallback()) {
  35521. throw $e;
  35522. }
  35523. }
  35524. }
  35525. if (false === $ret) {
  35526. $ret = fgets($inputStream, 4096);
  35527. if (false === $ret) {
  35528. throw new RuntimeException('Aborted');
  35529. }
  35530. $ret = trim($ret);
  35531. }
  35532. } else {
  35533. $ret = trim($this->autocomplete($output, $question, $inputStream, \is_array($autocomplete) ? $autocomplete : iterator_to_array($autocomplete, false)));
  35534. }
  35535. $ret = \strlen($ret) > 0 ? $ret : $question->getDefault();
  35536. if ($normalizer = $question->getNormalizer()) {
  35537. return $normalizer($ret);
  35538. }
  35539. return $ret;
  35540. }
  35541. protected function writePrompt(OutputInterface $output, Question $question)
  35542. {
  35543. $message = $question->getQuestion();
  35544. if ($question instanceof ChoiceQuestion) {
  35545. $maxWidth = max(array_map(array($this, 'strlen'), array_keys($question->getChoices())));
  35546. $messages = (array) $question->getQuestion();
  35547. foreach ($question->getChoices() as $key => $value) {
  35548. $width = $maxWidth - $this->strlen($key);
  35549. $messages[] = ' [<info>'.$key.str_repeat(' ', $width).'</info>] '.$value;
  35550. }
  35551. $output->writeln($messages);
  35552. $message = $question->getPrompt();
  35553. }
  35554. $output->write($message);
  35555. }
  35556. protected function writeError(OutputInterface $output, \Exception $error)
  35557. {
  35558. if (null !== $this->getHelperSet() && $this->getHelperSet()->has('formatter')) {
  35559. $message = $this->getHelperSet()->get('formatter')->formatBlock($error->getMessage(), 'error');
  35560. } else {
  35561. $message = '<error>'.$error->getMessage().'</error>';
  35562. }
  35563. $output->writeln($message);
  35564. }
  35565. private function autocomplete(OutputInterface $output, Question $question, $inputStream, array $autocomplete)
  35566. {
  35567. $ret = '';
  35568. $i = 0;
  35569. $ofs = -1;
  35570. $matches = $autocomplete;
  35571. $numMatches = \count($matches);
  35572. $sttyMode = shell_exec('stty -g');
  35573. shell_exec('stty -icanon -echo');
  35574. $output->getFormatter()->setStyle('hl', new OutputFormatterStyle('black', 'white'));
  35575. while (!feof($inputStream)) {
  35576. $c = fread($inputStream, 1);
  35577. if ("\177" === $c) {
  35578. if (0 === $numMatches && 0 !== $i) {
  35579. --$i;
  35580. $output->write("\033[1D");
  35581. }
  35582. if (0 === $i) {
  35583. $ofs = -1;
  35584. $matches = $autocomplete;
  35585. $numMatches = \count($matches);
  35586. } else {
  35587. $numMatches = 0;
  35588. }
  35589. $ret = substr($ret, 0, $i);
  35590. } elseif ("\033" === $c) {
  35591. $c .= fread($inputStream, 2);
  35592. if (isset($c[2]) && ('A' === $c[2] || 'B' === $c[2])) {
  35593. if ('A' === $c[2] && -1 === $ofs) {
  35594. $ofs = 0;
  35595. }
  35596. if (0 === $numMatches) {
  35597. continue;
  35598. }
  35599. $ofs += ('A' === $c[2]) ? -1 : 1;
  35600. $ofs = ($numMatches + $ofs) % $numMatches;
  35601. }
  35602. } elseif (\ord($c) < 32) {
  35603. if ("\t" === $c || "\n" === $c) {
  35604. if ($numMatches > 0 && -1 !== $ofs) {
  35605. $ret = $matches[$ofs];
  35606. $output->write(substr($ret, $i));
  35607. $i = \strlen($ret);
  35608. }
  35609. if ("\n" === $c) {
  35610. $output->write($c);
  35611. break;
  35612. }
  35613. $numMatches = 0;
  35614. }
  35615. continue;
  35616. } else {
  35617. $output->write($c);
  35618. $ret .= $c;
  35619. ++$i;
  35620. $numMatches = 0;
  35621. $ofs = 0;
  35622. foreach ($autocomplete as $value) {
  35623. if (0 === strpos($value, $ret)) {
  35624. $matches[$numMatches++] = $value;
  35625. }
  35626. }
  35627. }
  35628. $output->write("\033[K");
  35629. if ($numMatches > 0 && -1 !== $ofs) {
  35630. $output->write("\0337");
  35631. $output->write('<hl>'.OutputFormatter::escapeTrailingBackslash(substr($matches[$ofs], $i)).'</hl>');
  35632. $output->write("\0338");
  35633. }
  35634. }
  35635. shell_exec(sprintf('stty %s', $sttyMode));
  35636. return $ret;
  35637. }
  35638. private function getHiddenResponse(OutputInterface $output, $inputStream)
  35639. {
  35640. if ('\\' === \DIRECTORY_SEPARATOR) {
  35641. $exe = __DIR__.'/../Resources/bin/hiddeninput.exe';
  35642. if ('phar:' === substr(__FILE__, 0, 5)) {
  35643. $tmpExe = sys_get_temp_dir().'/hiddeninput.exe';
  35644. copy($exe, $tmpExe);
  35645. $exe = $tmpExe;
  35646. }
  35647. $value = rtrim(shell_exec($exe));
  35648. $output->writeln('');
  35649. if (isset($tmpExe)) {
  35650. unlink($tmpExe);
  35651. }
  35652. return $value;
  35653. }
  35654. if ($this->hasSttyAvailable()) {
  35655. $sttyMode = shell_exec('stty -g');
  35656. shell_exec('stty -echo');
  35657. $value = fgets($inputStream, 4096);
  35658. shell_exec(sprintf('stty %s', $sttyMode));
  35659. if (false === $value) {
  35660. throw new RuntimeException('Aborted');
  35661. }
  35662. $value = trim($value);
  35663. $output->writeln('');
  35664. return $value;
  35665. }
  35666. if (false !== $shell = $this->getShell()) {
  35667. $readCmd = 'csh' === $shell ? 'set mypassword = $<' : 'read -r mypassword';
  35668. $command = sprintf("/usr/bin/env %s -c 'stty -echo; %s; stty echo; echo \$mypassword'", $shell, $readCmd);
  35669. $value = rtrim(shell_exec($command));
  35670. $output->writeln('');
  35671. return $value;
  35672. }
  35673. throw new RuntimeException('Unable to hide the response.');
  35674. }
  35675. private function validateAttempts($interviewer, OutputInterface $output, Question $question)
  35676. {
  35677. $error = null;
  35678. $attempts = $question->getMaxAttempts();
  35679. while (null === $attempts || $attempts--) {
  35680. if (null !== $error) {
  35681. $this->writeError($output, $error);
  35682. }
  35683. try {
  35684. return \call_user_func($question->getValidator(), $interviewer());
  35685. } catch (RuntimeException $e) {
  35686. throw $e;
  35687. } catch (\Exception $error) {
  35688. }
  35689. }
  35690. throw $error;
  35691. }
  35692. private function getShell()
  35693. {
  35694. if (null !== self::$shell) {
  35695. return self::$shell;
  35696. }
  35697. self::$shell = false;
  35698. if (file_exists('/usr/bin/env')) {
  35699. $test = "/usr/bin/env %s -c 'echo OK' 2> /dev/null";
  35700. foreach (array('bash', 'zsh', 'ksh', 'csh') as $sh) {
  35701. if ('OK' === rtrim(shell_exec(sprintf($test, $sh)))) {
  35702. self::$shell = $sh;
  35703. break;
  35704. }
  35705. }
  35706. }
  35707. return self::$shell;
  35708. }
  35709. private function hasSttyAvailable()
  35710. {
  35711. if (null !== self::$stty) {
  35712. return self::$stty;
  35713. }
  35714. exec('stty 2>&1', $output, $exitcode);
  35715. return self::$stty = 0 === $exitcode;
  35716. }
  35717. }
  35718. <?php
  35719. namespace Symfony\Component\Console\Helper;
  35720. use Symfony\Component\Console\Exception\LogicException;
  35721. use Symfony\Component\Console\Formatter\OutputFormatter;
  35722. use Symfony\Component\Console\Input\InputInterface;
  35723. use Symfony\Component\Console\Output\OutputInterface;
  35724. use Symfony\Component\Console\Question\ChoiceQuestion;
  35725. use Symfony\Component\Console\Question\ConfirmationQuestion;
  35726. use Symfony\Component\Console\Question\Question;
  35727. use Symfony\Component\Console\Style\SymfonyStyle;
  35728. class SymfonyQuestionHelper extends QuestionHelper
  35729. {
  35730. public function ask(InputInterface $input, OutputInterface $output, Question $question)
  35731. {
  35732. $validator = $question->getValidator();
  35733. $question->setValidator(function ($value) use ($validator) {
  35734. if (null !== $validator) {
  35735. $value = $validator($value);
  35736. } else {
  35737. if (!\is_array($value) && !\is_bool($value) && 0 === \strlen($value)) {
  35738. throw new LogicException('A value is required.');
  35739. }
  35740. }
  35741. return $value;
  35742. });
  35743. return parent::ask($input, $output, $question);
  35744. }
  35745. protected function writePrompt(OutputInterface $output, Question $question)
  35746. {
  35747. $text = OutputFormatter::escapeTrailingBackslash($question->getQuestion());
  35748. $default = $question->getDefault();
  35749. switch (true) {
  35750. case null === $default:
  35751. $text = sprintf(' <info>%s</info>:', $text);
  35752. break;
  35753. case $question instanceof ConfirmationQuestion:
  35754. $text = sprintf(' <info>%s (yes/no)</info> [<comment>%s</comment>]:', $text, $default ? 'yes' : 'no');
  35755. break;
  35756. case $question instanceof ChoiceQuestion && $question->isMultiselect():
  35757. $choices = $question->getChoices();
  35758. $default = explode(',', $default);
  35759. foreach ($default as $key => $value) {
  35760. $default[$key] = $choices[trim($value)];
  35761. }
  35762. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(implode(', ', $default)));
  35763. break;
  35764. case $question instanceof ChoiceQuestion:
  35765. $choices = $question->getChoices();
  35766. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape(isset($choices[$default]) ? $choices[$default] : $default));
  35767. break;
  35768. default:
  35769. $text = sprintf(' <info>%s</info> [<comment>%s</comment>]:', $text, OutputFormatter::escape($default));
  35770. }
  35771. $output->writeln($text);
  35772. if ($question instanceof ChoiceQuestion) {
  35773. $width = max(array_map('strlen', array_keys($question->getChoices())));
  35774. foreach ($question->getChoices() as $key => $value) {
  35775. $output->writeln(sprintf(" [<comment>%-${width}s</comment>] %s", $key, $value));
  35776. }
  35777. }
  35778. $output->write(' > ');
  35779. }
  35780. protected function writeError(OutputInterface $output, \Exception $error)
  35781. {
  35782. if ($output instanceof SymfonyStyle) {
  35783. $output->newLine();
  35784. $output->error($error->getMessage());
  35785. return;
  35786. }
  35787. parent::writeError($output, $error);
  35788. }
  35789. }
  35790. <?php
  35791. namespace Symfony\Component\Console\Helper;
  35792. use Symfony\Component\Console\Exception\InvalidArgumentException;
  35793. use Symfony\Component\Console\Output\OutputInterface;
  35794. class Table
  35795. {
  35796. private $headers = array();
  35797. private $rows = array();
  35798. private $columnWidths = array();
  35799. private $numberOfColumns;
  35800. private $output;
  35801. private $style;
  35802. private $columnStyles = array();
  35803. private static $styles;
  35804. public function __construct(OutputInterface $output)
  35805. {
  35806. $this->output = $output;
  35807. if (!self::$styles) {
  35808. self::$styles = self::initStyles();
  35809. }
  35810. $this->setStyle('default');
  35811. }
  35812. public static function setStyleDefinition($name, TableStyle $style)
  35813. {
  35814. if (!self::$styles) {
  35815. self::$styles = self::initStyles();
  35816. }
  35817. self::$styles[$name] = $style;
  35818. }
  35819. public static function getStyleDefinition($name)
  35820. {
  35821. if (!self::$styles) {
  35822. self::$styles = self::initStyles();
  35823. }
  35824. if (isset(self::$styles[$name])) {
  35825. return self::$styles[$name];
  35826. }
  35827. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  35828. }
  35829. public function setStyle($name)
  35830. {
  35831. $this->style = $this->resolveStyle($name);
  35832. return $this;
  35833. }
  35834. public function getStyle()
  35835. {
  35836. return $this->style;
  35837. }
  35838. public function setColumnStyle($columnIndex, $name)
  35839. {
  35840. $columnIndex = (int) $columnIndex;
  35841. $this->columnStyles[$columnIndex] = $this->resolveStyle($name);
  35842. return $this;
  35843. }
  35844. public function getColumnStyle($columnIndex)
  35845. {
  35846. if (isset($this->columnStyles[$columnIndex])) {
  35847. return $this->columnStyles[$columnIndex];
  35848. }
  35849. return $this->getStyle();
  35850. }
  35851. public function setHeaders(array $headers)
  35852. {
  35853. $headers = array_values($headers);
  35854. if (!empty($headers) && !\is_array($headers[0])) {
  35855. $headers = array($headers);
  35856. }
  35857. $this->headers = $headers;
  35858. return $this;
  35859. }
  35860. public function setRows(array $rows)
  35861. {
  35862. $this->rows = array();
  35863. return $this->addRows($rows);
  35864. }
  35865. public function addRows(array $rows)
  35866. {
  35867. foreach ($rows as $row) {
  35868. $this->addRow($row);
  35869. }
  35870. return $this;
  35871. }
  35872. public function addRow($row)
  35873. {
  35874. if ($row instanceof TableSeparator) {
  35875. $this->rows[] = $row;
  35876. return $this;
  35877. }
  35878. if (!\is_array($row)) {
  35879. throw new InvalidArgumentException('A row must be an array or a TableSeparator instance.');
  35880. }
  35881. $this->rows[] = array_values($row);
  35882. return $this;
  35883. }
  35884. public function setRow($column, array $row)
  35885. {
  35886. $this->rows[$column] = $row;
  35887. return $this;
  35888. }
  35889. public function render()
  35890. {
  35891. $this->calculateNumberOfColumns();
  35892. $rows = $this->buildTableRows($this->rows);
  35893. $headers = $this->buildTableRows($this->headers);
  35894. $this->calculateColumnsWidth(array_merge($headers, $rows));
  35895. $this->renderRowSeparator();
  35896. if (!empty($headers)) {
  35897. foreach ($headers as $header) {
  35898. $this->renderRow($header, $this->style->getCellHeaderFormat());
  35899. $this->renderRowSeparator();
  35900. }
  35901. }
  35902. foreach ($rows as $row) {
  35903. if ($row instanceof TableSeparator) {
  35904. $this->renderRowSeparator();
  35905. } else {
  35906. $this->renderRow($row, $this->style->getCellRowFormat());
  35907. }
  35908. }
  35909. if (!empty($rows)) {
  35910. $this->renderRowSeparator();
  35911. }
  35912. $this->cleanup();
  35913. }
  35914. private function renderRowSeparator()
  35915. {
  35916. if (0 === $count = $this->numberOfColumns) {
  35917. return;
  35918. }
  35919. if (!$this->style->getHorizontalBorderChar() && !$this->style->getCrossingChar()) {
  35920. return;
  35921. }
  35922. $markup = $this->style->getCrossingChar();
  35923. for ($column = 0; $column < $count; ++$column) {
  35924. $markup .= str_repeat($this->style->getHorizontalBorderChar(), $this->columnWidths[$column]).$this->style->getCrossingChar();
  35925. }
  35926. $this->output->writeln(sprintf($this->style->getBorderFormat(), $markup));
  35927. }
  35928. private function renderColumnSeparator()
  35929. {
  35930. return sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar());
  35931. }
  35932. private function renderRow(array $row, $cellFormat)
  35933. {
  35934. if (empty($row)) {
  35935. return;
  35936. }
  35937. $rowContent = $this->renderColumnSeparator();
  35938. foreach ($this->getRowColumns($row) as $column) {
  35939. $rowContent .= $this->renderCell($row, $column, $cellFormat);
  35940. $rowContent .= $this->renderColumnSeparator();
  35941. }
  35942. $this->output->writeln($rowContent);
  35943. }
  35944. private function renderCell(array $row, $column, $cellFormat)
  35945. {
  35946. $cell = isset($row[$column]) ? $row[$column] : '';
  35947. $width = $this->columnWidths[$column];
  35948. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  35949. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $nextColumn) {
  35950. $width += $this->getColumnSeparatorWidth() + $this->columnWidths[$nextColumn];
  35951. }
  35952. }
  35953. if (false !== $encoding = mb_detect_encoding($cell, null, true)) {
  35954. $width += \strlen($cell) - mb_strwidth($cell, $encoding);
  35955. }
  35956. $style = $this->getColumnStyle($column);
  35957. if ($cell instanceof TableSeparator) {
  35958. return sprintf($style->getBorderFormat(), str_repeat($style->getHorizontalBorderChar(), $width));
  35959. }
  35960. $width += Helper::strlen($cell) - Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  35961. $content = sprintf($style->getCellRowContentFormat(), $cell);
  35962. return sprintf($cellFormat, str_pad($content, $width, $style->getPaddingChar(), $style->getPadType()));
  35963. }
  35964. private function calculateNumberOfColumns()
  35965. {
  35966. if (null !== $this->numberOfColumns) {
  35967. return;
  35968. }
  35969. $columns = array(0);
  35970. foreach (array_merge($this->headers, $this->rows) as $row) {
  35971. if ($row instanceof TableSeparator) {
  35972. continue;
  35973. }
  35974. $columns[] = $this->getNumberOfColumns($row);
  35975. }
  35976. $this->numberOfColumns = max($columns);
  35977. }
  35978. private function buildTableRows($rows)
  35979. {
  35980. $unmergedRows = array();
  35981. for ($rowKey = 0; $rowKey < \count($rows); ++$rowKey) {
  35982. $rows = $this->fillNextRows($rows, $rowKey);
  35983. foreach ($rows[$rowKey] as $column => $cell) {
  35984. if (!strstr($cell, "\n")) {
  35985. continue;
  35986. }
  35987. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  35988. foreach ($lines as $lineKey => $line) {
  35989. if ($cell instanceof TableCell) {
  35990. $line = new TableCell($line, array('colspan' => $cell->getColspan()));
  35991. }
  35992. if (0 === $lineKey) {
  35993. $rows[$rowKey][$column] = $line;
  35994. } else {
  35995. $unmergedRows[$rowKey][$lineKey][$column] = $line;
  35996. }
  35997. }
  35998. }
  35999. }
  36000. $tableRows = array();
  36001. foreach ($rows as $rowKey => $row) {
  36002. $tableRows[] = $this->fillCells($row);
  36003. if (isset($unmergedRows[$rowKey])) {
  36004. $tableRows = array_merge($tableRows, $unmergedRows[$rowKey]);
  36005. }
  36006. }
  36007. return $tableRows;
  36008. }
  36009. private function fillNextRows(array $rows, $line)
  36010. {
  36011. $unmergedRows = array();
  36012. foreach ($rows[$line] as $column => $cell) {
  36013. if ($cell instanceof TableCell && $cell->getRowspan() > 1) {
  36014. $nbLines = $cell->getRowspan() - 1;
  36015. $lines = array($cell);
  36016. if (strstr($cell, "\n")) {
  36017. $lines = explode("\n", str_replace("\n", "<fg=default;bg=default>\n</>", $cell));
  36018. $nbLines = \count($lines) > $nbLines ? substr_count($cell, "\n") : $nbLines;
  36019. $rows[$line][$column] = new TableCell($lines[0], array('colspan' => $cell->getColspan()));
  36020. unset($lines[0]);
  36021. }
  36022. $unmergedRows = array_replace_recursive(array_fill($line + 1, $nbLines, array()), $unmergedRows);
  36023. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  36024. $value = isset($lines[$unmergedRowKey - $line]) ? $lines[$unmergedRowKey - $line] : '';
  36025. $unmergedRows[$unmergedRowKey][$column] = new TableCell($value, array('colspan' => $cell->getColspan()));
  36026. if ($nbLines === $unmergedRowKey - $line) {
  36027. break;
  36028. }
  36029. }
  36030. }
  36031. }
  36032. foreach ($unmergedRows as $unmergedRowKey => $unmergedRow) {
  36033. if (isset($rows[$unmergedRowKey]) && \is_array($rows[$unmergedRowKey]) && ($this->getNumberOfColumns($rows[$unmergedRowKey]) + $this->getNumberOfColumns($unmergedRows[$unmergedRowKey]) <= $this->numberOfColumns)) {
  36034. foreach ($unmergedRow as $cellKey => $cell) {
  36035. array_splice($rows[$unmergedRowKey], $cellKey, 0, array($cell));
  36036. }
  36037. } else {
  36038. $row = $this->copyRow($rows, $unmergedRowKey - 1);
  36039. foreach ($unmergedRow as $column => $cell) {
  36040. if (!empty($cell)) {
  36041. $row[$column] = $unmergedRow[$column];
  36042. }
  36043. }
  36044. array_splice($rows, $unmergedRowKey, 0, array($row));
  36045. }
  36046. }
  36047. return $rows;
  36048. }
  36049. private function fillCells($row)
  36050. {
  36051. $newRow = array();
  36052. foreach ($row as $column => $cell) {
  36053. $newRow[] = $cell;
  36054. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  36055. foreach (range($column + 1, $column + $cell->getColspan() - 1) as $position) {
  36056. $newRow[] = '';
  36057. }
  36058. }
  36059. }
  36060. return $newRow ?: $row;
  36061. }
  36062. private function copyRow(array $rows, $line)
  36063. {
  36064. $row = $rows[$line];
  36065. foreach ($row as $cellKey => $cellValue) {
  36066. $row[$cellKey] = '';
  36067. if ($cellValue instanceof TableCell) {
  36068. $row[$cellKey] = new TableCell('', array('colspan' => $cellValue->getColspan()));
  36069. }
  36070. }
  36071. return $row;
  36072. }
  36073. private function getNumberOfColumns(array $row)
  36074. {
  36075. $columns = \count($row);
  36076. foreach ($row as $column) {
  36077. $columns += $column instanceof TableCell ? ($column->getColspan() - 1) : 0;
  36078. }
  36079. return $columns;
  36080. }
  36081. private function getRowColumns(array $row)
  36082. {
  36083. $columns = range(0, $this->numberOfColumns - 1);
  36084. foreach ($row as $cellKey => $cell) {
  36085. if ($cell instanceof TableCell && $cell->getColspan() > 1) {
  36086. $columns = array_diff($columns, range($cellKey + 1, $cellKey + $cell->getColspan() - 1));
  36087. }
  36088. }
  36089. return $columns;
  36090. }
  36091. private function calculateColumnsWidth($rows)
  36092. {
  36093. for ($column = 0; $column < $this->numberOfColumns; ++$column) {
  36094. $lengths = array();
  36095. foreach ($rows as $row) {
  36096. if ($row instanceof TableSeparator) {
  36097. continue;
  36098. }
  36099. foreach ($row as $i => $cell) {
  36100. if ($cell instanceof TableCell) {
  36101. $textContent = Helper::removeDecoration($this->output->getFormatter(), $cell);
  36102. $textLength = Helper::strlen($textContent);
  36103. if ($textLength > 0) {
  36104. $contentColumns = str_split($textContent, ceil($textLength / $cell->getColspan()));
  36105. foreach ($contentColumns as $position => $content) {
  36106. $row[$i + $position] = $content;
  36107. }
  36108. }
  36109. }
  36110. }
  36111. $lengths[] = $this->getCellWidth($row, $column);
  36112. }
  36113. $this->columnWidths[$column] = max($lengths) + Helper::strlen($this->style->getCellRowContentFormat()) - 2;
  36114. }
  36115. }
  36116. private function getColumnSeparatorWidth()
  36117. {
  36118. return Helper::strlen(sprintf($this->style->getBorderFormat(), $this->style->getVerticalBorderChar()));
  36119. }
  36120. private function getCellWidth(array $row, $column)
  36121. {
  36122. if (isset($row[$column])) {
  36123. $cell = $row[$column];
  36124. $cellWidth = Helper::strlenWithoutDecoration($this->output->getFormatter(), $cell);
  36125. return $cellWidth;
  36126. }
  36127. return 0;
  36128. }
  36129. private function cleanup()
  36130. {
  36131. $this->columnWidths = array();
  36132. $this->numberOfColumns = null;
  36133. }
  36134. private static function initStyles()
  36135. {
  36136. $borderless = new TableStyle();
  36137. $borderless
  36138. ->setHorizontalBorderChar('=')
  36139. ->setVerticalBorderChar(' ')
  36140. ->setCrossingChar(' ')
  36141. ;
  36142. $compact = new TableStyle();
  36143. $compact
  36144. ->setHorizontalBorderChar('')
  36145. ->setVerticalBorderChar(' ')
  36146. ->setCrossingChar('')
  36147. ->setCellRowContentFormat('%s')
  36148. ;
  36149. $styleGuide = new TableStyle();
  36150. $styleGuide
  36151. ->setHorizontalBorderChar('-')
  36152. ->setVerticalBorderChar(' ')
  36153. ->setCrossingChar(' ')
  36154. ->setCellHeaderFormat('%s')
  36155. ;
  36156. return array(
  36157. 'default' => new TableStyle(),
  36158. 'borderless' => $borderless,
  36159. 'compact' => $compact,
  36160. 'symfony-style-guide' => $styleGuide,
  36161. );
  36162. }
  36163. private function resolveStyle($name)
  36164. {
  36165. if ($name instanceof TableStyle) {
  36166. return $name;
  36167. }
  36168. if (isset(self::$styles[$name])) {
  36169. return self::$styles[$name];
  36170. }
  36171. throw new InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
  36172. }
  36173. }
  36174. <?php
  36175. namespace Symfony\Component\Console\Helper;
  36176. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36177. class TableCell
  36178. {
  36179. private $value;
  36180. private $options = array(
  36181. 'rowspan' => 1,
  36182. 'colspan' => 1,
  36183. );
  36184. public function __construct($value = '', array $options = array())
  36185. {
  36186. if (is_numeric($value) && !\is_string($value)) {
  36187. $value = (string) $value;
  36188. }
  36189. $this->value = $value;
  36190. if ($diff = array_diff(array_keys($options), array_keys($this->options))) {
  36191. throw new InvalidArgumentException(sprintf('The TableCell does not support the following options: \'%s\'.', implode('\', \'', $diff)));
  36192. }
  36193. $this->options = array_merge($this->options, $options);
  36194. }
  36195. public function __toString()
  36196. {
  36197. return $this->value;
  36198. }
  36199. public function getColspan()
  36200. {
  36201. return (int) $this->options['colspan'];
  36202. }
  36203. public function getRowspan()
  36204. {
  36205. return (int) $this->options['rowspan'];
  36206. }
  36207. }
  36208. <?php
  36209. namespace Symfony\Component\Console\Helper;
  36210. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36211. use Symfony\Component\Console\Output\NullOutput;
  36212. use Symfony\Component\Console\Output\OutputInterface;
  36213. class TableHelper extends Helper
  36214. {
  36215. const LAYOUT_DEFAULT = 0;
  36216. const LAYOUT_BORDERLESS = 1;
  36217. const LAYOUT_COMPACT = 2;
  36218. private $table;
  36219. public function __construct($triggerDeprecationError = true)
  36220. {
  36221. if ($triggerDeprecationError) {
  36222. @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);
  36223. }
  36224. $this->table = new Table(new NullOutput());
  36225. }
  36226. public function setLayout($layout)
  36227. {
  36228. switch ($layout) {
  36229. case self::LAYOUT_BORDERLESS:
  36230. $this->table->setStyle('borderless');
  36231. break;
  36232. case self::LAYOUT_COMPACT:
  36233. $this->table->setStyle('compact');
  36234. break;
  36235. case self::LAYOUT_DEFAULT:
  36236. $this->table->setStyle('default');
  36237. break;
  36238. default:
  36239. throw new InvalidArgumentException(sprintf('Invalid table layout "%s".', $layout));
  36240. }
  36241. return $this;
  36242. }
  36243. public function setHeaders(array $headers)
  36244. {
  36245. $this->table->setHeaders($headers);
  36246. return $this;
  36247. }
  36248. public function setRows(array $rows)
  36249. {
  36250. $this->table->setRows($rows);
  36251. return $this;
  36252. }
  36253. public function addRows(array $rows)
  36254. {
  36255. $this->table->addRows($rows);
  36256. return $this;
  36257. }
  36258. public function addRow(array $row)
  36259. {
  36260. $this->table->addRow($row);
  36261. return $this;
  36262. }
  36263. public function setRow($column, array $row)
  36264. {
  36265. $this->table->setRow($column, $row);
  36266. return $this;
  36267. }
  36268. public function setPaddingChar($paddingChar)
  36269. {
  36270. $this->table->getStyle()->setPaddingChar($paddingChar);
  36271. return $this;
  36272. }
  36273. public function setHorizontalBorderChar($horizontalBorderChar)
  36274. {
  36275. $this->table->getStyle()->setHorizontalBorderChar($horizontalBorderChar);
  36276. return $this;
  36277. }
  36278. public function setVerticalBorderChar($verticalBorderChar)
  36279. {
  36280. $this->table->getStyle()->setVerticalBorderChar($verticalBorderChar);
  36281. return $this;
  36282. }
  36283. public function setCrossingChar($crossingChar)
  36284. {
  36285. $this->table->getStyle()->setCrossingChar($crossingChar);
  36286. return $this;
  36287. }
  36288. public function setCellHeaderFormat($cellHeaderFormat)
  36289. {
  36290. $this->table->getStyle()->setCellHeaderFormat($cellHeaderFormat);
  36291. return $this;
  36292. }
  36293. public function setCellRowFormat($cellRowFormat)
  36294. {
  36295. $this->table->getStyle()->setCellHeaderFormat($cellRowFormat);
  36296. return $this;
  36297. }
  36298. public function setCellRowContentFormat($cellRowContentFormat)
  36299. {
  36300. $this->table->getStyle()->setCellRowContentFormat($cellRowContentFormat);
  36301. return $this;
  36302. }
  36303. public function setBorderFormat($borderFormat)
  36304. {
  36305. $this->table->getStyle()->setBorderFormat($borderFormat);
  36306. return $this;
  36307. }
  36308. public function setPadType($padType)
  36309. {
  36310. $this->table->getStyle()->setPadType($padType);
  36311. return $this;
  36312. }
  36313. public function render(OutputInterface $output)
  36314. {
  36315. $p = new \ReflectionProperty($this->table, 'output');
  36316. $p->setAccessible(true);
  36317. $p->setValue($this->table, $output);
  36318. $this->table->render();
  36319. }
  36320. public function getName()
  36321. {
  36322. return 'table';
  36323. }
  36324. }
  36325. <?php
  36326. namespace Symfony\Component\Console\Helper;
  36327. class TableSeparator extends TableCell
  36328. {
  36329. public function __construct(array $options = array())
  36330. {
  36331. parent::__construct('', $options);
  36332. }
  36333. }
  36334. <?php
  36335. namespace Symfony\Component\Console\Helper;
  36336. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36337. use Symfony\Component\Console\Exception\LogicException;
  36338. class TableStyle
  36339. {
  36340. private $paddingChar = ' ';
  36341. private $horizontalBorderChar = '-';
  36342. private $verticalBorderChar = '|';
  36343. private $crossingChar = '+';
  36344. private $cellHeaderFormat = '<info>%s</info>';
  36345. private $cellRowFormat = '%s';
  36346. private $cellRowContentFormat = ' %s ';
  36347. private $borderFormat = '%s';
  36348. private $padType = STR_PAD_RIGHT;
  36349. public function setPaddingChar($paddingChar)
  36350. {
  36351. if (!$paddingChar) {
  36352. throw new LogicException('The padding char must not be empty');
  36353. }
  36354. $this->paddingChar = $paddingChar;
  36355. return $this;
  36356. }
  36357. public function getPaddingChar()
  36358. {
  36359. return $this->paddingChar;
  36360. }
  36361. public function setHorizontalBorderChar($horizontalBorderChar)
  36362. {
  36363. $this->horizontalBorderChar = $horizontalBorderChar;
  36364. return $this;
  36365. }
  36366. public function getHorizontalBorderChar()
  36367. {
  36368. return $this->horizontalBorderChar;
  36369. }
  36370. public function setVerticalBorderChar($verticalBorderChar)
  36371. {
  36372. $this->verticalBorderChar = $verticalBorderChar;
  36373. return $this;
  36374. }
  36375. public function getVerticalBorderChar()
  36376. {
  36377. return $this->verticalBorderChar;
  36378. }
  36379. public function setCrossingChar($crossingChar)
  36380. {
  36381. $this->crossingChar = $crossingChar;
  36382. return $this;
  36383. }
  36384. public function getCrossingChar()
  36385. {
  36386. return $this->crossingChar;
  36387. }
  36388. public function setCellHeaderFormat($cellHeaderFormat)
  36389. {
  36390. $this->cellHeaderFormat = $cellHeaderFormat;
  36391. return $this;
  36392. }
  36393. public function getCellHeaderFormat()
  36394. {
  36395. return $this->cellHeaderFormat;
  36396. }
  36397. public function setCellRowFormat($cellRowFormat)
  36398. {
  36399. $this->cellRowFormat = $cellRowFormat;
  36400. return $this;
  36401. }
  36402. public function getCellRowFormat()
  36403. {
  36404. return $this->cellRowFormat;
  36405. }
  36406. public function setCellRowContentFormat($cellRowContentFormat)
  36407. {
  36408. $this->cellRowContentFormat = $cellRowContentFormat;
  36409. return $this;
  36410. }
  36411. public function getCellRowContentFormat()
  36412. {
  36413. return $this->cellRowContentFormat;
  36414. }
  36415. public function setBorderFormat($borderFormat)
  36416. {
  36417. $this->borderFormat = $borderFormat;
  36418. return $this;
  36419. }
  36420. public function getBorderFormat()
  36421. {
  36422. return $this->borderFormat;
  36423. }
  36424. public function setPadType($padType)
  36425. {
  36426. if (!\in_array($padType, array(STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH), true)) {
  36427. throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
  36428. }
  36429. $this->padType = $padType;
  36430. return $this;
  36431. }
  36432. public function getPadType()
  36433. {
  36434. return $this->padType;
  36435. }
  36436. }
  36437. <?php
  36438. namespace Symfony\Component\Console\Input;
  36439. use Symfony\Component\Console\Exception\RuntimeException;
  36440. class ArgvInput extends Input
  36441. {
  36442. private $tokens;
  36443. private $parsed;
  36444. public function __construct(array $argv = null, InputDefinition $definition = null)
  36445. {
  36446. if (null === $argv) {
  36447. $argv = $_SERVER['argv'];
  36448. }
  36449. array_shift($argv);
  36450. $this->tokens = $argv;
  36451. parent::__construct($definition);
  36452. }
  36453. protected function setTokens(array $tokens)
  36454. {
  36455. $this->tokens = $tokens;
  36456. }
  36457. protected function parse()
  36458. {
  36459. $parseOptions = true;
  36460. $this->parsed = $this->tokens;
  36461. while (null !== $token = array_shift($this->parsed)) {
  36462. if ($parseOptions && '' == $token) {
  36463. $this->parseArgument($token);
  36464. } elseif ($parseOptions && '--' == $token) {
  36465. $parseOptions = false;
  36466. } elseif ($parseOptions && 0 === strpos($token, '--')) {
  36467. $this->parseLongOption($token);
  36468. } elseif ($parseOptions && '-' === $token[0] && '-' !== $token) {
  36469. $this->parseShortOption($token);
  36470. } else {
  36471. $this->parseArgument($token);
  36472. }
  36473. }
  36474. }
  36475. private function parseShortOption($token)
  36476. {
  36477. $name = substr($token, 1);
  36478. if (\strlen($name) > 1) {
  36479. if ($this->definition->hasShortcut($name[0]) && $this->definition->getOptionForShortcut($name[0])->acceptValue()) {
  36480. $this->addShortOption($name[0], substr($name, 1));
  36481. } else {
  36482. $this->parseShortOptionSet($name);
  36483. }
  36484. } else {
  36485. $this->addShortOption($name, null);
  36486. }
  36487. }
  36488. private function parseShortOptionSet($name)
  36489. {
  36490. $len = \strlen($name);
  36491. for ($i = 0; $i < $len; ++$i) {
  36492. if (!$this->definition->hasShortcut($name[$i])) {
  36493. $encoding = mb_detect_encoding($name, null, true);
  36494. throw new RuntimeException(sprintf('The "-%s" option does not exist.', false === $encoding ? $name[$i] : mb_substr($name, $i, 1, $encoding)));
  36495. }
  36496. $option = $this->definition->getOptionForShortcut($name[$i]);
  36497. if ($option->acceptValue()) {
  36498. $this->addLongOption($option->getName(), $i === $len - 1 ? null : substr($name, $i + 1));
  36499. break;
  36500. } else {
  36501. $this->addLongOption($option->getName(), null);
  36502. }
  36503. }
  36504. }
  36505. private function parseLongOption($token)
  36506. {
  36507. $name = substr($token, 2);
  36508. if (false !== $pos = strpos($name, '=')) {
  36509. if (0 === \strlen($value = substr($name, $pos + 1))) {
  36510. array_unshift($this->parsed, null);
  36511. }
  36512. $this->addLongOption(substr($name, 0, $pos), $value);
  36513. } else {
  36514. $this->addLongOption($name, null);
  36515. }
  36516. }
  36517. private function parseArgument($token)
  36518. {
  36519. $c = \count($this->arguments);
  36520. if ($this->definition->hasArgument($c)) {
  36521. $arg = $this->definition->getArgument($c);
  36522. $this->arguments[$arg->getName()] = $arg->isArray() ? array($token) : $token;
  36523. } elseif ($this->definition->hasArgument($c - 1) && $this->definition->getArgument($c - 1)->isArray()) {
  36524. $arg = $this->definition->getArgument($c - 1);
  36525. $this->arguments[$arg->getName()][] = $token;
  36526. } else {
  36527. $all = $this->definition->getArguments();
  36528. if (\count($all)) {
  36529. throw new RuntimeException(sprintf('Too many arguments, expected arguments "%s".', implode('" "', array_keys($all))));
  36530. }
  36531. throw new RuntimeException(sprintf('No arguments expected, got "%s".', $token));
  36532. }
  36533. }
  36534. private function addShortOption($shortcut, $value)
  36535. {
  36536. if (!$this->definition->hasShortcut($shortcut)) {
  36537. throw new RuntimeException(sprintf('The "-%s" option does not exist.', $shortcut));
  36538. }
  36539. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36540. }
  36541. private function addLongOption($name, $value)
  36542. {
  36543. if (!$this->definition->hasOption($name)) {
  36544. throw new RuntimeException(sprintf('The "--%s" option does not exist.', $name));
  36545. }
  36546. $option = $this->definition->getOption($name);
  36547. if (!isset($value[0])) {
  36548. $value = null;
  36549. }
  36550. if (null !== $value && !$option->acceptValue()) {
  36551. throw new RuntimeException(sprintf('The "--%s" option does not accept a value.', $name));
  36552. }
  36553. if (null === $value && $option->acceptValue() && \count($this->parsed)) {
  36554. $next = array_shift($this->parsed);
  36555. if (isset($next[0]) && '-' !== $next[0]) {
  36556. $value = $next;
  36557. } elseif (empty($next)) {
  36558. $value = null;
  36559. } else {
  36560. array_unshift($this->parsed, $next);
  36561. }
  36562. }
  36563. if (null === $value) {
  36564. if ($option->isValueRequired()) {
  36565. throw new RuntimeException(sprintf('The "--%s" option requires a value.', $name));
  36566. }
  36567. if (!$option->isArray()) {
  36568. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36569. }
  36570. }
  36571. if ($option->isArray()) {
  36572. $this->options[$name][] = $value;
  36573. } else {
  36574. $this->options[$name] = $value;
  36575. }
  36576. }
  36577. public function getFirstArgument()
  36578. {
  36579. foreach ($this->tokens as $token) {
  36580. if ($token && '-' === $token[0]) {
  36581. continue;
  36582. }
  36583. return $token;
  36584. }
  36585. }
  36586. public function hasParameterOption($values)
  36587. {
  36588. $values = (array) $values;
  36589. foreach ($this->tokens as $token) {
  36590. foreach ($values as $value) {
  36591. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36592. if ($token === $value || '' !== $leading && 0 === strpos($token, $leading)) {
  36593. return true;
  36594. }
  36595. }
  36596. }
  36597. return false;
  36598. }
  36599. public function getParameterOption($values, $default = false)
  36600. {
  36601. $values = (array) $values;
  36602. $tokens = $this->tokens;
  36603. while (0 < \count($tokens)) {
  36604. $token = array_shift($tokens);
  36605. foreach ($values as $value) {
  36606. if ($token === $value) {
  36607. return array_shift($tokens);
  36608. }
  36609. $leading = 0 === strpos($value, '--') ? $value.'=' : $value;
  36610. if ('' !== $leading && 0 === strpos($token, $leading)) {
  36611. return substr($token, \strlen($leading));
  36612. }
  36613. }
  36614. }
  36615. return $default;
  36616. }
  36617. public function __toString()
  36618. {
  36619. $self = $this;
  36620. $tokens = array_map(function ($token) use ($self) {
  36621. if (preg_match('{^(-[^=]+=)(.+)}', $token, $match)) {
  36622. return $match[1].$self->escapeToken($match[2]);
  36623. }
  36624. if ($token && '-' !== $token[0]) {
  36625. return $self->escapeToken($token);
  36626. }
  36627. return $token;
  36628. }, $this->tokens);
  36629. return implode(' ', $tokens);
  36630. }
  36631. }
  36632. <?php
  36633. namespace Symfony\Component\Console\Input;
  36634. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36635. use Symfony\Component\Console\Exception\InvalidOptionException;
  36636. class ArrayInput extends Input
  36637. {
  36638. private $parameters;
  36639. public function __construct(array $parameters, InputDefinition $definition = null)
  36640. {
  36641. $this->parameters = $parameters;
  36642. parent::__construct($definition);
  36643. }
  36644. public function getFirstArgument()
  36645. {
  36646. foreach ($this->parameters as $key => $value) {
  36647. if ($key && '-' === $key[0]) {
  36648. continue;
  36649. }
  36650. return $value;
  36651. }
  36652. }
  36653. public function hasParameterOption($values)
  36654. {
  36655. $values = (array) $values;
  36656. foreach ($this->parameters as $k => $v) {
  36657. if (!\is_int($k)) {
  36658. $v = $k;
  36659. }
  36660. if (\in_array($v, $values)) {
  36661. return true;
  36662. }
  36663. }
  36664. return false;
  36665. }
  36666. public function getParameterOption($values, $default = false)
  36667. {
  36668. $values = (array) $values;
  36669. foreach ($this->parameters as $k => $v) {
  36670. if (\is_int($k)) {
  36671. if (\in_array($v, $values)) {
  36672. return true;
  36673. }
  36674. } elseif (\in_array($k, $values)) {
  36675. return $v;
  36676. }
  36677. }
  36678. return $default;
  36679. }
  36680. public function __toString()
  36681. {
  36682. $params = array();
  36683. foreach ($this->parameters as $param => $val) {
  36684. if ($param && '-' === $param[0]) {
  36685. if (\is_array($val)) {
  36686. foreach ($val as $v) {
  36687. $params[] = $param.('' != $v ? '='.$this->escapeToken($v) : '');
  36688. }
  36689. } else {
  36690. $params[] = $param.('' != $val ? '='.$this->escapeToken($val) : '');
  36691. }
  36692. } else {
  36693. $params[] = \is_array($val) ? implode(' ', array_map(array($this, 'escapeToken'), $val)) : $this->escapeToken($val);
  36694. }
  36695. }
  36696. return implode(' ', $params);
  36697. }
  36698. protected function parse()
  36699. {
  36700. foreach ($this->parameters as $key => $value) {
  36701. if (0 === strpos($key, '--')) {
  36702. $this->addLongOption(substr($key, 2), $value);
  36703. } elseif ('-' === $key[0]) {
  36704. $this->addShortOption(substr($key, 1), $value);
  36705. } else {
  36706. $this->addArgument($key, $value);
  36707. }
  36708. }
  36709. }
  36710. private function addShortOption($shortcut, $value)
  36711. {
  36712. if (!$this->definition->hasShortcut($shortcut)) {
  36713. throw new InvalidOptionException(sprintf('The "-%s" option does not exist.', $shortcut));
  36714. }
  36715. $this->addLongOption($this->definition->getOptionForShortcut($shortcut)->getName(), $value);
  36716. }
  36717. private function addLongOption($name, $value)
  36718. {
  36719. if (!$this->definition->hasOption($name)) {
  36720. throw new InvalidOptionException(sprintf('The "--%s" option does not exist.', $name));
  36721. }
  36722. $option = $this->definition->getOption($name);
  36723. if (null === $value) {
  36724. if ($option->isValueRequired()) {
  36725. throw new InvalidOptionException(sprintf('The "--%s" option requires a value.', $name));
  36726. }
  36727. $value = $option->isValueOptional() ? $option->getDefault() : true;
  36728. }
  36729. $this->options[$name] = $value;
  36730. }
  36731. private function addArgument($name, $value)
  36732. {
  36733. if (!$this->definition->hasArgument($name)) {
  36734. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36735. }
  36736. $this->arguments[$name] = $value;
  36737. }
  36738. }
  36739. <?php
  36740. namespace Symfony\Component\Console\Input;
  36741. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36742. use Symfony\Component\Console\Exception\RuntimeException;
  36743. abstract class Input implements InputInterface
  36744. {
  36745. protected $definition;
  36746. protected $options = array();
  36747. protected $arguments = array();
  36748. protected $interactive = true;
  36749. public function __construct(InputDefinition $definition = null)
  36750. {
  36751. if (null === $definition) {
  36752. $this->definition = new InputDefinition();
  36753. } else {
  36754. $this->bind($definition);
  36755. $this->validate();
  36756. }
  36757. }
  36758. public function bind(InputDefinition $definition)
  36759. {
  36760. $this->arguments = array();
  36761. $this->options = array();
  36762. $this->definition = $definition;
  36763. $this->parse();
  36764. }
  36765. abstract protected function parse();
  36766. public function validate()
  36767. {
  36768. $definition = $this->definition;
  36769. $givenArguments = $this->arguments;
  36770. $missingArguments = array_filter(array_keys($definition->getArguments()), function ($argument) use ($definition, $givenArguments) {
  36771. return !array_key_exists($argument, $givenArguments) && $definition->getArgument($argument)->isRequired();
  36772. });
  36773. if (\count($missingArguments) > 0) {
  36774. throw new RuntimeException(sprintf('Not enough arguments (missing: "%s").', implode(', ', $missingArguments)));
  36775. }
  36776. }
  36777. public function isInteractive()
  36778. {
  36779. return $this->interactive;
  36780. }
  36781. public function setInteractive($interactive)
  36782. {
  36783. $this->interactive = (bool) $interactive;
  36784. }
  36785. public function getArguments()
  36786. {
  36787. return array_merge($this->definition->getArgumentDefaults(), $this->arguments);
  36788. }
  36789. public function getArgument($name)
  36790. {
  36791. if (!$this->definition->hasArgument($name)) {
  36792. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36793. }
  36794. return isset($this->arguments[$name]) ? $this->arguments[$name] : $this->definition->getArgument($name)->getDefault();
  36795. }
  36796. public function setArgument($name, $value)
  36797. {
  36798. if (!$this->definition->hasArgument($name)) {
  36799. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36800. }
  36801. $this->arguments[$name] = $value;
  36802. }
  36803. public function hasArgument($name)
  36804. {
  36805. return $this->definition->hasArgument($name);
  36806. }
  36807. public function getOptions()
  36808. {
  36809. return array_merge($this->definition->getOptionDefaults(), $this->options);
  36810. }
  36811. public function getOption($name)
  36812. {
  36813. if (!$this->definition->hasOption($name)) {
  36814. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36815. }
  36816. return isset($this->options[$name]) ? $this->options[$name] : $this->definition->getOption($name)->getDefault();
  36817. }
  36818. public function setOption($name, $value)
  36819. {
  36820. if (!$this->definition->hasOption($name)) {
  36821. throw new InvalidArgumentException(sprintf('The "%s" option does not exist.', $name));
  36822. }
  36823. $this->options[$name] = $value;
  36824. }
  36825. public function hasOption($name)
  36826. {
  36827. return $this->definition->hasOption($name);
  36828. }
  36829. public function escapeToken($token)
  36830. {
  36831. return preg_match('{^[\w-]+$}', $token) ? $token : escapeshellarg($token);
  36832. }
  36833. }
  36834. <?php
  36835. namespace Symfony\Component\Console\Input;
  36836. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36837. use Symfony\Component\Console\Exception\LogicException;
  36838. class InputArgument
  36839. {
  36840. const REQUIRED = 1;
  36841. const OPTIONAL = 2;
  36842. const IS_ARRAY = 4;
  36843. private $name;
  36844. private $mode;
  36845. private $default;
  36846. private $description;
  36847. public function __construct($name, $mode = null, $description = '', $default = null)
  36848. {
  36849. if (null === $mode) {
  36850. $mode = self::OPTIONAL;
  36851. } elseif (!\is_int($mode) || $mode > 7 || $mode < 1) {
  36852. throw new InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
  36853. }
  36854. $this->name = $name;
  36855. $this->mode = $mode;
  36856. $this->description = $description;
  36857. $this->setDefault($default);
  36858. }
  36859. public function getName()
  36860. {
  36861. return $this->name;
  36862. }
  36863. public function isRequired()
  36864. {
  36865. return self::REQUIRED === (self::REQUIRED & $this->mode);
  36866. }
  36867. public function isArray()
  36868. {
  36869. return self::IS_ARRAY === (self::IS_ARRAY & $this->mode);
  36870. }
  36871. public function setDefault($default = null)
  36872. {
  36873. if (self::REQUIRED === $this->mode && null !== $default) {
  36874. throw new LogicException('Cannot set a default value except for InputArgument::OPTIONAL mode.');
  36875. }
  36876. if ($this->isArray()) {
  36877. if (null === $default) {
  36878. $default = array();
  36879. } elseif (!\is_array($default)) {
  36880. throw new LogicException('A default value for an array argument must be an array.');
  36881. }
  36882. }
  36883. $this->default = $default;
  36884. }
  36885. public function getDefault()
  36886. {
  36887. return $this->default;
  36888. }
  36889. public function getDescription()
  36890. {
  36891. return $this->description;
  36892. }
  36893. }
  36894. <?php
  36895. namespace Symfony\Component\Console\Input;
  36896. interface InputAwareInterface
  36897. {
  36898. public function setInput(InputInterface $input);
  36899. }
  36900. <?php
  36901. namespace Symfony\Component\Console\Input;
  36902. use Symfony\Component\Console\Descriptor\TextDescriptor;
  36903. use Symfony\Component\Console\Descriptor\XmlDescriptor;
  36904. use Symfony\Component\Console\Exception\InvalidArgumentException;
  36905. use Symfony\Component\Console\Exception\LogicException;
  36906. use Symfony\Component\Console\Output\BufferedOutput;
  36907. class InputDefinition
  36908. {
  36909. private $arguments;
  36910. private $requiredCount;
  36911. private $hasAnArrayArgument = false;
  36912. private $hasOptional;
  36913. private $options;
  36914. private $shortcuts;
  36915. public function __construct(array $definition = array())
  36916. {
  36917. $this->setDefinition($definition);
  36918. }
  36919. public function setDefinition(array $definition)
  36920. {
  36921. $arguments = array();
  36922. $options = array();
  36923. foreach ($definition as $item) {
  36924. if ($item instanceof InputOption) {
  36925. $options[] = $item;
  36926. } else {
  36927. $arguments[] = $item;
  36928. }
  36929. }
  36930. $this->setArguments($arguments);
  36931. $this->setOptions($options);
  36932. }
  36933. public function setArguments($arguments = array())
  36934. {
  36935. $this->arguments = array();
  36936. $this->requiredCount = 0;
  36937. $this->hasOptional = false;
  36938. $this->hasAnArrayArgument = false;
  36939. $this->addArguments($arguments);
  36940. }
  36941. public function addArguments($arguments = array())
  36942. {
  36943. if (null !== $arguments) {
  36944. foreach ($arguments as $argument) {
  36945. $this->addArgument($argument);
  36946. }
  36947. }
  36948. }
  36949. public function addArgument(InputArgument $argument)
  36950. {
  36951. if (isset($this->arguments[$argument->getName()])) {
  36952. throw new LogicException(sprintf('An argument with name "%s" already exists.', $argument->getName()));
  36953. }
  36954. if ($this->hasAnArrayArgument) {
  36955. throw new LogicException('Cannot add an argument after an array argument.');
  36956. }
  36957. if ($argument->isRequired() && $this->hasOptional) {
  36958. throw new LogicException('Cannot add a required argument after an optional one.');
  36959. }
  36960. if ($argument->isArray()) {
  36961. $this->hasAnArrayArgument = true;
  36962. }
  36963. if ($argument->isRequired()) {
  36964. ++$this->requiredCount;
  36965. } else {
  36966. $this->hasOptional = true;
  36967. }
  36968. $this->arguments[$argument->getName()] = $argument;
  36969. }
  36970. public function getArgument($name)
  36971. {
  36972. if (!$this->hasArgument($name)) {
  36973. throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
  36974. }
  36975. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36976. return $arguments[$name];
  36977. }
  36978. public function hasArgument($name)
  36979. {
  36980. $arguments = \is_int($name) ? array_values($this->arguments) : $this->arguments;
  36981. return isset($arguments[$name]);
  36982. }
  36983. public function getArguments()
  36984. {
  36985. return $this->arguments;
  36986. }
  36987. public function getArgumentCount()
  36988. {
  36989. return $this->hasAnArrayArgument ? PHP_INT_MAX : \count($this->arguments);
  36990. }
  36991. public function getArgumentRequiredCount()
  36992. {
  36993. return $this->requiredCount;
  36994. }
  36995. public function getArgumentDefaults()
  36996. {
  36997. $values = array();
  36998. foreach ($this->arguments as $argument) {
  36999. $values[$argument->getName()] = $argument->getDefault();
  37000. }
  37001. return $values;
  37002. }
  37003. public function setOptions($options = array())
  37004. {
  37005. $this->options = array();
  37006. $this->shortcuts = array();
  37007. $this->addOptions($options);
  37008. }
  37009. public function addOptions($options = array())
  37010. {
  37011. foreach ($options as $option) {
  37012. $this->addOption($option);
  37013. }
  37014. }
  37015. public function addOption(InputOption $option)
  37016. {
  37017. if (isset($this->options[$option->getName()]) && !$option->equals($this->options[$option->getName()])) {
  37018. throw new LogicException(sprintf('An option named "%s" already exists.', $option->getName()));
  37019. }
  37020. if ($option->getShortcut()) {
  37021. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  37022. if (isset($this->shortcuts[$shortcut]) && !$option->equals($this->options[$this->shortcuts[$shortcut]])) {
  37023. throw new LogicException(sprintf('An option with shortcut "%s" already exists.', $shortcut));
  37024. }
  37025. }
  37026. }
  37027. $this->options[$option->getName()] = $option;
  37028. if ($option->getShortcut()) {
  37029. foreach (explode('|', $option->getShortcut()) as $shortcut) {
  37030. $this->shortcuts[$shortcut] = $option->getName();
  37031. }
  37032. }
  37033. }
  37034. public function getOption($name)
  37035. {
  37036. if (!$this->hasOption($name)) {
  37037. throw new InvalidArgumentException(sprintf('The "--%s" option does not exist.', $name));
  37038. }
  37039. return $this->options[$name];
  37040. }
  37041. public function hasOption($name)
  37042. {
  37043. return isset($this->options[$name]);
  37044. }
  37045. public function getOptions()
  37046. {
  37047. return $this->options;
  37048. }
  37049. public function hasShortcut($name)
  37050. {
  37051. return isset($this->shortcuts[$name]);
  37052. }
  37053. public function getOptionForShortcut($shortcut)
  37054. {
  37055. return $this->getOption($this->shortcutToName($shortcut));
  37056. }
  37057. public function getOptionDefaults()
  37058. {
  37059. $values = array();
  37060. foreach ($this->options as $option) {
  37061. $values[$option->getName()] = $option->getDefault();
  37062. }
  37063. return $values;
  37064. }
  37065. private function shortcutToName($shortcut)
  37066. {
  37067. if (!isset($this->shortcuts[$shortcut])) {
  37068. throw new InvalidArgumentException(sprintf('The "-%s" option does not exist.', $shortcut));
  37069. }
  37070. return $this->shortcuts[$shortcut];
  37071. }
  37072. public function getSynopsis($short = false)
  37073. {
  37074. $elements = array();
  37075. if ($short && $this->getOptions()) {
  37076. $elements[] = '[options]';
  37077. } elseif (!$short) {
  37078. foreach ($this->getOptions() as $option) {
  37079. $value = '';
  37080. if ($option->acceptValue()) {
  37081. $value = sprintf(
  37082. ' %s%s%s',
  37083. $option->isValueOptional() ? '[' : '',
  37084. strtoupper($option->getName()),
  37085. $option->isValueOptional() ? ']' : ''
  37086. );
  37087. }
  37088. $shortcut = $option->getShortcut() ? sprintf('-%s|', $option->getShortcut()) : '';
  37089. $elements[] = sprintf('[%s--%s%s]', $shortcut, $option->getName(), $value);
  37090. }
  37091. }
  37092. if (\count($elements) && $this->getArguments()) {
  37093. $elements[] = '[--]';
  37094. }
  37095. foreach ($this->getArguments() as $argument) {
  37096. $element = '<'.$argument->getName().'>';
  37097. if (!$argument->isRequired()) {
  37098. $element = '['.$element.']';
  37099. } elseif ($argument->isArray()) {
  37100. $element .= ' ('.$element.')';
  37101. }
  37102. if ($argument->isArray()) {
  37103. $element .= '...';
  37104. }
  37105. $elements[] = $element;
  37106. }
  37107. return implode(' ', $elements);
  37108. }
  37109. public function asText()
  37110. {
  37111. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37112. $descriptor = new TextDescriptor();
  37113. $output = new BufferedOutput(BufferedOutput::VERBOSITY_NORMAL, true);
  37114. $descriptor->describe($output, $this, array('raw_output' => true));
  37115. return $output->fetch();
  37116. }
  37117. public function asXml($asDom = false)
  37118. {
  37119. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.3 and will be removed in 3.0.', E_USER_DEPRECATED);
  37120. $descriptor = new XmlDescriptor();
  37121. if ($asDom) {
  37122. return $descriptor->getInputDefinitionDocument($this);
  37123. }
  37124. $output = new BufferedOutput();
  37125. $descriptor->describe($output, $this);
  37126. return $output->fetch();
  37127. }
  37128. }
  37129. <?php
  37130. namespace Symfony\Component\Console\Input;
  37131. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37132. use Symfony\Component\Console\Exception\RuntimeException;
  37133. interface InputInterface
  37134. {
  37135. public function getFirstArgument();
  37136. public function hasParameterOption($values);
  37137. public function getParameterOption($values, $default = false);
  37138. public function bind(InputDefinition $definition);
  37139. public function validate();
  37140. public function getArguments();
  37141. public function getArgument($name);
  37142. public function setArgument($name, $value);
  37143. public function hasArgument($name);
  37144. public function getOptions();
  37145. public function getOption($name);
  37146. public function setOption($name, $value);
  37147. public function hasOption($name);
  37148. public function isInteractive();
  37149. public function setInteractive($interactive);
  37150. }
  37151. <?php
  37152. namespace Symfony\Component\Console\Input;
  37153. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37154. use Symfony\Component\Console\Exception\LogicException;
  37155. class InputOption
  37156. {
  37157. const VALUE_NONE = 1;
  37158. const VALUE_REQUIRED = 2;
  37159. const VALUE_OPTIONAL = 4;
  37160. const VALUE_IS_ARRAY = 8;
  37161. private $name;
  37162. private $shortcut;
  37163. private $mode;
  37164. private $default;
  37165. private $description;
  37166. public function __construct($name, $shortcut = null, $mode = null, $description = '', $default = null)
  37167. {
  37168. if (0 === strpos($name, '--')) {
  37169. $name = substr($name, 2);
  37170. }
  37171. if (empty($name)) {
  37172. throw new InvalidArgumentException('An option name cannot be empty.');
  37173. }
  37174. if (empty($shortcut)) {
  37175. $shortcut = null;
  37176. }
  37177. if (null !== $shortcut) {
  37178. if (\is_array($shortcut)) {
  37179. $shortcut = implode('|', $shortcut);
  37180. }
  37181. $shortcuts = preg_split('{(\|)-?}', ltrim($shortcut, '-'));
  37182. $shortcuts = array_filter($shortcuts);
  37183. $shortcut = implode('|', $shortcuts);
  37184. if (empty($shortcut)) {
  37185. throw new InvalidArgumentException('An option shortcut cannot be empty.');
  37186. }
  37187. }
  37188. if (null === $mode) {
  37189. $mode = self::VALUE_NONE;
  37190. } elseif (!\is_int($mode) || $mode > 15 || $mode < 1) {
  37191. throw new InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
  37192. }
  37193. $this->name = $name;
  37194. $this->shortcut = $shortcut;
  37195. $this->mode = $mode;
  37196. $this->description = $description;
  37197. if ($this->isArray() && !$this->acceptValue()) {
  37198. throw new InvalidArgumentException('Impossible to have an option mode VALUE_IS_ARRAY if the option does not accept a value.');
  37199. }
  37200. $this->setDefault($default);
  37201. }
  37202. public function getShortcut()
  37203. {
  37204. return $this->shortcut;
  37205. }
  37206. public function getName()
  37207. {
  37208. return $this->name;
  37209. }
  37210. public function acceptValue()
  37211. {
  37212. return $this->isValueRequired() || $this->isValueOptional();
  37213. }
  37214. public function isValueRequired()
  37215. {
  37216. return self::VALUE_REQUIRED === (self::VALUE_REQUIRED & $this->mode);
  37217. }
  37218. public function isValueOptional()
  37219. {
  37220. return self::VALUE_OPTIONAL === (self::VALUE_OPTIONAL & $this->mode);
  37221. }
  37222. public function isArray()
  37223. {
  37224. return self::VALUE_IS_ARRAY === (self::VALUE_IS_ARRAY & $this->mode);
  37225. }
  37226. public function setDefault($default = null)
  37227. {
  37228. if (self::VALUE_NONE === (self::VALUE_NONE & $this->mode) && null !== $default) {
  37229. throw new LogicException('Cannot set a default value when using InputOption::VALUE_NONE mode.');
  37230. }
  37231. if ($this->isArray()) {
  37232. if (null === $default) {
  37233. $default = array();
  37234. } elseif (!\is_array($default)) {
  37235. throw new LogicException('A default value for an array option must be an array.');
  37236. }
  37237. }
  37238. $this->default = $this->acceptValue() ? $default : false;
  37239. }
  37240. public function getDefault()
  37241. {
  37242. return $this->default;
  37243. }
  37244. public function getDescription()
  37245. {
  37246. return $this->description;
  37247. }
  37248. public function equals(self $option)
  37249. {
  37250. return $option->getName() === $this->getName()
  37251. && $option->getShortcut() === $this->getShortcut()
  37252. && $option->getDefault() === $this->getDefault()
  37253. && $option->isArray() === $this->isArray()
  37254. && $option->isValueRequired() === $this->isValueRequired()
  37255. && $option->isValueOptional() === $this->isValueOptional()
  37256. ;
  37257. }
  37258. }
  37259. <?php
  37260. namespace Symfony\Component\Console\Input;
  37261. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37262. class StringInput extends ArgvInput
  37263. {
  37264. const REGEX_STRING = '([^\s]+?)(?:\s|(?<!\\\\)"|(?<!\\\\)\'|$)';
  37265. const REGEX_QUOTED_STRING = '(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"|\'([^\'\\\\]*(?:\\\\.[^\'\\\\]*)*)\')';
  37266. public function __construct($input, InputDefinition $definition = null)
  37267. {
  37268. if ($definition) {
  37269. @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);
  37270. }
  37271. parent::__construct(array(), null);
  37272. $this->setTokens($this->tokenize($input));
  37273. if (null !== $definition) {
  37274. $this->bind($definition);
  37275. }
  37276. }
  37277. private function tokenize($input)
  37278. {
  37279. $tokens = array();
  37280. $length = \strlen($input);
  37281. $cursor = 0;
  37282. while ($cursor < $length) {
  37283. if (preg_match('/\s+/A', $input, $match, null, $cursor)) {
  37284. } elseif (preg_match('/([^="\'\s]+?)(=?)('.self::REGEX_QUOTED_STRING.'+)/A', $input, $match, null, $cursor)) {
  37285. $tokens[] = $match[1].$match[2].stripcslashes(str_replace(array('"\'', '\'"', '\'\'', '""'), '', substr($match[3], 1, \strlen($match[3]) - 2)));
  37286. } elseif (preg_match('/'.self::REGEX_QUOTED_STRING.'/A', $input, $match, null, $cursor)) {
  37287. $tokens[] = stripcslashes(substr($match[0], 1, \strlen($match[0]) - 2));
  37288. } elseif (preg_match('/'.self::REGEX_STRING.'/A', $input, $match, null, $cursor)) {
  37289. $tokens[] = stripcslashes($match[1]);
  37290. } else {
  37291. throw new InvalidArgumentException(sprintf('Unable to parse input near "... %s ..."', substr($input, $cursor, 10)));
  37292. }
  37293. $cursor += \strlen($match[0]);
  37294. }
  37295. return $tokens;
  37296. }
  37297. }
  37298. Copyright (c) 2004-2018 Fabien Potencier
  37299. Permission is hereby granted, free of charge, to any person obtaining a copy
  37300. of this software and associated documentation files (the "Software"), to deal
  37301. in the Software without restriction, including without limitation the rights
  37302. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  37303. copies of the Software, and to permit persons to whom the Software is furnished
  37304. to do so, subject to the following conditions:
  37305. The above copyright notice and this permission notice shall be included in all
  37306. copies or substantial portions of the Software.
  37307. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  37308. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  37309. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  37310. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  37311. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  37312. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  37313. THE SOFTWARE.
  37314. <?php
  37315. namespace Symfony\Component\Console\Logger;
  37316. use Psr\Log\AbstractLogger;
  37317. use Psr\Log\InvalidArgumentException;
  37318. use Psr\Log\LogLevel;
  37319. use Symfony\Component\Console\Output\ConsoleOutputInterface;
  37320. use Symfony\Component\Console\Output\OutputInterface;
  37321. class ConsoleLogger extends AbstractLogger
  37322. {
  37323. const INFO = 'info';
  37324. const ERROR = 'error';
  37325. private $output;
  37326. private $verbosityLevelMap = array(
  37327. LogLevel::EMERGENCY => OutputInterface::VERBOSITY_NORMAL,
  37328. LogLevel::ALERT => OutputInterface::VERBOSITY_NORMAL,
  37329. LogLevel::CRITICAL => OutputInterface::VERBOSITY_NORMAL,
  37330. LogLevel::ERROR => OutputInterface::VERBOSITY_NORMAL,
  37331. LogLevel::WARNING => OutputInterface::VERBOSITY_NORMAL,
  37332. LogLevel::NOTICE => OutputInterface::VERBOSITY_VERBOSE,
  37333. LogLevel::INFO => OutputInterface::VERBOSITY_VERY_VERBOSE,
  37334. LogLevel::DEBUG => OutputInterface::VERBOSITY_DEBUG,
  37335. );
  37336. private $formatLevelMap = array(
  37337. LogLevel::EMERGENCY => self::ERROR,
  37338. LogLevel::ALERT => self::ERROR,
  37339. LogLevel::CRITICAL => self::ERROR,
  37340. LogLevel::ERROR => self::ERROR,
  37341. LogLevel::WARNING => self::INFO,
  37342. LogLevel::NOTICE => self::INFO,
  37343. LogLevel::INFO => self::INFO,
  37344. LogLevel::DEBUG => self::INFO,
  37345. );
  37346. public function __construct(OutputInterface $output, array $verbosityLevelMap = array(), array $formatLevelMap = array())
  37347. {
  37348. $this->output = $output;
  37349. $this->verbosityLevelMap = $verbosityLevelMap + $this->verbosityLevelMap;
  37350. $this->formatLevelMap = $formatLevelMap + $this->formatLevelMap;
  37351. }
  37352. public function log($level, $message, array $context = array())
  37353. {
  37354. if (!isset($this->verbosityLevelMap[$level])) {
  37355. throw new InvalidArgumentException(sprintf('The log level "%s" does not exist.', $level));
  37356. }
  37357. if (self::ERROR === $this->formatLevelMap[$level] && $this->output instanceof ConsoleOutputInterface) {
  37358. $output = $this->output->getErrorOutput();
  37359. } else {
  37360. $output = $this->output;
  37361. }
  37362. if ($output->getVerbosity() >= $this->verbosityLevelMap[$level]) {
  37363. $output->writeln(sprintf('<%1$s>[%2$s] %3$s</%1$s>', $this->formatLevelMap[$level], $level, $this->interpolate($message, $context)));
  37364. }
  37365. }
  37366. private function interpolate($message, array $context)
  37367. {
  37368. $replace = array();
  37369. foreach ($context as $key => $val) {
  37370. if (!\is_array($val) && (!\is_object($val) || method_exists($val, '__toString'))) {
  37371. $replace[sprintf('{%s}', $key)] = $val;
  37372. }
  37373. }
  37374. return strtr($message, $replace);
  37375. }
  37376. }
  37377. <?php
  37378. namespace Symfony\Component\Console\Output;
  37379. class BufferedOutput extends Output
  37380. {
  37381. private $buffer = '';
  37382. public function fetch()
  37383. {
  37384. $content = $this->buffer;
  37385. $this->buffer = '';
  37386. return $content;
  37387. }
  37388. protected function doWrite($message, $newline)
  37389. {
  37390. $this->buffer .= $message;
  37391. if ($newline) {
  37392. $this->buffer .= PHP_EOL;
  37393. }
  37394. }
  37395. }
  37396. <?php
  37397. namespace Symfony\Component\Console\Output;
  37398. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37399. class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
  37400. {
  37401. private $stderr;
  37402. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37403. {
  37404. parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
  37405. $actualDecorated = $this->isDecorated();
  37406. $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
  37407. if (null === $decorated) {
  37408. $this->setDecorated($actualDecorated && $this->stderr->isDecorated());
  37409. }
  37410. }
  37411. public function setDecorated($decorated)
  37412. {
  37413. parent::setDecorated($decorated);
  37414. $this->stderr->setDecorated($decorated);
  37415. }
  37416. public function setFormatter(OutputFormatterInterface $formatter)
  37417. {
  37418. parent::setFormatter($formatter);
  37419. $this->stderr->setFormatter($formatter);
  37420. }
  37421. public function setVerbosity($level)
  37422. {
  37423. parent::setVerbosity($level);
  37424. $this->stderr->setVerbosity($level);
  37425. }
  37426. public function getErrorOutput()
  37427. {
  37428. return $this->stderr;
  37429. }
  37430. public function setErrorOutput(OutputInterface $error)
  37431. {
  37432. $this->stderr = $error;
  37433. }
  37434. protected function hasStdoutSupport()
  37435. {
  37436. return false === $this->isRunningOS400();
  37437. }
  37438. protected function hasStderrSupport()
  37439. {
  37440. return false === $this->isRunningOS400();
  37441. }
  37442. private function isRunningOS400()
  37443. {
  37444. $checks = array(
  37445. \function_exists('php_uname') ? php_uname('s') : '',
  37446. getenv('OSTYPE'),
  37447. PHP_OS,
  37448. );
  37449. return false !== stripos(implode(';', $checks), 'OS400');
  37450. }
  37451. private function openOutputStream()
  37452. {
  37453. $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
  37454. return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
  37455. }
  37456. private function openErrorStream()
  37457. {
  37458. $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
  37459. return fopen($errorStream, 'w');
  37460. }
  37461. }
  37462. <?php
  37463. namespace Symfony\Component\Console\Output;
  37464. interface ConsoleOutputInterface extends OutputInterface
  37465. {
  37466. public function getErrorOutput();
  37467. public function setErrorOutput(OutputInterface $error);
  37468. }
  37469. <?php
  37470. namespace Symfony\Component\Console\Output;
  37471. use Symfony\Component\Console\Formatter\OutputFormatter;
  37472. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37473. class NullOutput implements OutputInterface
  37474. {
  37475. public function setFormatter(OutputFormatterInterface $formatter)
  37476. {
  37477. }
  37478. public function getFormatter()
  37479. {
  37480. return new OutputFormatter();
  37481. }
  37482. public function setDecorated($decorated)
  37483. {
  37484. }
  37485. public function isDecorated()
  37486. {
  37487. return false;
  37488. }
  37489. public function setVerbosity($level)
  37490. {
  37491. }
  37492. public function getVerbosity()
  37493. {
  37494. return self::VERBOSITY_QUIET;
  37495. }
  37496. public function isQuiet()
  37497. {
  37498. return true;
  37499. }
  37500. public function isVerbose()
  37501. {
  37502. return false;
  37503. }
  37504. public function isVeryVerbose()
  37505. {
  37506. return false;
  37507. }
  37508. public function isDebug()
  37509. {
  37510. return false;
  37511. }
  37512. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37513. {
  37514. }
  37515. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37516. {
  37517. }
  37518. }
  37519. <?php
  37520. namespace Symfony\Component\Console\Output;
  37521. use Symfony\Component\Console\Formatter\OutputFormatter;
  37522. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37523. abstract class Output implements OutputInterface
  37524. {
  37525. private $verbosity;
  37526. private $formatter;
  37527. public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
  37528. {
  37529. $this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
  37530. $this->formatter = $formatter ?: new OutputFormatter();
  37531. $this->formatter->setDecorated($decorated);
  37532. }
  37533. public function setFormatter(OutputFormatterInterface $formatter)
  37534. {
  37535. $this->formatter = $formatter;
  37536. }
  37537. public function getFormatter()
  37538. {
  37539. return $this->formatter;
  37540. }
  37541. public function setDecorated($decorated)
  37542. {
  37543. $this->formatter->setDecorated($decorated);
  37544. }
  37545. public function isDecorated()
  37546. {
  37547. return $this->formatter->isDecorated();
  37548. }
  37549. public function setVerbosity($level)
  37550. {
  37551. $this->verbosity = (int) $level;
  37552. }
  37553. public function getVerbosity()
  37554. {
  37555. return $this->verbosity;
  37556. }
  37557. public function isQuiet()
  37558. {
  37559. return self::VERBOSITY_QUIET === $this->verbosity;
  37560. }
  37561. public function isVerbose()
  37562. {
  37563. return self::VERBOSITY_VERBOSE <= $this->verbosity;
  37564. }
  37565. public function isVeryVerbose()
  37566. {
  37567. return self::VERBOSITY_VERY_VERBOSE <= $this->verbosity;
  37568. }
  37569. public function isDebug()
  37570. {
  37571. return self::VERBOSITY_DEBUG <= $this->verbosity;
  37572. }
  37573. public function writeln($messages, $options = self::OUTPUT_NORMAL)
  37574. {
  37575. $this->write($messages, true, $options);
  37576. }
  37577. public function write($messages, $newline = false, $options = self::OUTPUT_NORMAL)
  37578. {
  37579. $messages = (array) $messages;
  37580. $types = self::OUTPUT_NORMAL | self::OUTPUT_RAW | self::OUTPUT_PLAIN;
  37581. $type = $types & $options ?: self::OUTPUT_NORMAL;
  37582. $verbosities = self::VERBOSITY_QUIET | self::VERBOSITY_NORMAL | self::VERBOSITY_VERBOSE | self::VERBOSITY_VERY_VERBOSE | self::VERBOSITY_DEBUG;
  37583. $verbosity = $verbosities & $options ?: self::VERBOSITY_NORMAL;
  37584. if ($verbosity > $this->getVerbosity()) {
  37585. return;
  37586. }
  37587. foreach ($messages as $message) {
  37588. switch ($type) {
  37589. case OutputInterface::OUTPUT_NORMAL:
  37590. $message = $this->formatter->format($message);
  37591. break;
  37592. case OutputInterface::OUTPUT_RAW:
  37593. break;
  37594. case OutputInterface::OUTPUT_PLAIN:
  37595. $message = strip_tags($this->formatter->format($message));
  37596. break;
  37597. }
  37598. $this->doWrite($message, $newline);
  37599. }
  37600. }
  37601. abstract protected function doWrite($message, $newline);
  37602. }
  37603. <?php
  37604. namespace Symfony\Component\Console\Output;
  37605. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37606. interface OutputInterface
  37607. {
  37608. const VERBOSITY_QUIET = 16;
  37609. const VERBOSITY_NORMAL = 32;
  37610. const VERBOSITY_VERBOSE = 64;
  37611. const VERBOSITY_VERY_VERBOSE = 128;
  37612. const VERBOSITY_DEBUG = 256;
  37613. const OUTPUT_NORMAL = 1;
  37614. const OUTPUT_RAW = 2;
  37615. const OUTPUT_PLAIN = 4;
  37616. public function write($messages, $newline = false, $options = 0);
  37617. public function writeln($messages, $options = 0);
  37618. public function setVerbosity($level);
  37619. public function getVerbosity();
  37620. public function setDecorated($decorated);
  37621. public function isDecorated();
  37622. public function setFormatter(OutputFormatterInterface $formatter);
  37623. public function getFormatter();
  37624. }
  37625. <?php
  37626. namespace Symfony\Component\Console\Output;
  37627. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37628. use Symfony\Component\Console\Exception\RuntimeException;
  37629. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  37630. class StreamOutput extends Output
  37631. {
  37632. private $stream;
  37633. public function __construct($stream, $verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
  37634. {
  37635. if (!\is_resource($stream) || 'stream' !== get_resource_type($stream)) {
  37636. throw new InvalidArgumentException('The StreamOutput class needs a stream as its first argument.');
  37637. }
  37638. $this->stream = $stream;
  37639. if (null === $decorated) {
  37640. $decorated = $this->hasColorSupport();
  37641. }
  37642. parent::__construct($verbosity, $decorated, $formatter);
  37643. }
  37644. public function getStream()
  37645. {
  37646. return $this->stream;
  37647. }
  37648. protected function doWrite($message, $newline)
  37649. {
  37650. if ($newline) {
  37651. $message .= PHP_EOL;
  37652. }
  37653. if (false === @fwrite($this->stream, $message)) {
  37654. throw new RuntimeException('Unable to write output.');
  37655. }
  37656. fflush($this->stream);
  37657. }
  37658. protected function hasColorSupport()
  37659. {
  37660. if ('Hyper' === getenv('TERM_PROGRAM')) {
  37661. return true;
  37662. }
  37663. if (\DIRECTORY_SEPARATOR === '\\') {
  37664. return (\function_exists('sapi_windows_vt100_support')
  37665. && @sapi_windows_vt100_support($this->stream))
  37666. || false !== getenv('ANSICON')
  37667. || 'ON' === getenv('ConEmuANSI')
  37668. || 'xterm' === getenv('TERM');
  37669. }
  37670. if (\function_exists('stream_isatty')) {
  37671. return @stream_isatty($this->stream);
  37672. }
  37673. if (\function_exists('posix_isatty')) {
  37674. return @posix_isatty($this->stream);
  37675. }
  37676. $stat = @fstat($this->stream);
  37677. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  37678. }
  37679. }
  37680. <?php
  37681. namespace Symfony\Component\Console\Question;
  37682. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37683. class ChoiceQuestion extends Question
  37684. {
  37685. private $choices;
  37686. private $multiselect = false;
  37687. private $prompt = ' > ';
  37688. private $errorMessage = 'Value "%s" is invalid';
  37689. public function __construct($question, array $choices, $default = null)
  37690. {
  37691. if (!$choices) {
  37692. throw new \LogicException('Choice question must have at least 1 choice available.');
  37693. }
  37694. parent::__construct($question, $default);
  37695. $this->choices = $choices;
  37696. $this->setValidator($this->getDefaultValidator());
  37697. $this->setAutocompleterValues($choices);
  37698. }
  37699. public function getChoices()
  37700. {
  37701. return $this->choices;
  37702. }
  37703. public function setMultiselect($multiselect)
  37704. {
  37705. $this->multiselect = $multiselect;
  37706. $this->setValidator($this->getDefaultValidator());
  37707. return $this;
  37708. }
  37709. public function isMultiselect()
  37710. {
  37711. return $this->multiselect;
  37712. }
  37713. public function getPrompt()
  37714. {
  37715. return $this->prompt;
  37716. }
  37717. public function setPrompt($prompt)
  37718. {
  37719. $this->prompt = $prompt;
  37720. return $this;
  37721. }
  37722. public function setErrorMessage($errorMessage)
  37723. {
  37724. $this->errorMessage = $errorMessage;
  37725. $this->setValidator($this->getDefaultValidator());
  37726. return $this;
  37727. }
  37728. private function getDefaultValidator()
  37729. {
  37730. $choices = $this->choices;
  37731. $errorMessage = $this->errorMessage;
  37732. $multiselect = $this->multiselect;
  37733. $isAssoc = $this->isAssoc($choices);
  37734. return function ($selected) use ($choices, $errorMessage, $multiselect, $isAssoc) {
  37735. $selectedChoices = str_replace(' ', '', $selected);
  37736. if ($multiselect) {
  37737. if (!preg_match('/^[^,]+(?:,[^,]+)*$/', $selectedChoices, $matches)) {
  37738. throw new InvalidArgumentException(sprintf($errorMessage, $selected));
  37739. }
  37740. $selectedChoices = explode(',', $selectedChoices);
  37741. } else {
  37742. $selectedChoices = array($selected);
  37743. }
  37744. $multiselectChoices = array();
  37745. foreach ($selectedChoices as $value) {
  37746. $results = array();
  37747. foreach ($choices as $key => $choice) {
  37748. if ($choice === $value) {
  37749. $results[] = $key;
  37750. }
  37751. }
  37752. if (\count($results) > 1) {
  37753. throw new InvalidArgumentException(sprintf('The provided answer is ambiguous. Value should be one of %s.', implode(' or ', $results)));
  37754. }
  37755. $result = array_search($value, $choices);
  37756. if (!$isAssoc) {
  37757. if (false !== $result) {
  37758. $result = $choices[$result];
  37759. } elseif (isset($choices[$value])) {
  37760. $result = $choices[$value];
  37761. }
  37762. } elseif (false === $result && isset($choices[$value])) {
  37763. $result = $value;
  37764. }
  37765. if (false === $result) {
  37766. throw new InvalidArgumentException(sprintf($errorMessage, $value));
  37767. }
  37768. $multiselectChoices[] = (string) $result;
  37769. }
  37770. if ($multiselect) {
  37771. return $multiselectChoices;
  37772. }
  37773. return current($multiselectChoices);
  37774. };
  37775. }
  37776. }
  37777. <?php
  37778. namespace Symfony\Component\Console\Question;
  37779. class ConfirmationQuestion extends Question
  37780. {
  37781. private $trueAnswerRegex;
  37782. public function __construct($question, $default = true, $trueAnswerRegex = '/^y/i')
  37783. {
  37784. parent::__construct($question, (bool) $default);
  37785. $this->trueAnswerRegex = $trueAnswerRegex;
  37786. $this->setNormalizer($this->getDefaultNormalizer());
  37787. }
  37788. private function getDefaultNormalizer()
  37789. {
  37790. $default = $this->getDefault();
  37791. $regex = $this->trueAnswerRegex;
  37792. return function ($answer) use ($default, $regex) {
  37793. if (\is_bool($answer)) {
  37794. return $answer;
  37795. }
  37796. $answerIsTrue = (bool) preg_match($regex, $answer);
  37797. if (false === $default) {
  37798. return $answer && $answerIsTrue;
  37799. }
  37800. return !$answer || $answerIsTrue;
  37801. };
  37802. }
  37803. }
  37804. <?php
  37805. namespace Symfony\Component\Console\Question;
  37806. use Symfony\Component\Console\Exception\InvalidArgumentException;
  37807. use Symfony\Component\Console\Exception\LogicException;
  37808. class Question
  37809. {
  37810. private $question;
  37811. private $attempts;
  37812. private $hidden = false;
  37813. private $hiddenFallback = true;
  37814. private $autocompleterValues;
  37815. private $validator;
  37816. private $default;
  37817. private $normalizer;
  37818. public function __construct($question, $default = null)
  37819. {
  37820. $this->question = $question;
  37821. $this->default = $default;
  37822. }
  37823. public function getQuestion()
  37824. {
  37825. return $this->question;
  37826. }
  37827. public function getDefault()
  37828. {
  37829. return $this->default;
  37830. }
  37831. public function isHidden()
  37832. {
  37833. return $this->hidden;
  37834. }
  37835. public function setHidden($hidden)
  37836. {
  37837. if ($this->autocompleterValues) {
  37838. throw new LogicException('A hidden question cannot use the autocompleter.');
  37839. }
  37840. $this->hidden = (bool) $hidden;
  37841. return $this;
  37842. }
  37843. public function isHiddenFallback()
  37844. {
  37845. return $this->hiddenFallback;
  37846. }
  37847. public function setHiddenFallback($fallback)
  37848. {
  37849. $this->hiddenFallback = (bool) $fallback;
  37850. return $this;
  37851. }
  37852. public function getAutocompleterValues()
  37853. {
  37854. return $this->autocompleterValues;
  37855. }
  37856. public function setAutocompleterValues($values)
  37857. {
  37858. if (\is_array($values)) {
  37859. $values = $this->isAssoc($values) ? array_merge(array_keys($values), array_values($values)) : array_values($values);
  37860. }
  37861. if (null !== $values && !\is_array($values) && !$values instanceof \Traversable) {
  37862. throw new InvalidArgumentException('Autocompleter values can be either an array, `null` or a `Traversable` object.');
  37863. }
  37864. if ($this->hidden) {
  37865. throw new LogicException('A hidden question cannot use the autocompleter.');
  37866. }
  37867. $this->autocompleterValues = $values;
  37868. return $this;
  37869. }
  37870. public function setValidator($validator)
  37871. {
  37872. $this->validator = $validator;
  37873. return $this;
  37874. }
  37875. public function getValidator()
  37876. {
  37877. return $this->validator;
  37878. }
  37879. public function setMaxAttempts($attempts)
  37880. {
  37881. if (null !== $attempts && $attempts < 1) {
  37882. throw new InvalidArgumentException('Maximum number of attempts must be a positive value.');
  37883. }
  37884. $this->attempts = $attempts;
  37885. return $this;
  37886. }
  37887. public function getMaxAttempts()
  37888. {
  37889. return $this->attempts;
  37890. }
  37891. public function setNormalizer($normalizer)
  37892. {
  37893. $this->normalizer = $normalizer;
  37894. return $this;
  37895. }
  37896. public function getNormalizer()
  37897. {
  37898. return $this->normalizer;
  37899. }
  37900. protected function isAssoc($array)
  37901. {
  37902. return (bool) \count(array_filter(array_keys($array), 'is_string'));
  37903. }
  37904. }
  37905. <?php
  37906. namespace Symfony\Component\Console;
  37907. use Symfony\Component\Console\Exception\RuntimeException;
  37908. use Symfony\Component\Console\Input\StringInput;
  37909. use Symfony\Component\Console\Output\ConsoleOutput;
  37910. use Symfony\Component\Process\PhpExecutableFinder;
  37911. use Symfony\Component\Process\ProcessBuilder;
  37912. class Shell
  37913. {
  37914. private $application;
  37915. private $history;
  37916. private $output;
  37917. private $hasReadline;
  37918. private $processIsolation = false;
  37919. public function __construct(Application $application)
  37920. {
  37921. @trigger_error('The '.__CLASS__.' class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  37922. $this->hasReadline = \function_exists('readline');
  37923. $this->application = $application;
  37924. $this->history = getenv('HOME').'/.history_'.$application->getName();
  37925. $this->output = new ConsoleOutput();
  37926. }
  37927. public function run()
  37928. {
  37929. $this->application->setAutoExit(false);
  37930. $this->application->setCatchExceptions(true);
  37931. if ($this->hasReadline) {
  37932. readline_read_history($this->history);
  37933. readline_completion_function(array($this, 'autocompleter'));
  37934. }
  37935. $this->output->writeln($this->getHeader());
  37936. $php = null;
  37937. if ($this->processIsolation) {
  37938. $finder = new PhpExecutableFinder();
  37939. $php = $finder->find();
  37940. $this->output->writeln(<<<'EOF'
  37941. <info>Running with process isolation, you should consider this:</info>
  37942. * each command is executed as separate process,
  37943. * commands don't support interactivity, all params must be passed explicitly,
  37944. * commands output is not colorized.
  37945. EOF
  37946. );
  37947. }
  37948. while (true) {
  37949. $command = $this->readline();
  37950. if (false === $command) {
  37951. $this->output->writeln("\n");
  37952. break;
  37953. }
  37954. if ($this->hasReadline) {
  37955. readline_add_history($command);
  37956. readline_write_history($this->history);
  37957. }
  37958. if ($this->processIsolation) {
  37959. $pb = new ProcessBuilder();
  37960. $process = $pb
  37961. ->add($php)
  37962. ->add($_SERVER['argv'][0])
  37963. ->add($command)
  37964. ->inheritEnvironmentVariables(true)
  37965. ->getProcess()
  37966. ;
  37967. $output = $this->output;
  37968. $process->run(function ($type, $data) use ($output) {
  37969. $output->writeln($data);
  37970. });
  37971. $ret = $process->getExitCode();
  37972. } else {
  37973. $ret = $this->application->run(new StringInput($command), $this->output);
  37974. }
  37975. if (0 !== $ret) {
  37976. $this->output->writeln(sprintf('<error>The command terminated with an error status (%s)</error>', $ret));
  37977. }
  37978. }
  37979. }
  37980. protected function getHeader()
  37981. {
  37982. return <<<EOF
  37983. Welcome to the <info>{$this->application->getName()}</info> shell (<comment>{$this->application->getVersion()}</comment>).
  37984. At the prompt, type <comment>help</comment> for some help,
  37985. or <comment>list</comment> to get a list of available commands.
  37986. To exit the shell, type <comment>^D</comment>.
  37987. EOF;
  37988. }
  37989. protected function getPrompt()
  37990. {
  37991. return $this->output->getFormatter()->format($this->application->getName().' > ');
  37992. }
  37993. protected function getOutput()
  37994. {
  37995. return $this->output;
  37996. }
  37997. protected function getApplication()
  37998. {
  37999. return $this->application;
  38000. }
  38001. private function autocompleter($text)
  38002. {
  38003. $info = readline_info();
  38004. $text = substr($info['line_buffer'], 0, $info['end']);
  38005. if ($info['point'] !== $info['end']) {
  38006. return true;
  38007. }
  38008. if (false === strpos($text, ' ') || !$text) {
  38009. return array_keys($this->application->all());
  38010. }
  38011. try {
  38012. $command = $this->application->find(substr($text, 0, strpos($text, ' ')));
  38013. } catch (\Exception $e) {
  38014. return true;
  38015. }
  38016. $list = array('--help');
  38017. foreach ($command->getDefinition()->getOptions() as $option) {
  38018. $list[] = '--'.$option->getName();
  38019. }
  38020. return $list;
  38021. }
  38022. private function readline()
  38023. {
  38024. if ($this->hasReadline) {
  38025. $line = readline($this->getPrompt());
  38026. } else {
  38027. $this->output->write($this->getPrompt());
  38028. $line = fgets(STDIN, 1024);
  38029. $line = (false === $line || '' === $line) ? false : rtrim($line);
  38030. }
  38031. return $line;
  38032. }
  38033. public function getProcessIsolation()
  38034. {
  38035. return $this->processIsolation;
  38036. }
  38037. public function setProcessIsolation($processIsolation)
  38038. {
  38039. $this->processIsolation = (bool) $processIsolation;
  38040. if ($this->processIsolation && !class_exists('Symfony\\Component\\Process\\Process')) {
  38041. throw new RuntimeException('Unable to isolate processes as the Symfony Process Component is not installed.');
  38042. }
  38043. }
  38044. }
  38045. <?php
  38046. namespace Symfony\Component\Console\Style;
  38047. use Symfony\Component\Console\Formatter\OutputFormatterInterface;
  38048. use Symfony\Component\Console\Helper\ProgressBar;
  38049. use Symfony\Component\Console\Output\OutputInterface;
  38050. abstract class OutputStyle implements OutputInterface, StyleInterface
  38051. {
  38052. private $output;
  38053. public function __construct(OutputInterface $output)
  38054. {
  38055. $this->output = $output;
  38056. }
  38057. public function newLine($count = 1)
  38058. {
  38059. $this->output->write(str_repeat(PHP_EOL, $count));
  38060. }
  38061. public function createProgressBar($max = 0)
  38062. {
  38063. return new ProgressBar($this->output, $max);
  38064. }
  38065. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  38066. {
  38067. $this->output->write($messages, $newline, $type);
  38068. }
  38069. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  38070. {
  38071. $this->output->writeln($messages, $type);
  38072. }
  38073. public function setVerbosity($level)
  38074. {
  38075. $this->output->setVerbosity($level);
  38076. }
  38077. public function getVerbosity()
  38078. {
  38079. return $this->output->getVerbosity();
  38080. }
  38081. public function setDecorated($decorated)
  38082. {
  38083. $this->output->setDecorated($decorated);
  38084. }
  38085. public function isDecorated()
  38086. {
  38087. return $this->output->isDecorated();
  38088. }
  38089. public function setFormatter(OutputFormatterInterface $formatter)
  38090. {
  38091. $this->output->setFormatter($formatter);
  38092. }
  38093. public function getFormatter()
  38094. {
  38095. return $this->output->getFormatter();
  38096. }
  38097. }
  38098. <?php
  38099. namespace Symfony\Component\Console\Style;
  38100. interface StyleInterface
  38101. {
  38102. public function title($message);
  38103. public function section($message);
  38104. public function listing(array $elements);
  38105. public function text($message);
  38106. public function success($message);
  38107. public function error($message);
  38108. public function warning($message);
  38109. public function note($message);
  38110. public function caution($message);
  38111. public function table(array $headers, array $rows);
  38112. public function ask($question, $default = null, $validator = null);
  38113. public function askHidden($question, $validator = null);
  38114. public function confirm($question, $default = true);
  38115. public function choice($question, array $choices, $default = null);
  38116. public function newLine($count = 1);
  38117. public function progressStart($max = 0);
  38118. public function progressAdvance($step = 1);
  38119. public function progressFinish();
  38120. }
  38121. <?php
  38122. namespace Symfony\Component\Console\Style;
  38123. use Symfony\Component\Console\Application;
  38124. use Symfony\Component\Console\Exception\RuntimeException;
  38125. use Symfony\Component\Console\Formatter\OutputFormatter;
  38126. use Symfony\Component\Console\Helper\Helper;
  38127. use Symfony\Component\Console\Helper\ProgressBar;
  38128. use Symfony\Component\Console\Helper\SymfonyQuestionHelper;
  38129. use Symfony\Component\Console\Helper\Table;
  38130. use Symfony\Component\Console\Input\InputInterface;
  38131. use Symfony\Component\Console\Output\BufferedOutput;
  38132. use Symfony\Component\Console\Output\OutputInterface;
  38133. use Symfony\Component\Console\Question\ChoiceQuestion;
  38134. use Symfony\Component\Console\Question\ConfirmationQuestion;
  38135. use Symfony\Component\Console\Question\Question;
  38136. class SymfonyStyle extends OutputStyle
  38137. {
  38138. const MAX_LINE_LENGTH = 120;
  38139. private $input;
  38140. private $questionHelper;
  38141. private $progressBar;
  38142. private $lineLength;
  38143. private $bufferedOutput;
  38144. public function __construct(InputInterface $input, OutputInterface $output)
  38145. {
  38146. $this->input = $input;
  38147. $this->bufferedOutput = new BufferedOutput($output->getVerbosity(), false, clone $output->getFormatter());
  38148. $this->lineLength = min($this->getTerminalWidth() - (int) (\DIRECTORY_SEPARATOR === '\\'), self::MAX_LINE_LENGTH);
  38149. parent::__construct($output);
  38150. }
  38151. public function block($messages, $type = null, $style = null, $prefix = ' ', $padding = false)
  38152. {
  38153. $messages = \is_array($messages) ? array_values($messages) : array($messages);
  38154. $this->autoPrependBlock();
  38155. $this->writeln($this->createBlock($messages, $type, $style, $prefix, $padding, true));
  38156. $this->newLine();
  38157. }
  38158. public function title($message)
  38159. {
  38160. $this->autoPrependBlock();
  38161. $this->writeln(array(
  38162. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38163. sprintf('<comment>%s</>', str_repeat('=', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38164. ));
  38165. $this->newLine();
  38166. }
  38167. public function section($message)
  38168. {
  38169. $this->autoPrependBlock();
  38170. $this->writeln(array(
  38171. sprintf('<comment>%s</>', OutputFormatter::escapeTrailingBackslash($message)),
  38172. sprintf('<comment>%s</>', str_repeat('-', Helper::strlenWithoutDecoration($this->getFormatter(), $message))),
  38173. ));
  38174. $this->newLine();
  38175. }
  38176. public function listing(array $elements)
  38177. {
  38178. $this->autoPrependText();
  38179. $elements = array_map(function ($element) {
  38180. return sprintf(' * %s', $element);
  38181. }, $elements);
  38182. $this->writeln($elements);
  38183. $this->newLine();
  38184. }
  38185. public function text($message)
  38186. {
  38187. $this->autoPrependText();
  38188. $messages = \is_array($message) ? array_values($message) : array($message);
  38189. foreach ($messages as $message) {
  38190. $this->writeln(sprintf(' %s', $message));
  38191. }
  38192. }
  38193. public function comment($message)
  38194. {
  38195. $messages = \is_array($message) ? array_values($message) : array($message);
  38196. $this->autoPrependBlock();
  38197. $this->writeln($this->createBlock($messages, null, null, '<fg=default;bg=default> // </>'));
  38198. $this->newLine();
  38199. }
  38200. public function success($message)
  38201. {
  38202. $this->block($message, 'OK', 'fg=black;bg=green', ' ', true);
  38203. }
  38204. public function error($message)
  38205. {
  38206. $this->block($message, 'ERROR', 'fg=white;bg=red', ' ', true);
  38207. }
  38208. public function warning($message)
  38209. {
  38210. $this->block($message, 'WARNING', 'fg=white;bg=red', ' ', true);
  38211. }
  38212. public function note($message)
  38213. {
  38214. $this->block($message, 'NOTE', 'fg=yellow', ' ! ');
  38215. }
  38216. public function caution($message)
  38217. {
  38218. $this->block($message, 'CAUTION', 'fg=white;bg=red', ' ! ', true);
  38219. }
  38220. public function table(array $headers, array $rows)
  38221. {
  38222. $style = clone Table::getStyleDefinition('symfony-style-guide');
  38223. $style->setCellHeaderFormat('<info>%s</info>');
  38224. $table = new Table($this);
  38225. $table->setHeaders($headers);
  38226. $table->setRows($rows);
  38227. $table->setStyle($style);
  38228. $table->render();
  38229. $this->newLine();
  38230. }
  38231. public function ask($question, $default = null, $validator = null)
  38232. {
  38233. $question = new Question($question, $default);
  38234. $question->setValidator($validator);
  38235. return $this->askQuestion($question);
  38236. }
  38237. public function askHidden($question, $validator = null)
  38238. {
  38239. $question = new Question($question);
  38240. $question->setHidden(true);
  38241. $question->setValidator($validator);
  38242. return $this->askQuestion($question);
  38243. }
  38244. public function confirm($question, $default = true)
  38245. {
  38246. return $this->askQuestion(new ConfirmationQuestion($question, $default));
  38247. }
  38248. public function choice($question, array $choices, $default = null)
  38249. {
  38250. if (null !== $default) {
  38251. $values = array_flip($choices);
  38252. $default = $values[$default];
  38253. }
  38254. return $this->askQuestion(new ChoiceQuestion($question, $choices, $default));
  38255. }
  38256. public function progressStart($max = 0)
  38257. {
  38258. $this->progressBar = $this->createProgressBar($max);
  38259. $this->progressBar->start();
  38260. }
  38261. public function progressAdvance($step = 1)
  38262. {
  38263. $this->getProgressBar()->advance($step);
  38264. }
  38265. public function progressFinish()
  38266. {
  38267. $this->getProgressBar()->finish();
  38268. $this->newLine(2);
  38269. $this->progressBar = null;
  38270. }
  38271. public function createProgressBar($max = 0)
  38272. {
  38273. $progressBar = parent::createProgressBar($max);
  38274. if ('\\' !== \DIRECTORY_SEPARATOR || 'Hyper' === getenv('TERM_PROGRAM')) {
  38275. $progressBar->setEmptyBarCharacter('â–‘');
  38276. $progressBar->setProgressCharacter('');
  38277. $progressBar->setBarCharacter('â–“');
  38278. }
  38279. return $progressBar;
  38280. }
  38281. public function askQuestion(Question $question)
  38282. {
  38283. if ($this->input->isInteractive()) {
  38284. $this->autoPrependBlock();
  38285. }
  38286. if (!$this->questionHelper) {
  38287. $this->questionHelper = new SymfonyQuestionHelper();
  38288. }
  38289. $answer = $this->questionHelper->ask($this->input, $this, $question);
  38290. if ($this->input->isInteractive()) {
  38291. $this->newLine();
  38292. $this->bufferedOutput->write("\n");
  38293. }
  38294. return $answer;
  38295. }
  38296. public function writeln($messages, $type = self::OUTPUT_NORMAL)
  38297. {
  38298. parent::writeln($messages, $type);
  38299. $this->bufferedOutput->writeln($this->reduceBuffer($messages), $type);
  38300. }
  38301. public function write($messages, $newline = false, $type = self::OUTPUT_NORMAL)
  38302. {
  38303. parent::write($messages, $newline, $type);
  38304. $this->bufferedOutput->write($this->reduceBuffer($messages), $newline, $type);
  38305. }
  38306. public function newLine($count = 1)
  38307. {
  38308. parent::newLine($count);
  38309. $this->bufferedOutput->write(str_repeat("\n", $count));
  38310. }
  38311. private function getProgressBar()
  38312. {
  38313. if (!$this->progressBar) {
  38314. throw new RuntimeException('The ProgressBar is not started.');
  38315. }
  38316. return $this->progressBar;
  38317. }
  38318. private function getTerminalWidth()
  38319. {
  38320. $application = new Application();
  38321. $dimensions = $application->getTerminalDimensions();
  38322. return $dimensions[0] ?: self::MAX_LINE_LENGTH;
  38323. }
  38324. private function autoPrependBlock()
  38325. {
  38326. $chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
  38327. if (!isset($chars[0])) {
  38328. return $this->newLine();
  38329. }
  38330. $this->newLine(2 - substr_count($chars, "\n"));
  38331. }
  38332. private function autoPrependText()
  38333. {
  38334. $fetched = $this->bufferedOutput->fetch();
  38335. if ("\n" !== substr($fetched, -1)) {
  38336. $this->newLine();
  38337. }
  38338. }
  38339. private function reduceBuffer($messages)
  38340. {
  38341. return array_map(function ($value) {
  38342. return substr($value, -4);
  38343. }, array_merge(array($this->bufferedOutput->fetch()), (array) $messages));
  38344. }
  38345. private function createBlock($messages, $type = null, $style = null, $prefix = ' ', $padding = false, $escape = false)
  38346. {
  38347. $indentLength = 0;
  38348. $prefixLength = Helper::strlenWithoutDecoration($this->getFormatter(), $prefix);
  38349. $lines = array();
  38350. if (null !== $type) {
  38351. $type = sprintf('[%s] ', $type);
  38352. $indentLength = \strlen($type);
  38353. $lineIndentation = str_repeat(' ', $indentLength);
  38354. }
  38355. foreach ($messages as $key => $message) {
  38356. if ($escape) {
  38357. $message = OutputFormatter::escape($message);
  38358. }
  38359. $lines = array_merge($lines, explode(PHP_EOL, wordwrap($message, $this->lineLength - $prefixLength - $indentLength, PHP_EOL, true)));
  38360. if (\count($messages) > 1 && $key < \count($messages) - 1) {
  38361. $lines[] = '';
  38362. }
  38363. }
  38364. $firstLineIndex = 0;
  38365. if ($padding && $this->isDecorated()) {
  38366. $firstLineIndex = 1;
  38367. array_unshift($lines, '');
  38368. $lines[] = '';
  38369. }
  38370. foreach ($lines as $i => &$line) {
  38371. if (null !== $type) {
  38372. $line = $firstLineIndex === $i ? $type.$line : $lineIndentation.$line;
  38373. }
  38374. $line = $prefix.$line;
  38375. $line .= str_repeat(' ', $this->lineLength - Helper::strlenWithoutDecoration($this->getFormatter(), $line));
  38376. if ($style) {
  38377. $line = sprintf('<%s>%s</>', $style, $line);
  38378. }
  38379. }
  38380. return $lines;
  38381. }
  38382. }
  38383. <?php
  38384. namespace Symfony\Component\Console\Tester;
  38385. use Symfony\Component\Console\Application;
  38386. use Symfony\Component\Console\Input\ArrayInput;
  38387. use Symfony\Component\Console\Input\InputInterface;
  38388. use Symfony\Component\Console\Output\OutputInterface;
  38389. use Symfony\Component\Console\Output\StreamOutput;
  38390. class ApplicationTester
  38391. {
  38392. private $application;
  38393. private $input;
  38394. private $output;
  38395. private $statusCode;
  38396. public function __construct(Application $application)
  38397. {
  38398. $this->application = $application;
  38399. }
  38400. public function run(array $input, $options = array())
  38401. {
  38402. $this->input = new ArrayInput($input);
  38403. if (isset($options['interactive'])) {
  38404. $this->input->setInteractive($options['interactive']);
  38405. }
  38406. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38407. if (isset($options['decorated'])) {
  38408. $this->output->setDecorated($options['decorated']);
  38409. }
  38410. if (isset($options['verbosity'])) {
  38411. $this->output->setVerbosity($options['verbosity']);
  38412. }
  38413. return $this->statusCode = $this->application->run($this->input, $this->output);
  38414. }
  38415. public function getDisplay($normalize = false)
  38416. {
  38417. rewind($this->output->getStream());
  38418. $display = stream_get_contents($this->output->getStream());
  38419. if ($normalize) {
  38420. $display = str_replace(PHP_EOL, "\n", $display);
  38421. }
  38422. return $display;
  38423. }
  38424. public function getInput()
  38425. {
  38426. return $this->input;
  38427. }
  38428. public function getOutput()
  38429. {
  38430. return $this->output;
  38431. }
  38432. public function getStatusCode()
  38433. {
  38434. return $this->statusCode;
  38435. }
  38436. }
  38437. <?php
  38438. namespace Symfony\Component\Console\Tester;
  38439. use Symfony\Component\Console\Command\Command;
  38440. use Symfony\Component\Console\Input\ArrayInput;
  38441. use Symfony\Component\Console\Input\InputInterface;
  38442. use Symfony\Component\Console\Output\OutputInterface;
  38443. use Symfony\Component\Console\Output\StreamOutput;
  38444. class CommandTester
  38445. {
  38446. private $command;
  38447. private $input;
  38448. private $output;
  38449. private $statusCode;
  38450. public function __construct(Command $command)
  38451. {
  38452. $this->command = $command;
  38453. }
  38454. public function execute(array $input, array $options = array())
  38455. {
  38456. if (!isset($input['command'])
  38457. && (null !== $application = $this->command->getApplication())
  38458. && $application->getDefinition()->hasArgument('command')
  38459. ) {
  38460. $input = array_merge(array('command' => $this->command->getName()), $input);
  38461. }
  38462. $this->input = new ArrayInput($input);
  38463. if (isset($options['interactive'])) {
  38464. $this->input->setInteractive($options['interactive']);
  38465. }
  38466. $this->output = new StreamOutput(fopen('php://memory', 'w', false));
  38467. $this->output->setDecorated(isset($options['decorated']) ? $options['decorated'] : false);
  38468. if (isset($options['verbosity'])) {
  38469. $this->output->setVerbosity($options['verbosity']);
  38470. }
  38471. return $this->statusCode = $this->command->run($this->input, $this->output);
  38472. }
  38473. public function getDisplay($normalize = false)
  38474. {
  38475. rewind($this->output->getStream());
  38476. $display = stream_get_contents($this->output->getStream());
  38477. if ($normalize) {
  38478. $display = str_replace(PHP_EOL, "\n", $display);
  38479. }
  38480. return $display;
  38481. }
  38482. public function getInput()
  38483. {
  38484. return $this->input;
  38485. }
  38486. public function getOutput()
  38487. {
  38488. return $this->output;
  38489. }
  38490. public function getStatusCode()
  38491. {
  38492. return $this->statusCode;
  38493. }
  38494. }
  38495. <?php
  38496. namespace Symfony\Component\Debug;
  38497. use Psr\Log\AbstractLogger;
  38498. class BufferingLogger extends AbstractLogger
  38499. {
  38500. private $logs = array();
  38501. public function log($level, $message, array $context = array())
  38502. {
  38503. $this->logs[] = array($level, $message, $context);
  38504. }
  38505. public function cleanLogs()
  38506. {
  38507. $logs = $this->logs;
  38508. $this->logs = array();
  38509. return $logs;
  38510. }
  38511. }
  38512. <?php
  38513. namespace Symfony\Component\Debug;
  38514. class Debug
  38515. {
  38516. private static $enabled = false;
  38517. public static function enable($errorReportingLevel = null, $displayErrors = true)
  38518. {
  38519. if (static::$enabled) {
  38520. return;
  38521. }
  38522. static::$enabled = true;
  38523. if (null !== $errorReportingLevel) {
  38524. error_reporting($errorReportingLevel);
  38525. } else {
  38526. error_reporting(-1);
  38527. }
  38528. if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
  38529. ini_set('display_errors', 0);
  38530. ExceptionHandler::register();
  38531. } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
  38532. ini_set('display_errors', 1);
  38533. }
  38534. if ($displayErrors) {
  38535. ErrorHandler::register(new ErrorHandler(new BufferingLogger()));
  38536. } else {
  38537. ErrorHandler::register()->throwAt(0, true);
  38538. }
  38539. DebugClassLoader::enable();
  38540. }
  38541. }
  38542. <?php
  38543. namespace Symfony\Component\Debug;
  38544. class DebugClassLoader
  38545. {
  38546. private $classLoader;
  38547. private $isFinder;
  38548. private $loaded = array();
  38549. private $wasFinder;
  38550. private static $caseCheck;
  38551. private static $deprecated = array();
  38552. private static $php7Reserved = array('int', 'float', 'bool', 'string', 'true', 'false', 'null');
  38553. private static $darwinCache = array('/' => array('/', array()));
  38554. public function __construct($classLoader)
  38555. {
  38556. $this->wasFinder = \is_object($classLoader) && method_exists($classLoader, 'findFile');
  38557. if ($this->wasFinder) {
  38558. @trigger_error('The '.__METHOD__.' method will no longer support receiving an object into its $classLoader argument in 3.0.', E_USER_DEPRECATED);
  38559. $this->classLoader = array($classLoader, 'loadClass');
  38560. $this->isFinder = true;
  38561. } else {
  38562. $this->classLoader = $classLoader;
  38563. $this->isFinder = \is_array($classLoader) && method_exists($classLoader[0], 'findFile');
  38564. }
  38565. if (!isset(self::$caseCheck)) {
  38566. $file = file_exists(__FILE__) ? __FILE__ : rtrim(realpath('.'), \DIRECTORY_SEPARATOR);
  38567. $i = strrpos($file, \DIRECTORY_SEPARATOR);
  38568. $dir = substr($file, 0, 1 + $i);
  38569. $file = substr($file, 1 + $i);
  38570. $test = strtoupper($file) === $file ? strtolower($file) : strtoupper($file);
  38571. $test = realpath($dir.$test);
  38572. if (false === $test || false === $i) {
  38573. self::$caseCheck = 0;
  38574. } elseif (substr($test, -\strlen($file)) === $file) {
  38575. self::$caseCheck = 1;
  38576. } elseif (false !== stripos(PHP_OS, 'darwin')) {
  38577. self::$caseCheck = 2;
  38578. } else {
  38579. self::$caseCheck = 0;
  38580. }
  38581. }
  38582. }
  38583. public function getClassLoader()
  38584. {
  38585. return $this->wasFinder ? $this->classLoader[0] : $this->classLoader;
  38586. }
  38587. public static function enable()
  38588. {
  38589. class_exists('Symfony\Component\Debug\ErrorHandler');
  38590. class_exists('Psr\Log\LogLevel');
  38591. if (!\is_array($functions = spl_autoload_functions())) {
  38592. return;
  38593. }
  38594. foreach ($functions as $function) {
  38595. spl_autoload_unregister($function);
  38596. }
  38597. foreach ($functions as $function) {
  38598. if (!\is_array($function) || !$function[0] instanceof self) {
  38599. $function = array(new static($function), 'loadClass');
  38600. }
  38601. spl_autoload_register($function);
  38602. }
  38603. }
  38604. public static function disable()
  38605. {
  38606. if (!\is_array($functions = spl_autoload_functions())) {
  38607. return;
  38608. }
  38609. foreach ($functions as $function) {
  38610. spl_autoload_unregister($function);
  38611. }
  38612. foreach ($functions as $function) {
  38613. if (\is_array($function) && $function[0] instanceof self) {
  38614. $function = $function[0]->getClassLoader();
  38615. }
  38616. spl_autoload_register($function);
  38617. }
  38618. }
  38619. public function findFile($class)
  38620. {
  38621. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  38622. if ($this->wasFinder) {
  38623. return $this->classLoader[0]->findFile($class);
  38624. }
  38625. }
  38626. public function loadClass($class)
  38627. {
  38628. ErrorHandler::stackErrors();
  38629. try {
  38630. if ($this->isFinder && !isset($this->loaded[$class])) {
  38631. $this->loaded[$class] = true;
  38632. if ($file = $this->classLoader[0]->findFile($class)) {
  38633. require $file;
  38634. }
  38635. } else {
  38636. \call_user_func($this->classLoader, $class);
  38637. $file = false;
  38638. }
  38639. } catch (\Exception $e) {
  38640. ErrorHandler::unstackErrors();
  38641. throw $e;
  38642. } catch (\Throwable $e) {
  38643. ErrorHandler::unstackErrors();
  38644. throw $e;
  38645. }
  38646. ErrorHandler::unstackErrors();
  38647. $exists = class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  38648. if ($class && '\\' === $class[0]) {
  38649. $class = substr($class, 1);
  38650. }
  38651. if ($exists) {
  38652. $refl = new \ReflectionClass($class);
  38653. $name = $refl->getName();
  38654. if ($name !== $class && 0 === strcasecmp($name, $class)) {
  38655. throw new \RuntimeException(sprintf('Case mismatch between loaded and declared class names: %s vs %s', $class, $name));
  38656. }
  38657. if (\in_array(strtolower($refl->getShortName()), self::$php7Reserved)) {
  38658. @trigger_error(sprintf('%s uses a reserved class name (%s) that will break on PHP 7 and higher', $name, $refl->getShortName()), E_USER_DEPRECATED);
  38659. } elseif (preg_match('#\n \* @deprecated (.*?)\r?\n \*(?: @|/$)#s', $refl->getDocComment(), $notice)) {
  38660. self::$deprecated[$name] = preg_replace('#\s*\r?\n \* +#', ' ', $notice[1]);
  38661. } else {
  38662. if (2 > $len = 1 + (strpos($name, '\\') ?: strpos($name, '_'))) {
  38663. $len = 0;
  38664. $ns = '';
  38665. } else {
  38666. $ns = substr($name, 0, $len);
  38667. }
  38668. $parent = get_parent_class($class);
  38669. if (!$parent || strncmp($ns, $parent, $len)) {
  38670. if ($parent && isset(self::$deprecated[$parent]) && strncmp($ns, $parent, $len)) {
  38671. @trigger_error(sprintf('The %s class extends %s that is deprecated %s', $name, $parent, self::$deprecated[$parent]), E_USER_DEPRECATED);
  38672. }
  38673. $parentInterfaces = array();
  38674. $deprecatedInterfaces = array();
  38675. if ($parent) {
  38676. foreach (class_implements($parent) as $interface) {
  38677. $parentInterfaces[$interface] = 1;
  38678. }
  38679. }
  38680. foreach ($refl->getInterfaceNames() as $interface) {
  38681. if (isset(self::$deprecated[$interface]) && strncmp($ns, $interface, $len)) {
  38682. $deprecatedInterfaces[] = $interface;
  38683. }
  38684. foreach (class_implements($interface) as $interface) {
  38685. $parentInterfaces[$interface] = 1;
  38686. }
  38687. }
  38688. foreach ($deprecatedInterfaces as $interface) {
  38689. if (!isset($parentInterfaces[$interface])) {
  38690. @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);
  38691. }
  38692. }
  38693. }
  38694. }
  38695. }
  38696. if ($file) {
  38697. if (!$exists) {
  38698. if (false !== strpos($class, '/')) {
  38699. 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));
  38700. }
  38701. 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));
  38702. }
  38703. if (self::$caseCheck) {
  38704. $real = explode('\\', $class.strrchr($file, '.'));
  38705. $tail = explode(\DIRECTORY_SEPARATOR, str_replace('/', \DIRECTORY_SEPARATOR, $file));
  38706. $i = \count($tail) - 1;
  38707. $j = \count($real) - 1;
  38708. while (isset($tail[$i], $real[$j]) && $tail[$i] === $real[$j]) {
  38709. --$i;
  38710. --$j;
  38711. }
  38712. array_splice($tail, 0, $i + 1);
  38713. }
  38714. if (self::$caseCheck && $tail) {
  38715. $tail = \DIRECTORY_SEPARATOR.implode(\DIRECTORY_SEPARATOR, $tail);
  38716. $tailLen = \strlen($tail);
  38717. $real = $refl->getFileName();
  38718. if (2 === self::$caseCheck) {
  38719. $i = 1 + strrpos($real, '/');
  38720. $file = substr($real, $i);
  38721. $real = substr($real, 0, $i);
  38722. if (isset(self::$darwinCache[$real])) {
  38723. $kDir = $real;
  38724. } else {
  38725. $kDir = strtolower($real);
  38726. if (isset(self::$darwinCache[$kDir])) {
  38727. $real = self::$darwinCache[$kDir][0];
  38728. } else {
  38729. $dir = getcwd();
  38730. chdir($real);
  38731. $real = getcwd().'/';
  38732. chdir($dir);
  38733. $dir = $real;
  38734. $k = $kDir;
  38735. $i = \strlen($dir) - 1;
  38736. while (!isset(self::$darwinCache[$k])) {
  38737. self::$darwinCache[$k] = array($dir, array());
  38738. self::$darwinCache[$dir] = &self::$darwinCache[$k];
  38739. while ('/' !== $dir[--$i]) {
  38740. }
  38741. $k = substr($k, 0, ++$i);
  38742. $dir = substr($dir, 0, $i--);
  38743. }
  38744. }
  38745. }
  38746. $dirFiles = self::$darwinCache[$kDir][1];
  38747. if (isset($dirFiles[$file])) {
  38748. $kFile = $file;
  38749. } else {
  38750. $kFile = strtolower($file);
  38751. if (!isset($dirFiles[$kFile])) {
  38752. foreach (scandir($real, 2) as $f) {
  38753. if ('.' !== $f[0]) {
  38754. $dirFiles[$f] = $f;
  38755. if ($f === $file) {
  38756. $kFile = $k = $file;
  38757. } elseif ($f !== $k = strtolower($f)) {
  38758. $dirFiles[$k] = $f;
  38759. }
  38760. }
  38761. }
  38762. self::$darwinCache[$kDir][1] = $dirFiles;
  38763. }
  38764. }
  38765. $real .= $dirFiles[$kFile];
  38766. }
  38767. if (0 === substr_compare($real, $tail, -$tailLen, $tailLen, true)
  38768. && 0 !== substr_compare($real, $tail, -$tailLen, $tailLen, false)
  38769. ) {
  38770. 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)));
  38771. }
  38772. }
  38773. return true;
  38774. }
  38775. }
  38776. }
  38777. <?php
  38778. namespace Symfony\Component\Debug;
  38779. use Psr\Log\LoggerInterface;
  38780. use Psr\Log\LogLevel;
  38781. use Symfony\Component\Debug\Exception\ContextErrorException;
  38782. use Symfony\Component\Debug\Exception\FatalErrorException;
  38783. use Symfony\Component\Debug\Exception\FatalThrowableError;
  38784. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  38785. use Symfony\Component\Debug\FatalErrorHandler\ClassNotFoundFatalErrorHandler;
  38786. use Symfony\Component\Debug\FatalErrorHandler\FatalErrorHandlerInterface;
  38787. use Symfony\Component\Debug\FatalErrorHandler\UndefinedFunctionFatalErrorHandler;
  38788. use Symfony\Component\Debug\FatalErrorHandler\UndefinedMethodFatalErrorHandler;
  38789. class ErrorHandler
  38790. {
  38791. const TYPE_DEPRECATION = -100;
  38792. private $levels = array(
  38793. E_DEPRECATED => 'Deprecated',
  38794. E_USER_DEPRECATED => 'User Deprecated',
  38795. E_NOTICE => 'Notice',
  38796. E_USER_NOTICE => 'User Notice',
  38797. E_STRICT => 'Runtime Notice',
  38798. E_WARNING => 'Warning',
  38799. E_USER_WARNING => 'User Warning',
  38800. E_COMPILE_WARNING => 'Compile Warning',
  38801. E_CORE_WARNING => 'Core Warning',
  38802. E_USER_ERROR => 'User Error',
  38803. E_RECOVERABLE_ERROR => 'Catchable Fatal Error',
  38804. E_COMPILE_ERROR => 'Compile Error',
  38805. E_PARSE => 'Parse Error',
  38806. E_ERROR => 'Error',
  38807. E_CORE_ERROR => 'Core Error',
  38808. );
  38809. private $loggers = array(
  38810. E_DEPRECATED => array(null, LogLevel::INFO),
  38811. E_USER_DEPRECATED => array(null, LogLevel::INFO),
  38812. E_NOTICE => array(null, LogLevel::WARNING),
  38813. E_USER_NOTICE => array(null, LogLevel::WARNING),
  38814. E_STRICT => array(null, LogLevel::WARNING),
  38815. E_WARNING => array(null, LogLevel::WARNING),
  38816. E_USER_WARNING => array(null, LogLevel::WARNING),
  38817. E_COMPILE_WARNING => array(null, LogLevel::WARNING),
  38818. E_CORE_WARNING => array(null, LogLevel::WARNING),
  38819. E_USER_ERROR => array(null, LogLevel::CRITICAL),
  38820. E_RECOVERABLE_ERROR => array(null, LogLevel::CRITICAL),
  38821. E_COMPILE_ERROR => array(null, LogLevel::CRITICAL),
  38822. E_PARSE => array(null, LogLevel::CRITICAL),
  38823. E_ERROR => array(null, LogLevel::CRITICAL),
  38824. E_CORE_ERROR => array(null, LogLevel::CRITICAL),
  38825. );
  38826. private $thrownErrors = 0x1FFF;
  38827. private $scopedErrors = 0x1FFF;
  38828. private $tracedErrors = 0x77FB;
  38829. private $screamedErrors = 0x55;
  38830. private $loggedErrors = 0;
  38831. private $loggedTraces = array();
  38832. private $isRecursive = 0;
  38833. private $isRoot = false;
  38834. private $exceptionHandler;
  38835. private $bootstrappingLogger;
  38836. private static $reservedMemory;
  38837. private static $stackedErrors = array();
  38838. private static $stackedErrorLevels = array();
  38839. private static $toStringException = null;
  38840. private static $exitCode = 0;
  38841. private $displayErrors = 0x1FFF;
  38842. public static function register($handler = null, $replace = true)
  38843. {
  38844. if (null === self::$reservedMemory) {
  38845. self::$reservedMemory = str_repeat('x', 10240);
  38846. register_shutdown_function(__CLASS__.'::handleFatalError');
  38847. }
  38848. $levels = -1;
  38849. if ($handlerIsNew = !$handler instanceof self) {
  38850. if (null !== $handler) {
  38851. $levels = $replace ? $handler : 0;
  38852. $replace = true;
  38853. }
  38854. $handler = new static();
  38855. }
  38856. if (null === $prev = set_error_handler(array($handler, 'handleError'))) {
  38857. restore_error_handler();
  38858. set_error_handler(array($handler, 'handleError'), $handler->thrownErrors | $handler->loggedErrors);
  38859. $handler->isRoot = true;
  38860. }
  38861. if ($handlerIsNew && \is_array($prev) && $prev[0] instanceof self) {
  38862. $handler = $prev[0];
  38863. $replace = false;
  38864. }
  38865. if (!$replace && $prev) {
  38866. restore_error_handler();
  38867. $handlerIsRegistered = \is_array($prev) && $handler === $prev[0];
  38868. } else {
  38869. $handlerIsRegistered = true;
  38870. }
  38871. if (\is_array($prev = set_exception_handler(array($handler, 'handleException'))) && $prev[0] instanceof self) {
  38872. restore_exception_handler();
  38873. if (!$handlerIsRegistered) {
  38874. $handler = $prev[0];
  38875. } elseif ($handler !== $prev[0] && $replace) {
  38876. set_exception_handler(array($handler, 'handleException'));
  38877. $p = $prev[0]->setExceptionHandler(null);
  38878. $handler->setExceptionHandler($p);
  38879. $prev[0]->setExceptionHandler($p);
  38880. }
  38881. } else {
  38882. $handler->setExceptionHandler($prev);
  38883. }
  38884. $handler->throwAt($levels & $handler->thrownErrors, true);
  38885. return $handler;
  38886. }
  38887. public function __construct(BufferingLogger $bootstrappingLogger = null)
  38888. {
  38889. if ($bootstrappingLogger) {
  38890. $this->bootstrappingLogger = $bootstrappingLogger;
  38891. $this->setDefaultLogger($bootstrappingLogger);
  38892. }
  38893. }
  38894. public function setDefaultLogger(LoggerInterface $logger, $levels = null, $replace = false)
  38895. {
  38896. $loggers = array();
  38897. if (\is_array($levels)) {
  38898. foreach ($levels as $type => $logLevel) {
  38899. if (empty($this->loggers[$type][0]) || $replace || $this->loggers[$type][0] === $this->bootstrappingLogger) {
  38900. $loggers[$type] = array($logger, $logLevel);
  38901. }
  38902. }
  38903. } else {
  38904. if (null === $levels) {
  38905. $levels = E_ALL | E_STRICT;
  38906. }
  38907. foreach ($this->loggers as $type => $log) {
  38908. if (($type & $levels) && (empty($log[0]) || $replace || $log[0] === $this->bootstrappingLogger)) {
  38909. $log[0] = $logger;
  38910. $loggers[$type] = $log;
  38911. }
  38912. }
  38913. }
  38914. $this->setLoggers($loggers);
  38915. }
  38916. public function setLoggers(array $loggers)
  38917. {
  38918. $prevLogged = $this->loggedErrors;
  38919. $prev = $this->loggers;
  38920. $flush = array();
  38921. foreach ($loggers as $type => $log) {
  38922. if (!isset($prev[$type])) {
  38923. throw new \InvalidArgumentException('Unknown error type: '.$type);
  38924. }
  38925. if (!\is_array($log)) {
  38926. $log = array($log);
  38927. } elseif (!array_key_exists(0, $log)) {
  38928. throw new \InvalidArgumentException('No logger provided');
  38929. }
  38930. if (null === $log[0]) {
  38931. $this->loggedErrors &= ~$type;
  38932. } elseif ($log[0] instanceof LoggerInterface) {
  38933. $this->loggedErrors |= $type;
  38934. } else {
  38935. throw new \InvalidArgumentException('Invalid logger provided');
  38936. }
  38937. $this->loggers[$type] = $log + $prev[$type];
  38938. if ($this->bootstrappingLogger && $prev[$type][0] === $this->bootstrappingLogger) {
  38939. $flush[$type] = $type;
  38940. }
  38941. }
  38942. $this->reRegister($prevLogged | $this->thrownErrors);
  38943. if ($flush) {
  38944. foreach ($this->bootstrappingLogger->cleanLogs() as $log) {
  38945. $type = $log[2]['type'];
  38946. if (!isset($flush[$type])) {
  38947. $this->bootstrappingLogger->log($log[0], $log[1], $log[2]);
  38948. } elseif ($this->loggers[$type][0]) {
  38949. $this->loggers[$type][0]->log($this->loggers[$type][1], $log[1], $log[2]);
  38950. }
  38951. }
  38952. }
  38953. return $prev;
  38954. }
  38955. public function setExceptionHandler($handler)
  38956. {
  38957. if (null !== $handler && !\is_callable($handler)) {
  38958. throw new \LogicException('The exception handler must be a valid PHP callable.');
  38959. }
  38960. $prev = $this->exceptionHandler;
  38961. $this->exceptionHandler = $handler;
  38962. return $prev;
  38963. }
  38964. public function throwAt($levels, $replace = false)
  38965. {
  38966. $prev = $this->thrownErrors;
  38967. $this->thrownErrors = ($levels | E_RECOVERABLE_ERROR | E_USER_ERROR) & ~E_USER_DEPRECATED & ~E_DEPRECATED;
  38968. if (!$replace) {
  38969. $this->thrownErrors |= $prev;
  38970. }
  38971. $this->reRegister($prev | $this->loggedErrors);
  38972. $this->displayErrors = $this->thrownErrors;
  38973. return $prev;
  38974. }
  38975. public function scopeAt($levels, $replace = false)
  38976. {
  38977. $prev = $this->scopedErrors;
  38978. $this->scopedErrors = (int) $levels;
  38979. if (!$replace) {
  38980. $this->scopedErrors |= $prev;
  38981. }
  38982. return $prev;
  38983. }
  38984. public function traceAt($levels, $replace = false)
  38985. {
  38986. $prev = $this->tracedErrors;
  38987. $this->tracedErrors = (int) $levels;
  38988. if (!$replace) {
  38989. $this->tracedErrors |= $prev;
  38990. }
  38991. return $prev;
  38992. }
  38993. public function screamAt($levels, $replace = false)
  38994. {
  38995. $prev = $this->screamedErrors;
  38996. $this->screamedErrors = (int) $levels;
  38997. if (!$replace) {
  38998. $this->screamedErrors |= $prev;
  38999. }
  39000. return $prev;
  39001. }
  39002. private function reRegister($prev)
  39003. {
  39004. if ($prev !== $this->thrownErrors | $this->loggedErrors) {
  39005. $handler = set_error_handler('var_dump');
  39006. $handler = \is_array($handler) ? $handler[0] : null;
  39007. restore_error_handler();
  39008. if ($handler === $this) {
  39009. restore_error_handler();
  39010. if ($this->isRoot) {
  39011. set_error_handler(array($this, 'handleError'), $this->thrownErrors | $this->loggedErrors);
  39012. } else {
  39013. set_error_handler(array($this, 'handleError'));
  39014. }
  39015. }
  39016. }
  39017. }
  39018. public function handleError($type, $message, $file, $line)
  39019. {
  39020. $level = error_reporting();
  39021. $silenced = 0 === ($level & $type);
  39022. $level |= E_RECOVERABLE_ERROR | E_USER_ERROR | E_DEPRECATED | E_USER_DEPRECATED;
  39023. $log = $this->loggedErrors & $type;
  39024. $throw = $this->thrownErrors & $type & $level;
  39025. $type &= $level | $this->screamedErrors;
  39026. if (!$type || (!$log && !$throw)) {
  39027. return !$silenced && $type && $log;
  39028. }
  39029. $scope = $this->scopedErrors & $type;
  39030. if (4 < $numArgs = \func_num_args()) {
  39031. $context = $scope ? (func_get_arg(4) ?: array()) : array();
  39032. $backtrace = 5 < $numArgs ? func_get_arg(5) : null;
  39033. } else {
  39034. $context = array();
  39035. $backtrace = null;
  39036. }
  39037. if (isset($context['GLOBALS']) && $scope) {
  39038. $e = $context;
  39039. unset($e['GLOBALS'], $context);
  39040. $context = $e;
  39041. }
  39042. if (null !== $backtrace && $type & E_ERROR) {
  39043. $this->handleFatalError(compact('type', 'message', 'file', 'line', 'backtrace'));
  39044. return true;
  39045. }
  39046. if ($throw) {
  39047. if (null !== self::$toStringException) {
  39048. $throw = self::$toStringException;
  39049. self::$toStringException = null;
  39050. } elseif ($scope && class_exists('Symfony\Component\Debug\Exception\ContextErrorException')) {
  39051. $throw = new ContextErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line, $context);
  39052. } else {
  39053. $throw = new \ErrorException($this->levels[$type].': '.$message, 0, $type, $file, $line);
  39054. }
  39055. if (\PHP_VERSION_ID <= 50407 && (\PHP_VERSION_ID >= 50400 || \PHP_VERSION_ID <= 50317)) {
  39056. $throw->errorHandlerCanary = new ErrorHandlerCanary();
  39057. }
  39058. if (E_USER_ERROR & $type) {
  39059. $backtrace = $backtrace ?: $throw->getTrace();
  39060. for ($i = 1; isset($backtrace[$i]); ++$i) {
  39061. if (isset($backtrace[$i]['function'], $backtrace[$i]['type'], $backtrace[$i - 1]['function'])
  39062. && '__toString' === $backtrace[$i]['function']
  39063. && '->' === $backtrace[$i]['type']
  39064. && !isset($backtrace[$i - 1]['class'])
  39065. && ('trigger_error' === $backtrace[$i - 1]['function'] || 'user_error' === $backtrace[$i - 1]['function'])
  39066. ) {
  39067. foreach ($context as $e) {
  39068. if (($e instanceof \Exception || $e instanceof \Throwable) && $e->__toString() === $message) {
  39069. if (1 === $i) {
  39070. $throw = $e;
  39071. break;
  39072. }
  39073. self::$toStringException = $e;
  39074. return true;
  39075. }
  39076. }
  39077. if (1 < $i) {
  39078. $this->handleException($throw);
  39079. return false;
  39080. }
  39081. }
  39082. }
  39083. }
  39084. throw $throw;
  39085. }
  39086. $e = md5("{$type}/{$line}/{$file}\x00{$message}", true);
  39087. $trace = true;
  39088. if (!($this->tracedErrors & $type) || isset($this->loggedTraces[$e])) {
  39089. $trace = false;
  39090. } else {
  39091. $this->loggedTraces[$e] = 1;
  39092. }
  39093. $e = compact('type', 'file', 'line', 'level');
  39094. if ($type & $level) {
  39095. if ($scope) {
  39096. $e['scope_vars'] = $context;
  39097. if ($trace) {
  39098. $e['stack'] = $backtrace ?: debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT);
  39099. }
  39100. } elseif ($trace) {
  39101. if (null === $backtrace) {
  39102. $e['stack'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
  39103. } else {
  39104. foreach ($backtrace as &$frame) {
  39105. unset($frame['args'], $frame);
  39106. }
  39107. $e['stack'] = $backtrace;
  39108. }
  39109. }
  39110. }
  39111. if ($this->isRecursive) {
  39112. $log = 0;
  39113. } elseif (self::$stackedErrorLevels) {
  39114. self::$stackedErrors[] = array($this->loggers[$type][0], ($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39115. } else {
  39116. try {
  39117. $this->isRecursive = true;
  39118. $this->loggers[$type][0]->log(($type & $level) ? $this->loggers[$type][1] : LogLevel::DEBUG, $message, $e);
  39119. $this->isRecursive = false;
  39120. } catch (\Exception $e) {
  39121. $this->isRecursive = false;
  39122. throw $e;
  39123. } catch (\Throwable $e) {
  39124. $this->isRecursive = false;
  39125. throw $e;
  39126. }
  39127. }
  39128. return !$silenced && $type && $log;
  39129. }
  39130. public function handleException($exception, array $error = null)
  39131. {
  39132. if (null === $error) {
  39133. self::$exitCode = 255;
  39134. }
  39135. if (!$exception instanceof \Exception) {
  39136. $exception = new FatalThrowableError($exception);
  39137. }
  39138. $type = $exception instanceof FatalErrorException ? $exception->getSeverity() : E_ERROR;
  39139. $handlerException = null;
  39140. if (($this->loggedErrors & $type) || $exception instanceof FatalThrowableError) {
  39141. $e = array(
  39142. 'type' => $type,
  39143. 'file' => $exception->getFile(),
  39144. 'line' => $exception->getLine(),
  39145. 'level' => error_reporting(),
  39146. 'stack' => $exception->getTrace(),
  39147. );
  39148. if ($exception instanceof FatalErrorException) {
  39149. if ($exception instanceof FatalThrowableError) {
  39150. $error = array(
  39151. 'type' => $type,
  39152. 'message' => $message = $exception->getMessage(),
  39153. 'file' => $e['file'],
  39154. 'line' => $e['line'],
  39155. );
  39156. } else {
  39157. $message = 'Fatal '.$exception->getMessage();
  39158. }
  39159. } elseif ($exception instanceof \ErrorException) {
  39160. $message = 'Uncaught '.$exception->getMessage();
  39161. if ($exception instanceof ContextErrorException) {
  39162. $e['context'] = $exception->getContext();
  39163. }
  39164. } else {
  39165. $message = 'Uncaught Exception: '.$exception->getMessage();
  39166. }
  39167. }
  39168. if ($this->loggedErrors & $type) {
  39169. try {
  39170. $this->loggers[$type][0]->log($this->loggers[$type][1], $message, $e);
  39171. } catch (\Exception $handlerException) {
  39172. } catch (\Throwable $handlerException) {
  39173. }
  39174. }
  39175. if ($exception instanceof FatalErrorException && !$exception instanceof OutOfMemoryException && $error) {
  39176. foreach ($this->getFatalErrorHandlers() as $handler) {
  39177. if ($e = $handler->handleError($error, $exception)) {
  39178. $exception = $e;
  39179. break;
  39180. }
  39181. }
  39182. }
  39183. $exceptionHandler = $this->exceptionHandler;
  39184. $this->exceptionHandler = null;
  39185. try {
  39186. if (null !== $exceptionHandler) {
  39187. return \call_user_func($exceptionHandler, $exception);
  39188. }
  39189. $handlerException = $handlerException ?: $exception;
  39190. } catch (\Exception $handlerException) {
  39191. } catch (\Throwable $handlerException) {
  39192. }
  39193. if ($exception === $handlerException) {
  39194. self::$reservedMemory = null;
  39195. throw $exception;
  39196. }
  39197. $this->handleException($handlerException);
  39198. }
  39199. public static function handleFatalError(array $error = null)
  39200. {
  39201. if (null === self::$reservedMemory) {
  39202. return;
  39203. }
  39204. $handler = self::$reservedMemory = null;
  39205. $handlers = array();
  39206. $previousHandler = null;
  39207. $sameHandlerLimit = 10;
  39208. while (!\is_array($handler) || !$handler[0] instanceof self) {
  39209. $handler = set_exception_handler('var_dump');
  39210. restore_exception_handler();
  39211. if (!$handler) {
  39212. break;
  39213. }
  39214. restore_exception_handler();
  39215. if ($handler !== $previousHandler) {
  39216. array_unshift($handlers, $handler);
  39217. $previousHandler = $handler;
  39218. } elseif (0 === --$sameHandlerLimit) {
  39219. $handler = null;
  39220. break;
  39221. }
  39222. }
  39223. foreach ($handlers as $h) {
  39224. set_exception_handler($h);
  39225. }
  39226. if (!$handler) {
  39227. return;
  39228. }
  39229. if ($handler !== $h) {
  39230. $handler[0]->setExceptionHandler($h);
  39231. }
  39232. $handler = $handler[0];
  39233. $handlers = array();
  39234. if ($exit = null === $error) {
  39235. $error = error_get_last();
  39236. }
  39237. try {
  39238. while (self::$stackedErrorLevels) {
  39239. static::unstackErrors();
  39240. }
  39241. } catch (\Exception $exception) {
  39242. } catch (\Throwable $exception) {
  39243. }
  39244. if ($error && $error['type'] &= E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR) {
  39245. $handler->throwAt(0, true);
  39246. $trace = isset($error['backtrace']) ? $error['backtrace'] : null;
  39247. if (0 === strpos($error['message'], 'Allowed memory') || 0 === strpos($error['message'], 'Out of memory')) {
  39248. $exception = new OutOfMemoryException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, false, $trace);
  39249. } else {
  39250. $exception = new FatalErrorException($handler->levels[$error['type']].': '.$error['message'], 0, $error['type'], $error['file'], $error['line'], 2, true, $trace);
  39251. }
  39252. }
  39253. try {
  39254. if (isset($exception)) {
  39255. self::$exitCode = 255;
  39256. $handler->handleException($exception, $error);
  39257. }
  39258. } catch (FatalErrorException $e) {
  39259. }
  39260. if ($exit && self::$exitCode) {
  39261. $exitCode = self::$exitCode;
  39262. register_shutdown_function('register_shutdown_function', function () use ($exitCode) { exit($exitCode); });
  39263. }
  39264. }
  39265. public static function stackErrors()
  39266. {
  39267. self::$stackedErrorLevels[] = error_reporting(error_reporting() | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39268. }
  39269. public static function unstackErrors()
  39270. {
  39271. $level = array_pop(self::$stackedErrorLevels);
  39272. if (null !== $level) {
  39273. $e = error_reporting($level);
  39274. if ($e !== ($level | E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR)) {
  39275. error_reporting($e);
  39276. }
  39277. }
  39278. if (empty(self::$stackedErrorLevels)) {
  39279. $errors = self::$stackedErrors;
  39280. self::$stackedErrors = array();
  39281. foreach ($errors as $e) {
  39282. $e[0]->log($e[1], $e[2], $e[3]);
  39283. }
  39284. }
  39285. }
  39286. protected function getFatalErrorHandlers()
  39287. {
  39288. return array(
  39289. new UndefinedFunctionFatalErrorHandler(),
  39290. new UndefinedMethodFatalErrorHandler(),
  39291. new ClassNotFoundFatalErrorHandler(),
  39292. );
  39293. }
  39294. public function setLevel($level)
  39295. {
  39296. @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);
  39297. $level = null === $level ? error_reporting() : $level;
  39298. $this->throwAt($level, true);
  39299. }
  39300. public function setDisplayErrors($displayErrors)
  39301. {
  39302. @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);
  39303. if ($displayErrors) {
  39304. $this->throwAt($this->displayErrors, true);
  39305. } else {
  39306. $displayErrors = $this->displayErrors;
  39307. $this->throwAt(0, true);
  39308. $this->displayErrors = $displayErrors;
  39309. }
  39310. }
  39311. public static function setLogger(LoggerInterface $logger, $channel = 'deprecation')
  39312. {
  39313. @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);
  39314. $handler = set_error_handler('var_dump');
  39315. $handler = \is_array($handler) ? $handler[0] : null;
  39316. restore_error_handler();
  39317. if (!$handler instanceof self) {
  39318. return;
  39319. }
  39320. if ('deprecation' === $channel) {
  39321. $handler->setDefaultLogger($logger, E_DEPRECATED | E_USER_DEPRECATED, true);
  39322. $handler->screamAt(E_DEPRECATED | E_USER_DEPRECATED);
  39323. } elseif ('scream' === $channel) {
  39324. $handler->setDefaultLogger($logger, E_ALL | E_STRICT, false);
  39325. $handler->screamAt(E_ALL | E_STRICT);
  39326. } elseif ('emergency' === $channel) {
  39327. $handler->setDefaultLogger($logger, E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR, true);
  39328. $handler->screamAt(E_PARSE | E_ERROR | E_CORE_ERROR | E_COMPILE_ERROR);
  39329. }
  39330. }
  39331. public function handle($level, $message, $file = 'unknown', $line = 0, $context = array())
  39332. {
  39333. $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());
  39334. return $this->handleError($level, $message, $file, $line, (array) $context);
  39335. }
  39336. public function handleFatal()
  39337. {
  39338. @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);
  39339. static::handleFatalError();
  39340. }
  39341. }
  39342. class ErrorHandlerCanary
  39343. {
  39344. private static $displayErrors = null;
  39345. public function __construct()
  39346. {
  39347. if (null === self::$displayErrors) {
  39348. self::$displayErrors = ini_set('display_errors', 1);
  39349. }
  39350. }
  39351. public function __destruct()
  39352. {
  39353. if (null !== self::$displayErrors) {
  39354. ini_set('display_errors', self::$displayErrors);
  39355. self::$displayErrors = null;
  39356. }
  39357. }
  39358. }
  39359. <?php
  39360. namespace Symfony\Component\Debug\Exception;
  39361. class ClassNotFoundException extends FatalErrorException
  39362. {
  39363. public function __construct($message, \ErrorException $previous)
  39364. {
  39365. parent::__construct(
  39366. $message,
  39367. $previous->getCode(),
  39368. $previous->getSeverity(),
  39369. $previous->getFile(),
  39370. $previous->getLine(),
  39371. null,
  39372. true,
  39373. null,
  39374. $previous->getPrevious()
  39375. );
  39376. $this->setTrace($previous->getTrace());
  39377. }
  39378. }
  39379. <?php
  39380. namespace Symfony\Component\Debug\Exception;
  39381. class ContextErrorException extends \ErrorException
  39382. {
  39383. private $context = array();
  39384. public function __construct($message, $code, $severity, $filename, $lineno, $context = array())
  39385. {
  39386. parent::__construct($message, $code, $severity, $filename, $lineno);
  39387. $this->context = $context;
  39388. }
  39389. public function getContext()
  39390. {
  39391. return $this->context;
  39392. }
  39393. }
  39394. <?php
  39395. namespace Symfony\Component\Debug\Exception;
  39396. @trigger_error('The '.__NAMESPACE__.'\DummyException class is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  39397. class DummyException extends \ErrorException
  39398. {
  39399. }
  39400. <?php
  39401. namespace Symfony\Component\HttpKernel\Exception;
  39402. class FatalErrorException extends \ErrorException
  39403. {
  39404. }
  39405. namespace Symfony\Component\Debug\Exception;
  39406. use Symfony\Component\HttpKernel\Exception\FatalErrorException as LegacyFatalErrorException;
  39407. class FatalErrorException extends LegacyFatalErrorException
  39408. {
  39409. public function __construct($message, $code, $severity, $filename, $lineno, $traceOffset = null, $traceArgs = true, array $trace = null, $previous = null)
  39410. {
  39411. parent::__construct($message, $code, $severity, $filename, $lineno, $previous);
  39412. if (null !== $trace) {
  39413. if (!$traceArgs) {
  39414. foreach ($trace as &$frame) {
  39415. unset($frame['args'], $frame['this'], $frame);
  39416. }
  39417. }
  39418. $this->setTrace($trace);
  39419. } elseif (null !== $traceOffset) {
  39420. if (\function_exists('xdebug_get_function_stack')) {
  39421. $trace = xdebug_get_function_stack();
  39422. if (0 < $traceOffset) {
  39423. array_splice($trace, -$traceOffset);
  39424. }
  39425. foreach ($trace as &$frame) {
  39426. if (!isset($frame['type'])) {
  39427. if (isset($frame['class'])) {
  39428. $frame['type'] = '::';
  39429. }
  39430. } elseif ('dynamic' === $frame['type']) {
  39431. $frame['type'] = '->';
  39432. } elseif ('static' === $frame['type']) {
  39433. $frame['type'] = '::';
  39434. }
  39435. if (!$traceArgs) {
  39436. unset($frame['params'], $frame['args']);
  39437. } elseif (isset($frame['params']) && !isset($frame['args'])) {
  39438. $frame['args'] = $frame['params'];
  39439. unset($frame['params']);
  39440. }
  39441. }
  39442. unset($frame);
  39443. $trace = array_reverse($trace);
  39444. } elseif (\function_exists('symfony_debug_backtrace')) {
  39445. $trace = symfony_debug_backtrace();
  39446. if (0 < $traceOffset) {
  39447. array_splice($trace, 0, $traceOffset);
  39448. }
  39449. } else {
  39450. $trace = array();
  39451. }
  39452. $this->setTrace($trace);
  39453. }
  39454. }
  39455. protected function setTrace($trace)
  39456. {
  39457. $traceReflector = new \ReflectionProperty('Exception', 'trace');
  39458. $traceReflector->setAccessible(true);
  39459. $traceReflector->setValue($this, $trace);
  39460. }
  39461. }
  39462. <?php
  39463. namespace Symfony\Component\Debug\Exception;
  39464. class FatalThrowableError extends FatalErrorException
  39465. {
  39466. public function __construct(\Throwable $e)
  39467. {
  39468. if ($e instanceof \ParseError) {
  39469. $message = 'Parse error: '.$e->getMessage();
  39470. $severity = E_PARSE;
  39471. } elseif ($e instanceof \TypeError) {
  39472. $message = 'Type error: '.$e->getMessage();
  39473. $severity = E_RECOVERABLE_ERROR;
  39474. } else {
  39475. $message = $e->getMessage();
  39476. $severity = E_ERROR;
  39477. }
  39478. \ErrorException::__construct(
  39479. $message,
  39480. $e->getCode(),
  39481. $severity,
  39482. $e->getFile(),
  39483. $e->getLine(),
  39484. $e->getPrevious()
  39485. );
  39486. $this->setTrace($e->getTrace());
  39487. }
  39488. }
  39489. <?php
  39490. namespace Symfony\Component\HttpKernel\Exception;
  39491. use Symfony\Component\Debug\Exception\FlattenException as DebugFlattenException;
  39492. class FlattenException
  39493. {
  39494. private $handler;
  39495. public static function __callStatic($method, $args)
  39496. {
  39497. if (!method_exists('Symfony\Component\Debug\Exception\FlattenException', $method)) {
  39498. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_called_class(), $method));
  39499. }
  39500. return \call_user_func_array(array('Symfony\Component\Debug\Exception\FlattenException', $method), $args);
  39501. }
  39502. public function __call($method, $args)
  39503. {
  39504. if (!isset($this->handler)) {
  39505. $this->handler = new DebugFlattenException();
  39506. }
  39507. if (!method_exists($this->handler, $method)) {
  39508. throw new \BadMethodCallException(sprintf('Call to undefined method %s::%s()', \get_class($this), $method));
  39509. }
  39510. return \call_user_func_array(array($this->handler, $method), $args);
  39511. }
  39512. }
  39513. namespace Symfony\Component\Debug\Exception;
  39514. use Symfony\Component\HttpKernel\Exception\FlattenException as LegacyFlattenException;
  39515. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  39516. class FlattenException extends LegacyFlattenException
  39517. {
  39518. private $message;
  39519. private $code;
  39520. private $previous;
  39521. private $trace;
  39522. private $class;
  39523. private $statusCode;
  39524. private $headers;
  39525. private $file;
  39526. private $line;
  39527. public static function create(\Exception $exception, $statusCode = null, array $headers = array())
  39528. {
  39529. $e = new static();
  39530. $e->setMessage($exception->getMessage());
  39531. $e->setCode($exception->getCode());
  39532. if ($exception instanceof HttpExceptionInterface) {
  39533. $statusCode = $exception->getStatusCode();
  39534. $headers = array_merge($headers, $exception->getHeaders());
  39535. }
  39536. if (null === $statusCode) {
  39537. $statusCode = 500;
  39538. }
  39539. $e->setStatusCode($statusCode);
  39540. $e->setHeaders($headers);
  39541. $e->setTraceFromException($exception);
  39542. $e->setClass(\get_class($exception));
  39543. $e->setFile($exception->getFile());
  39544. $e->setLine($exception->getLine());
  39545. $previous = $exception->getPrevious();
  39546. if ($previous instanceof \Exception) {
  39547. $e->setPrevious(static::create($previous));
  39548. } elseif ($previous instanceof \Throwable) {
  39549. $e->setPrevious(static::create(new FatalThrowableError($previous)));
  39550. }
  39551. return $e;
  39552. }
  39553. public function toArray()
  39554. {
  39555. $exceptions = array();
  39556. foreach (array_merge(array($this), $this->getAllPrevious()) as $exception) {
  39557. $exceptions[] = array(
  39558. 'message' => $exception->getMessage(),
  39559. 'class' => $exception->getClass(),
  39560. 'trace' => $exception->getTrace(),
  39561. );
  39562. }
  39563. return $exceptions;
  39564. }
  39565. public function getStatusCode()
  39566. {
  39567. return $this->statusCode;
  39568. }
  39569. public function setStatusCode($code)
  39570. {
  39571. $this->statusCode = $code;
  39572. }
  39573. public function getHeaders()
  39574. {
  39575. return $this->headers;
  39576. }
  39577. public function setHeaders(array $headers)
  39578. {
  39579. $this->headers = $headers;
  39580. }
  39581. public function getClass()
  39582. {
  39583. return $this->class;
  39584. }
  39585. public function setClass($class)
  39586. {
  39587. $this->class = $class;
  39588. }
  39589. public function getFile()
  39590. {
  39591. return $this->file;
  39592. }
  39593. public function setFile($file)
  39594. {
  39595. $this->file = $file;
  39596. }
  39597. public function getLine()
  39598. {
  39599. return $this->line;
  39600. }
  39601. public function setLine($line)
  39602. {
  39603. $this->line = $line;
  39604. }
  39605. public function getMessage()
  39606. {
  39607. return $this->message;
  39608. }
  39609. public function setMessage($message)
  39610. {
  39611. $this->message = $message;
  39612. }
  39613. public function getCode()
  39614. {
  39615. return $this->code;
  39616. }
  39617. public function setCode($code)
  39618. {
  39619. $this->code = $code;
  39620. }
  39621. public function getPrevious()
  39622. {
  39623. return $this->previous;
  39624. }
  39625. public function setPrevious(FlattenException $previous)
  39626. {
  39627. $this->previous = $previous;
  39628. }
  39629. public function getAllPrevious()
  39630. {
  39631. $exceptions = array();
  39632. $e = $this;
  39633. while ($e = $e->getPrevious()) {
  39634. $exceptions[] = $e;
  39635. }
  39636. return $exceptions;
  39637. }
  39638. public function getTrace()
  39639. {
  39640. return $this->trace;
  39641. }
  39642. public function setTraceFromException(\Exception $exception)
  39643. {
  39644. $this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
  39645. }
  39646. public function setTrace($trace, $file, $line)
  39647. {
  39648. $this->trace = array();
  39649. $this->trace[] = array(
  39650. 'namespace' => '',
  39651. 'short_class' => '',
  39652. 'class' => '',
  39653. 'type' => '',
  39654. 'function' => '',
  39655. 'file' => $file,
  39656. 'line' => $line,
  39657. 'args' => array(),
  39658. );
  39659. foreach ($trace as $entry) {
  39660. $class = '';
  39661. $namespace = '';
  39662. if (isset($entry['class'])) {
  39663. $parts = explode('\\', $entry['class']);
  39664. $class = array_pop($parts);
  39665. $namespace = implode('\\', $parts);
  39666. }
  39667. $this->trace[] = array(
  39668. 'namespace' => $namespace,
  39669. 'short_class' => $class,
  39670. 'class' => isset($entry['class']) ? $entry['class'] : '',
  39671. 'type' => isset($entry['type']) ? $entry['type'] : '',
  39672. 'function' => isset($entry['function']) ? $entry['function'] : null,
  39673. 'file' => isset($entry['file']) ? $entry['file'] : null,
  39674. 'line' => isset($entry['line']) ? $entry['line'] : null,
  39675. 'args' => isset($entry['args']) ? $this->flattenArgs($entry['args']) : array(),
  39676. );
  39677. }
  39678. }
  39679. private function flattenArgs($args, $level = 0, &$count = 0)
  39680. {
  39681. $result = array();
  39682. foreach ($args as $key => $value) {
  39683. if (++$count > 1e4) {
  39684. return array('array', '*SKIPPED over 10000 entries*');
  39685. }
  39686. if ($value instanceof \__PHP_Incomplete_Class) {
  39687. $result[$key] = array('incomplete-object', $this->getClassNameFromIncomplete($value));
  39688. } elseif (\is_object($value)) {
  39689. $result[$key] = array('object', \get_class($value));
  39690. } elseif (\is_array($value)) {
  39691. if ($level > 10) {
  39692. $result[$key] = array('array', '*DEEP NESTED ARRAY*');
  39693. } else {
  39694. $result[$key] = array('array', $this->flattenArgs($value, $level + 1, $count));
  39695. }
  39696. } elseif (null === $value) {
  39697. $result[$key] = array('null', null);
  39698. } elseif (\is_bool($value)) {
  39699. $result[$key] = array('boolean', $value);
  39700. } elseif (\is_resource($value)) {
  39701. $result[$key] = array('resource', get_resource_type($value));
  39702. } else {
  39703. $result[$key] = array('string', (string) $value);
  39704. }
  39705. }
  39706. return $result;
  39707. }
  39708. private function getClassNameFromIncomplete(\__PHP_Incomplete_Class $value)
  39709. {
  39710. $array = new \ArrayObject($value);
  39711. return $array['__PHP_Incomplete_Class_Name'];
  39712. }
  39713. }
  39714. <?php
  39715. namespace Symfony\Component\Debug\Exception;
  39716. class OutOfMemoryException extends FatalErrorException
  39717. {
  39718. }
  39719. <?php
  39720. namespace Symfony\Component\Debug\Exception;
  39721. class UndefinedFunctionException extends FatalErrorException
  39722. {
  39723. public function __construct($message, \ErrorException $previous)
  39724. {
  39725. parent::__construct(
  39726. $message,
  39727. $previous->getCode(),
  39728. $previous->getSeverity(),
  39729. $previous->getFile(),
  39730. $previous->getLine(),
  39731. null,
  39732. true,
  39733. null,
  39734. $previous->getPrevious()
  39735. );
  39736. $this->setTrace($previous->getTrace());
  39737. }
  39738. }
  39739. <?php
  39740. namespace Symfony\Component\Debug\Exception;
  39741. class UndefinedMethodException extends FatalErrorException
  39742. {
  39743. public function __construct($message, \ErrorException $previous)
  39744. {
  39745. parent::__construct(
  39746. $message,
  39747. $previous->getCode(),
  39748. $previous->getSeverity(),
  39749. $previous->getFile(),
  39750. $previous->getLine(),
  39751. null,
  39752. true,
  39753. null,
  39754. $previous->getPrevious()
  39755. );
  39756. $this->setTrace($previous->getTrace());
  39757. }
  39758. }
  39759. <?php
  39760. namespace Symfony\Component\Debug;
  39761. use Symfony\Component\Debug\Exception\FlattenException;
  39762. use Symfony\Component\Debug\Exception\OutOfMemoryException;
  39763. use Symfony\Component\HttpFoundation\Response;
  39764. class ExceptionHandler
  39765. {
  39766. private $debug;
  39767. private $charset;
  39768. private $handler;
  39769. private $caughtBuffer;
  39770. private $caughtLength;
  39771. private $fileLinkFormat;
  39772. public function __construct($debug = true, $charset = null, $fileLinkFormat = null)
  39773. {
  39774. if (false !== strpos($charset, '%')) {
  39775. @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);
  39776. $pivot = $fileLinkFormat;
  39777. $fileLinkFormat = $charset;
  39778. $charset = $pivot;
  39779. }
  39780. $this->debug = $debug;
  39781. $this->charset = $charset ?: ini_get('default_charset') ?: 'UTF-8';
  39782. $this->fileLinkFormat = $fileLinkFormat ?: ini_get('xdebug.file_link_format') ?: get_cfg_var('xdebug.file_link_format');
  39783. }
  39784. public static function register($debug = true, $charset = null, $fileLinkFormat = null)
  39785. {
  39786. $handler = new static($debug, $charset, $fileLinkFormat);
  39787. $prev = set_exception_handler(array($handler, 'handle'));
  39788. if (\is_array($prev) && $prev[0] instanceof ErrorHandler) {
  39789. restore_exception_handler();
  39790. $prev[0]->setExceptionHandler(array($handler, 'handle'));
  39791. }
  39792. return $handler;
  39793. }
  39794. public function setHandler($handler)
  39795. {
  39796. if (null !== $handler && !\is_callable($handler)) {
  39797. throw new \LogicException('The exception handler must be a valid PHP callable.');
  39798. }
  39799. $old = $this->handler;
  39800. $this->handler = $handler;
  39801. return $old;
  39802. }
  39803. public function setFileLinkFormat($format)
  39804. {
  39805. $old = $this->fileLinkFormat;
  39806. $this->fileLinkFormat = $format;
  39807. return $old;
  39808. }
  39809. public function handle(\Exception $exception)
  39810. {
  39811. if (null === $this->handler || $exception instanceof OutOfMemoryException) {
  39812. $this->failSafeHandle($exception);
  39813. return;
  39814. }
  39815. $caughtLength = $this->caughtLength = 0;
  39816. ob_start(array($this, 'catchOutput'));
  39817. $this->failSafeHandle($exception);
  39818. while (null === $this->caughtBuffer && ob_end_flush()) {
  39819. }
  39820. if (isset($this->caughtBuffer[0])) {
  39821. ob_start(array($this, 'cleanOutput'));
  39822. echo $this->caughtBuffer;
  39823. $caughtLength = ob_get_length();
  39824. }
  39825. $this->caughtBuffer = null;
  39826. try {
  39827. \call_user_func($this->handler, $exception);
  39828. $this->caughtLength = $caughtLength;
  39829. } catch (\Exception $e) {
  39830. if (!$caughtLength) {
  39831. throw $exception;
  39832. }
  39833. }
  39834. }
  39835. private function failSafeHandle(\Exception $exception)
  39836. {
  39837. if (class_exists('Symfony\Component\HttpFoundation\Response', false)
  39838. && __CLASS__ !== \get_class($this)
  39839. && ($reflector = new \ReflectionMethod($this, 'createResponse'))
  39840. && __CLASS__ !== $reflector->class
  39841. ) {
  39842. $response = $this->createResponse($exception);
  39843. $response->sendHeaders();
  39844. $response->sendContent();
  39845. @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);
  39846. return;
  39847. }
  39848. $this->sendPhpResponse($exception);
  39849. }
  39850. public function sendPhpResponse($exception)
  39851. {
  39852. if (!$exception instanceof FlattenException) {
  39853. $exception = FlattenException::create($exception);
  39854. }
  39855. if (!headers_sent()) {
  39856. header(sprintf('HTTP/1.0 %s', $exception->getStatusCode()));
  39857. foreach ($exception->getHeaders() as $name => $value) {
  39858. header($name.': '.$value, false);
  39859. }
  39860. header('Content-Type: text/html; charset='.$this->charset);
  39861. }
  39862. echo $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39863. }
  39864. public function createResponse($exception)
  39865. {
  39866. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  39867. if (!$exception instanceof FlattenException) {
  39868. $exception = FlattenException::create($exception);
  39869. }
  39870. return Response::create($this->getHtml($exception), $exception->getStatusCode(), $exception->getHeaders())->setCharset($this->charset);
  39871. }
  39872. public function getHtml($exception)
  39873. {
  39874. if (!$exception instanceof FlattenException) {
  39875. $exception = FlattenException::create($exception);
  39876. }
  39877. return $this->decorate($this->getContent($exception), $this->getStylesheet($exception));
  39878. }
  39879. public function getContent(FlattenException $exception)
  39880. {
  39881. switch ($exception->getStatusCode()) {
  39882. case 404:
  39883. $title = 'Sorry, the page you are looking for could not be found.';
  39884. break;
  39885. default:
  39886. $title = 'Whoops, looks like something went wrong.';
  39887. }
  39888. $content = '';
  39889. if ($this->debug) {
  39890. try {
  39891. $count = \count($exception->getAllPrevious());
  39892. $total = $count + 1;
  39893. foreach ($exception->toArray() as $position => $e) {
  39894. $ind = $count - $position + 1;
  39895. $class = $this->formatClass($e['class']);
  39896. $message = nl2br($this->escapeHtml($e['message']));
  39897. $content .= sprintf(<<<'EOF'
  39898. <h2 class="block_exception clear_fix">
  39899. <span class="exception_counter">%d/%d</span>
  39900. <span class="exception_title">%s%s:</span>
  39901. <span class="exception_message">%s</span>
  39902. </h2>
  39903. <div class="block">
  39904. <ol class="traces list_exception">
  39905. EOF
  39906. , $ind, $total, $class, $this->formatPath($e['trace'][0]['file'], $e['trace'][0]['line']), $message);
  39907. foreach ($e['trace'] as $trace) {
  39908. $content .= ' <li>';
  39909. if ($trace['function']) {
  39910. $content .= sprintf('at %s%s%s(%s)', $this->formatClass($trace['class']), $trace['type'], $trace['function'], $this->formatArgs($trace['args']));
  39911. }
  39912. if (isset($trace['file']) && isset($trace['line'])) {
  39913. $content .= $this->formatPath($trace['file'], $trace['line']);
  39914. }
  39915. $content .= "</li>\n";
  39916. }
  39917. $content .= " </ol>\n</div>\n";
  39918. }
  39919. } catch (\Exception $e) {
  39920. if ($this->debug) {
  39921. $title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
  39922. } else {
  39923. $title = 'Whoops, looks like something went wrong.';
  39924. }
  39925. }
  39926. }
  39927. return <<<EOF
  39928. <div id="sf-resetcontent" class="sf-reset">
  39929. <h1>$title</h1>
  39930. $content
  39931. </div>
  39932. EOF;
  39933. }
  39934. public function getStylesheet(FlattenException $exception)
  39935. {
  39936. return <<<'EOF'
  39937. .sf-reset { font: 11px Verdana, Arial, sans-serif; color: #333 }
  39938. .sf-reset .clear { clear:both; height:0; font-size:0; line-height:0; }
  39939. .sf-reset .clear_fix:after { display:block; height:0; clear:both; visibility:hidden; }
  39940. .sf-reset .clear_fix { display:inline-block; }
  39941. .sf-reset * html .clear_fix { height:1%; }
  39942. .sf-reset .clear_fix { display:block; }
  39943. .sf-reset, .sf-reset .block { margin: auto }
  39944. .sf-reset abbr { border-bottom: 1px dotted #000; cursor: help; }
  39945. .sf-reset p { font-size:14px; line-height:20px; color:#868686; padding-bottom:20px }
  39946. .sf-reset strong { font-weight:bold; }
  39947. .sf-reset a { color:#6c6159; cursor: default; }
  39948. .sf-reset a img { border:none; }
  39949. .sf-reset a:hover { text-decoration:underline; }
  39950. .sf-reset em { font-style:italic; }
  39951. .sf-reset h1, .sf-reset h2 { font: 20px Georgia, "Times New Roman", Times, serif }
  39952. .sf-reset .exception_counter { background-color: #fff; color: #333; padding: 6px; float: left; margin-right: 10px; float: left; display: block; }
  39953. .sf-reset .exception_title { margin-left: 3em; margin-bottom: 0.7em; display: block; }
  39954. .sf-reset .exception_message { margin-left: 3em; display: block; }
  39955. .sf-reset .traces li { font-size:12px; padding: 2px 4px; list-style-type:decimal; margin-left:20px; }
  39956. .sf-reset .block { background-color:#FFFFFF; padding:10px 28px; margin-bottom:20px;
  39957. -webkit-border-bottom-right-radius: 16px;
  39958. -webkit-border-bottom-left-radius: 16px;
  39959. -moz-border-radius-bottomright: 16px;
  39960. -moz-border-radius-bottomleft: 16px;
  39961. border-bottom-right-radius: 16px;
  39962. border-bottom-left-radius: 16px;
  39963. border-bottom:1px solid #ccc;
  39964. border-right:1px solid #ccc;
  39965. border-left:1px solid #ccc;
  39966. word-wrap: break-word;
  39967. }
  39968. .sf-reset .block_exception { background-color:#ddd; color: #333; padding:20px;
  39969. -webkit-border-top-left-radius: 16px;
  39970. -webkit-border-top-right-radius: 16px;
  39971. -moz-border-radius-topleft: 16px;
  39972. -moz-border-radius-topright: 16px;
  39973. border-top-left-radius: 16px;
  39974. border-top-right-radius: 16px;
  39975. border-top:1px solid #ccc;
  39976. border-right:1px solid #ccc;
  39977. border-left:1px solid #ccc;
  39978. overflow: hidden;
  39979. word-wrap: break-word;
  39980. }
  39981. .sf-reset a { background:none; color:#868686; text-decoration:none; }
  39982. .sf-reset a:hover { background:none; color:#313131; text-decoration:underline; }
  39983. .sf-reset ol { padding: 10px 0; }
  39984. .sf-reset h1 { background-color:#FFFFFF; padding: 15px 28px; margin-bottom: 20px;
  39985. -webkit-border-radius: 10px;
  39986. -moz-border-radius: 10px;
  39987. border-radius: 10px;
  39988. border: 1px solid #ccc;
  39989. }
  39990. EOF;
  39991. }
  39992. private function decorate($content, $css)
  39993. {
  39994. return <<<EOF
  39995. <!DOCTYPE html>
  39996. <html>
  39997. <head>
  39998. <meta charset="{$this->charset}" />
  39999. <meta name="robots" content="noindex,nofollow" />
  40000. <style>
  40001. /* Copyright (c) 2010, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.com/yui/license.html */
  40002. 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;}
  40003. html { background: #eee; padding: 10px }
  40004. img { border: 0; }
  40005. #sf-resetcontent { width:970px; margin:0 auto; }
  40006. $css
  40007. </style>
  40008. </head>
  40009. <body>
  40010. $content
  40011. </body>
  40012. </html>
  40013. EOF;
  40014. }
  40015. private function formatClass($class)
  40016. {
  40017. $parts = explode('\\', $class);
  40018. return sprintf('<abbr title="%s">%s</abbr>', $class, array_pop($parts));
  40019. }
  40020. private function formatPath($path, $line)
  40021. {
  40022. $path = $this->escapeHtml($path);
  40023. $file = preg_match('#[^/\\\\]*$#', $path, $file) ? $file[0] : $path;
  40024. if ($linkFormat = $this->fileLinkFormat) {
  40025. $link = strtr($this->escapeHtml($linkFormat), array('%f' => $path, '%l' => (int) $line));
  40026. return sprintf(' in <a href="%s" title="Go to source">%s line %d</a>', $link, $file, $line);
  40027. }
  40028. 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);
  40029. }
  40030. private function formatArgs(array $args)
  40031. {
  40032. $result = array();
  40033. foreach ($args as $key => $item) {
  40034. if ('object' === $item[0]) {
  40035. $formattedValue = sprintf('<em>object</em>(%s)', $this->formatClass($item[1]));
  40036. } elseif ('array' === $item[0]) {
  40037. $formattedValue = sprintf('<em>array</em>(%s)', \is_array($item[1]) ? $this->formatArgs($item[1]) : $item[1]);
  40038. } elseif ('string' === $item[0]) {
  40039. $formattedValue = sprintf("'%s'", $this->escapeHtml($item[1]));
  40040. } elseif ('null' === $item[0]) {
  40041. $formattedValue = '<em>null</em>';
  40042. } elseif ('boolean' === $item[0]) {
  40043. $formattedValue = '<em>'.strtolower(var_export($item[1], true)).'</em>';
  40044. } elseif ('resource' === $item[0]) {
  40045. $formattedValue = '<em>resource</em>';
  40046. } else {
  40047. $formattedValue = str_replace("\n", '', var_export($this->escapeHtml((string) $item[1]), true));
  40048. }
  40049. $result[] = \is_int($key) ? $formattedValue : sprintf("'%s' => %s", $this->escapeHtml($key), $formattedValue);
  40050. }
  40051. return implode(', ', $result);
  40052. }
  40053. protected static function utf8Htmlize($str)
  40054. {
  40055. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.7 and will be removed in 3.0.', E_USER_DEPRECATED);
  40056. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), 'UTF-8');
  40057. }
  40058. private function escapeHtml($str)
  40059. {
  40060. return htmlspecialchars($str, ENT_QUOTES | (\PHP_VERSION_ID >= 50400 ? ENT_SUBSTITUTE : 0), $this->charset);
  40061. }
  40062. public function catchOutput($buffer)
  40063. {
  40064. $this->caughtBuffer = $buffer;
  40065. return '';
  40066. }
  40067. public function cleanOutput($buffer)
  40068. {
  40069. if ($this->caughtLength) {
  40070. $cleanBuffer = substr_replace($buffer, '', 0, $this->caughtLength);
  40071. if (isset($cleanBuffer[0])) {
  40072. $buffer = $cleanBuffer;
  40073. }
  40074. }
  40075. return $buffer;
  40076. }
  40077. }
  40078. <?php
  40079. namespace Symfony\Component\Debug\FatalErrorHandler;
  40080. use Composer\Autoload\ClassLoader as ComposerClassLoader;
  40081. use Symfony\Component\ClassLoader\ClassLoader as SymfonyClassLoader;
  40082. use Symfony\Component\ClassLoader\UniversalClassLoader as SymfonyUniversalClassLoader;
  40083. use Symfony\Component\Debug\DebugClassLoader;
  40084. use Symfony\Component\Debug\Exception\ClassNotFoundException;
  40085. use Symfony\Component\Debug\Exception\FatalErrorException;
  40086. class ClassNotFoundFatalErrorHandler implements FatalErrorHandlerInterface
  40087. {
  40088. public function handleError(array $error, FatalErrorException $exception)
  40089. {
  40090. $messageLen = \strlen($error['message']);
  40091. $notFoundSuffix = '\' not found';
  40092. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40093. if ($notFoundSuffixLen > $messageLen) {
  40094. return;
  40095. }
  40096. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40097. return;
  40098. }
  40099. foreach (array('class', 'interface', 'trait') as $typeName) {
  40100. $prefix = ucfirst($typeName).' \'';
  40101. $prefixLen = \strlen($prefix);
  40102. if (0 !== strpos($error['message'], $prefix)) {
  40103. continue;
  40104. }
  40105. $fullyQualifiedClassName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40106. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedClassName, '\\')) {
  40107. $className = substr($fullyQualifiedClassName, $namespaceSeparatorIndex + 1);
  40108. $namespacePrefix = substr($fullyQualifiedClassName, 0, $namespaceSeparatorIndex);
  40109. $message = sprintf('Attempted to load %s "%s" from namespace "%s".', $typeName, $className, $namespacePrefix);
  40110. $tail = ' for another namespace?';
  40111. } else {
  40112. $className = $fullyQualifiedClassName;
  40113. $message = sprintf('Attempted to load %s "%s" from the global namespace.', $typeName, $className);
  40114. $tail = '?';
  40115. }
  40116. if ($candidates = $this->getClassCandidates($className)) {
  40117. $tail = array_pop($candidates).'"?';
  40118. if ($candidates) {
  40119. $tail = ' for e.g. "'.implode('", "', $candidates).'" or "'.$tail;
  40120. } else {
  40121. $tail = ' for "'.$tail;
  40122. }
  40123. }
  40124. $message .= "\nDid you forget a \"use\" statement".$tail;
  40125. return new ClassNotFoundException($message, $exception);
  40126. }
  40127. }
  40128. private function getClassCandidates($class)
  40129. {
  40130. if (!\is_array($functions = spl_autoload_functions())) {
  40131. return array();
  40132. }
  40133. $classes = array();
  40134. foreach ($functions as $function) {
  40135. if (!\is_array($function)) {
  40136. continue;
  40137. }
  40138. if ($function[0] instanceof DebugClassLoader) {
  40139. $function = $function[0]->getClassLoader();
  40140. if (\is_object($function)) {
  40141. $function = array($function);
  40142. }
  40143. if (!\is_array($function)) {
  40144. continue;
  40145. }
  40146. }
  40147. if ($function[0] instanceof ComposerClassLoader || $function[0] instanceof SymfonyClassLoader || $function[0] instanceof SymfonyUniversalClassLoader) {
  40148. foreach ($function[0]->getPrefixes() as $prefix => $paths) {
  40149. foreach ($paths as $path) {
  40150. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40151. }
  40152. }
  40153. }
  40154. if ($function[0] instanceof ComposerClassLoader) {
  40155. foreach ($function[0]->getPrefixesPsr4() as $prefix => $paths) {
  40156. foreach ($paths as $path) {
  40157. $classes = array_merge($classes, $this->findClassInPath($path, $class, $prefix));
  40158. }
  40159. }
  40160. }
  40161. }
  40162. return array_unique($classes);
  40163. }
  40164. private function findClassInPath($path, $class, $prefix)
  40165. {
  40166. if (!$path = realpath($path.'/'.strtr($prefix, '\\_', '//')) ?: realpath($path.'/'.\dirname(strtr($prefix, '\\_', '//'))) ?: realpath($path)) {
  40167. return array();
  40168. }
  40169. $classes = array();
  40170. $filename = $class.'.php';
  40171. foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($path, \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::LEAVES_ONLY) as $file) {
  40172. if ($filename == $file->getFileName() && $class = $this->convertFileToClass($path, $file->getPathName(), $prefix)) {
  40173. $classes[] = $class;
  40174. }
  40175. }
  40176. return $classes;
  40177. }
  40178. private function convertFileToClass($path, $file, $prefix)
  40179. {
  40180. $candidates = array(
  40181. $namespacedClass = str_replace(array($path.\DIRECTORY_SEPARATOR, '.php', '/'), array('', '', '\\'), $file),
  40182. $prefix.$namespacedClass,
  40183. $prefix.'\\'.$namespacedClass,
  40184. str_replace('\\', '_', $namespacedClass),
  40185. str_replace('\\', '_', $prefix.$namespacedClass),
  40186. str_replace('\\', '_', $prefix.'\\'.$namespacedClass),
  40187. );
  40188. if ($prefix) {
  40189. $candidates = array_filter($candidates, function ($candidate) use ($prefix) { return 0 === strpos($candidate, $prefix); });
  40190. }
  40191. foreach ($candidates as $candidate) {
  40192. if ($this->classExists($candidate)) {
  40193. return $candidate;
  40194. }
  40195. }
  40196. require_once $file;
  40197. foreach ($candidates as $candidate) {
  40198. if ($this->classExists($candidate)) {
  40199. return $candidate;
  40200. }
  40201. }
  40202. }
  40203. private function classExists($class)
  40204. {
  40205. return class_exists($class, false) || interface_exists($class, false) || (\function_exists('trait_exists') && trait_exists($class, false));
  40206. }
  40207. }
  40208. <?php
  40209. namespace Symfony\Component\Debug\FatalErrorHandler;
  40210. use Symfony\Component\Debug\Exception\FatalErrorException;
  40211. interface FatalErrorHandlerInterface
  40212. {
  40213. public function handleError(array $error, FatalErrorException $exception);
  40214. }
  40215. <?php
  40216. namespace Symfony\Component\Debug\FatalErrorHandler;
  40217. use Symfony\Component\Debug\Exception\FatalErrorException;
  40218. use Symfony\Component\Debug\Exception\UndefinedFunctionException;
  40219. class UndefinedFunctionFatalErrorHandler implements FatalErrorHandlerInterface
  40220. {
  40221. public function handleError(array $error, FatalErrorException $exception)
  40222. {
  40223. $messageLen = \strlen($error['message']);
  40224. $notFoundSuffix = '()';
  40225. $notFoundSuffixLen = \strlen($notFoundSuffix);
  40226. if ($notFoundSuffixLen > $messageLen) {
  40227. return;
  40228. }
  40229. if (0 !== substr_compare($error['message'], $notFoundSuffix, -$notFoundSuffixLen)) {
  40230. return;
  40231. }
  40232. $prefix = 'Call to undefined function ';
  40233. $prefixLen = \strlen($prefix);
  40234. if (0 !== strpos($error['message'], $prefix)) {
  40235. return;
  40236. }
  40237. $fullyQualifiedFunctionName = substr($error['message'], $prefixLen, -$notFoundSuffixLen);
  40238. if (false !== $namespaceSeparatorIndex = strrpos($fullyQualifiedFunctionName, '\\')) {
  40239. $functionName = substr($fullyQualifiedFunctionName, $namespaceSeparatorIndex + 1);
  40240. $namespacePrefix = substr($fullyQualifiedFunctionName, 0, $namespaceSeparatorIndex);
  40241. $message = sprintf('Attempted to call function "%s" from namespace "%s".', $functionName, $namespacePrefix);
  40242. } else {
  40243. $functionName = $fullyQualifiedFunctionName;
  40244. $message = sprintf('Attempted to call function "%s" from the global namespace.', $functionName);
  40245. }
  40246. $candidates = array();
  40247. foreach (get_defined_functions() as $type => $definedFunctionNames) {
  40248. foreach ($definedFunctionNames as $definedFunctionName) {
  40249. if (false !== $namespaceSeparatorIndex = strrpos($definedFunctionName, '\\')) {
  40250. $definedFunctionNameBasename = substr($definedFunctionName, $namespaceSeparatorIndex + 1);
  40251. } else {
  40252. $definedFunctionNameBasename = $definedFunctionName;
  40253. }
  40254. if ($definedFunctionNameBasename === $functionName) {
  40255. $candidates[] = '\\'.$definedFunctionName;
  40256. }
  40257. }
  40258. }
  40259. if ($candidates) {
  40260. sort($candidates);
  40261. $last = array_pop($candidates).'"?';
  40262. if ($candidates) {
  40263. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40264. } else {
  40265. $candidates = '"'.$last;
  40266. }
  40267. $message .= "\nDid you mean to call ".$candidates;
  40268. }
  40269. return new UndefinedFunctionException($message, $exception);
  40270. }
  40271. }
  40272. <?php
  40273. namespace Symfony\Component\Debug\FatalErrorHandler;
  40274. use Symfony\Component\Debug\Exception\FatalErrorException;
  40275. use Symfony\Component\Debug\Exception\UndefinedMethodException;
  40276. class UndefinedMethodFatalErrorHandler implements FatalErrorHandlerInterface
  40277. {
  40278. public function handleError(array $error, FatalErrorException $exception)
  40279. {
  40280. preg_match('/^Call to undefined method (.*)::(.*)\(\)$/', $error['message'], $matches);
  40281. if (!$matches) {
  40282. return;
  40283. }
  40284. $className = $matches[1];
  40285. $methodName = $matches[2];
  40286. $message = sprintf('Attempted to call an undefined method named "%s" of class "%s".', $methodName, $className);
  40287. if (!class_exists($className) || null === $methods = get_class_methods($className)) {
  40288. return new UndefinedMethodException($message, $exception);
  40289. }
  40290. $candidates = array();
  40291. foreach ($methods as $definedMethodName) {
  40292. $lev = levenshtein($methodName, $definedMethodName);
  40293. if ($lev <= \strlen($methodName) / 3 || false !== strpos($definedMethodName, $methodName)) {
  40294. $candidates[] = $definedMethodName;
  40295. }
  40296. }
  40297. if ($candidates) {
  40298. sort($candidates);
  40299. $last = array_pop($candidates).'"?';
  40300. if ($candidates) {
  40301. $candidates = 'e.g. "'.implode('", "', $candidates).'" or "'.$last;
  40302. } else {
  40303. $candidates = '"'.$last;
  40304. }
  40305. $message .= "\nDid you mean to call ".$candidates;
  40306. }
  40307. return new UndefinedMethodException($message, $exception);
  40308. }
  40309. }
  40310. Copyright (c) 2004-2018 Fabien Potencier
  40311. Permission is hereby granted, free of charge, to any person obtaining a copy
  40312. of this software and associated documentation files (the "Software"), to deal
  40313. in the Software without restriction, including without limitation the rights
  40314. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40315. copies of the Software, and to permit persons to whom the Software is furnished
  40316. to do so, subject to the following conditions:
  40317. The above copyright notice and this permission notice shall be included in all
  40318. copies or substantial portions of the Software.
  40319. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40320. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40321. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40322. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40323. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40324. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40325. THE SOFTWARE.
  40326. <?php
  40327. namespace Symfony\Component\Filesystem\Exception;
  40328. interface ExceptionInterface
  40329. {
  40330. }
  40331. <?php
  40332. namespace Symfony\Component\Filesystem\Exception;
  40333. class FileNotFoundException extends IOException
  40334. {
  40335. public function __construct($message = null, $code = 0, \Exception $previous = null, $path = null)
  40336. {
  40337. if (null === $message) {
  40338. if (null === $path) {
  40339. $message = 'File could not be found.';
  40340. } else {
  40341. $message = sprintf('File "%s" could not be found.', $path);
  40342. }
  40343. }
  40344. parent::__construct($message, $code, $previous, $path);
  40345. }
  40346. }
  40347. <?php
  40348. namespace Symfony\Component\Filesystem\Exception;
  40349. class IOException extends \RuntimeException implements IOExceptionInterface
  40350. {
  40351. private $path;
  40352. public function __construct($message, $code = 0, \Exception $previous = null, $path = null)
  40353. {
  40354. $this->path = $path;
  40355. parent::__construct($message, $code, $previous);
  40356. }
  40357. public function getPath()
  40358. {
  40359. return $this->path;
  40360. }
  40361. }
  40362. <?php
  40363. namespace Symfony\Component\Filesystem\Exception;
  40364. interface IOExceptionInterface extends ExceptionInterface
  40365. {
  40366. public function getPath();
  40367. }
  40368. <?php
  40369. namespace Symfony\Component\Filesystem;
  40370. use Symfony\Component\Filesystem\Exception\FileNotFoundException;
  40371. use Symfony\Component\Filesystem\Exception\IOException;
  40372. class Filesystem
  40373. {
  40374. private static $lastError;
  40375. public function copy($originFile, $targetFile, $overwriteNewerFiles = false)
  40376. {
  40377. $originIsLocal = stream_is_local($originFile) || 0 === stripos($originFile, 'file://');
  40378. if ($originIsLocal && !is_file($originFile)) {
  40379. throw new FileNotFoundException(sprintf('Failed to copy "%s" because file does not exist.', $originFile), 0, null, $originFile);
  40380. }
  40381. $this->mkdir(\dirname($targetFile));
  40382. $doCopy = true;
  40383. if (!$overwriteNewerFiles && null === parse_url($originFile, PHP_URL_HOST) && is_file($targetFile)) {
  40384. $doCopy = filemtime($originFile) > filemtime($targetFile);
  40385. }
  40386. if ($doCopy) {
  40387. if (false === $source = @fopen($originFile, 'r')) {
  40388. throw new IOException(sprintf('Failed to copy "%s" to "%s" because source file could not be opened for reading.', $originFile, $targetFile), 0, null, $originFile);
  40389. }
  40390. if (false === $target = @fopen($targetFile, 'w', null, stream_context_create(array('ftp' => array('overwrite' => true))))) {
  40391. throw new IOException(sprintf('Failed to copy "%s" to "%s" because target file could not be opened for writing.', $originFile, $targetFile), 0, null, $originFile);
  40392. }
  40393. $bytesCopied = stream_copy_to_stream($source, $target);
  40394. fclose($source);
  40395. fclose($target);
  40396. unset($source, $target);
  40397. if (!is_file($targetFile)) {
  40398. throw new IOException(sprintf('Failed to copy "%s" to "%s".', $originFile, $targetFile), 0, null, $originFile);
  40399. }
  40400. if ($originIsLocal) {
  40401. @chmod($targetFile, fileperms($targetFile) | (fileperms($originFile) & 0111));
  40402. if ($bytesCopied !== $bytesOrigin = filesize($originFile)) {
  40403. 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);
  40404. }
  40405. }
  40406. }
  40407. }
  40408. public function mkdir($dirs, $mode = 0777)
  40409. {
  40410. foreach ($this->toIterator($dirs) as $dir) {
  40411. if (is_dir($dir)) {
  40412. continue;
  40413. }
  40414. if (!self::box('mkdir', $dir, $mode, true)) {
  40415. if (!is_dir($dir)) {
  40416. if (self::$lastError) {
  40417. throw new IOException(sprintf('Failed to create "%s": %s.', $dir, self::$lastError), 0, null, $dir);
  40418. }
  40419. throw new IOException(sprintf('Failed to create "%s"', $dir), 0, null, $dir);
  40420. }
  40421. }
  40422. }
  40423. }
  40424. public function exists($files)
  40425. {
  40426. $maxPathLength = PHP_MAXPATHLEN - 2;
  40427. foreach ($this->toIterator($files) as $file) {
  40428. if (\strlen($file) > $maxPathLength) {
  40429. throw new IOException(sprintf('Could not check if file exist because path length exceeds %d characters.', $maxPathLength), 0, null, $file);
  40430. }
  40431. if (!file_exists($file)) {
  40432. return false;
  40433. }
  40434. }
  40435. return true;
  40436. }
  40437. public function touch($files, $time = null, $atime = null)
  40438. {
  40439. foreach ($this->toIterator($files) as $file) {
  40440. $touch = $time ? @touch($file, $time, $atime) : @touch($file);
  40441. if (true !== $touch) {
  40442. throw new IOException(sprintf('Failed to touch "%s".', $file), 0, null, $file);
  40443. }
  40444. }
  40445. }
  40446. public function remove($files)
  40447. {
  40448. if ($files instanceof \Traversable) {
  40449. $files = iterator_to_array($files, false);
  40450. } elseif (!\is_array($files)) {
  40451. $files = array($files);
  40452. }
  40453. $files = array_reverse($files);
  40454. foreach ($files as $file) {
  40455. if (is_link($file)) {
  40456. if (!(self::box('unlink', $file) || '\\' !== \DIRECTORY_SEPARATOR || self::box('rmdir', $file)) && file_exists($file)) {
  40457. throw new IOException(sprintf('Failed to remove symlink "%s": %s.', $file, self::$lastError));
  40458. }
  40459. } elseif (is_dir($file)) {
  40460. $this->remove(new \FilesystemIterator($file, \FilesystemIterator::CURRENT_AS_PATHNAME | \FilesystemIterator::SKIP_DOTS));
  40461. if (!self::box('rmdir', $file) && file_exists($file)) {
  40462. throw new IOException(sprintf('Failed to remove directory "%s": %s.', $file, self::$lastError));
  40463. }
  40464. } elseif (!self::box('unlink', $file) && file_exists($file)) {
  40465. throw new IOException(sprintf('Failed to remove file "%s": %s.', $file, self::$lastError));
  40466. }
  40467. }
  40468. }
  40469. public function chmod($files, $mode, $umask = 0000, $recursive = false)
  40470. {
  40471. foreach ($this->toIterator($files) as $file) {
  40472. if (true !== @chmod($file, $mode & ~$umask)) {
  40473. throw new IOException(sprintf('Failed to chmod file "%s".', $file), 0, null, $file);
  40474. }
  40475. if ($recursive && is_dir($file) && !is_link($file)) {
  40476. $this->chmod(new \FilesystemIterator($file), $mode, $umask, true);
  40477. }
  40478. }
  40479. }
  40480. public function chown($files, $user, $recursive = false)
  40481. {
  40482. foreach ($this->toIterator($files) as $file) {
  40483. if ($recursive && is_dir($file) && !is_link($file)) {
  40484. $this->chown(new \FilesystemIterator($file), $user, true);
  40485. }
  40486. if (is_link($file) && \function_exists('lchown')) {
  40487. if (true !== @lchown($file, $user)) {
  40488. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40489. }
  40490. } else {
  40491. if (true !== @chown($file, $user)) {
  40492. throw new IOException(sprintf('Failed to chown file "%s".', $file), 0, null, $file);
  40493. }
  40494. }
  40495. }
  40496. }
  40497. public function chgrp($files, $group, $recursive = false)
  40498. {
  40499. foreach ($this->toIterator($files) as $file) {
  40500. if ($recursive && is_dir($file) && !is_link($file)) {
  40501. $this->chgrp(new \FilesystemIterator($file), $group, true);
  40502. }
  40503. if (is_link($file) && \function_exists('lchgrp')) {
  40504. if (true !== @lchgrp($file, $group) || (\defined('HHVM_VERSION') && !posix_getgrnam($group))) {
  40505. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40506. }
  40507. } else {
  40508. if (true !== @chgrp($file, $group)) {
  40509. throw new IOException(sprintf('Failed to chgrp file "%s".', $file), 0, null, $file);
  40510. }
  40511. }
  40512. }
  40513. }
  40514. public function rename($origin, $target, $overwrite = false)
  40515. {
  40516. if (!$overwrite && $this->isReadable($target)) {
  40517. throw new IOException(sprintf('Cannot rename because the target "%s" already exists.', $target), 0, null, $target);
  40518. }
  40519. if (true !== @rename($origin, $target)) {
  40520. if (is_dir($origin)) {
  40521. $this->mirror($origin, $target, null, array('override' => $overwrite, 'delete' => $overwrite));
  40522. $this->remove($origin);
  40523. return;
  40524. }
  40525. throw new IOException(sprintf('Cannot rename "%s" to "%s".', $origin, $target), 0, null, $target);
  40526. }
  40527. }
  40528. private function isReadable($filename)
  40529. {
  40530. $maxPathLength = PHP_MAXPATHLEN - 2;
  40531. if (\strlen($filename) > $maxPathLength) {
  40532. throw new IOException(sprintf('Could not check if file is readable because path length exceeds %d characters.', $maxPathLength), 0, null, $filename);
  40533. }
  40534. return is_readable($filename);
  40535. }
  40536. public function symlink($originDir, $targetDir, $copyOnWindows = false)
  40537. {
  40538. if ('\\' === \DIRECTORY_SEPARATOR) {
  40539. $originDir = strtr($originDir, '/', '\\');
  40540. $targetDir = strtr($targetDir, '/', '\\');
  40541. if ($copyOnWindows) {
  40542. $this->mirror($originDir, $targetDir);
  40543. return;
  40544. }
  40545. }
  40546. $this->mkdir(\dirname($targetDir));
  40547. if (is_link($targetDir)) {
  40548. if (readlink($targetDir) === $originDir) {
  40549. return;
  40550. }
  40551. $this->remove($targetDir);
  40552. }
  40553. if (!self::box('symlink', $originDir, $targetDir)) {
  40554. if (null !== self::$lastError) {
  40555. if ('\\' === \DIRECTORY_SEPARATOR && false !== strpos(self::$lastError, 'error code(1314)')) {
  40556. 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);
  40557. }
  40558. }
  40559. throw new IOException(sprintf('Failed to create symbolic link from "%s" to "%s".', $originDir, $targetDir), 0, null, $targetDir);
  40560. }
  40561. }
  40562. public function makePathRelative($endPath, $startPath)
  40563. {
  40564. if ('\\' === \DIRECTORY_SEPARATOR) {
  40565. $endPath = str_replace('\\', '/', $endPath);
  40566. $startPath = str_replace('\\', '/', $startPath);
  40567. }
  40568. $stripDriveLetter = function ($path) {
  40569. if (\strlen($path) > 2 && ':' === $path[1] && '/' === $path[2] && ctype_alpha($path[0])) {
  40570. return substr($path, 2);
  40571. }
  40572. return $path;
  40573. };
  40574. $endPath = $stripDriveLetter($endPath);
  40575. $startPath = $stripDriveLetter($startPath);
  40576. $startPathArr = explode('/', trim($startPath, '/'));
  40577. $endPathArr = explode('/', trim($endPath, '/'));
  40578. $normalizePathArray = function ($pathSegments, $absolute) {
  40579. $result = array();
  40580. foreach ($pathSegments as $segment) {
  40581. if ('..' === $segment && ($absolute || \count($result))) {
  40582. array_pop($result);
  40583. } elseif ('.' !== $segment) {
  40584. $result[] = $segment;
  40585. }
  40586. }
  40587. return $result;
  40588. };
  40589. $startPathArr = $normalizePathArray($startPathArr, static::isAbsolutePath($startPath));
  40590. $endPathArr = $normalizePathArray($endPathArr, static::isAbsolutePath($endPath));
  40591. $index = 0;
  40592. while (isset($startPathArr[$index]) && isset($endPathArr[$index]) && $startPathArr[$index] === $endPathArr[$index]) {
  40593. ++$index;
  40594. }
  40595. if (1 === \count($startPathArr) && '' === $startPathArr[0]) {
  40596. $depth = 0;
  40597. } else {
  40598. $depth = \count($startPathArr) - $index;
  40599. }
  40600. $traverser = str_repeat('../', $depth);
  40601. $endPathRemainder = implode('/', \array_slice($endPathArr, $index));
  40602. $relativePath = $traverser.('' !== $endPathRemainder ? $endPathRemainder.'/' : '');
  40603. return '' === $relativePath ? './' : $relativePath;
  40604. }
  40605. public function mirror($originDir, $targetDir, \Traversable $iterator = null, $options = array())
  40606. {
  40607. $targetDir = rtrim($targetDir, '/\\');
  40608. $originDir = rtrim($originDir, '/\\');
  40609. $originDirLen = \strlen($originDir);
  40610. if ($this->exists($targetDir) && isset($options['delete']) && $options['delete']) {
  40611. $deleteIterator = $iterator;
  40612. if (null === $deleteIterator) {
  40613. $flags = \FilesystemIterator::SKIP_DOTS;
  40614. $deleteIterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($targetDir, $flags), \RecursiveIteratorIterator::CHILD_FIRST);
  40615. }
  40616. $targetDirLen = \strlen($targetDir);
  40617. foreach ($deleteIterator as $file) {
  40618. $origin = $originDir.substr($file->getPathname(), $targetDirLen);
  40619. if (!$this->exists($origin)) {
  40620. $this->remove($file);
  40621. }
  40622. }
  40623. }
  40624. $copyOnWindows = false;
  40625. if (isset($options['copy_on_windows'])) {
  40626. $copyOnWindows = $options['copy_on_windows'];
  40627. }
  40628. if (null === $iterator) {
  40629. $flags = $copyOnWindows ? \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::FOLLOW_SYMLINKS : \FilesystemIterator::SKIP_DOTS;
  40630. $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($originDir, $flags), \RecursiveIteratorIterator::SELF_FIRST);
  40631. }
  40632. if ($this->exists($originDir)) {
  40633. $this->mkdir($targetDir);
  40634. }
  40635. foreach ($iterator as $file) {
  40636. $target = $targetDir.substr($file->getPathname(), $originDirLen);
  40637. if ($copyOnWindows) {
  40638. if (is_file($file)) {
  40639. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40640. } elseif (is_dir($file)) {
  40641. $this->mkdir($target);
  40642. } else {
  40643. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40644. }
  40645. } else {
  40646. if (is_link($file)) {
  40647. $this->symlink($file->getLinkTarget(), $target);
  40648. } elseif (is_dir($file)) {
  40649. $this->mkdir($target);
  40650. } elseif (is_file($file)) {
  40651. $this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
  40652. } else {
  40653. throw new IOException(sprintf('Unable to guess "%s" file type.', $file), 0, null, $file);
  40654. }
  40655. }
  40656. }
  40657. }
  40658. public function isAbsolutePath($file)
  40659. {
  40660. return strspn($file, '/\\', 0, 1)
  40661. || (\strlen($file) > 3 && ctype_alpha($file[0])
  40662. && ':' === substr($file, 1, 1)
  40663. && strspn($file, '/\\', 2, 1)
  40664. )
  40665. || null !== parse_url($file, PHP_URL_SCHEME)
  40666. ;
  40667. }
  40668. public function tempnam($dir, $prefix)
  40669. {
  40670. list($scheme, $hierarchy) = $this->getSchemeAndHierarchy($dir);
  40671. if (null === $scheme || 'file' === $scheme || 'gs' === $scheme) {
  40672. $tmpFile = @tempnam($hierarchy, $prefix);
  40673. if (false !== $tmpFile) {
  40674. if (null !== $scheme && 'gs' !== $scheme) {
  40675. return $scheme.'://'.$tmpFile;
  40676. }
  40677. return $tmpFile;
  40678. }
  40679. throw new IOException('A temporary file could not be created.');
  40680. }
  40681. for ($i = 0; $i < 10; ++$i) {
  40682. $tmpFile = $dir.'/'.$prefix.uniqid(mt_rand(), true);
  40683. $handle = @fopen($tmpFile, 'x+');
  40684. if (false === $handle) {
  40685. continue;
  40686. }
  40687. @fclose($handle);
  40688. return $tmpFile;
  40689. }
  40690. throw new IOException('A temporary file could not be created.');
  40691. }
  40692. public function dumpFile($filename, $content, $mode = 0666)
  40693. {
  40694. $dir = \dirname($filename);
  40695. if (!is_dir($dir)) {
  40696. $this->mkdir($dir);
  40697. }
  40698. if (!is_writable($dir)) {
  40699. throw new IOException(sprintf('Unable to write to the "%s" directory.', $dir), 0, null, $dir);
  40700. }
  40701. $tmpFile = $this->tempnam($dir, basename($filename));
  40702. if (false === @file_put_contents($tmpFile, $content)) {
  40703. throw new IOException(sprintf('Failed to write file "%s".', $filename), 0, null, $filename);
  40704. }
  40705. if (null !== $mode) {
  40706. if (\func_num_args() > 2) {
  40707. @trigger_error('Support for modifying file permissions is deprecated since Symfony 2.3.12 and will be removed in 3.0.', E_USER_DEPRECATED);
  40708. }
  40709. $this->chmod($tmpFile, $mode);
  40710. } elseif (file_exists($filename)) {
  40711. @chmod($tmpFile, fileperms($filename));
  40712. }
  40713. $this->rename($tmpFile, $filename, true);
  40714. }
  40715. private function toIterator($files)
  40716. {
  40717. if (!$files instanceof \Traversable) {
  40718. $files = new \ArrayObject(\is_array($files) ? $files : array($files));
  40719. }
  40720. return $files;
  40721. }
  40722. private function getSchemeAndHierarchy($filename)
  40723. {
  40724. $components = explode('://', $filename, 2);
  40725. return 2 === \count($components) ? array($components[0], $components[1]) : array(null, $components[0]);
  40726. }
  40727. private static function box($func)
  40728. {
  40729. self::$lastError = null;
  40730. \set_error_handler(__CLASS__.'::handleError');
  40731. try {
  40732. $result = \call_user_func_array($func, \array_slice(\func_get_args(), 1));
  40733. \restore_error_handler();
  40734. return $result;
  40735. } catch (\Throwable $e) {
  40736. } catch (\Exception $e) {
  40737. }
  40738. \restore_error_handler();
  40739. throw $e;
  40740. }
  40741. public static function handleError($type, $msg)
  40742. {
  40743. self::$lastError = $msg;
  40744. }
  40745. }
  40746. Copyright (c) 2004-2018 Fabien Potencier
  40747. Permission is hereby granted, free of charge, to any person obtaining a copy
  40748. of this software and associated documentation files (the "Software"), to deal
  40749. in the Software without restriction, including without limitation the rights
  40750. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  40751. copies of the Software, and to permit persons to whom the Software is furnished
  40752. to do so, subject to the following conditions:
  40753. The above copyright notice and this permission notice shall be included in all
  40754. copies or substantial portions of the Software.
  40755. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  40756. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  40757. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  40758. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  40759. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  40760. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  40761. THE SOFTWARE.
  40762. <?php
  40763. namespace Symfony\Component\Filesystem;
  40764. use Symfony\Component\Filesystem\Exception\IOException;
  40765. class LockHandler
  40766. {
  40767. private $file;
  40768. private $handle;
  40769. public function __construct($name, $lockPath = null)
  40770. {
  40771. $lockPath = $lockPath ?: sys_get_temp_dir();
  40772. if (!is_dir($lockPath)) {
  40773. $fs = new Filesystem();
  40774. $fs->mkdir($lockPath);
  40775. }
  40776. if (!is_writable($lockPath)) {
  40777. throw new IOException(sprintf('The directory "%s" is not writable.', $lockPath), 0, null, $lockPath);
  40778. }
  40779. $this->file = sprintf('%s/sf.%s.%s.lock', $lockPath, preg_replace('/[^a-z0-9\._-]+/i', '-', $name), hash('sha256', $name));
  40780. }
  40781. public function lock($blocking = false)
  40782. {
  40783. if ($this->handle) {
  40784. return true;
  40785. }
  40786. $error = null;
  40787. set_error_handler(function ($errno, $msg) use (&$error) {
  40788. $error = $msg;
  40789. });
  40790. if (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40791. if ($this->handle = fopen($this->file, 'x')) {
  40792. chmod($this->file, 0666);
  40793. } elseif (!$this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r')) {
  40794. usleep(100);
  40795. $this->handle = fopen($this->file, 'r+') ?: fopen($this->file, 'r');
  40796. }
  40797. }
  40798. restore_error_handler();
  40799. if (!$this->handle) {
  40800. throw new IOException($error, 0, null, $this->file);
  40801. }
  40802. if (!flock($this->handle, LOCK_EX | ($blocking ? 0 : LOCK_NB))) {
  40803. fclose($this->handle);
  40804. $this->handle = null;
  40805. return false;
  40806. }
  40807. return true;
  40808. }
  40809. public function release()
  40810. {
  40811. if ($this->handle) {
  40812. flock($this->handle, LOCK_UN | LOCK_NB);
  40813. fclose($this->handle);
  40814. $this->handle = null;
  40815. }
  40816. }
  40817. }
  40818. <?php
  40819. namespace Symfony\Component\Finder\Adapter;
  40820. @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);
  40821. abstract class AbstractAdapter implements AdapterInterface
  40822. {
  40823. protected $followLinks = false;
  40824. protected $mode = 0;
  40825. protected $minDepth = 0;
  40826. protected $maxDepth = PHP_INT_MAX;
  40827. protected $exclude = array();
  40828. protected $names = array();
  40829. protected $notNames = array();
  40830. protected $contains = array();
  40831. protected $notContains = array();
  40832. protected $sizes = array();
  40833. protected $dates = array();
  40834. protected $filters = array();
  40835. protected $sort = false;
  40836. protected $paths = array();
  40837. protected $notPaths = array();
  40838. protected $ignoreUnreadableDirs = false;
  40839. private static $areSupported = array();
  40840. public function isSupported()
  40841. {
  40842. $name = $this->getName();
  40843. if (!array_key_exists($name, self::$areSupported)) {
  40844. self::$areSupported[$name] = $this->canBeUsed();
  40845. }
  40846. return self::$areSupported[$name];
  40847. }
  40848. public function setFollowLinks($followLinks)
  40849. {
  40850. $this->followLinks = $followLinks;
  40851. return $this;
  40852. }
  40853. public function setMode($mode)
  40854. {
  40855. $this->mode = $mode;
  40856. return $this;
  40857. }
  40858. public function setDepths(array $depths)
  40859. {
  40860. $this->minDepth = 0;
  40861. $this->maxDepth = PHP_INT_MAX;
  40862. foreach ($depths as $comparator) {
  40863. switch ($comparator->getOperator()) {
  40864. case '>':
  40865. $this->minDepth = $comparator->getTarget() + 1;
  40866. break;
  40867. case '>=':
  40868. $this->minDepth = $comparator->getTarget();
  40869. break;
  40870. case '<':
  40871. $this->maxDepth = $comparator->getTarget() - 1;
  40872. break;
  40873. case '<=':
  40874. $this->maxDepth = $comparator->getTarget();
  40875. break;
  40876. default:
  40877. $this->minDepth = $this->maxDepth = $comparator->getTarget();
  40878. }
  40879. }
  40880. return $this;
  40881. }
  40882. public function setExclude(array $exclude)
  40883. {
  40884. $this->exclude = $exclude;
  40885. return $this;
  40886. }
  40887. public function setNames(array $names)
  40888. {
  40889. $this->names = $names;
  40890. return $this;
  40891. }
  40892. public function setNotNames(array $notNames)
  40893. {
  40894. $this->notNames = $notNames;
  40895. return $this;
  40896. }
  40897. public function setContains(array $contains)
  40898. {
  40899. $this->contains = $contains;
  40900. return $this;
  40901. }
  40902. public function setNotContains(array $notContains)
  40903. {
  40904. $this->notContains = $notContains;
  40905. return $this;
  40906. }
  40907. public function setSizes(array $sizes)
  40908. {
  40909. $this->sizes = $sizes;
  40910. return $this;
  40911. }
  40912. public function setDates(array $dates)
  40913. {
  40914. $this->dates = $dates;
  40915. return $this;
  40916. }
  40917. public function setFilters(array $filters)
  40918. {
  40919. $this->filters = $filters;
  40920. return $this;
  40921. }
  40922. public function setSort($sort)
  40923. {
  40924. $this->sort = $sort;
  40925. return $this;
  40926. }
  40927. public function setPath(array $paths)
  40928. {
  40929. $this->paths = $paths;
  40930. return $this;
  40931. }
  40932. public function setNotPath(array $notPaths)
  40933. {
  40934. $this->notPaths = $notPaths;
  40935. return $this;
  40936. }
  40937. public function ignoreUnreadableDirs($ignore = true)
  40938. {
  40939. $this->ignoreUnreadableDirs = (bool) $ignore;
  40940. return $this;
  40941. }
  40942. abstract protected function canBeUsed();
  40943. }
  40944. <?php
  40945. namespace Symfony\Component\Finder\Adapter;
  40946. @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);
  40947. use Symfony\Component\Finder\Comparator\DateComparator;
  40948. use Symfony\Component\Finder\Comparator\NumberComparator;
  40949. use Symfony\Component\Finder\Exception\AccessDeniedException;
  40950. use Symfony\Component\Finder\Expression\Expression;
  40951. use Symfony\Component\Finder\Iterator;
  40952. use Symfony\Component\Finder\Shell\Command;
  40953. use Symfony\Component\Finder\Shell\Shell;
  40954. abstract class AbstractFindAdapter extends AbstractAdapter
  40955. {
  40956. protected $shell;
  40957. public function __construct()
  40958. {
  40959. $this->shell = new Shell();
  40960. }
  40961. public function searchInDirectory($dir)
  40962. {
  40963. $dir = realpath($dir);
  40964. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode && ($this->contains || $this->notContains)) {
  40965. return new Iterator\FilePathsIterator(array(), $dir);
  40966. }
  40967. $command = Command::create();
  40968. $find = $this->buildFindCommand($command, $dir);
  40969. if ($this->followLinks) {
  40970. $find->add('-follow');
  40971. }
  40972. $find->add('-mindepth')->add($this->minDepth + 1);
  40973. if (PHP_INT_MAX !== $this->maxDepth) {
  40974. $find->add('-maxdepth')->add($this->maxDepth + 1);
  40975. }
  40976. if (Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES === $this->mode) {
  40977. $find->add('-type d');
  40978. } elseif (Iterator\FileTypeFilterIterator::ONLY_FILES === $this->mode) {
  40979. $find->add('-type f');
  40980. }
  40981. $this->buildNamesFiltering($find, $this->names);
  40982. $this->buildNamesFiltering($find, $this->notNames, true);
  40983. $this->buildPathsFiltering($find, $dir, $this->paths);
  40984. $this->buildPathsFiltering($find, $dir, $this->notPaths, true);
  40985. $this->buildSizesFiltering($find, $this->sizes);
  40986. $this->buildDatesFiltering($find, $this->dates);
  40987. $useGrep = $this->shell->testCommand('grep') && $this->shell->testCommand('xargs');
  40988. $useSort = \is_int($this->sort) && $this->shell->testCommand('sort') && $this->shell->testCommand('cut');
  40989. if ($useGrep && ($this->contains || $this->notContains)) {
  40990. $grep = $command->ins('grep');
  40991. $this->buildContentFiltering($grep, $this->contains);
  40992. $this->buildContentFiltering($grep, $this->notContains, true);
  40993. }
  40994. if ($useSort) {
  40995. $this->buildSorting($command, $this->sort);
  40996. }
  40997. $command->setErrorHandler(
  40998. $this->ignoreUnreadableDirs
  40999. ? function ($stderr) { }
  41000. : function ($stderr) { throw new AccessDeniedException($stderr); }
  41001. );
  41002. $paths = $this->shell->testCommand('uniq') ? $command->add('| uniq')->execute() : array_unique($command->execute());
  41003. $iterator = new Iterator\FilePathsIterator($paths, $dir);
  41004. if ($this->exclude) {
  41005. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41006. }
  41007. if (!$useGrep && ($this->contains || $this->notContains)) {
  41008. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41009. }
  41010. if ($this->filters) {
  41011. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41012. }
  41013. if (!$useSort && $this->sort) {
  41014. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41015. $iterator = $iteratorAggregate->getIterator();
  41016. }
  41017. return $iterator;
  41018. }
  41019. protected function canBeUsed()
  41020. {
  41021. return $this->shell->testCommand('find');
  41022. }
  41023. protected function buildFindCommand(Command $command, $dir)
  41024. {
  41025. return $command
  41026. ->ins('find')
  41027. ->add('find ')
  41028. ->arg($dir)
  41029. ->add('-noleaf');
  41030. }
  41031. private function buildNamesFiltering(Command $command, array $names, $not = false)
  41032. {
  41033. if (0 === \count($names)) {
  41034. return;
  41035. }
  41036. $command->add($not ? '-not' : null)->cmd('(');
  41037. foreach ($names as $i => $name) {
  41038. $expr = Expression::create($name);
  41039. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  41040. $expr = Expression::create($expr->getGlob()->toRegex(false));
  41041. }
  41042. if ($expr->isRegex()) {
  41043. $regex = $expr->getRegex();
  41044. $regex->prepend($regex->hasStartFlag() ? '/' : '/[^/]*')
  41045. ->setStartFlag(false)
  41046. ->setStartJoker(true)
  41047. ->replaceJokers('[^/]');
  41048. if (!$regex->hasEndFlag() || $regex->hasEndJoker()) {
  41049. $regex->setEndJoker(false)->append('[^/]*');
  41050. }
  41051. }
  41052. $command
  41053. ->add($i > 0 ? '-or' : null)
  41054. ->add($expr->isRegex()
  41055. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  41056. : ($expr->isCaseSensitive() ? '-name' : '-iname')
  41057. )
  41058. ->arg($expr->renderPattern());
  41059. }
  41060. $command->cmd(')');
  41061. }
  41062. private function buildPathsFiltering(Command $command, $dir, array $paths, $not = false)
  41063. {
  41064. if (0 === \count($paths)) {
  41065. return;
  41066. }
  41067. $command->add($not ? '-not' : null)->cmd('(');
  41068. foreach ($paths as $i => $path) {
  41069. $expr = Expression::create($path);
  41070. if ($expr->isGlob() && $expr->getGlob()->isExpandable()) {
  41071. $expr = Expression::create($expr->getGlob()->toRegex(false));
  41072. }
  41073. if ($expr->isRegex()) {
  41074. $regex = $expr->getRegex();
  41075. $regex->prepend($regex->hasStartFlag() ? preg_quote($dir).\DIRECTORY_SEPARATOR : '.*')->setEndJoker(!$regex->hasEndFlag());
  41076. } else {
  41077. $expr->prepend('*')->append('*');
  41078. }
  41079. $command
  41080. ->add($i > 0 ? '-or' : null)
  41081. ->add($expr->isRegex()
  41082. ? ($expr->isCaseSensitive() ? '-regex' : '-iregex')
  41083. : ($expr->isCaseSensitive() ? '-path' : '-ipath')
  41084. )
  41085. ->arg($expr->renderPattern());
  41086. }
  41087. $command->cmd(')');
  41088. }
  41089. private function buildSizesFiltering(Command $command, array $sizes)
  41090. {
  41091. foreach ($sizes as $i => $size) {
  41092. $command->add($i > 0 ? '-and' : null);
  41093. switch ($size->getOperator()) {
  41094. case '<=':
  41095. $command->add('-size -'.($size->getTarget() + 1).'c');
  41096. break;
  41097. case '>=':
  41098. $command->add('-size +'.($size->getTarget() - 1).'c');
  41099. break;
  41100. case '>':
  41101. $command->add('-size +'.$size->getTarget().'c');
  41102. break;
  41103. case '!=':
  41104. $command->add('-size -'.$size->getTarget().'c');
  41105. $command->add('-size +'.$size->getTarget().'c');
  41106. break;
  41107. case '<':
  41108. default:
  41109. $command->add('-size -'.$size->getTarget().'c');
  41110. }
  41111. }
  41112. }
  41113. private function buildDatesFiltering(Command $command, array $dates)
  41114. {
  41115. foreach ($dates as $i => $date) {
  41116. $command->add($i > 0 ? '-and' : null);
  41117. $mins = (int) round((time() - $date->getTarget()) / 60);
  41118. if (0 > $mins) {
  41119. $command->add(' -mmin -0');
  41120. return;
  41121. }
  41122. switch ($date->getOperator()) {
  41123. case '<=':
  41124. $command->add('-mmin +'.($mins - 1));
  41125. break;
  41126. case '>=':
  41127. $command->add('-mmin -'.($mins + 1));
  41128. break;
  41129. case '>':
  41130. $command->add('-mmin -'.$mins);
  41131. break;
  41132. case '!=':
  41133. $command->add('-mmin +'.$mins.' -or -mmin -'.$mins);
  41134. break;
  41135. case '<':
  41136. default:
  41137. $command->add('-mmin +'.$mins);
  41138. }
  41139. }
  41140. }
  41141. private function buildSorting(Command $command, $sort)
  41142. {
  41143. $this->buildFormatSorting($command, $sort);
  41144. }
  41145. abstract protected function buildFormatSorting(Command $command, $sort);
  41146. abstract protected function buildContentFiltering(Command $command, array $contains, $not = false);
  41147. }
  41148. <?php
  41149. namespace Symfony\Component\Finder\Adapter;
  41150. interface AdapterInterface
  41151. {
  41152. public function setFollowLinks($followLinks);
  41153. public function setMode($mode);
  41154. public function setExclude(array $exclude);
  41155. public function setDepths(array $depths);
  41156. public function setNames(array $names);
  41157. public function setNotNames(array $notNames);
  41158. public function setContains(array $contains);
  41159. public function setNotContains(array $notContains);
  41160. public function setSizes(array $sizes);
  41161. public function setDates(array $dates);
  41162. public function setFilters(array $filters);
  41163. public function setSort($sort);
  41164. public function setPath(array $paths);
  41165. public function setNotPath(array $notPaths);
  41166. public function ignoreUnreadableDirs($ignore = true);
  41167. public function searchInDirectory($dir);
  41168. public function isSupported();
  41169. public function getName();
  41170. }
  41171. <?php
  41172. namespace Symfony\Component\Finder\Adapter;
  41173. @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);
  41174. use Symfony\Component\Finder\Expression\Expression;
  41175. use Symfony\Component\Finder\Iterator\SortableIterator;
  41176. use Symfony\Component\Finder\Shell\Command;
  41177. use Symfony\Component\Finder\Shell\Shell;
  41178. class BsdFindAdapter extends AbstractFindAdapter
  41179. {
  41180. public function getName()
  41181. {
  41182. return 'bsd_find';
  41183. }
  41184. protected function canBeUsed()
  41185. {
  41186. return \in_array($this->shell->getType(), array(Shell::TYPE_BSD, Shell::TYPE_DARWIN)) && parent::canBeUsed();
  41187. }
  41188. protected function buildFormatSorting(Command $command, $sort)
  41189. {
  41190. switch ($sort) {
  41191. case SortableIterator::SORT_BY_NAME:
  41192. $command->ins('sort')->add('| sort');
  41193. return;
  41194. case SortableIterator::SORT_BY_TYPE:
  41195. $format = '%HT';
  41196. break;
  41197. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41198. $format = '%a';
  41199. break;
  41200. case SortableIterator::SORT_BY_CHANGED_TIME:
  41201. $format = '%c';
  41202. break;
  41203. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41204. $format = '%m';
  41205. break;
  41206. default:
  41207. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41208. }
  41209. $command
  41210. ->add('-print0 | xargs -0 stat -f')
  41211. ->arg($format.'%t%N')
  41212. ->add('| sort | cut -f 2');
  41213. }
  41214. protected function buildFindCommand(Command $command, $dir)
  41215. {
  41216. parent::buildFindCommand($command, $dir)->addAtIndex('-E', 1);
  41217. return $command;
  41218. }
  41219. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41220. {
  41221. foreach ($contains as $contain) {
  41222. $expr = Expression::create($contain);
  41223. $command
  41224. ->add('| grep -v \'^$\'')
  41225. ->add('| xargs -I{} grep -I')
  41226. ->add($expr->isCaseSensitive() ? null : '-i')
  41227. ->add($not ? '-L' : '-l')
  41228. ->add('-Ee')->arg($expr->renderPattern())
  41229. ->add('{}')
  41230. ;
  41231. }
  41232. }
  41233. }
  41234. <?php
  41235. namespace Symfony\Component\Finder\Adapter;
  41236. @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);
  41237. use Symfony\Component\Finder\Expression\Expression;
  41238. use Symfony\Component\Finder\Iterator\SortableIterator;
  41239. use Symfony\Component\Finder\Shell\Command;
  41240. use Symfony\Component\Finder\Shell\Shell;
  41241. class GnuFindAdapter extends AbstractFindAdapter
  41242. {
  41243. public function getName()
  41244. {
  41245. return 'gnu_find';
  41246. }
  41247. protected function buildFormatSorting(Command $command, $sort)
  41248. {
  41249. switch ($sort) {
  41250. case SortableIterator::SORT_BY_NAME:
  41251. $command->ins('sort')->add('| sort');
  41252. return;
  41253. case SortableIterator::SORT_BY_TYPE:
  41254. $format = '%y';
  41255. break;
  41256. case SortableIterator::SORT_BY_ACCESSED_TIME:
  41257. $format = '%A@';
  41258. break;
  41259. case SortableIterator::SORT_BY_CHANGED_TIME:
  41260. $format = '%C@';
  41261. break;
  41262. case SortableIterator::SORT_BY_MODIFIED_TIME:
  41263. $format = '%T@';
  41264. break;
  41265. default:
  41266. throw new \InvalidArgumentException(sprintf('Unknown sort options: %s.', $sort));
  41267. }
  41268. $command
  41269. ->get('find')
  41270. ->add('-printf')
  41271. ->arg($format.' %h/%f\\n')
  41272. ->add('| sort | cut')
  41273. ->arg('-d ')
  41274. ->arg('-f2-')
  41275. ;
  41276. }
  41277. protected function canBeUsed()
  41278. {
  41279. return Shell::TYPE_UNIX === $this->shell->getType() && parent::canBeUsed();
  41280. }
  41281. protected function buildFindCommand(Command $command, $dir)
  41282. {
  41283. return parent::buildFindCommand($command, $dir)->add('-regextype posix-extended');
  41284. }
  41285. protected function buildContentFiltering(Command $command, array $contains, $not = false)
  41286. {
  41287. foreach ($contains as $contain) {
  41288. $expr = Expression::create($contain);
  41289. $command
  41290. ->add('| xargs -I{} -r grep -I')
  41291. ->add($expr->isCaseSensitive() ? null : '-i')
  41292. ->add($not ? '-L' : '-l')
  41293. ->add('-Ee')->arg($expr->renderPattern())
  41294. ->add('{}')
  41295. ;
  41296. }
  41297. }
  41298. }
  41299. <?php
  41300. namespace Symfony\Component\Finder\Adapter;
  41301. @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);
  41302. use Symfony\Component\Finder\Iterator;
  41303. class PhpAdapter extends AbstractAdapter
  41304. {
  41305. public function searchInDirectory($dir)
  41306. {
  41307. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  41308. if ($this->followLinks) {
  41309. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  41310. }
  41311. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  41312. if ($this->exclude) {
  41313. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  41314. }
  41315. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  41316. if ($this->minDepth > 0 || $this->maxDepth < PHP_INT_MAX) {
  41317. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $this->minDepth, $this->maxDepth);
  41318. }
  41319. if ($this->mode) {
  41320. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  41321. }
  41322. if ($this->names || $this->notNames) {
  41323. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  41324. }
  41325. if ($this->contains || $this->notContains) {
  41326. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  41327. }
  41328. if ($this->sizes) {
  41329. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  41330. }
  41331. if ($this->dates) {
  41332. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  41333. }
  41334. if ($this->filters) {
  41335. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  41336. }
  41337. if ($this->paths || $this->notPaths) {
  41338. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  41339. }
  41340. if ($this->sort) {
  41341. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  41342. $iterator = $iteratorAggregate->getIterator();
  41343. }
  41344. return $iterator;
  41345. }
  41346. public function getName()
  41347. {
  41348. return 'php';
  41349. }
  41350. protected function canBeUsed()
  41351. {
  41352. return true;
  41353. }
  41354. }
  41355. <?php
  41356. namespace Symfony\Component\Finder\Comparator;
  41357. class Comparator
  41358. {
  41359. private $target;
  41360. private $operator = '==';
  41361. public function getTarget()
  41362. {
  41363. return $this->target;
  41364. }
  41365. public function setTarget($target)
  41366. {
  41367. $this->target = $target;
  41368. }
  41369. public function getOperator()
  41370. {
  41371. return $this->operator;
  41372. }
  41373. public function setOperator($operator)
  41374. {
  41375. if (!$operator) {
  41376. $operator = '==';
  41377. }
  41378. if (!\in_array($operator, array('>', '<', '>=', '<=', '==', '!='))) {
  41379. throw new \InvalidArgumentException(sprintf('Invalid operator "%s".', $operator));
  41380. }
  41381. $this->operator = $operator;
  41382. }
  41383. public function test($test)
  41384. {
  41385. switch ($this->operator) {
  41386. case '>':
  41387. return $test > $this->target;
  41388. case '>=':
  41389. return $test >= $this->target;
  41390. case '<':
  41391. return $test < $this->target;
  41392. case '<=':
  41393. return $test <= $this->target;
  41394. case '!=':
  41395. return $test != $this->target;
  41396. }
  41397. return $test == $this->target;
  41398. }
  41399. }
  41400. <?php
  41401. namespace Symfony\Component\Finder\Comparator;
  41402. class DateComparator extends Comparator
  41403. {
  41404. public function __construct($test)
  41405. {
  41406. if (!preg_match('#^\s*(==|!=|[<>]=?|after|since|before|until)?\s*(.+?)\s*$#i', $test, $matches)) {
  41407. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a date test.', $test));
  41408. }
  41409. try {
  41410. $date = new \DateTime($matches[2]);
  41411. $target = $date->format('U');
  41412. } catch (\Exception $e) {
  41413. throw new \InvalidArgumentException(sprintf('"%s" is not a valid date.', $matches[2]));
  41414. }
  41415. $operator = isset($matches[1]) ? $matches[1] : '==';
  41416. if ('since' === $operator || 'after' === $operator) {
  41417. $operator = '>';
  41418. }
  41419. if ('until' === $operator || 'before' === $operator) {
  41420. $operator = '<';
  41421. }
  41422. $this->setOperator($operator);
  41423. $this->setTarget($target);
  41424. }
  41425. }
  41426. <?php
  41427. namespace Symfony\Component\Finder\Comparator;
  41428. class NumberComparator extends Comparator
  41429. {
  41430. public function __construct($test)
  41431. {
  41432. if (!preg_match('#^\s*(==|!=|[<>]=?)?\s*([0-9\.]+)\s*([kmg]i?)?\s*$#i', $test, $matches)) {
  41433. throw new \InvalidArgumentException(sprintf('Don\'t understand "%s" as a number test.', $test));
  41434. }
  41435. $target = $matches[2];
  41436. if (!is_numeric($target)) {
  41437. throw new \InvalidArgumentException(sprintf('Invalid number "%s".', $target));
  41438. }
  41439. if (isset($matches[3])) {
  41440. switch (strtolower($matches[3])) {
  41441. case 'k':
  41442. $target *= 1000;
  41443. break;
  41444. case 'ki':
  41445. $target *= 1024;
  41446. break;
  41447. case 'm':
  41448. $target *= 1000000;
  41449. break;
  41450. case 'mi':
  41451. $target *= 1024 * 1024;
  41452. break;
  41453. case 'g':
  41454. $target *= 1000000000;
  41455. break;
  41456. case 'gi':
  41457. $target *= 1024 * 1024 * 1024;
  41458. break;
  41459. }
  41460. }
  41461. $this->setTarget($target);
  41462. $this->setOperator(isset($matches[1]) ? $matches[1] : '==');
  41463. }
  41464. }
  41465. <?php
  41466. namespace Symfony\Component\Finder\Exception;
  41467. class AccessDeniedException extends \UnexpectedValueException
  41468. {
  41469. }
  41470. <?php
  41471. namespace Symfony\Component\Finder\Exception;
  41472. @trigger_error('The '.__NAMESPACE__.'\AdapterFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41473. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41474. class AdapterFailureException extends \RuntimeException implements ExceptionInterface
  41475. {
  41476. private $adapter;
  41477. public function __construct(AdapterInterface $adapter, $message = null, \Exception $previous = null)
  41478. {
  41479. $this->adapter = $adapter;
  41480. parent::__construct($message ?: 'Search failed with "'.$adapter->getName().'" adapter.', $previous);
  41481. }
  41482. public function getAdapter()
  41483. {
  41484. return $this->adapter;
  41485. }
  41486. }
  41487. <?php
  41488. namespace Symfony\Component\Finder\Exception;
  41489. interface ExceptionInterface
  41490. {
  41491. public function getAdapter();
  41492. }
  41493. <?php
  41494. namespace Symfony\Component\Finder\Exception;
  41495. @trigger_error('The '.__NAMESPACE__.'\OperationNotPermitedException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41496. class OperationNotPermitedException extends AdapterFailureException
  41497. {
  41498. }
  41499. <?php
  41500. namespace Symfony\Component\Finder\Exception;
  41501. @trigger_error('The '.__NAMESPACE__.'\ShellCommandFailureException class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41502. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41503. use Symfony\Component\Finder\Shell\Command;
  41504. class ShellCommandFailureException extends AdapterFailureException
  41505. {
  41506. private $command;
  41507. public function __construct(AdapterInterface $adapter, Command $command, \Exception $previous = null)
  41508. {
  41509. $this->command = $command;
  41510. parent::__construct($adapter, 'Shell command failed: "'.$command->join().'".', $previous);
  41511. }
  41512. public function getCommand()
  41513. {
  41514. return $this->command;
  41515. }
  41516. }
  41517. <?php
  41518. namespace Symfony\Component\Finder\Expression;
  41519. @trigger_error('The '.__NAMESPACE__.'\Expression class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41520. class Expression implements ValueInterface
  41521. {
  41522. const TYPE_REGEX = 1;
  41523. const TYPE_GLOB = 2;
  41524. private $value;
  41525. public static function create($expr)
  41526. {
  41527. return new self($expr);
  41528. }
  41529. public function __construct($expr)
  41530. {
  41531. try {
  41532. $this->value = Regex::create($expr);
  41533. } catch (\InvalidArgumentException $e) {
  41534. $this->value = new Glob($expr);
  41535. }
  41536. }
  41537. public function __toString()
  41538. {
  41539. return $this->render();
  41540. }
  41541. public function render()
  41542. {
  41543. return $this->value->render();
  41544. }
  41545. public function renderPattern()
  41546. {
  41547. return $this->value->renderPattern();
  41548. }
  41549. public function isCaseSensitive()
  41550. {
  41551. return $this->value->isCaseSensitive();
  41552. }
  41553. public function getType()
  41554. {
  41555. return $this->value->getType();
  41556. }
  41557. public function prepend($expr)
  41558. {
  41559. $this->value->prepend($expr);
  41560. return $this;
  41561. }
  41562. public function append($expr)
  41563. {
  41564. $this->value->append($expr);
  41565. return $this;
  41566. }
  41567. public function isRegex()
  41568. {
  41569. return self::TYPE_REGEX === $this->value->getType();
  41570. }
  41571. public function isGlob()
  41572. {
  41573. return self::TYPE_GLOB === $this->value->getType();
  41574. }
  41575. public function getGlob()
  41576. {
  41577. if (self::TYPE_GLOB !== $this->value->getType()) {
  41578. throw new \LogicException('Regex can\'t be transformed to glob.');
  41579. }
  41580. return $this->value;
  41581. }
  41582. public function getRegex()
  41583. {
  41584. return self::TYPE_REGEX === $this->value->getType() ? $this->value : $this->value->toRegex();
  41585. }
  41586. }
  41587. <?php
  41588. namespace Symfony\Component\Finder\Expression;
  41589. @trigger_error('The '.__NAMESPACE__.'\Glob class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41590. use Symfony\Component\Finder\Glob as FinderGlob;
  41591. class Glob implements ValueInterface
  41592. {
  41593. private $pattern;
  41594. public function __construct($pattern)
  41595. {
  41596. $this->pattern = $pattern;
  41597. }
  41598. public function render()
  41599. {
  41600. return $this->pattern;
  41601. }
  41602. public function renderPattern()
  41603. {
  41604. return $this->pattern;
  41605. }
  41606. public function getType()
  41607. {
  41608. return Expression::TYPE_GLOB;
  41609. }
  41610. public function isCaseSensitive()
  41611. {
  41612. return true;
  41613. }
  41614. public function prepend($expr)
  41615. {
  41616. $this->pattern = $expr.$this->pattern;
  41617. return $this;
  41618. }
  41619. public function append($expr)
  41620. {
  41621. $this->pattern .= $expr;
  41622. return $this;
  41623. }
  41624. public function isExpandable()
  41625. {
  41626. return false !== strpos($this->pattern, '{')
  41627. && false !== strpos($this->pattern, '}');
  41628. }
  41629. public function toRegex($strictLeadingDot = true, $strictWildcardSlash = true)
  41630. {
  41631. $regex = FinderGlob::toRegex($this->pattern, $strictLeadingDot, $strictWildcardSlash, '');
  41632. return new Regex($regex);
  41633. }
  41634. }
  41635. <?php
  41636. namespace Symfony\Component\Finder\Expression;
  41637. @trigger_error('The '.__NAMESPACE__.'\Regex class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41638. class Regex implements ValueInterface
  41639. {
  41640. const START_FLAG = '^';
  41641. const END_FLAG = '$';
  41642. const BOUNDARY = '~';
  41643. const JOKER = '.*';
  41644. const ESCAPING = '\\';
  41645. private $pattern;
  41646. private $options;
  41647. private $startFlag;
  41648. private $endFlag;
  41649. private $startJoker;
  41650. private $endJoker;
  41651. public static function create($expr)
  41652. {
  41653. if (preg_match('/^(.{3,}?)([imsxuADU]*)$/', $expr, $m)) {
  41654. $start = substr($m[1], 0, 1);
  41655. $end = substr($m[1], -1);
  41656. if (
  41657. ($start === $end && !preg_match('/[*?[:alnum:] \\\\]/', $start))
  41658. || ('{' === $start && '}' === $end)
  41659. || ('(' === $start && ')' === $end)
  41660. ) {
  41661. return new self(substr($m[1], 1, -1), $m[2], $end);
  41662. }
  41663. }
  41664. throw new \InvalidArgumentException('Given expression is not a regex.');
  41665. }
  41666. public function __construct($pattern, $options = '', $delimiter = null)
  41667. {
  41668. if (null !== $delimiter) {
  41669. $pattern = str_replace('\\'.$delimiter, $delimiter, $pattern);
  41670. }
  41671. $this->parsePattern($pattern);
  41672. $this->options = $options;
  41673. }
  41674. public function __toString()
  41675. {
  41676. return $this->render();
  41677. }
  41678. public function render()
  41679. {
  41680. return self::BOUNDARY
  41681. .$this->renderPattern()
  41682. .self::BOUNDARY
  41683. .$this->options;
  41684. }
  41685. public function renderPattern()
  41686. {
  41687. return ($this->startFlag ? self::START_FLAG : '')
  41688. .($this->startJoker ? self::JOKER : '')
  41689. .str_replace(self::BOUNDARY, '\\'.self::BOUNDARY, $this->pattern)
  41690. .($this->endJoker ? self::JOKER : '')
  41691. .($this->endFlag ? self::END_FLAG : '');
  41692. }
  41693. public function isCaseSensitive()
  41694. {
  41695. return !$this->hasOption('i');
  41696. }
  41697. public function getType()
  41698. {
  41699. return Expression::TYPE_REGEX;
  41700. }
  41701. public function prepend($expr)
  41702. {
  41703. $this->pattern = $expr.$this->pattern;
  41704. return $this;
  41705. }
  41706. public function append($expr)
  41707. {
  41708. $this->pattern .= $expr;
  41709. return $this;
  41710. }
  41711. public function hasOption($option)
  41712. {
  41713. return false !== strpos($this->options, $option);
  41714. }
  41715. public function addOption($option)
  41716. {
  41717. if (!$this->hasOption($option)) {
  41718. $this->options .= $option;
  41719. }
  41720. return $this;
  41721. }
  41722. public function removeOption($option)
  41723. {
  41724. $this->options = str_replace($option, '', $this->options);
  41725. return $this;
  41726. }
  41727. public function setStartFlag($startFlag)
  41728. {
  41729. $this->startFlag = $startFlag;
  41730. return $this;
  41731. }
  41732. public function hasStartFlag()
  41733. {
  41734. return $this->startFlag;
  41735. }
  41736. public function setEndFlag($endFlag)
  41737. {
  41738. $this->endFlag = (bool) $endFlag;
  41739. return $this;
  41740. }
  41741. public function hasEndFlag()
  41742. {
  41743. return $this->endFlag;
  41744. }
  41745. public function setStartJoker($startJoker)
  41746. {
  41747. $this->startJoker = $startJoker;
  41748. return $this;
  41749. }
  41750. public function hasStartJoker()
  41751. {
  41752. return $this->startJoker;
  41753. }
  41754. public function setEndJoker($endJoker)
  41755. {
  41756. $this->endJoker = (bool) $endJoker;
  41757. return $this;
  41758. }
  41759. public function hasEndJoker()
  41760. {
  41761. return $this->endJoker;
  41762. }
  41763. public function replaceJokers($replacement)
  41764. {
  41765. $replace = function ($subject) use ($replacement) {
  41766. $subject = $subject[0];
  41767. $replace = 0 === substr_count($subject, '\\') % 2;
  41768. return $replace ? str_replace('.', $replacement, $subject) : $subject;
  41769. };
  41770. $this->pattern = preg_replace_callback('~[\\\\]*\\.~', $replace, $this->pattern);
  41771. return $this;
  41772. }
  41773. private function parsePattern($pattern)
  41774. {
  41775. if ($this->startFlag = self::START_FLAG === substr($pattern, 0, 1)) {
  41776. $pattern = substr($pattern, 1);
  41777. }
  41778. if ($this->startJoker = self::JOKER === substr($pattern, 0, 2)) {
  41779. $pattern = substr($pattern, 2);
  41780. }
  41781. if ($this->endFlag = (self::END_FLAG === substr($pattern, -1) && self::ESCAPING !== substr($pattern, -2, -1))) {
  41782. $pattern = substr($pattern, 0, -1);
  41783. }
  41784. if ($this->endJoker = (self::JOKER === substr($pattern, -2) && self::ESCAPING !== substr($pattern, -3, -2))) {
  41785. $pattern = substr($pattern, 0, -2);
  41786. }
  41787. $this->pattern = $pattern;
  41788. }
  41789. }
  41790. <?php
  41791. namespace Symfony\Component\Finder\Expression;
  41792. @trigger_error('The '.__NAMESPACE__.'\ValueInterface interface is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41793. interface ValueInterface
  41794. {
  41795. public function render();
  41796. public function renderPattern();
  41797. public function isCaseSensitive();
  41798. public function getType();
  41799. public function prepend($expr);
  41800. public function append($expr);
  41801. }
  41802. <?php
  41803. namespace Symfony\Component\Finder;
  41804. use Symfony\Component\Finder\Adapter\AdapterInterface;
  41805. use Symfony\Component\Finder\Adapter\BsdFindAdapter;
  41806. use Symfony\Component\Finder\Adapter\GnuFindAdapter;
  41807. use Symfony\Component\Finder\Adapter\PhpAdapter;
  41808. use Symfony\Component\Finder\Comparator\DateComparator;
  41809. use Symfony\Component\Finder\Comparator\NumberComparator;
  41810. use Symfony\Component\Finder\Exception\ExceptionInterface;
  41811. use Symfony\Component\Finder\Iterator\CustomFilterIterator;
  41812. use Symfony\Component\Finder\Iterator\DateRangeFilterIterator;
  41813. use Symfony\Component\Finder\Iterator\DepthRangeFilterIterator;
  41814. use Symfony\Component\Finder\Iterator\ExcludeDirectoryFilterIterator;
  41815. use Symfony\Component\Finder\Iterator\FilecontentFilterIterator;
  41816. use Symfony\Component\Finder\Iterator\FilenameFilterIterator;
  41817. use Symfony\Component\Finder\Iterator\SizeRangeFilterIterator;
  41818. use Symfony\Component\Finder\Iterator\SortableIterator;
  41819. class Finder implements \IteratorAggregate, \Countable
  41820. {
  41821. const IGNORE_VCS_FILES = 1;
  41822. const IGNORE_DOT_FILES = 2;
  41823. private $mode = 0;
  41824. private $names = array();
  41825. private $notNames = array();
  41826. private $exclude = array();
  41827. private $filters = array();
  41828. private $depths = array();
  41829. private $sizes = array();
  41830. private $followLinks = false;
  41831. private $sort = false;
  41832. private $ignore = 0;
  41833. private $dirs = array();
  41834. private $dates = array();
  41835. private $iterators = array();
  41836. private $contains = array();
  41837. private $notContains = array();
  41838. private $adapters = null;
  41839. private $paths = array();
  41840. private $notPaths = array();
  41841. private $ignoreUnreadableDirs = false;
  41842. private static $vcsPatterns = array('.svn', '_svn', 'CVS', '_darcs', '.arch-params', '.monotone', '.bzr', '.git', '.hg');
  41843. public function __construct()
  41844. {
  41845. $this->ignore = static::IGNORE_VCS_FILES | static::IGNORE_DOT_FILES;
  41846. }
  41847. public static function create()
  41848. {
  41849. return new static();
  41850. }
  41851. public function addAdapter(AdapterInterface $adapter, $priority = 0)
  41852. {
  41853. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41854. $this->initDefaultAdapters();
  41855. $this->adapters[$adapter->getName()] = array(
  41856. 'adapter' => $adapter,
  41857. 'priority' => $priority,
  41858. 'selected' => false,
  41859. );
  41860. return $this->sortAdapters();
  41861. }
  41862. public function useBestAdapter()
  41863. {
  41864. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41865. $this->initDefaultAdapters();
  41866. $this->resetAdapterSelection();
  41867. return $this->sortAdapters();
  41868. }
  41869. public function setAdapter($name)
  41870. {
  41871. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41872. $this->initDefaultAdapters();
  41873. if (!isset($this->adapters[$name])) {
  41874. throw new \InvalidArgumentException(sprintf('Adapter "%s" does not exist.', $name));
  41875. }
  41876. $this->resetAdapterSelection();
  41877. $this->adapters[$name]['selected'] = true;
  41878. return $this->sortAdapters();
  41879. }
  41880. public function removeAdapters()
  41881. {
  41882. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41883. $this->adapters = array();
  41884. return $this;
  41885. }
  41886. public function getAdapters()
  41887. {
  41888. @trigger_error('The '.__METHOD__.' method is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  41889. $this->initDefaultAdapters();
  41890. return array_values(array_map(function (array $adapter) {
  41891. return $adapter['adapter'];
  41892. }, $this->adapters));
  41893. }
  41894. public function directories()
  41895. {
  41896. $this->mode = Iterator\FileTypeFilterIterator::ONLY_DIRECTORIES;
  41897. return $this;
  41898. }
  41899. public function files()
  41900. {
  41901. $this->mode = Iterator\FileTypeFilterIterator::ONLY_FILES;
  41902. return $this;
  41903. }
  41904. public function depth($level)
  41905. {
  41906. $this->depths[] = new Comparator\NumberComparator($level);
  41907. return $this;
  41908. }
  41909. public function date($date)
  41910. {
  41911. $this->dates[] = new Comparator\DateComparator($date);
  41912. return $this;
  41913. }
  41914. public function name($pattern)
  41915. {
  41916. $this->names[] = $pattern;
  41917. return $this;
  41918. }
  41919. public function notName($pattern)
  41920. {
  41921. $this->notNames[] = $pattern;
  41922. return $this;
  41923. }
  41924. public function contains($pattern)
  41925. {
  41926. $this->contains[] = $pattern;
  41927. return $this;
  41928. }
  41929. public function notContains($pattern)
  41930. {
  41931. $this->notContains[] = $pattern;
  41932. return $this;
  41933. }
  41934. public function path($pattern)
  41935. {
  41936. $this->paths[] = $pattern;
  41937. return $this;
  41938. }
  41939. public function notPath($pattern)
  41940. {
  41941. $this->notPaths[] = $pattern;
  41942. return $this;
  41943. }
  41944. public function size($size)
  41945. {
  41946. $this->sizes[] = new Comparator\NumberComparator($size);
  41947. return $this;
  41948. }
  41949. public function exclude($dirs)
  41950. {
  41951. $this->exclude = array_merge($this->exclude, (array) $dirs);
  41952. return $this;
  41953. }
  41954. public function ignoreDotFiles($ignoreDotFiles)
  41955. {
  41956. if ($ignoreDotFiles) {
  41957. $this->ignore |= static::IGNORE_DOT_FILES;
  41958. } else {
  41959. $this->ignore &= ~static::IGNORE_DOT_FILES;
  41960. }
  41961. return $this;
  41962. }
  41963. public function ignoreVCS($ignoreVCS)
  41964. {
  41965. if ($ignoreVCS) {
  41966. $this->ignore |= static::IGNORE_VCS_FILES;
  41967. } else {
  41968. $this->ignore &= ~static::IGNORE_VCS_FILES;
  41969. }
  41970. return $this;
  41971. }
  41972. public static function addVCSPattern($pattern)
  41973. {
  41974. foreach ((array) $pattern as $p) {
  41975. self::$vcsPatterns[] = $p;
  41976. }
  41977. self::$vcsPatterns = array_unique(self::$vcsPatterns);
  41978. }
  41979. public function sort(\Closure $closure)
  41980. {
  41981. $this->sort = $closure;
  41982. return $this;
  41983. }
  41984. public function sortByName()
  41985. {
  41986. $this->sort = Iterator\SortableIterator::SORT_BY_NAME;
  41987. return $this;
  41988. }
  41989. public function sortByType()
  41990. {
  41991. $this->sort = Iterator\SortableIterator::SORT_BY_TYPE;
  41992. return $this;
  41993. }
  41994. public function sortByAccessedTime()
  41995. {
  41996. $this->sort = Iterator\SortableIterator::SORT_BY_ACCESSED_TIME;
  41997. return $this;
  41998. }
  41999. public function sortByChangedTime()
  42000. {
  42001. $this->sort = Iterator\SortableIterator::SORT_BY_CHANGED_TIME;
  42002. return $this;
  42003. }
  42004. public function sortByModifiedTime()
  42005. {
  42006. $this->sort = Iterator\SortableIterator::SORT_BY_MODIFIED_TIME;
  42007. return $this;
  42008. }
  42009. public function filter(\Closure $closure)
  42010. {
  42011. $this->filters[] = $closure;
  42012. return $this;
  42013. }
  42014. public function followLinks()
  42015. {
  42016. $this->followLinks = true;
  42017. return $this;
  42018. }
  42019. public function ignoreUnreadableDirs($ignore = true)
  42020. {
  42021. $this->ignoreUnreadableDirs = (bool) $ignore;
  42022. return $this;
  42023. }
  42024. public function in($dirs)
  42025. {
  42026. $resolvedDirs = array();
  42027. foreach ((array) $dirs as $dir) {
  42028. if (is_dir($dir)) {
  42029. $resolvedDirs[] = $this->normalizeDir($dir);
  42030. } elseif ($glob = glob($dir, (\defined('GLOB_BRACE') ? GLOB_BRACE : 0) | GLOB_ONLYDIR)) {
  42031. $resolvedDirs = array_merge($resolvedDirs, array_map(array($this, 'normalizeDir'), $glob));
  42032. } else {
  42033. throw new \InvalidArgumentException(sprintf('The "%s" directory does not exist.', $dir));
  42034. }
  42035. }
  42036. $this->dirs = array_merge($this->dirs, $resolvedDirs);
  42037. return $this;
  42038. }
  42039. public function getIterator()
  42040. {
  42041. if (0 === \count($this->dirs) && 0 === \count($this->iterators)) {
  42042. throw new \LogicException('You must call one of in() or append() methods before iterating over a Finder.');
  42043. }
  42044. if (1 === \count($this->dirs) && 0 === \count($this->iterators)) {
  42045. return $this->searchInDirectory($this->dirs[0]);
  42046. }
  42047. $iterator = new \AppendIterator();
  42048. foreach ($this->dirs as $dir) {
  42049. $iterator->append($this->searchInDirectory($dir));
  42050. }
  42051. foreach ($this->iterators as $it) {
  42052. $iterator->append($it);
  42053. }
  42054. return $iterator;
  42055. }
  42056. public function append($iterator)
  42057. {
  42058. if ($iterator instanceof \IteratorAggregate) {
  42059. $this->iterators[] = $iterator->getIterator();
  42060. } elseif ($iterator instanceof \Iterator) {
  42061. $this->iterators[] = $iterator;
  42062. } elseif ($iterator instanceof \Traversable || \is_array($iterator)) {
  42063. $it = new \ArrayIterator();
  42064. foreach ($iterator as $file) {
  42065. $it->append($file instanceof \SplFileInfo ? $file : new \SplFileInfo($file));
  42066. }
  42067. $this->iterators[] = $it;
  42068. } else {
  42069. throw new \InvalidArgumentException('Finder::append() method wrong argument type.');
  42070. }
  42071. return $this;
  42072. }
  42073. public function count()
  42074. {
  42075. return iterator_count($this->getIterator());
  42076. }
  42077. private function sortAdapters()
  42078. {
  42079. uasort($this->adapters, function (array $a, array $b) {
  42080. if ($a['selected'] || $b['selected']) {
  42081. return $a['selected'] ? -1 : 1;
  42082. }
  42083. return $a['priority'] > $b['priority'] ? -1 : 1;
  42084. });
  42085. return $this;
  42086. }
  42087. private function searchInDirectory($dir)
  42088. {
  42089. if (static::IGNORE_VCS_FILES === (static::IGNORE_VCS_FILES & $this->ignore)) {
  42090. $this->exclude = array_merge($this->exclude, self::$vcsPatterns);
  42091. }
  42092. if (static::IGNORE_DOT_FILES === (static::IGNORE_DOT_FILES & $this->ignore)) {
  42093. $this->notPaths[] = '#(^|/)\..+(/|$)#';
  42094. }
  42095. if ($this->adapters) {
  42096. foreach ($this->adapters as $adapter) {
  42097. if ($adapter['adapter']->isSupported()) {
  42098. try {
  42099. return $this
  42100. ->buildAdapter($adapter['adapter'])
  42101. ->searchInDirectory($dir);
  42102. } catch (ExceptionInterface $e) {
  42103. }
  42104. }
  42105. }
  42106. }
  42107. $minDepth = 0;
  42108. $maxDepth = PHP_INT_MAX;
  42109. foreach ($this->depths as $comparator) {
  42110. switch ($comparator->getOperator()) {
  42111. case '>':
  42112. $minDepth = $comparator->getTarget() + 1;
  42113. break;
  42114. case '>=':
  42115. $minDepth = $comparator->getTarget();
  42116. break;
  42117. case '<':
  42118. $maxDepth = $comparator->getTarget() - 1;
  42119. break;
  42120. case '<=':
  42121. $maxDepth = $comparator->getTarget();
  42122. break;
  42123. default:
  42124. $minDepth = $maxDepth = $comparator->getTarget();
  42125. }
  42126. }
  42127. $flags = \RecursiveDirectoryIterator::SKIP_DOTS;
  42128. if ($this->followLinks) {
  42129. $flags |= \RecursiveDirectoryIterator::FOLLOW_SYMLINKS;
  42130. }
  42131. $iterator = new Iterator\RecursiveDirectoryIterator($dir, $flags, $this->ignoreUnreadableDirs);
  42132. if ($this->exclude) {
  42133. $iterator = new Iterator\ExcludeDirectoryFilterIterator($iterator, $this->exclude);
  42134. }
  42135. $iterator = new \RecursiveIteratorIterator($iterator, \RecursiveIteratorIterator::SELF_FIRST);
  42136. if ($minDepth > 0 || $maxDepth < PHP_INT_MAX) {
  42137. $iterator = new Iterator\DepthRangeFilterIterator($iterator, $minDepth, $maxDepth);
  42138. }
  42139. if ($this->mode) {
  42140. $iterator = new Iterator\FileTypeFilterIterator($iterator, $this->mode);
  42141. }
  42142. if ($this->names || $this->notNames) {
  42143. $iterator = new Iterator\FilenameFilterIterator($iterator, $this->names, $this->notNames);
  42144. }
  42145. if ($this->contains || $this->notContains) {
  42146. $iterator = new Iterator\FilecontentFilterIterator($iterator, $this->contains, $this->notContains);
  42147. }
  42148. if ($this->sizes) {
  42149. $iterator = new Iterator\SizeRangeFilterIterator($iterator, $this->sizes);
  42150. }
  42151. if ($this->dates) {
  42152. $iterator = new Iterator\DateRangeFilterIterator($iterator, $this->dates);
  42153. }
  42154. if ($this->filters) {
  42155. $iterator = new Iterator\CustomFilterIterator($iterator, $this->filters);
  42156. }
  42157. if ($this->paths || $this->notPaths) {
  42158. $iterator = new Iterator\PathFilterIterator($iterator, $this->paths, $this->notPaths);
  42159. }
  42160. if ($this->sort) {
  42161. $iteratorAggregate = new Iterator\SortableIterator($iterator, $this->sort);
  42162. $iterator = $iteratorAggregate->getIterator();
  42163. }
  42164. return $iterator;
  42165. }
  42166. private function buildAdapter(AdapterInterface $adapter)
  42167. {
  42168. return $adapter
  42169. ->setFollowLinks($this->followLinks)
  42170. ->setDepths($this->depths)
  42171. ->setMode($this->mode)
  42172. ->setExclude($this->exclude)
  42173. ->setNames($this->names)
  42174. ->setNotNames($this->notNames)
  42175. ->setContains($this->contains)
  42176. ->setNotContains($this->notContains)
  42177. ->setSizes($this->sizes)
  42178. ->setDates($this->dates)
  42179. ->setFilters($this->filters)
  42180. ->setSort($this->sort)
  42181. ->setPath($this->paths)
  42182. ->setNotPath($this->notPaths)
  42183. ->ignoreUnreadableDirs($this->ignoreUnreadableDirs);
  42184. }
  42185. private function resetAdapterSelection()
  42186. {
  42187. $this->adapters = array_map(function (array $properties) {
  42188. $properties['selected'] = false;
  42189. return $properties;
  42190. }, $this->adapters);
  42191. }
  42192. private function initDefaultAdapters()
  42193. {
  42194. if (null === $this->adapters) {
  42195. $this->adapters = array();
  42196. $this
  42197. ->addAdapter(new GnuFindAdapter())
  42198. ->addAdapter(new BsdFindAdapter())
  42199. ->addAdapter(new PhpAdapter(), -50)
  42200. ->setAdapter('php')
  42201. ;
  42202. }
  42203. }
  42204. private function normalizeDir($dir)
  42205. {
  42206. return rtrim($dir, '/'.\DIRECTORY_SEPARATOR);
  42207. }
  42208. }
  42209. <?php
  42210. namespace Symfony\Component\Finder;
  42211. class Glob
  42212. {
  42213. public static function toRegex($glob, $strictLeadingDot = true, $strictWildcardSlash = true, $delimiter = '#')
  42214. {
  42215. $firstByte = true;
  42216. $escaping = false;
  42217. $inCurlies = 0;
  42218. $regex = '';
  42219. $sizeGlob = \strlen($glob);
  42220. for ($i = 0; $i < $sizeGlob; ++$i) {
  42221. $car = $glob[$i];
  42222. if ($firstByte) {
  42223. if ($strictLeadingDot && '.' !== $car) {
  42224. $regex .= '(?=[^\.])';
  42225. }
  42226. $firstByte = false;
  42227. }
  42228. if ('/' === $car) {
  42229. $firstByte = true;
  42230. }
  42231. if ($delimiter === $car || '.' === $car || '(' === $car || ')' === $car || '|' === $car || '+' === $car || '^' === $car || '$' === $car) {
  42232. $regex .= "\\$car";
  42233. } elseif ('*' === $car) {
  42234. $regex .= $escaping ? '\\*' : ($strictWildcardSlash ? '[^/]*' : '.*');
  42235. } elseif ('?' === $car) {
  42236. $regex .= $escaping ? '\\?' : ($strictWildcardSlash ? '[^/]' : '.');
  42237. } elseif ('{' === $car) {
  42238. $regex .= $escaping ? '\\{' : '(';
  42239. if (!$escaping) {
  42240. ++$inCurlies;
  42241. }
  42242. } elseif ('}' === $car && $inCurlies) {
  42243. $regex .= $escaping ? '}' : ')';
  42244. if (!$escaping) {
  42245. --$inCurlies;
  42246. }
  42247. } elseif (',' === $car && $inCurlies) {
  42248. $regex .= $escaping ? ',' : '|';
  42249. } elseif ('\\' === $car) {
  42250. if ($escaping) {
  42251. $regex .= '\\\\';
  42252. $escaping = false;
  42253. } else {
  42254. $escaping = true;
  42255. }
  42256. continue;
  42257. } else {
  42258. $regex .= $car;
  42259. }
  42260. $escaping = false;
  42261. }
  42262. return $delimiter.'^'.$regex.'$'.$delimiter;
  42263. }
  42264. }
  42265. <?php
  42266. namespace Symfony\Component\Finder\Iterator;
  42267. class CustomFilterIterator extends FilterIterator
  42268. {
  42269. private $filters = array();
  42270. public function __construct(\Iterator $iterator, array $filters)
  42271. {
  42272. foreach ($filters as $filter) {
  42273. if (!\is_callable($filter)) {
  42274. throw new \InvalidArgumentException('Invalid PHP callback.');
  42275. }
  42276. }
  42277. $this->filters = $filters;
  42278. parent::__construct($iterator);
  42279. }
  42280. public function accept()
  42281. {
  42282. $fileinfo = $this->current();
  42283. foreach ($this->filters as $filter) {
  42284. if (false === \call_user_func($filter, $fileinfo)) {
  42285. return false;
  42286. }
  42287. }
  42288. return true;
  42289. }
  42290. }
  42291. <?php
  42292. namespace Symfony\Component\Finder\Iterator;
  42293. use Symfony\Component\Finder\Comparator\DateComparator;
  42294. class DateRangeFilterIterator extends FilterIterator
  42295. {
  42296. private $comparators = array();
  42297. public function __construct(\Iterator $iterator, array $comparators)
  42298. {
  42299. $this->comparators = $comparators;
  42300. parent::__construct($iterator);
  42301. }
  42302. public function accept()
  42303. {
  42304. $fileinfo = $this->current();
  42305. if (!file_exists($fileinfo->getPathname())) {
  42306. return false;
  42307. }
  42308. $filedate = $fileinfo->getMTime();
  42309. foreach ($this->comparators as $compare) {
  42310. if (!$compare->test($filedate)) {
  42311. return false;
  42312. }
  42313. }
  42314. return true;
  42315. }
  42316. }
  42317. <?php
  42318. namespace Symfony\Component\Finder\Iterator;
  42319. class DepthRangeFilterIterator extends FilterIterator
  42320. {
  42321. private $minDepth = 0;
  42322. public function __construct(\RecursiveIteratorIterator $iterator, $minDepth = 0, $maxDepth = PHP_INT_MAX)
  42323. {
  42324. $this->minDepth = $minDepth;
  42325. $iterator->setMaxDepth(PHP_INT_MAX === $maxDepth ? -1 : $maxDepth);
  42326. parent::__construct($iterator);
  42327. }
  42328. public function accept()
  42329. {
  42330. return $this->getInnerIterator()->getDepth() >= $this->minDepth;
  42331. }
  42332. }
  42333. <?php
  42334. namespace Symfony\Component\Finder\Iterator;
  42335. class ExcludeDirectoryFilterIterator extends FilterIterator implements \RecursiveIterator
  42336. {
  42337. private $iterator;
  42338. private $isRecursive;
  42339. private $excludedDirs = array();
  42340. private $excludedPattern;
  42341. public function __construct(\Iterator $iterator, array $directories)
  42342. {
  42343. $this->iterator = $iterator;
  42344. $this->isRecursive = $iterator instanceof \RecursiveIterator;
  42345. $patterns = array();
  42346. foreach ($directories as $directory) {
  42347. $directory = rtrim($directory, '/');
  42348. if (!$this->isRecursive || false !== strpos($directory, '/')) {
  42349. $patterns[] = preg_quote($directory, '#');
  42350. } else {
  42351. $this->excludedDirs[$directory] = true;
  42352. }
  42353. }
  42354. if ($patterns) {
  42355. $this->excludedPattern = '#(?:^|/)(?:'.implode('|', $patterns).')(?:/|$)#';
  42356. }
  42357. parent::__construct($iterator);
  42358. }
  42359. public function accept()
  42360. {
  42361. if ($this->isRecursive && isset($this->excludedDirs[$this->getFilename()]) && $this->isDir()) {
  42362. return false;
  42363. }
  42364. if ($this->excludedPattern) {
  42365. $path = $this->isDir() ? $this->current()->getRelativePathname() : $this->current()->getRelativePath();
  42366. $path = str_replace('\\', '/', $path);
  42367. return !preg_match($this->excludedPattern, $path);
  42368. }
  42369. return true;
  42370. }
  42371. public function hasChildren()
  42372. {
  42373. return $this->isRecursive && $this->iterator->hasChildren();
  42374. }
  42375. public function getChildren()
  42376. {
  42377. $children = new self($this->iterator->getChildren(), array());
  42378. $children->excludedDirs = $this->excludedDirs;
  42379. $children->excludedPattern = $this->excludedPattern;
  42380. return $children;
  42381. }
  42382. }
  42383. <?php
  42384. namespace Symfony\Component\Finder\Iterator;
  42385. @trigger_error('The '.__NAMESPACE__.'\FilePathsIterator class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42386. use Symfony\Component\Finder\SplFileInfo;
  42387. class FilePathsIterator extends \ArrayIterator
  42388. {
  42389. private $baseDir;
  42390. private $baseDirLength;
  42391. private $subPath;
  42392. private $subPathname;
  42393. private $current;
  42394. public function __construct(array $paths, $baseDir)
  42395. {
  42396. $this->baseDir = $baseDir;
  42397. $this->baseDirLength = \strlen($baseDir);
  42398. parent::__construct($paths);
  42399. }
  42400. public function __call($name, array $arguments)
  42401. {
  42402. return \call_user_func_array(array($this->current(), $name), $arguments);
  42403. }
  42404. public function current()
  42405. {
  42406. return $this->current;
  42407. }
  42408. public function key()
  42409. {
  42410. return $this->current->getPathname();
  42411. }
  42412. public function next()
  42413. {
  42414. parent::next();
  42415. $this->buildProperties();
  42416. }
  42417. public function rewind()
  42418. {
  42419. parent::rewind();
  42420. $this->buildProperties();
  42421. }
  42422. public function getSubPath()
  42423. {
  42424. return $this->subPath;
  42425. }
  42426. public function getSubPathname()
  42427. {
  42428. return $this->subPathname;
  42429. }
  42430. private function buildProperties()
  42431. {
  42432. $absolutePath = parent::current();
  42433. if ($this->baseDir === substr($absolutePath, 0, $this->baseDirLength)) {
  42434. $this->subPathname = ltrim(substr($absolutePath, $this->baseDirLength), '/\\');
  42435. $dir = \dirname($this->subPathname);
  42436. $this->subPath = '.' === $dir ? '' : $dir;
  42437. } else {
  42438. $this->subPath = $this->subPathname = '';
  42439. }
  42440. $this->current = new SplFileInfo(parent::current(), $this->subPath, $this->subPathname);
  42441. }
  42442. }
  42443. <?php
  42444. namespace Symfony\Component\Finder\Iterator;
  42445. class FileTypeFilterIterator extends FilterIterator
  42446. {
  42447. const ONLY_FILES = 1;
  42448. const ONLY_DIRECTORIES = 2;
  42449. private $mode;
  42450. public function __construct(\Iterator $iterator, $mode)
  42451. {
  42452. $this->mode = $mode;
  42453. parent::__construct($iterator);
  42454. }
  42455. public function accept()
  42456. {
  42457. $fileinfo = $this->current();
  42458. if (self::ONLY_DIRECTORIES === (self::ONLY_DIRECTORIES & $this->mode) && $fileinfo->isFile()) {
  42459. return false;
  42460. } elseif (self::ONLY_FILES === (self::ONLY_FILES & $this->mode) && $fileinfo->isDir()) {
  42461. return false;
  42462. }
  42463. return true;
  42464. }
  42465. }
  42466. <?php
  42467. namespace Symfony\Component\Finder\Iterator;
  42468. class FilecontentFilterIterator extends MultiplePcreFilterIterator
  42469. {
  42470. public function accept()
  42471. {
  42472. if (!$this->matchRegexps && !$this->noMatchRegexps) {
  42473. return true;
  42474. }
  42475. $fileinfo = $this->current();
  42476. if ($fileinfo->isDir() || !$fileinfo->isReadable()) {
  42477. return false;
  42478. }
  42479. $content = $fileinfo->getContents();
  42480. if (!$content) {
  42481. return false;
  42482. }
  42483. return $this->isAccepted($content);
  42484. }
  42485. protected function toRegex($str)
  42486. {
  42487. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42488. }
  42489. }
  42490. <?php
  42491. namespace Symfony\Component\Finder\Iterator;
  42492. use Symfony\Component\Finder\Glob;
  42493. class FilenameFilterIterator extends MultiplePcreFilterIterator
  42494. {
  42495. public function accept()
  42496. {
  42497. return $this->isAccepted($this->current()->getFilename());
  42498. }
  42499. protected function toRegex($str)
  42500. {
  42501. return $this->isRegex($str) ? $str : Glob::toRegex($str);
  42502. }
  42503. }
  42504. <?php
  42505. namespace Symfony\Component\Finder\Iterator;
  42506. abstract class FilterIterator extends \FilterIterator
  42507. {
  42508. public function rewind()
  42509. {
  42510. if (\PHP_VERSION_ID > 50607 || (\PHP_VERSION_ID > 50523 && \PHP_VERSION_ID < 50600)) {
  42511. parent::rewind();
  42512. return;
  42513. }
  42514. $iterator = $this;
  42515. while ($iterator instanceof \OuterIterator) {
  42516. $innerIterator = $iterator->getInnerIterator();
  42517. if ($innerIterator instanceof RecursiveDirectoryIterator) {
  42518. if ($innerIterator->isRewindable()) {
  42519. $innerIterator->next();
  42520. $innerIterator->rewind();
  42521. }
  42522. } elseif ($innerIterator instanceof \FilesystemIterator) {
  42523. $innerIterator->next();
  42524. $innerIterator->rewind();
  42525. }
  42526. $iterator = $innerIterator;
  42527. }
  42528. parent::rewind();
  42529. }
  42530. }
  42531. <?php
  42532. namespace Symfony\Component\Finder\Iterator;
  42533. abstract class MultiplePcreFilterIterator extends FilterIterator
  42534. {
  42535. protected $matchRegexps = array();
  42536. protected $noMatchRegexps = array();
  42537. public function __construct(\Iterator $iterator, array $matchPatterns, array $noMatchPatterns)
  42538. {
  42539. foreach ($matchPatterns as $pattern) {
  42540. $this->matchRegexps[] = $this->toRegex($pattern);
  42541. }
  42542. foreach ($noMatchPatterns as $pattern) {
  42543. $this->noMatchRegexps[] = $this->toRegex($pattern);
  42544. }
  42545. parent::__construct($iterator);
  42546. }
  42547. protected function isAccepted($string)
  42548. {
  42549. foreach ($this->noMatchRegexps as $regex) {
  42550. if (preg_match($regex, $string)) {
  42551. return false;
  42552. }
  42553. }
  42554. if ($this->matchRegexps) {
  42555. foreach ($this->matchRegexps as $regex) {
  42556. if (preg_match($regex, $string)) {
  42557. return true;
  42558. }
  42559. }
  42560. return false;
  42561. }
  42562. return true;
  42563. }
  42564. protected function isRegex($str)
  42565. {
  42566. if (preg_match('/^(.{3,}?)[imsxuADU]*$/', $str, $m)) {
  42567. $start = substr($m[1], 0, 1);
  42568. $end = substr($m[1], -1);
  42569. if ($start === $end) {
  42570. return !preg_match('/[*?[:alnum:] \\\\]/', $start);
  42571. }
  42572. foreach (array(array('{', '}'), array('(', ')'), array('[', ']'), array('<', '>')) as $delimiters) {
  42573. if ($start === $delimiters[0] && $end === $delimiters[1]) {
  42574. return true;
  42575. }
  42576. }
  42577. }
  42578. return false;
  42579. }
  42580. abstract protected function toRegex($str);
  42581. }
  42582. <?php
  42583. namespace Symfony\Component\Finder\Iterator;
  42584. class PathFilterIterator extends MultiplePcreFilterIterator
  42585. {
  42586. public function accept()
  42587. {
  42588. $filename = $this->current()->getRelativePathname();
  42589. if ('\\' === \DIRECTORY_SEPARATOR) {
  42590. $filename = str_replace('\\', '/', $filename);
  42591. }
  42592. return $this->isAccepted($filename);
  42593. }
  42594. protected function toRegex($str)
  42595. {
  42596. return $this->isRegex($str) ? $str : '/'.preg_quote($str, '/').'/';
  42597. }
  42598. }
  42599. <?php
  42600. namespace Symfony\Component\Finder\Iterator;
  42601. use Symfony\Component\Finder\Exception\AccessDeniedException;
  42602. use Symfony\Component\Finder\SplFileInfo;
  42603. class RecursiveDirectoryIterator extends \RecursiveDirectoryIterator
  42604. {
  42605. private $ignoreUnreadableDirs;
  42606. private $rewindable;
  42607. private $rootPath;
  42608. private $subPath;
  42609. private $directorySeparator = '/';
  42610. public function __construct($path, $flags, $ignoreUnreadableDirs = false)
  42611. {
  42612. if ($flags & (self::CURRENT_AS_PATHNAME | self::CURRENT_AS_SELF)) {
  42613. throw new \RuntimeException('This iterator only support returning current as fileinfo.');
  42614. }
  42615. parent::__construct($path, $flags);
  42616. $this->ignoreUnreadableDirs = $ignoreUnreadableDirs;
  42617. $this->rootPath = (string) $path;
  42618. if ('/' !== \DIRECTORY_SEPARATOR && !($flags & self::UNIX_PATHS)) {
  42619. $this->directorySeparator = \DIRECTORY_SEPARATOR;
  42620. }
  42621. }
  42622. public function current()
  42623. {
  42624. if (null === $subPathname = $this->subPath) {
  42625. $subPathname = $this->subPath = (string) $this->getSubPath();
  42626. }
  42627. if ('' !== $subPathname) {
  42628. $subPathname .= $this->directorySeparator;
  42629. }
  42630. $subPathname .= $this->getFilename();
  42631. return new SplFileInfo($this->rootPath.$this->directorySeparator.$subPathname, $this->subPath, $subPathname);
  42632. }
  42633. public function getChildren()
  42634. {
  42635. try {
  42636. $children = parent::getChildren();
  42637. if ($children instanceof self) {
  42638. $children->ignoreUnreadableDirs = $this->ignoreUnreadableDirs;
  42639. $children->rewindable = &$this->rewindable;
  42640. $children->rootPath = $this->rootPath;
  42641. }
  42642. return $children;
  42643. } catch (\UnexpectedValueException $e) {
  42644. if ($this->ignoreUnreadableDirs) {
  42645. return new \RecursiveArrayIterator(array());
  42646. } else {
  42647. throw new AccessDeniedException($e->getMessage(), $e->getCode(), $e);
  42648. }
  42649. }
  42650. }
  42651. public function rewind()
  42652. {
  42653. if (false === $this->isRewindable()) {
  42654. return;
  42655. }
  42656. if (\PHP_VERSION_ID < 50523 || \PHP_VERSION_ID >= 50600 && \PHP_VERSION_ID < 50607) {
  42657. parent::next();
  42658. }
  42659. parent::rewind();
  42660. }
  42661. public function isRewindable()
  42662. {
  42663. if (null !== $this->rewindable) {
  42664. return $this->rewindable;
  42665. }
  42666. if ('' === $this->getPath()) {
  42667. return $this->rewindable = false;
  42668. }
  42669. if (false !== $stream = @opendir($this->getPath())) {
  42670. $infos = stream_get_meta_data($stream);
  42671. closedir($stream);
  42672. if ($infos['seekable']) {
  42673. return $this->rewindable = true;
  42674. }
  42675. }
  42676. return $this->rewindable = false;
  42677. }
  42678. }
  42679. <?php
  42680. namespace Symfony\Component\Finder\Iterator;
  42681. use Symfony\Component\Finder\Comparator\NumberComparator;
  42682. class SizeRangeFilterIterator extends FilterIterator
  42683. {
  42684. private $comparators = array();
  42685. public function __construct(\Iterator $iterator, array $comparators)
  42686. {
  42687. $this->comparators = $comparators;
  42688. parent::__construct($iterator);
  42689. }
  42690. public function accept()
  42691. {
  42692. $fileinfo = $this->current();
  42693. if (!$fileinfo->isFile()) {
  42694. return true;
  42695. }
  42696. $filesize = $fileinfo->getSize();
  42697. foreach ($this->comparators as $compare) {
  42698. if (!$compare->test($filesize)) {
  42699. return false;
  42700. }
  42701. }
  42702. return true;
  42703. }
  42704. }
  42705. <?php
  42706. namespace Symfony\Component\Finder\Iterator;
  42707. class SortableIterator implements \IteratorAggregate
  42708. {
  42709. const SORT_BY_NAME = 1;
  42710. const SORT_BY_TYPE = 2;
  42711. const SORT_BY_ACCESSED_TIME = 3;
  42712. const SORT_BY_CHANGED_TIME = 4;
  42713. const SORT_BY_MODIFIED_TIME = 5;
  42714. private $iterator;
  42715. private $sort;
  42716. public function __construct(\Traversable $iterator, $sort)
  42717. {
  42718. $this->iterator = $iterator;
  42719. if (self::SORT_BY_NAME === $sort) {
  42720. $this->sort = function ($a, $b) {
  42721. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42722. };
  42723. } elseif (self::SORT_BY_TYPE === $sort) {
  42724. $this->sort = function ($a, $b) {
  42725. if ($a->isDir() && $b->isFile()) {
  42726. return -1;
  42727. } elseif ($a->isFile() && $b->isDir()) {
  42728. return 1;
  42729. }
  42730. return strcmp($a->getRealpath() ?: $a->getPathname(), $b->getRealpath() ?: $b->getPathname());
  42731. };
  42732. } elseif (self::SORT_BY_ACCESSED_TIME === $sort) {
  42733. $this->sort = function ($a, $b) {
  42734. return $a->getATime() - $b->getATime();
  42735. };
  42736. } elseif (self::SORT_BY_CHANGED_TIME === $sort) {
  42737. $this->sort = function ($a, $b) {
  42738. return $a->getCTime() - $b->getCTime();
  42739. };
  42740. } elseif (self::SORT_BY_MODIFIED_TIME === $sort) {
  42741. $this->sort = function ($a, $b) {
  42742. return $a->getMTime() - $b->getMTime();
  42743. };
  42744. } elseif (\is_callable($sort)) {
  42745. $this->sort = $sort;
  42746. } else {
  42747. throw new \InvalidArgumentException('The SortableIterator takes a PHP callable or a valid built-in sort algorithm as an argument.');
  42748. }
  42749. }
  42750. public function getIterator()
  42751. {
  42752. $array = iterator_to_array($this->iterator, true);
  42753. uasort($array, $this->sort);
  42754. return new \ArrayIterator($array);
  42755. }
  42756. }
  42757. Copyright (c) 2004-2018 Fabien Potencier
  42758. Permission is hereby granted, free of charge, to any person obtaining a copy
  42759. of this software and associated documentation files (the "Software"), to deal
  42760. in the Software without restriction, including without limitation the rights
  42761. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  42762. copies of the Software, and to permit persons to whom the Software is furnished
  42763. to do so, subject to the following conditions:
  42764. The above copyright notice and this permission notice shall be included in all
  42765. copies or substantial portions of the Software.
  42766. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  42767. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  42768. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  42769. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  42770. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  42771. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  42772. THE SOFTWARE.
  42773. <?php
  42774. namespace Symfony\Component\Finder\Shell;
  42775. @trigger_error('The '.__NAMESPACE__.'\Command class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42776. class Command
  42777. {
  42778. private $parent;
  42779. private $bits = array();
  42780. private $labels = array();
  42781. private $errorHandler;
  42782. public function __construct(Command $parent = null)
  42783. {
  42784. $this->parent = $parent;
  42785. }
  42786. public function __toString()
  42787. {
  42788. return $this->join();
  42789. }
  42790. public static function create(Command $parent = null)
  42791. {
  42792. return new self($parent);
  42793. }
  42794. public static function escape($input)
  42795. {
  42796. return escapeshellcmd($input);
  42797. }
  42798. public static function quote($input)
  42799. {
  42800. return escapeshellarg($input);
  42801. }
  42802. public function add($bit)
  42803. {
  42804. $this->bits[] = $bit;
  42805. return $this;
  42806. }
  42807. public function top($bit)
  42808. {
  42809. array_unshift($this->bits, $bit);
  42810. foreach ($this->labels as $label => $index) {
  42811. ++$this->labels[$label];
  42812. }
  42813. return $this;
  42814. }
  42815. public function arg($arg)
  42816. {
  42817. $this->bits[] = self::quote($arg);
  42818. return $this;
  42819. }
  42820. public function cmd($esc)
  42821. {
  42822. $this->bits[] = self::escape($esc);
  42823. return $this;
  42824. }
  42825. public function ins($label)
  42826. {
  42827. if (isset($this->labels[$label])) {
  42828. throw new \RuntimeException(sprintf('Label "%s" already exists.', $label));
  42829. }
  42830. $this->bits[] = self::create($this);
  42831. $this->labels[$label] = \count($this->bits) - 1;
  42832. return $this->bits[$this->labels[$label]];
  42833. }
  42834. public function get($label)
  42835. {
  42836. if (!isset($this->labels[$label])) {
  42837. throw new \RuntimeException(sprintf('Label "%s" does not exist.', $label));
  42838. }
  42839. return $this->bits[$this->labels[$label]];
  42840. }
  42841. public function end()
  42842. {
  42843. if (null === $this->parent) {
  42844. throw new \RuntimeException('Calling end on root command doesn\'t make sense.');
  42845. }
  42846. return $this->parent;
  42847. }
  42848. public function length()
  42849. {
  42850. return \count($this->bits);
  42851. }
  42852. public function setErrorHandler(\Closure $errorHandler)
  42853. {
  42854. $this->errorHandler = $errorHandler;
  42855. return $this;
  42856. }
  42857. public function getErrorHandler()
  42858. {
  42859. return $this->errorHandler;
  42860. }
  42861. public function execute()
  42862. {
  42863. if (null === $errorHandler = $this->errorHandler) {
  42864. exec($this->join(), $output);
  42865. } else {
  42866. $process = proc_open($this->join(), array(0 => array('pipe', 'r'), 1 => array('pipe', 'w'), 2 => array('pipe', 'w')), $pipes);
  42867. $output = preg_split('~(\r\n|\r|\n)~', stream_get_contents($pipes[1]), -1, PREG_SPLIT_NO_EMPTY);
  42868. if ($error = stream_get_contents($pipes[2])) {
  42869. $errorHandler($error);
  42870. }
  42871. proc_close($process);
  42872. }
  42873. return $output ?: array();
  42874. }
  42875. public function join()
  42876. {
  42877. return implode(' ', array_filter(
  42878. array_map(function ($bit) {
  42879. return $bit instanceof Command ? $bit->join() : ($bit ?: null);
  42880. }, $this->bits),
  42881. function ($bit) { return null !== $bit; }
  42882. ));
  42883. }
  42884. public function addAtIndex($bit, $index)
  42885. {
  42886. array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
  42887. return $this;
  42888. }
  42889. }
  42890. <?php
  42891. namespace Symfony\Component\Finder\Shell;
  42892. @trigger_error('The '.__NAMESPACE__.'\Shell class is deprecated since Symfony 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
  42893. class Shell
  42894. {
  42895. const TYPE_UNIX = 1;
  42896. const TYPE_DARWIN = 2;
  42897. const TYPE_CYGWIN = 3;
  42898. const TYPE_WINDOWS = 4;
  42899. const TYPE_BSD = 5;
  42900. private $type;
  42901. public function getType()
  42902. {
  42903. if (null === $this->type) {
  42904. $this->type = $this->guessType();
  42905. }
  42906. return $this->type;
  42907. }
  42908. public function testCommand($command)
  42909. {
  42910. if (!\function_exists('exec')) {
  42911. return false;
  42912. }
  42913. $testCommand = 'which ';
  42914. if (self::TYPE_WINDOWS === $this->type) {
  42915. $testCommand = 'where ';
  42916. }
  42917. $command = escapeshellcmd($command);
  42918. exec($testCommand.$command, $output, $code);
  42919. return 0 === $code && \count($output) > 0;
  42920. }
  42921. private function guessType()
  42922. {
  42923. $os = strtolower(PHP_OS);
  42924. if (false !== strpos($os, 'cygwin')) {
  42925. return self::TYPE_CYGWIN;
  42926. }
  42927. if (false !== strpos($os, 'darwin')) {
  42928. return self::TYPE_DARWIN;
  42929. }
  42930. if (false !== strpos($os, 'bsd')) {
  42931. return self::TYPE_BSD;
  42932. }
  42933. if (0 === strpos($os, 'win')) {
  42934. return self::TYPE_WINDOWS;
  42935. }
  42936. return self::TYPE_UNIX;
  42937. }
  42938. }
  42939. <?php
  42940. namespace Symfony\Component\Finder;
  42941. class SplFileInfo extends \SplFileInfo
  42942. {
  42943. private $relativePath;
  42944. private $relativePathname;
  42945. public function __construct($file, $relativePath, $relativePathname)
  42946. {
  42947. parent::__construct($file);
  42948. $this->relativePath = $relativePath;
  42949. $this->relativePathname = $relativePathname;
  42950. }
  42951. public function getRelativePath()
  42952. {
  42953. return $this->relativePath;
  42954. }
  42955. public function getRelativePathname()
  42956. {
  42957. return $this->relativePathname;
  42958. }
  42959. public function getContents()
  42960. {
  42961. set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
  42962. $content = file_get_contents($this->getPathname());
  42963. restore_error_handler();
  42964. if (false === $content) {
  42965. throw new \RuntimeException($error);
  42966. }
  42967. return $content;
  42968. }
  42969. }
  42970. <?php
  42971. namespace Symfony\Polyfill\Ctype;
  42972. final class Ctype
  42973. {
  42974. public static function ctype_alnum($text)
  42975. {
  42976. $text = self::convert_int_to_char_for_ctype($text);
  42977. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z0-9]/', $text);
  42978. }
  42979. public static function ctype_alpha($text)
  42980. {
  42981. $text = self::convert_int_to_char_for_ctype($text);
  42982. return \is_string($text) && '' !== $text && !preg_match('/[^A-Za-z]/', $text);
  42983. }
  42984. public static function ctype_cntrl($text)
  42985. {
  42986. $text = self::convert_int_to_char_for_ctype($text);
  42987. return \is_string($text) && '' !== $text && !preg_match('/[^\x00-\x1f\x7f]/', $text);
  42988. }
  42989. public static function ctype_digit($text)
  42990. {
  42991. $text = self::convert_int_to_char_for_ctype($text);
  42992. return \is_string($text) && '' !== $text && !preg_match('/[^0-9]/', $text);
  42993. }
  42994. public static function ctype_graph($text)
  42995. {
  42996. $text = self::convert_int_to_char_for_ctype($text);
  42997. return \is_string($text) && '' !== $text && !preg_match('/[^!-~]/', $text);
  42998. }
  42999. public static function ctype_lower($text)
  43000. {
  43001. $text = self::convert_int_to_char_for_ctype($text);
  43002. return \is_string($text) && '' !== $text && !preg_match('/[^a-z]/', $text);
  43003. }
  43004. public static function ctype_print($text)
  43005. {
  43006. $text = self::convert_int_to_char_for_ctype($text);
  43007. return \is_string($text) && '' !== $text && !preg_match('/[^ -~]/', $text);
  43008. }
  43009. public static function ctype_punct($text)
  43010. {
  43011. $text = self::convert_int_to_char_for_ctype($text);
  43012. return \is_string($text) && '' !== $text && !preg_match('/[^!-\/\:-@\[-`\{-~]/', $text);
  43013. }
  43014. public static function ctype_space($text)
  43015. {
  43016. $text = self::convert_int_to_char_for_ctype($text);
  43017. return \is_string($text) && '' !== $text && !preg_match('/[^\s]/', $text);
  43018. }
  43019. public static function ctype_upper($text)
  43020. {
  43021. $text = self::convert_int_to_char_for_ctype($text);
  43022. return \is_string($text) && '' !== $text && !preg_match('/[^A-Z]/', $text);
  43023. }
  43024. public static function ctype_xdigit($text)
  43025. {
  43026. $text = self::convert_int_to_char_for_ctype($text);
  43027. return \is_string($text) && '' !== $text && !preg_match('/[^A-Fa-f0-9]/', $text);
  43028. }
  43029. private static function convert_int_to_char_for_ctype($int)
  43030. {
  43031. if (!\is_int($int)) {
  43032. return $int;
  43033. }
  43034. if ($int < -128 || $int > 255) {
  43035. return (string) $int;
  43036. }
  43037. if ($int < 0) {
  43038. $int += 256;
  43039. }
  43040. return \chr($int);
  43041. }
  43042. }
  43043. Copyright (c) 2018-2019 Fabien Potencier
  43044. Permission is hereby granted, free of charge, to any person obtaining a copy
  43045. of this software and associated documentation files (the "Software"), to deal
  43046. in the Software without restriction, including without limitation the rights
  43047. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43048. copies of the Software, and to permit persons to whom the Software is furnished
  43049. to do so, subject to the following conditions:
  43050. The above copyright notice and this permission notice shall be included in all
  43051. copies or substantial portions of the Software.
  43052. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43053. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43054. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43055. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43056. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43057. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43058. THE SOFTWARE.
  43059. <?php
  43060. use Symfony\Polyfill\Ctype as p;
  43061. if (!function_exists('ctype_alnum')) {
  43062. function ctype_alnum($text) { return p\Ctype::ctype_alnum($text); }
  43063. function ctype_alpha($text) { return p\Ctype::ctype_alpha($text); }
  43064. function ctype_cntrl($text) { return p\Ctype::ctype_cntrl($text); }
  43065. function ctype_digit($text) { return p\Ctype::ctype_digit($text); }
  43066. function ctype_graph($text) { return p\Ctype::ctype_graph($text); }
  43067. function ctype_lower($text) { return p\Ctype::ctype_lower($text); }
  43068. function ctype_print($text) { return p\Ctype::ctype_print($text); }
  43069. function ctype_punct($text) { return p\Ctype::ctype_punct($text); }
  43070. function ctype_space($text) { return p\Ctype::ctype_space($text); }
  43071. function ctype_upper($text) { return p\Ctype::ctype_upper($text); }
  43072. function ctype_xdigit($text) { return p\Ctype::ctype_xdigit($text); }
  43073. }
  43074. Copyright (c) 2015-2019 Fabien Potencier
  43075. Permission is hereby granted, free of charge, to any person obtaining a copy
  43076. of this software and associated documentation files (the "Software"), to deal
  43077. in the Software without restriction, including without limitation the rights
  43078. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  43079. copies of the Software, and to permit persons to whom the Software is furnished
  43080. to do so, subject to the following conditions:
  43081. The above copyright notice and this permission notice shall be included in all
  43082. copies or substantial portions of the Software.
  43083. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  43084. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  43085. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  43086. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  43087. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  43088. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  43089. THE SOFTWARE.
  43090. <?php
  43091. namespace Symfony\Polyfill\Mbstring;
  43092. final class Mbstring
  43093. {
  43094. const MB_CASE_FOLD = PHP_INT_MAX;
  43095. private static $encodingList = array('ASCII', 'UTF-8');
  43096. private static $language = 'neutral';
  43097. private static $internalEncoding = 'UTF-8';
  43098. private static $caseFold = array(
  43099. array('µ', 'ſ', "\xCD\x85", 'ς', "\xCF\x90", "\xCF\x91", "\xCF\x95", "\xCF\x96", "\xCF\xB0", "\xCF\xB1", "\xCF\xB5", "\xE1\xBA\x9B", "\xE1\xBE\xBE"),
  43100. array('μ', 's', 'ι', 'σ', 'β', 'θ', 'φ', 'π', 'κ', '�', 'ε', "\xE1\xB9\xA1", 'ι'),
  43101. );
  43102. public static function mb_convert_encoding($s, $toEncoding, $fromEncoding = null)
  43103. {
  43104. if (\is_array($fromEncoding) || false !== strpos($fromEncoding, ',')) {
  43105. $fromEncoding = self::mb_detect_encoding($s, $fromEncoding);
  43106. } else {
  43107. $fromEncoding = self::getEncoding($fromEncoding);
  43108. }
  43109. $toEncoding = self::getEncoding($toEncoding);
  43110. if ('BASE64' === $fromEncoding) {
  43111. $s = base64_decode($s);
  43112. $fromEncoding = $toEncoding;
  43113. }
  43114. if ('BASE64' === $toEncoding) {
  43115. return base64_encode($s);
  43116. }
  43117. if ('HTML-ENTITIES' === $toEncoding || 'HTML' === $toEncoding) {
  43118. if ('HTML-ENTITIES' === $fromEncoding || 'HTML' === $fromEncoding) {
  43119. $fromEncoding = 'Windows-1252';
  43120. }
  43121. if ('UTF-8' !== $fromEncoding) {
  43122. $s = iconv($fromEncoding, 'UTF-8//IGNORE', $s);
  43123. }
  43124. return preg_replace_callback('/[\x80-\xFF]+/', array(__CLASS__, 'html_encoding_callback'), $s);
  43125. }
  43126. if ('HTML-ENTITIES' === $fromEncoding) {
  43127. $s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
  43128. $fromEncoding = 'UTF-8';
  43129. }
  43130. return iconv($fromEncoding, $toEncoding.'//IGNORE', $s);
  43131. }
  43132. public static function mb_convert_variables($toEncoding, $fromEncoding, &$a = null, &$b = null, &$c = null, &$d = null, &$e = null, &$f = null)
  43133. {
  43134. $vars = array(&$a, &$b, &$c, &$d, &$e, &$f);
  43135. $ok = true;
  43136. array_walk_recursive($vars, function (&$v) use (&$ok, $toEncoding, $fromEncoding) {
  43137. if (false === $v = Mbstring::mb_convert_encoding($v, $toEncoding, $fromEncoding)) {
  43138. $ok = false;
  43139. }
  43140. });
  43141. return $ok ? $fromEncoding : false;
  43142. }
  43143. public static function mb_decode_mimeheader($s)
  43144. {
  43145. return iconv_mime_decode($s, 2, self::$internalEncoding);
  43146. }
  43147. public static function mb_encode_mimeheader($s, $charset = null, $transferEncoding = null, $linefeed = null, $indent = null)
  43148. {
  43149. trigger_error('mb_encode_mimeheader() is bugged. Please use iconv_mime_encode() instead', E_USER_WARNING);
  43150. }
  43151. public static function mb_decode_numericentity($s, $convmap, $encoding = null)
  43152. {
  43153. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43154. trigger_error('mb_decode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43155. return null;
  43156. }
  43157. if (!\is_array($convmap) || !$convmap) {
  43158. return false;
  43159. }
  43160. if (null !== $encoding && !\is_scalar($encoding)) {
  43161. trigger_error('mb_decode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43162. return '';
  43163. }
  43164. $s = (string) $s;
  43165. if ('' === $s) {
  43166. return '';
  43167. }
  43168. $encoding = self::getEncoding($encoding);
  43169. if ('UTF-8' === $encoding) {
  43170. $encoding = null;
  43171. if (!preg_match('//u', $s)) {
  43172. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43173. }
  43174. } else {
  43175. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43176. }
  43177. $cnt = floor(\count($convmap) / 4) * 4;
  43178. for ($i = 0; $i < $cnt; $i += 4) {
  43179. $convmap[$i] += $convmap[$i + 2];
  43180. $convmap[$i + 1] += $convmap[$i + 2];
  43181. }
  43182. $s = preg_replace_callback('/&#(?:0*([0-9]+)|x0*([0-9a-fA-F]+))(?!&);?/', function (array $m) use ($cnt, $convmap) {
  43183. $c = isset($m[2]) ? (int) hexdec($m[2]) : $m[1];
  43184. for ($i = 0; $i < $cnt; $i += 4) {
  43185. if ($c >= $convmap[$i] && $c <= $convmap[$i + 1]) {
  43186. return Mbstring::mb_chr($c - $convmap[$i + 2]);
  43187. }
  43188. }
  43189. return $m[0];
  43190. }, $s);
  43191. if (null === $encoding) {
  43192. return $s;
  43193. }
  43194. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43195. }
  43196. public static function mb_encode_numericentity($s, $convmap, $encoding = null, $is_hex = false)
  43197. {
  43198. if (null !== $s && !\is_scalar($s) && !(\is_object($s) && \method_exists($s, '__toString'))) {
  43199. trigger_error('mb_encode_numericentity() expects parameter 1 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43200. return null;
  43201. }
  43202. if (!\is_array($convmap) || !$convmap) {
  43203. return false;
  43204. }
  43205. if (null !== $encoding && !\is_scalar($encoding)) {
  43206. trigger_error('mb_encode_numericentity() expects parameter 3 to be string, '.\gettype($s).' given', E_USER_WARNING);
  43207. return null;
  43208. }
  43209. if (null !== $is_hex && !\is_scalar($is_hex)) {
  43210. trigger_error('mb_encode_numericentity() expects parameter 4 to be boolean, '.\gettype($s).' given', E_USER_WARNING);
  43211. return null;
  43212. }
  43213. $s = (string) $s;
  43214. if ('' === $s) {
  43215. return '';
  43216. }
  43217. $encoding = self::getEncoding($encoding);
  43218. if ('UTF-8' === $encoding) {
  43219. $encoding = null;
  43220. if (!preg_match('//u', $s)) {
  43221. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43222. }
  43223. } else {
  43224. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43225. }
  43226. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43227. $cnt = floor(\count($convmap) / 4) * 4;
  43228. $i = 0;
  43229. $len = \strlen($s);
  43230. $result = '';
  43231. while ($i < $len) {
  43232. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43233. $uchr = substr($s, $i, $ulen);
  43234. $i += $ulen;
  43235. $c = self::mb_ord($uchr);
  43236. for ($j = 0; $j < $cnt; $j += 4) {
  43237. if ($c >= $convmap[$j] && $c <= $convmap[$j + 1]) {
  43238. $cOffset = ($c + $convmap[$j + 2]) & $convmap[$j + 3];
  43239. $result .= $is_hex ? sprintf('&#x%X;', $cOffset) : '&#'.$cOffset.';';
  43240. continue 2;
  43241. }
  43242. }
  43243. $result .= $uchr;
  43244. }
  43245. if (null === $encoding) {
  43246. return $result;
  43247. }
  43248. return iconv('UTF-8', $encoding.'//IGNORE', $result);
  43249. }
  43250. public static function mb_convert_case($s, $mode, $encoding = null)
  43251. {
  43252. $s = (string) $s;
  43253. if ('' === $s) {
  43254. return '';
  43255. }
  43256. $encoding = self::getEncoding($encoding);
  43257. if ('UTF-8' === $encoding) {
  43258. $encoding = null;
  43259. if (!preg_match('//u', $s)) {
  43260. $s = @iconv('UTF-8', 'UTF-8//IGNORE', $s);
  43261. }
  43262. } else {
  43263. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43264. }
  43265. if (MB_CASE_TITLE == $mode) {
  43266. static $titleRegexp = null;
  43267. if (null === $titleRegexp) {
  43268. $titleRegexp = self::getData('titleCaseRegexp');
  43269. }
  43270. $s = preg_replace_callback($titleRegexp, array(__CLASS__, 'title_case'), $s);
  43271. } else {
  43272. if (MB_CASE_UPPER == $mode) {
  43273. static $upper = null;
  43274. if (null === $upper) {
  43275. $upper = self::getData('upperCase');
  43276. }
  43277. $map = $upper;
  43278. } else {
  43279. if (self::MB_CASE_FOLD === $mode) {
  43280. $s = str_replace(self::$caseFold[0], self::$caseFold[1], $s);
  43281. }
  43282. static $lower = null;
  43283. if (null === $lower) {
  43284. $lower = self::getData('lowerCase');
  43285. }
  43286. $map = $lower;
  43287. }
  43288. static $ulenMask = array("\xC0" => 2, "\xD0" => 2, "\xE0" => 3, "\xF0" => 4);
  43289. $i = 0;
  43290. $len = \strlen($s);
  43291. while ($i < $len) {
  43292. $ulen = $s[$i] < "\x80" ? 1 : $ulenMask[$s[$i] & "\xF0"];
  43293. $uchr = substr($s, $i, $ulen);
  43294. $i += $ulen;
  43295. if (isset($map[$uchr])) {
  43296. $uchr = $map[$uchr];
  43297. $nlen = \strlen($uchr);
  43298. if ($nlen == $ulen) {
  43299. $nlen = $i;
  43300. do {
  43301. $s[--$nlen] = $uchr[--$ulen];
  43302. } while ($ulen);
  43303. } else {
  43304. $s = substr_replace($s, $uchr, $i - $ulen, $ulen);
  43305. $len += $nlen - $ulen;
  43306. $i += $nlen - $ulen;
  43307. }
  43308. }
  43309. }
  43310. }
  43311. if (null === $encoding) {
  43312. return $s;
  43313. }
  43314. return iconv('UTF-8', $encoding.'//IGNORE', $s);
  43315. }
  43316. public static function mb_internal_encoding($encoding = null)
  43317. {
  43318. if (null === $encoding) {
  43319. return self::$internalEncoding;
  43320. }
  43321. $encoding = self::getEncoding($encoding);
  43322. if ('UTF-8' === $encoding || false !== @iconv($encoding, $encoding, ' ')) {
  43323. self::$internalEncoding = $encoding;
  43324. return true;
  43325. }
  43326. return false;
  43327. }
  43328. public static function mb_language($lang = null)
  43329. {
  43330. if (null === $lang) {
  43331. return self::$language;
  43332. }
  43333. switch ($lang = strtolower($lang)) {
  43334. case 'uni':
  43335. case 'neutral':
  43336. self::$language = $lang;
  43337. return true;
  43338. }
  43339. return false;
  43340. }
  43341. public static function mb_list_encodings()
  43342. {
  43343. return array('UTF-8');
  43344. }
  43345. public static function mb_encoding_aliases($encoding)
  43346. {
  43347. switch (strtoupper($encoding)) {
  43348. case 'UTF8':
  43349. case 'UTF-8':
  43350. return array('utf8');
  43351. }
  43352. return false;
  43353. }
  43354. public static function mb_check_encoding($var = null, $encoding = null)
  43355. {
  43356. if (null === $encoding) {
  43357. if (null === $var) {
  43358. return false;
  43359. }
  43360. $encoding = self::$internalEncoding;
  43361. }
  43362. return self::mb_detect_encoding($var, array($encoding)) || false !== @iconv($encoding, $encoding, $var);
  43363. }
  43364. public static function mb_detect_encoding($str, $encodingList = null, $strict = false)
  43365. {
  43366. if (null === $encodingList) {
  43367. $encodingList = self::$encodingList;
  43368. } else {
  43369. if (!\is_array($encodingList)) {
  43370. $encodingList = array_map('trim', explode(',', $encodingList));
  43371. }
  43372. $encodingList = array_map('strtoupper', $encodingList);
  43373. }
  43374. foreach ($encodingList as $enc) {
  43375. switch ($enc) {
  43376. case 'ASCII':
  43377. if (!preg_match('/[\x80-\xFF]/', $str)) {
  43378. return $enc;
  43379. }
  43380. break;
  43381. case 'UTF8':
  43382. case 'UTF-8':
  43383. if (preg_match('//u', $str)) {
  43384. return 'UTF-8';
  43385. }
  43386. break;
  43387. default:
  43388. if (0 === strncmp($enc, 'ISO-8859-', 9)) {
  43389. return $enc;
  43390. }
  43391. }
  43392. }
  43393. return false;
  43394. }
  43395. public static function mb_detect_order($encodingList = null)
  43396. {
  43397. if (null === $encodingList) {
  43398. return self::$encodingList;
  43399. }
  43400. if (!\is_array($encodingList)) {
  43401. $encodingList = array_map('trim', explode(',', $encodingList));
  43402. }
  43403. $encodingList = array_map('strtoupper', $encodingList);
  43404. foreach ($encodingList as $enc) {
  43405. switch ($enc) {
  43406. default:
  43407. if (strncmp($enc, 'ISO-8859-', 9)) {
  43408. return false;
  43409. }
  43410. case 'ASCII':
  43411. case 'UTF8':
  43412. case 'UTF-8':
  43413. }
  43414. }
  43415. self::$encodingList = $encodingList;
  43416. return true;
  43417. }
  43418. public static function mb_strlen($s, $encoding = null)
  43419. {
  43420. $encoding = self::getEncoding($encoding);
  43421. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43422. return \strlen($s);
  43423. }
  43424. return @iconv_strlen($s, $encoding);
  43425. }
  43426. public static function mb_strpos($haystack, $needle, $offset = 0, $encoding = null)
  43427. {
  43428. $encoding = self::getEncoding($encoding);
  43429. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43430. return strpos($haystack, $needle, $offset);
  43431. }
  43432. $needle = (string) $needle;
  43433. if ('' === $needle) {
  43434. trigger_error(__METHOD__.': Empty delimiter', E_USER_WARNING);
  43435. return false;
  43436. }
  43437. return iconv_strpos($haystack, $needle, $offset, $encoding);
  43438. }
  43439. public static function mb_strrpos($haystack, $needle, $offset = 0, $encoding = null)
  43440. {
  43441. $encoding = self::getEncoding($encoding);
  43442. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43443. return strrpos($haystack, $needle, $offset);
  43444. }
  43445. if ($offset != (int) $offset) {
  43446. $offset = 0;
  43447. } elseif ($offset = (int) $offset) {
  43448. if ($offset < 0) {
  43449. $haystack = self::mb_substr($haystack, 0, $offset, $encoding);
  43450. $offset = 0;
  43451. } else {
  43452. $haystack = self::mb_substr($haystack, $offset, 2147483647, $encoding);
  43453. }
  43454. }
  43455. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43456. return false !== $pos ? $offset + $pos : false;
  43457. }
  43458. public static function mb_str_split($string, $split_length = 1, $encoding = null)
  43459. {
  43460. if (null !== $string && !\is_scalar($string) && !(\is_object($string) && \method_exists($string, '__toString'))) {
  43461. trigger_error('mb_str_split() expects parameter 1 to be string, '.\gettype($string).' given', E_USER_WARNING);
  43462. return null;
  43463. }
  43464. if ($split_length < 1) {
  43465. trigger_error('The length of each segment must be greater than zero', E_USER_WARNING);
  43466. return false;
  43467. }
  43468. if (null === $encoding) {
  43469. $encoding = mb_internal_encoding();
  43470. }
  43471. $result = array();
  43472. $length = mb_strlen($string, $encoding);
  43473. for ($i = 0; $i < $length; $i += $split_length) {
  43474. $result[] = mb_substr($string, $i, $split_length, $encoding);
  43475. }
  43476. return $result;
  43477. }
  43478. public static function mb_strtolower($s, $encoding = null)
  43479. {
  43480. return self::mb_convert_case($s, MB_CASE_LOWER, $encoding);
  43481. }
  43482. public static function mb_strtoupper($s, $encoding = null)
  43483. {
  43484. return self::mb_convert_case($s, MB_CASE_UPPER, $encoding);
  43485. }
  43486. public static function mb_substitute_character($c = null)
  43487. {
  43488. if (0 === strcasecmp($c, 'none')) {
  43489. return true;
  43490. }
  43491. return null !== $c ? false : 'none';
  43492. }
  43493. public static function mb_substr($s, $start, $length = null, $encoding = null)
  43494. {
  43495. $encoding = self::getEncoding($encoding);
  43496. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43497. return (string) substr($s, $start, null === $length ? 2147483647 : $length);
  43498. }
  43499. if ($start < 0) {
  43500. $start = iconv_strlen($s, $encoding) + $start;
  43501. if ($start < 0) {
  43502. $start = 0;
  43503. }
  43504. }
  43505. if (null === $length) {
  43506. $length = 2147483647;
  43507. } elseif ($length < 0) {
  43508. $length = iconv_strlen($s, $encoding) + $length - $start;
  43509. if ($length < 0) {
  43510. return '';
  43511. }
  43512. }
  43513. return (string) iconv_substr($s, $start, $length, $encoding);
  43514. }
  43515. public static function mb_stripos($haystack, $needle, $offset = 0, $encoding = null)
  43516. {
  43517. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43518. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43519. return self::mb_strpos($haystack, $needle, $offset, $encoding);
  43520. }
  43521. public static function mb_stristr($haystack, $needle, $part = false, $encoding = null)
  43522. {
  43523. $pos = self::mb_stripos($haystack, $needle, 0, $encoding);
  43524. return self::getSubpart($pos, $part, $haystack, $encoding);
  43525. }
  43526. public static function mb_strrchr($haystack, $needle, $part = false, $encoding = null)
  43527. {
  43528. $encoding = self::getEncoding($encoding);
  43529. if ('CP850' === $encoding || 'ASCII' === $encoding) {
  43530. return strrchr($haystack, $needle, $part);
  43531. }
  43532. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43533. $pos = iconv_strrpos($haystack, $needle, $encoding);
  43534. return self::getSubpart($pos, $part, $haystack, $encoding);
  43535. }
  43536. public static function mb_strrichr($haystack, $needle, $part = false, $encoding = null)
  43537. {
  43538. $needle = self::mb_substr($needle, 0, 1, $encoding);
  43539. $pos = self::mb_strripos($haystack, $needle, $encoding);
  43540. return self::getSubpart($pos, $part, $haystack, $encoding);
  43541. }
  43542. public static function mb_strripos($haystack, $needle, $offset = 0, $encoding = null)
  43543. {
  43544. $haystack = self::mb_convert_case($haystack, self::MB_CASE_FOLD, $encoding);
  43545. $needle = self::mb_convert_case($needle, self::MB_CASE_FOLD, $encoding);
  43546. return self::mb_strrpos($haystack, $needle, $offset, $encoding);
  43547. }
  43548. public static function mb_strstr($haystack, $needle, $part = false, $encoding = null)
  43549. {
  43550. $pos = strpos($haystack, $needle);
  43551. if (false === $pos) {
  43552. return false;
  43553. }
  43554. if ($part) {
  43555. return substr($haystack, 0, $pos);
  43556. }
  43557. return substr($haystack, $pos);
  43558. }
  43559. public static function mb_get_info($type = 'all')
  43560. {
  43561. $info = array(
  43562. 'internal_encoding' => self::$internalEncoding,
  43563. 'http_output' => 'pass',
  43564. 'http_output_conv_mimetypes' => '^(text/|application/xhtml\+xml)',
  43565. 'func_overload' => 0,
  43566. 'func_overload_list' => 'no overload',
  43567. 'mail_charset' => 'UTF-8',
  43568. 'mail_header_encoding' => 'BASE64',
  43569. 'mail_body_encoding' => 'BASE64',
  43570. 'illegal_chars' => 0,
  43571. 'encoding_translation' => 'Off',
  43572. 'language' => self::$language,
  43573. 'detect_order' => self::$encodingList,
  43574. 'substitute_character' => 'none',
  43575. 'strict_detection' => 'Off',
  43576. );
  43577. if ('all' === $type) {
  43578. return $info;
  43579. }
  43580. if (isset($info[$type])) {
  43581. return $info[$type];
  43582. }
  43583. return false;
  43584. }
  43585. public static function mb_http_input($type = '')
  43586. {
  43587. return false;
  43588. }
  43589. public static function mb_http_output($encoding = null)
  43590. {
  43591. return null !== $encoding ? 'pass' === $encoding : 'pass';
  43592. }
  43593. public static function mb_strwidth($s, $encoding = null)
  43594. {
  43595. $encoding = self::getEncoding($encoding);
  43596. if ('UTF-8' !== $encoding) {
  43597. $s = iconv($encoding, 'UTF-8//IGNORE', $s);
  43598. }
  43599. $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);
  43600. return ($wide << 1) + iconv_strlen($s, 'UTF-8');
  43601. }
  43602. public static function mb_substr_count($haystack, $needle, $encoding = null)
  43603. {
  43604. return substr_count($haystack, $needle);
  43605. }
  43606. public static function mb_output_handler($contents, $status)
  43607. {
  43608. return $contents;
  43609. }
  43610. public static function mb_chr($code, $encoding = null)
  43611. {
  43612. if (0x80 > $code %= 0x200000) {
  43613. $s = \chr($code);
  43614. } elseif (0x800 > $code) {
  43615. $s = \chr(0xC0 | $code >> 6).\chr(0x80 | $code & 0x3F);
  43616. } elseif (0x10000 > $code) {
  43617. $s = \chr(0xE0 | $code >> 12).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43618. } else {
  43619. $s = \chr(0xF0 | $code >> 18).\chr(0x80 | $code >> 12 & 0x3F).\chr(0x80 | $code >> 6 & 0x3F).\chr(0x80 | $code & 0x3F);
  43620. }
  43621. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43622. $s = mb_convert_encoding($s, $encoding, 'UTF-8');
  43623. }
  43624. return $s;
  43625. }
  43626. public static function mb_ord($s, $encoding = null)
  43627. {
  43628. if ('UTF-8' !== $encoding = self::getEncoding($encoding)) {
  43629. $s = mb_convert_encoding($s, 'UTF-8', $encoding);
  43630. }
  43631. if (1 === \strlen($s)) {
  43632. return \ord($s);
  43633. }
  43634. $code = ($s = unpack('C*', substr($s, 0, 4))) ? $s[1] : 0;
  43635. if (0xF0 <= $code) {
  43636. return (($code - 0xF0) << 18) + (($s[2] - 0x80) << 12) + (($s[3] - 0x80) << 6) + $s[4] - 0x80;
  43637. }
  43638. if (0xE0 <= $code) {
  43639. return (($code - 0xE0) << 12) + (($s[2] - 0x80) << 6) + $s[3] - 0x80;
  43640. }
  43641. if (0xC0 <= $code) {
  43642. return (($code - 0xC0) << 6) + $s[2] - 0x80;
  43643. }
  43644. return $code;
  43645. }
  43646. private static function getSubpart($pos, $part, $haystack, $encoding)
  43647. {
  43648. if (false === $pos) {
  43649. return false;
  43650. }
  43651. if ($part) {
  43652. return self::mb_substr($haystack, 0, $pos, $encoding);
  43653. }
  43654. return self::mb_substr($haystack, $pos, null, $encoding);
  43655. }
  43656. private static function html_encoding_callback(array $m)
  43657. {
  43658. $i = 1;
  43659. $entities = '';
  43660. $m = unpack('C*', htmlentities($m[0], ENT_COMPAT, 'UTF-8'));
  43661. while (isset($m[$i])) {
  43662. if (0x80 > $m[$i]) {
  43663. $entities .= \chr($m[$i++]);
  43664. continue;
  43665. }
  43666. if (0xF0 <= $m[$i]) {
  43667. $c = (($m[$i++] - 0xF0) << 18) + (($m[$i++] - 0x80) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43668. } elseif (0xE0 <= $m[$i]) {
  43669. $c = (($m[$i++] - 0xE0) << 12) + (($m[$i++] - 0x80) << 6) + $m[$i++] - 0x80;
  43670. } else {
  43671. $c = (($m[$i++] - 0xC0) << 6) + $m[$i++] - 0x80;
  43672. }
  43673. $entities .= '&#'.$c.';';
  43674. }
  43675. return $entities;
  43676. }
  43677. private static function title_case(array $s)
  43678. {
  43679. return self::mb_convert_case($s[1], MB_CASE_UPPER, 'UTF-8').self::mb_convert_case($s[2], MB_CASE_LOWER, 'UTF-8');
  43680. }
  43681. private static function getData($file)
  43682. {
  43683. if (file_exists($file = __DIR__.'/Resources/unidata/'.$file.'.php')) {
  43684. return require $file;
  43685. }
  43686. return false;
  43687. }
  43688. private static function getEncoding($encoding)
  43689. {
  43690. if (null === $encoding) {
  43691. return self::$internalEncoding;
  43692. }
  43693. $encoding = strtoupper($encoding);
  43694. if ('8BIT' === $encoding || 'BINARY' === $encoding) {
  43695. return 'CP850';
  43696. }
  43697. if ('UTF8' === $encoding) {
  43698. return 'UTF-8';
  43699. }
  43700. return $encoding;
  43701. }
  43702. }
  43703. <?php
  43704. return array(
  43705. 'A' => 'a',
  43706. 'B' => 'b',
  43707. 'C' => 'c',
  43708. 'D' => 'd',
  43709. 'E' => 'e',
  43710. 'F' => 'f',
  43711. 'G' => 'g',
  43712. 'H' => 'h',
  43713. 'I' => 'i',
  43714. 'J' => 'j',
  43715. 'K' => 'k',
  43716. 'L' => 'l',
  43717. 'M' => 'm',
  43718. 'N' => 'n',
  43719. 'O' => 'o',
  43720. 'P' => 'p',
  43721. 'Q' => 'q',
  43722. 'R' => 'r',
  43723. 'S' => 's',
  43724. 'T' => 't',
  43725. 'U' => 'u',
  43726. 'V' => 'v',
  43727. 'W' => 'w',
  43728. 'X' => 'x',
  43729. 'Y' => 'y',
  43730. 'Z' => 'z',
  43731. 'À' => 'à',
  43732. '�' => 'á',
  43733. 'Â' => 'â',
  43734. 'Ã' => 'ã',
  43735. 'Ä' => 'ä',
  43736. 'Ã…' => 'Ã¥',
  43737. 'Æ' => 'æ',
  43738. 'Ç' => 'ç',
  43739. 'È' => 'è',
  43740. 'É' => 'é',
  43741. 'Ê' => 'ê',
  43742. 'Ë' => 'ë',
  43743. 'Ì' => 'ì',
  43744. '�' => 'í',
  43745. 'Î' => 'î',
  43746. '�' => 'ï',
  43747. '�' => 'ð',
  43748. 'Ñ' => 'ñ',
  43749. 'Ò' => 'ò',
  43750. 'Ó' => 'ó',
  43751. 'Ô' => 'ô',
  43752. 'Õ' => 'õ',
  43753. 'Ö' => 'ö',
  43754. 'Ø' => 'ø',
  43755. 'Ù' => 'ù',
  43756. 'Ú' => 'ú',
  43757. 'Û' => 'û',
  43758. 'Ü' => 'ü',
  43759. '�' => 'ý',
  43760. 'Þ' => 'þ',
  43761. 'Ā' => '�',
  43762. 'Ă' => 'ă',
  43763. 'Ä„' => 'Ä…',
  43764. 'Ć' => 'ć',
  43765. 'Ĉ' => 'ĉ',
  43766. 'ÄŠ' => 'Ä‹',
  43767. 'Č' => '�',
  43768. 'Ď' => '�',
  43769. '�' => 'đ',
  43770. 'Ä’' => 'Ä“',
  43771. 'Ä”' => 'Ä•',
  43772. 'Ä–' => 'Ä—',
  43773. 'Ę' => 'ę',
  43774. 'Äš' => 'Ä›',
  43775. 'Ĝ' => '�',
  43776. 'Äž' => 'ÄŸ',
  43777. 'Ä ' => 'Ä¡',
  43778. 'Ä¢' => 'Ä£',
  43779. 'Ĥ' => 'ĥ',
  43780. 'Ħ' => 'ħ',
  43781. 'Ĩ' => 'ĩ',
  43782. 'Ī' => 'ī',
  43783. 'Ĭ' => 'ĭ',
  43784. 'Į' => 'į',
  43785. 'Ä°' => 'i',
  43786. 'IJ' => 'ij',
  43787. 'Ĵ' => 'ĵ',
  43788. 'Ķ' => 'ķ',
  43789. 'Ĺ' => 'ĺ',
  43790. 'Ļ' => 'ļ',
  43791. 'Ľ' => 'ľ',
  43792. 'Ä¿' => 'Å€',
  43793. '�' => 'ł',
  43794. 'Ń' => 'ń',
  43795. 'Ņ' => 'ņ',
  43796. 'Ň' => 'ň',
  43797. 'ÅŠ' => 'Å‹',
  43798. 'Ō' => '�',
  43799. 'Ŏ' => '�',
  43800. '�' => 'ő',
  43801. 'Å’' => 'Å“',
  43802. 'Å”' => 'Å•',
  43803. 'Å–' => 'Å—',
  43804. 'Ř' => 'ř',
  43805. 'Åš' => 'Å›',
  43806. 'Ŝ' => '�',
  43807. 'Åž' => 'ÅŸ',
  43808. 'Å ' => 'Å¡',
  43809. 'Å¢' => 'Å£',
  43810. 'Ť' => 'ť',
  43811. 'Ŧ' => 'ŧ',
  43812. 'Ũ' => 'ũ',
  43813. 'Ū' => 'ū',
  43814. 'Ŭ' => 'ŭ',
  43815. 'Ů' => 'ů',
  43816. 'Ű' => 'ű',
  43817. 'Ų' => 'ų',
  43818. 'Ŵ' => 'ŵ',
  43819. 'Ŷ' => 'ŷ',
  43820. 'Ÿ' => 'ÿ',
  43821. 'Ź' => 'ź',
  43822. 'Ż' => 'ż',
  43823. 'Ž' => 'ž',
  43824. '�' => 'ɓ',
  43825. 'Ƃ' => 'ƃ',
  43826. 'Æ„' => 'Æ…',
  43827. 'Ɔ' => 'ɔ',
  43828. 'Ƈ' => 'ƈ',
  43829. 'Ɖ' => 'ɖ',
  43830. 'ÆŠ' => 'É—',
  43831. 'Ƌ' => 'ƌ',
  43832. 'Ǝ' => '�',
  43833. '�' => 'ə',
  43834. '�' => 'ɛ',
  43835. 'Æ‘' => 'Æ’',
  43836. 'Æ“' => 'É ',
  43837. 'Æ”' => 'É£',
  43838. 'Æ–' => 'É©',
  43839. 'Ɨ' => 'ɨ',
  43840. 'Ƙ' => 'ƙ',
  43841. 'Ɯ' => 'ɯ',
  43842. '�' => 'ɲ',
  43843. 'Ɵ' => 'ɵ',
  43844. 'Æ ' => 'Æ¡',
  43845. 'Æ¢' => 'Æ£',
  43846. 'Ƥ' => 'ƥ',
  43847. 'Ʀ' => 'ʀ',
  43848. 'Ƨ' => 'ƨ',
  43849. 'Ʃ' => 'ʃ',
  43850. 'Ƭ' => 'ƭ',
  43851. 'Ʈ' => 'ʈ',
  43852. 'Ư' => 'ư',
  43853. 'Ʊ' => 'ʊ',
  43854. 'Ʋ' => 'ʋ',
  43855. 'Ƴ' => 'ƴ',
  43856. 'Ƶ' => 'ƶ',
  43857. 'Æ·' => 'Ê’',
  43858. 'Ƹ' => 'ƹ',
  43859. 'Ƽ' => 'ƽ',
  43860. 'DŽ' => 'dž',
  43861. 'Dž' => 'dž',
  43862. 'LJ' => 'lj',
  43863. 'Lj' => 'lj',
  43864. 'NJ' => 'nj',
  43865. 'Nj' => 'nj',
  43866. '�' => 'ǎ',
  43867. '�' => '�',
  43868. 'Ç‘' => 'Ç’',
  43869. 'Ç“' => 'Ç”',
  43870. 'Ç•' => 'Ç–',
  43871. 'Ǘ' => 'ǘ',
  43872. 'Ç™' => 'Çš',
  43873. 'Ǜ' => 'ǜ',
  43874. 'Çž' => 'ÇŸ',
  43875. 'Ç ' => 'Ç¡',
  43876. 'Ç¢' => 'Ç£',
  43877. 'Ǥ' => 'ǥ',
  43878. 'Ǧ' => 'ǧ',
  43879. 'Ǩ' => 'ǩ',
  43880. 'Ǫ' => 'ǫ',
  43881. 'Ǭ' => 'ǭ',
  43882. 'Ǯ' => 'ǯ',
  43883. 'DZ' => 'dz',
  43884. 'Dz' => 'dz',
  43885. 'Ǵ' => 'ǵ',
  43886. 'Ƕ' => 'ƕ',
  43887. 'Ç·' => 'Æ¿',
  43888. 'Ǹ' => 'ǹ',
  43889. 'Ǻ' => 'ǻ',
  43890. 'Ǽ' => 'ǽ',
  43891. 'Ǿ' => 'ǿ',
  43892. 'Ȁ' => '�',
  43893. 'Ȃ' => 'ȃ',
  43894. 'È„' => 'È…',
  43895. 'Ȇ' => 'ȇ',
  43896. 'Ȉ' => 'ȉ',
  43897. 'ÈŠ' => 'È‹',
  43898. 'Ȍ' => '�',
  43899. 'Ȏ' => '�',
  43900. '�' => 'ȑ',
  43901. 'È’' => 'È“',
  43902. 'È”' => 'È•',
  43903. 'È–' => 'È—',
  43904. 'Ș' => 'ș',
  43905. 'Èš' => 'È›',
  43906. 'Ȝ' => '�',
  43907. 'Èž' => 'ÈŸ',
  43908. 'È ' => 'Æž',
  43909. 'È¢' => 'È£',
  43910. 'Ȥ' => 'ȥ',
  43911. 'Ȧ' => 'ȧ',
  43912. 'Ȩ' => 'ȩ',
  43913. 'Ȫ' => 'ȫ',
  43914. 'Ȭ' => 'ȭ',
  43915. 'Ȯ' => 'ȯ',
  43916. 'Ȱ' => 'ȱ',
  43917. 'Ȳ' => 'ȳ',
  43918. 'Ⱥ' => 'ⱥ',
  43919. 'Ȼ' => 'ȼ',
  43920. 'Ƚ' => 'ƚ',
  43921. 'Ⱦ' => 'ⱦ',
  43922. '�' => 'ɂ',
  43923. 'Ƀ' => 'ƀ',
  43924. 'Ʉ' => 'ʉ',
  43925. 'Ʌ' => 'ʌ',
  43926. 'Ɇ' => 'ɇ',
  43927. 'Ɉ' => 'ɉ',
  43928. 'ÉŠ' => 'É‹',
  43929. 'Ɍ' => '�',
  43930. 'Ɏ' => '�',
  43931. 'Ͱ' => 'ͱ',
  43932. 'Ͳ' => 'ͳ',
  43933. 'Ͷ' => 'ͷ',
  43934. 'Ϳ' => 'ϳ',
  43935. 'Ά' => 'ά',
  43936. 'Έ' => 'έ',
  43937. 'Ή' => 'ή',
  43938. 'Ί' => 'ί',
  43939. 'Ό' => 'ό',
  43940. 'Ύ' => '�',
  43941. '�' => 'ώ',
  43942. 'Α' => 'α',
  43943. 'Β' => 'β',
  43944. 'Γ' => 'γ',
  43945. 'Δ' => 'δ',
  43946. 'Ε' => 'ε',
  43947. 'Ζ' => 'ζ',
  43948. 'Η' => 'η',
  43949. 'Θ' => 'θ',
  43950. 'Ι' => 'ι',
  43951. 'Κ' => 'κ',
  43952. 'Λ' => 'λ',
  43953. 'Μ' => 'μ',
  43954. '�' => 'ν',
  43955. 'Ξ' => 'ξ',
  43956. 'Ο' => 'ο',
  43957. 'Π' => 'π',
  43958. 'Ρ' => '�',
  43959. 'Σ' => 'σ',
  43960. 'Τ' => 'τ',
  43961. 'Î¥' => 'Ï…',
  43962. 'Φ' => 'φ',
  43963. 'Χ' => 'χ',
  43964. 'Ψ' => 'ψ',
  43965. 'Ω' => 'ω',
  43966. 'Ϊ' => 'ϊ',
  43967. 'Ϋ' => 'ϋ',
  43968. '�' => 'ϗ',
  43969. 'Ϙ' => 'ϙ',
  43970. 'Ïš' => 'Ï›',
  43971. 'Ϝ' => '�',
  43972. 'Ïž' => 'ÏŸ',
  43973. 'Ï ' => 'Ï¡',
  43974. 'Ï¢' => 'Ï£',
  43975. 'Ϥ' => 'ϥ',
  43976. 'Ϧ' => 'ϧ',
  43977. 'Ϩ' => 'ϩ',
  43978. 'Ϫ' => 'ϫ',
  43979. 'Ϭ' => 'ϭ',
  43980. 'Ϯ' => 'ϯ',
  43981. 'ϴ' => 'θ',
  43982. 'Ϸ' => 'ϸ',
  43983. 'Ϲ' => 'ϲ',
  43984. 'Ϻ' => 'ϻ',
  43985. 'Ͻ' => 'ͻ',
  43986. 'Ͼ' => 'ͼ',
  43987. 'Ͽ' => 'ͽ',
  43988. 'Ѐ' => '�',
  43989. '�' => 'ё',
  43990. 'Ђ' => 'ђ',
  43991. 'Ѓ' => 'ѓ',
  43992. 'Є' => 'є',
  43993. 'Ð…' => 'Ñ•',
  43994. 'І' => 'і',
  43995. 'Ї' => 'ї',
  43996. 'Ј' => 'ј',
  43997. 'Љ' => 'љ',
  43998. 'Њ' => 'њ',
  43999. 'Ћ' => 'ћ',
  44000. 'Ќ' => 'ќ',
  44001. '�' => '�',
  44002. 'ÐŽ' => 'Ñž',
  44003. '�' => 'џ',
  44004. '�' => 'а',
  44005. 'Б' => 'б',
  44006. 'В' => 'в',
  44007. 'Г' => 'г',
  44008. 'Д' => 'д',
  44009. 'Е' => 'е',
  44010. 'Ж' => 'ж',
  44011. 'З' => 'з',
  44012. 'И' => 'и',
  44013. 'Й' => 'й',
  44014. 'К' => 'к',
  44015. 'Л' => 'л',
  44016. 'М' => 'м',
  44017. '�' => 'н',
  44018. 'О' => 'о',
  44019. 'П' => 'п',
  44020. 'Р' => 'р',
  44021. 'С' => '�',
  44022. 'Т' => 'т',
  44023. 'У' => 'у',
  44024. 'Ф' => 'ф',
  44025. 'Ð¥' => 'Ñ…',
  44026. 'Ц' => 'ц',
  44027. 'Ч' => 'ч',
  44028. 'Ш' => 'ш',
  44029. 'Щ' => 'щ',
  44030. 'Ъ' => 'ъ',
  44031. 'Ы' => 'ы',
  44032. 'Ь' => 'ь',
  44033. 'Э' => '�',
  44034. 'Ю' => 'ю',
  44035. 'Я' => '�',
  44036. 'Ñ ' => 'Ñ¡',
  44037. 'Ñ¢' => 'Ñ£',
  44038. 'Ѥ' => 'ѥ',
  44039. 'Ѧ' => 'ѧ',
  44040. 'Ѩ' => 'ѩ',
  44041. 'Ѫ' => 'ѫ',
  44042. 'Ѭ' => 'ѭ',
  44043. 'Ѯ' => 'ѯ',
  44044. 'Ѱ' => 'ѱ',
  44045. 'Ѳ' => 'ѳ',
  44046. 'Ѵ' => 'ѵ',
  44047. 'Ѷ' => 'ѷ',
  44048. 'Ѹ' => 'ѹ',
  44049. 'Ѻ' => 'ѻ',
  44050. 'Ѽ' => 'ѽ',
  44051. 'Ѿ' => 'ѿ',
  44052. 'Ò€' => 'Ò�',
  44053. 'ÒŠ' => 'Ò‹',
  44054. 'Ҍ' => '�',
  44055. 'ÒŽ' => 'Ò�',
  44056. 'Ò�' => 'Ò‘',
  44057. 'Ò’' => 'Ò“',
  44058. 'Ò”' => 'Ò•',
  44059. 'Ò–' => 'Ò—',
  44060. 'Ò˜' => 'Ò™',
  44061. 'Òš' => 'Ò›',
  44062. 'Ҝ' => '�',
  44063. 'Òž' => 'ÒŸ',
  44064. 'Ò ' => 'Ò¡',
  44065. 'Ò¢' => 'Ò£',
  44066. 'Ò¤' => 'Ò¥',
  44067. 'Ò¦' => 'Ò§',
  44068. 'Ò¨' => 'Ò©',
  44069. 'Òª' => 'Ò«',
  44070. 'Ò¬' => 'Ò­',
  44071. 'Ò®' => 'Ò¯',
  44072. 'Ò°' => 'Ò±',
  44073. 'Ò²' => 'Ò³',
  44074. 'Ò´' => 'Òµ',
  44075. 'Ò¶' => 'Ò·',
  44076. 'Ò¸' => 'Ò¹',
  44077. 'Òº' => 'Ò»',
  44078. 'Ò¼' => 'Ò½',
  44079. 'Ò¾' => 'Ò¿',
  44080. 'Ó€' => 'Ó�',
  44081. 'Ó�' => 'Ó‚',
  44082. 'Óƒ' => 'Ó„',
  44083. 'Ó…' => 'Ó†',
  44084. 'Ó‡' => 'Óˆ',
  44085. 'Ó‰' => 'ÓŠ',
  44086. 'Ӌ' => 'ӌ',
  44087. 'Ó�' => 'ÓŽ',
  44088. 'Ó�' => 'Ó‘',
  44089. 'Ó’' => 'Ó“',
  44090. 'Ó”' => 'Ó•',
  44091. 'Ó–' => 'Ó—',
  44092. 'Ó˜' => 'Ó™',
  44093. 'Óš' => 'Ó›',
  44094. 'Ӝ' => '�',
  44095. 'Óž' => 'ÓŸ',
  44096. 'Ó ' => 'Ó¡',
  44097. 'Ó¢' => 'Ó£',
  44098. 'Ó¤' => 'Ó¥',
  44099. 'Ó¦' => 'Ó§',
  44100. 'Ó¨' => 'Ó©',
  44101. 'Óª' => 'Ó«',
  44102. 'Ó¬' => 'Ó­',
  44103. 'Ó®' => 'Ó¯',
  44104. 'Ó°' => 'Ó±',
  44105. 'Ó²' => 'Ó³',
  44106. 'Ó´' => 'Óµ',
  44107. 'Ó¶' => 'Ó·',
  44108. 'Ó¸' => 'Ó¹',
  44109. 'Óº' => 'Ó»',
  44110. 'Ó¼' => 'Ó½',
  44111. 'Ó¾' => 'Ó¿',
  44112. 'Ô€' => 'Ô�',
  44113. 'Ô‚' => 'Ôƒ',
  44114. 'Ô„' => 'Ô…',
  44115. 'Ô†' => 'Ô‡',
  44116. 'Ôˆ' => 'Ô‰',
  44117. 'ÔŠ' => 'Ô‹',
  44118. 'Ԍ' => '�',
  44119. 'ÔŽ' => 'Ô�',
  44120. 'Ô�' => 'Ô‘',
  44121. 'Ô’' => 'Ô“',
  44122. 'Ô”' => 'Ô•',
  44123. 'Ô–' => 'Ô—',
  44124. 'Ô˜' => 'Ô™',
  44125. 'Ôš' => 'Ô›',
  44126. 'Ԝ' => '�',
  44127. 'Ôž' => 'ÔŸ',
  44128. 'Ô ' => 'Ô¡',
  44129. 'Ô¢' => 'Ô£',
  44130. 'Ô¤' => 'Ô¥',
  44131. 'Ô¦' => 'Ô§',
  44132. 'Ô¨' => 'Ô©',
  44133. 'Ôª' => 'Ô«',
  44134. 'Ô¬' => 'Ô­',
  44135. 'Ô®' => 'Ô¯',
  44136. 'Ô±' => 'Õ¡',
  44137. 'Ô²' => 'Õ¢',
  44138. 'Ô³' => 'Õ£',
  44139. 'Ô´' => 'Õ¤',
  44140. 'Ôµ' => 'Õ¥',
  44141. 'Ô¶' => 'Õ¦',
  44142. 'Ô·' => 'Õ§',
  44143. 'Ô¸' => 'Õ¨',
  44144. 'Ô¹' => 'Õ©',
  44145. 'Ôº' => 'Õª',
  44146. 'Ô»' => 'Õ«',
  44147. 'Ô¼' => 'Õ¬',
  44148. 'Ô½' => 'Õ­',
  44149. 'Ô¾' => 'Õ®',
  44150. 'Ô¿' => 'Õ¯',
  44151. 'Õ€' => 'Õ°',
  44152. 'Õ�' => 'Õ±',
  44153. 'Õ‚' => 'Õ²',
  44154. 'Õƒ' => 'Õ³',
  44155. 'Õ„' => 'Õ´',
  44156. 'Õ…' => 'Õµ',
  44157. 'Õ†' => 'Õ¶',
  44158. 'Õ‡' => 'Õ·',
  44159. 'Õˆ' => 'Õ¸',
  44160. 'Õ‰' => 'Õ¹',
  44161. 'ÕŠ' => 'Õº',
  44162. 'Õ‹' => 'Õ»',
  44163. 'Ռ' => 'ռ',
  44164. 'Õ�' => 'Õ½',
  44165. 'ÕŽ' => 'Õ¾',
  44166. 'Õ�' => 'Õ¿',
  44167. 'Õ�' => 'Ö€',
  44168. 'Õ‘' => 'Ö�',
  44169. 'Õ’' => 'Ö‚',
  44170. 'Õ“' => 'Öƒ',
  44171. 'Õ”' => 'Ö„',
  44172. 'Õ•' => 'Ö…',
  44173. 'Õ–' => 'Ö†',
  44174. 'á‚ ' => 'â´€',
  44175. 'á‚¡' => 'â´�',
  44176. 'á‚¢' => 'â´‚',
  44177. 'á‚£' => 'â´ƒ',
  44178. 'Ⴄ' => 'ⴄ',
  44179. 'á‚¥' => 'â´…',
  44180. 'Ⴆ' => 'ⴆ',
  44181. 'Ⴇ' => 'ⴇ',
  44182. 'Ⴈ' => 'ⴈ',
  44183. 'á‚©' => 'â´‰',
  44184. 'Ⴊ' => 'ⴊ',
  44185. 'á‚«' => 'â´‹',
  44186. 'Ⴌ' => 'ⴌ',
  44187. 'á‚­' => 'â´�',
  44188. 'á‚®' => 'â´Ž',
  44189. 'Ⴏ' => '�',
  44190. 'á‚°' => 'â´�',
  44191. 'Ⴑ' => 'ⴑ',
  44192. 'Ⴒ' => 'ⴒ',
  44193. 'Ⴓ' => 'ⴓ',
  44194. 'á‚´' => 'â´”',
  44195. 'Ⴕ' => 'ⴕ',
  44196. 'Ⴖ' => 'ⴖ',
  44197. 'á‚·' => 'â´—',
  44198. 'Ⴘ' => 'ⴘ',
  44199. 'Ⴙ' => 'ⴙ',
  44200. 'Ⴚ' => 'ⴚ',
  44201. 'á‚»' => 'â´›',
  44202. 'Ⴜ' => 'ⴜ',
  44203. 'Ⴝ' => '�',
  44204. 'Ⴞ' => 'ⴞ',
  44205. 'á‚¿' => 'â´Ÿ',
  44206. 'Ⴠ' => 'ⴠ',
  44207. '�' => 'ⴡ',
  44208. 'Ⴢ' => 'ⴢ',
  44209. 'Ⴣ' => 'ⴣ',
  44210. 'Ⴤ' => 'ⴤ',
  44211. 'Ⴥ' => 'ⴥ',
  44212. 'Ⴧ' => 'ⴧ',
  44213. '�' => 'ⴭ',
  44214. 'Ḁ' => '�',
  44215. 'Ḃ' => 'ḃ',
  44216. 'Ḅ' => 'ḅ',
  44217. 'Ḇ' => 'ḇ',
  44218. 'Ḉ' => 'ḉ',
  44219. 'Ḋ' => 'ḋ',
  44220. 'Ḍ' => '�',
  44221. 'Ḏ' => '�',
  44222. '�' => 'ḑ',
  44223. 'Ḓ' => 'ḓ',
  44224. 'Ḕ' => 'ḕ',
  44225. 'Ḗ' => 'ḗ',
  44226. 'Ḙ' => 'ḙ',
  44227. 'Ḛ' => 'ḛ',
  44228. 'Ḝ' => '�',
  44229. 'Ḟ' => 'ḟ',
  44230. 'Ḡ' => 'ḡ',
  44231. 'Ḣ' => 'ḣ',
  44232. 'Ḥ' => 'ḥ',
  44233. 'Ḧ' => 'ḧ',
  44234. 'Ḩ' => 'ḩ',
  44235. 'Ḫ' => 'ḫ',
  44236. 'Ḭ' => 'ḭ',
  44237. 'Ḯ' => 'ḯ',
  44238. 'Ḱ' => 'ḱ',
  44239. 'Ḳ' => 'ḳ',
  44240. 'Ḵ' => 'ḵ',
  44241. 'Ḷ' => 'ḷ',
  44242. 'Ḹ' => 'ḹ',
  44243. 'Ḻ' => 'ḻ',
  44244. 'Ḽ' => 'ḽ',
  44245. 'Ḿ' => 'ḿ',
  44246. 'Ṁ' => '�',
  44247. 'Ṃ' => 'ṃ',
  44248. 'Ṅ' => 'ṅ',
  44249. 'Ṇ' => 'ṇ',
  44250. 'Ṉ' => 'ṉ',
  44251. 'Ṋ' => 'ṋ',
  44252. 'Ṍ' => '�',
  44253. 'Ṏ' => '�',
  44254. '�' => 'ṑ',
  44255. 'Ṓ' => 'ṓ',
  44256. 'Ṕ' => 'ṕ',
  44257. 'á¹–' => 'á¹—',
  44258. 'Ṙ' => 'ṙ',
  44259. 'Ṛ' => 'ṛ',
  44260. 'Ṝ' => '�',
  44261. 'Ṟ' => 'ṟ',
  44262. 'Ṡ' => 'ṡ',
  44263. 'á¹¢' => 'á¹£',
  44264. 'Ṥ' => 'ṥ',
  44265. 'Ṧ' => 'ṧ',
  44266. 'Ṩ' => 'ṩ',
  44267. 'Ṫ' => 'ṫ',
  44268. 'Ṭ' => 'ṭ',
  44269. 'Ṯ' => 'ṯ',
  44270. 'á¹°' => 'á¹±',
  44271. 'á¹²' => 'á¹³',
  44272. 'á¹´' => 'á¹µ',
  44273. 'Ṷ' => 'ṷ',
  44274. 'Ṹ' => 'ṹ',
  44275. 'Ṻ' => 'ṻ',
  44276. 'á¹¼' => 'á¹½',
  44277. 'Ṿ' => 'ṿ',
  44278. 'Ẁ' => '�',
  44279. 'Ẃ' => 'ẃ',
  44280. 'Ẅ' => 'ẅ',
  44281. 'Ẇ' => 'ẇ',
  44282. 'Ẉ' => 'ẉ',
  44283. 'Ẋ' => 'ẋ',
  44284. 'Ẍ' => '�',
  44285. 'Ẏ' => '�',
  44286. '�' => 'ẑ',
  44287. 'Ẓ' => 'ẓ',
  44288. 'Ẕ' => 'ẕ',
  44289. 'ẞ' => 'ß',
  44290. 'Ạ' => 'ạ',
  44291. 'Ả' => 'ả',
  44292. 'Ấ' => 'ấ',
  44293. 'Ầ' => 'ầ',
  44294. 'Ẩ' => 'ẩ',
  44295. 'Ẫ' => 'ẫ',
  44296. 'Ậ' => 'ậ',
  44297. 'Ắ' => 'ắ',
  44298. 'Ằ' => 'ằ',
  44299. 'Ẳ' => 'ẳ',
  44300. 'Ẵ' => 'ẵ',
  44301. 'Ặ' => 'ặ',
  44302. 'Ẹ' => 'ẹ',
  44303. 'Ẻ' => 'ẻ',
  44304. 'Ẽ' => 'ẽ',
  44305. 'Ế' => 'ế',
  44306. 'Ề' => '�',
  44307. 'Ể' => 'ể',
  44308. 'Ễ' => 'ễ',
  44309. 'Ệ' => 'ệ',
  44310. 'Ỉ' => 'ỉ',
  44311. 'Ị' => 'ị',
  44312. 'Ọ' => '�',
  44313. 'Ỏ' => '�',
  44314. '�' => 'ố',
  44315. 'Ồ' => 'ồ',
  44316. 'Ổ' => 'ổ',
  44317. 'á»–' => 'á»—',
  44318. 'Ộ' => 'ộ',
  44319. 'Ớ' => 'ớ',
  44320. 'Ờ' => '�',
  44321. 'Ở' => 'ở',
  44322. 'Ỡ' => 'ỡ',
  44323. 'Ợ' => 'ợ',
  44324. 'Ụ' => 'ụ',
  44325. 'Ủ' => 'ủ',
  44326. 'Ứ' => 'ứ',
  44327. 'Ừ' => 'ừ',
  44328. 'Ử' => 'ử',
  44329. 'Ữ' => 'ữ',
  44330. 'á»°' => 'á»±',
  44331. 'Ỳ' => 'ỳ',
  44332. 'Ỵ' => 'ỵ',
  44333. 'Ỷ' => 'ỷ',
  44334. 'Ỹ' => 'ỹ',
  44335. 'Ỻ' => 'ỻ',
  44336. 'Ỽ' => 'ỽ',
  44337. 'Ỿ' => 'ỿ',
  44338. 'Ἀ' => 'ἀ',
  44339. 'Ἁ' => '�',
  44340. 'Ἂ' => 'ἂ',
  44341. 'Ἃ' => 'ἃ',
  44342. 'Ἄ' => 'ἄ',
  44343. '�' => 'ἅ',
  44344. 'Ἆ' => 'ἆ',
  44345. '�' => 'ἇ',
  44346. 'Ἐ' => '�',
  44347. 'Ἑ' => 'ἑ',
  44348. 'Ἒ' => 'ἒ',
  44349. 'Ἓ' => 'ἓ',
  44350. 'Ἔ' => 'ἔ',
  44351. '�' => 'ἕ',
  44352. 'Ἠ' => 'ἠ',
  44353. 'Ἡ' => 'ἡ',
  44354. 'Ἢ' => 'ἢ',
  44355. 'Ἣ' => 'ἣ',
  44356. 'Ἤ' => 'ἤ',
  44357. 'á¼­' => 'á¼¥',
  44358. 'Ἦ' => 'ἦ',
  44359. 'Ἧ' => 'ἧ',
  44360. 'Ἰ' => 'ἰ',
  44361. 'á¼¹' => 'á¼±',
  44362. 'Ἲ' => 'ἲ',
  44363. 'á¼»' => 'á¼³',
  44364. 'á¼¼' => 'á¼´',
  44365. 'á¼½' => 'á¼µ',
  44366. 'Ἶ' => 'ἶ',
  44367. 'Ἷ' => 'ἷ',
  44368. 'Ὀ' => 'ὀ',
  44369. 'Ὁ' => '�',
  44370. 'Ὂ' => 'ὂ',
  44371. 'Ὃ' => 'ὃ',
  44372. 'Ὄ' => 'ὄ',
  44373. '�' => 'ὅ',
  44374. 'Ὑ' => 'ὑ',
  44375. 'Ὓ' => 'ὓ',
  44376. '�' => 'ὕ',
  44377. 'Ὗ' => 'ὗ',
  44378. 'Ὠ' => 'ὠ',
  44379. 'Ὡ' => 'ὡ',
  44380. 'Ὢ' => 'ὢ',
  44381. 'Ὣ' => 'ὣ',
  44382. 'Ὤ' => 'ὤ',
  44383. 'á½­' => 'á½¥',
  44384. 'Ὦ' => 'ὦ',
  44385. 'Ὧ' => 'ὧ',
  44386. 'ᾈ' => 'ᾀ',
  44387. 'ᾉ' => '�',
  44388. 'ᾊ' => 'ᾂ',
  44389. 'ᾋ' => 'ᾃ',
  44390. 'ᾌ' => 'ᾄ',
  44391. '�' => 'ᾅ',
  44392. 'ᾎ' => 'ᾆ',
  44393. '�' => 'ᾇ',
  44394. 'ᾘ' => '�',
  44395. 'ᾙ' => 'ᾑ',
  44396. 'ᾚ' => 'ᾒ',
  44397. 'ᾛ' => 'ᾓ',
  44398. 'ᾜ' => 'ᾔ',
  44399. '�' => 'ᾕ',
  44400. 'ᾞ' => 'ᾖ',
  44401. 'ᾟ' => 'ᾗ',
  44402. 'ᾨ' => 'ᾠ',
  44403. 'ᾩ' => 'ᾡ',
  44404. 'ᾪ' => 'ᾢ',
  44405. 'ᾫ' => 'ᾣ',
  44406. 'ᾬ' => 'ᾤ',
  44407. 'á¾­' => 'á¾¥',
  44408. 'ᾮ' => 'ᾦ',
  44409. 'ᾯ' => 'ᾧ',
  44410. 'Ᾰ' => 'ᾰ',
  44411. 'á¾¹' => 'á¾±',
  44412. 'Ὰ' => 'ὰ',
  44413. 'á¾»' => 'á½±',
  44414. 'á¾¼' => 'á¾³',
  44415. 'Ὲ' => 'ὲ',
  44416. 'Έ' => 'έ',
  44417. 'á¿Š' => 'á½´',
  44418. 'á¿‹' => 'á½µ',
  44419. 'ῌ' => 'ῃ',
  44420. 'Ῐ' => '�',
  44421. 'á¿™' => 'á¿‘',
  44422. 'Ὶ' => 'ὶ',
  44423. 'á¿›' => 'á½·',
  44424. 'Ῠ' => 'ῠ',
  44425. 'á¿©' => 'á¿¡',
  44426. 'Ὺ' => 'ὺ',
  44427. 'á¿«' => 'á½»',
  44428. 'Ῥ' => 'ῥ',
  44429. 'Ὸ' => 'ὸ',
  44430. 'Ό' => 'ό',
  44431. 'Ὼ' => 'ὼ',
  44432. 'á¿»' => 'á½½',
  44433. 'ῼ' => 'ῳ',
  44434. 'Ω' => 'ω',
  44435. 'K' => 'k',
  44436. 'â„«' => 'Ã¥',
  44437. 'Ⅎ' => 'ⅎ',
  44438. 'â… ' => 'â…°',
  44439. 'â…¡' => 'â…±',
  44440. 'â…¢' => 'â…²',
  44441. 'â…£' => 'â…³',
  44442. 'â…¤' => 'â…´',
  44443. 'â…¥' => 'â…µ',
  44444. 'â…¦' => 'â…¶',
  44445. 'â…§' => 'â…·',
  44446. 'â…¨' => 'â…¸',
  44447. 'â…©' => 'â…¹',
  44448. 'â…ª' => 'â…º',
  44449. 'â…«' => 'â…»',
  44450. 'â…¬' => 'â…¼',
  44451. 'â…­' => 'â…½',
  44452. 'â…®' => 'â…¾',
  44453. 'â…¯' => 'â…¿',
  44454. 'Ↄ' => 'ↄ',
  44455. 'Ⓐ' => '�',
  44456. 'â’·' => 'â“‘',
  44457. 'â’¸' => 'â“’',
  44458. 'â’¹' => 'â““',
  44459. 'â’º' => 'â“”',
  44460. 'â’»' => 'â“•',
  44461. 'â’¼' => 'â“–',
  44462. 'â’½' => 'â“—',
  44463. 'Ⓘ' => 'ⓘ',
  44464. 'â’¿' => 'â“™',
  44465. 'â“€' => 'â“š',
  44466. '�' => 'ⓛ',
  44467. 'Ⓜ' => 'ⓜ',
  44468. 'Ⓝ' => '�',
  44469. 'â“„' => 'â“ž',
  44470. 'â“…' => 'â“Ÿ',
  44471. 'Ⓠ' => 'ⓠ',
  44472. 'Ⓡ' => 'ⓡ',
  44473. 'Ⓢ' => 'ⓢ',
  44474. 'Ⓣ' => 'ⓣ',
  44475. 'Ⓤ' => 'ⓤ',
  44476. 'â“‹' => 'â“¥',
  44477. 'Ⓦ' => 'ⓦ',
  44478. '�' => 'ⓧ',
  44479. 'Ⓨ' => 'ⓨ',
  44480. '�' => 'ⓩ',
  44481. 'â°€' => 'â°°',
  44482. 'â°�' => 'â°±',
  44483. 'â°‚' => 'â°²',
  44484. 'â°ƒ' => 'â°³',
  44485. 'â°„' => 'â°´',
  44486. 'â°…' => 'â°µ',
  44487. 'â°†' => 'â°¶',
  44488. 'â°‡' => 'â°·',
  44489. 'â°ˆ' => 'â°¸',
  44490. 'â°‰' => 'â°¹',
  44491. 'â°Š' => 'â°º',
  44492. 'â°‹' => 'â°»',
  44493. 'Ⰼ' => 'ⰼ',
  44494. 'â°�' => 'â°½',
  44495. 'â°Ž' => 'â°¾',
  44496. 'â°�' => 'â°¿',
  44497. 'â°�' => 'â±€',
  44498. 'Ⱁ' => '�',
  44499. 'Ⱂ' => 'ⱂ',
  44500. 'Ⱃ' => 'ⱃ',
  44501. 'Ⱄ' => 'ⱄ',
  44502. 'â°•' => 'â±…',
  44503. 'Ⱆ' => 'ⱆ',
  44504. 'Ⱇ' => 'ⱇ',
  44505. 'Ⱈ' => 'ⱈ',
  44506. 'Ⱉ' => 'ⱉ',
  44507. 'Ⱊ' => 'ⱊ',
  44508. 'Ⱋ' => 'ⱋ',
  44509. 'Ⱌ' => 'ⱌ',
  44510. '�' => '�',
  44511. 'Ⱎ' => 'ⱎ',
  44512. 'Ⱏ' => '�',
  44513. 'Ⱐ' => '�',
  44514. 'Ⱑ' => 'ⱑ',
  44515. 'â°¢' => 'â±’',
  44516. 'Ⱓ' => 'ⱓ',
  44517. 'â°¤' => 'â±”',
  44518. 'Ⱕ' => 'ⱕ',
  44519. 'â°¦' => 'â±–',
  44520. 'â°§' => 'â±—',
  44521. 'Ⱘ' => 'ⱘ',
  44522. 'â°©' => 'â±™',
  44523. 'Ⱚ' => 'ⱚ',
  44524. 'â°«' => 'â±›',
  44525. 'Ⱜ' => 'ⱜ',
  44526. 'Ⱝ' => '�',
  44527. 'Ⱞ' => 'ⱞ',
  44528. 'Ⱡ' => 'ⱡ',
  44529. 'â±¢' => 'É«',
  44530. 'â±£' => 'áµ½',
  44531. 'Ɽ' => 'ɽ',
  44532. 'Ⱨ' => 'ⱨ',
  44533. 'Ⱪ' => 'ⱪ',
  44534. 'Ⱬ' => 'ⱬ',
  44535. 'â±­' => 'É‘',
  44536. 'Ɱ' => 'ɱ',
  44537. 'Ɐ' => '�',
  44538. 'â±°' => 'É’',
  44539. 'â±²' => 'â±³',
  44540. 'Ⱶ' => 'ⱶ',
  44541. 'â±¾' => 'È¿',
  44542. 'Ɀ' => 'ɀ',
  44543. 'Ⲁ' => '�',
  44544. 'Ⲃ' => 'ⲃ',
  44545. 'Ⲅ' => 'ⲅ',
  44546. 'Ⲇ' => 'ⲇ',
  44547. 'Ⲉ' => 'ⲉ',
  44548. 'Ⲋ' => 'ⲋ',
  44549. 'Ⲍ' => '�',
  44550. 'Ⲏ' => '�',
  44551. '�' => 'ⲑ',
  44552. 'Ⲓ' => 'ⲓ',
  44553. 'Ⲕ' => 'ⲕ',
  44554. 'â²–' => 'â²—',
  44555. 'Ⲙ' => 'ⲙ',
  44556. 'Ⲛ' => 'ⲛ',
  44557. 'Ⲝ' => '�',
  44558. 'Ⲟ' => 'ⲟ',
  44559. 'Ⲡ' => 'ⲡ',
  44560. 'â²¢' => 'â²£',
  44561. 'Ⲥ' => 'ⲥ',
  44562. 'Ⲧ' => 'ⲧ',
  44563. 'Ⲩ' => 'ⲩ',
  44564. 'Ⲫ' => 'ⲫ',
  44565. 'Ⲭ' => 'ⲭ',
  44566. 'Ⲯ' => 'ⲯ',
  44567. 'â²°' => 'â²±',
  44568. 'â²²' => 'â²³',
  44569. 'â²´' => 'â²µ',
  44570. 'Ⲷ' => 'ⲷ',
  44571. 'Ⲹ' => 'ⲹ',
  44572. 'Ⲻ' => 'ⲻ',
  44573. 'â²¼' => 'â²½',
  44574. 'Ⲿ' => 'ⲿ',
  44575. 'Ⳁ' => '�',
  44576. 'Ⳃ' => 'ⳃ',
  44577. 'Ⳅ' => 'ⳅ',
  44578. 'Ⳇ' => 'ⳇ',
  44579. 'Ⳉ' => 'ⳉ',
  44580. 'Ⳋ' => 'ⳋ',
  44581. 'Ⳍ' => '�',
  44582. 'Ⳏ' => '�',
  44583. '�' => 'ⳑ',
  44584. 'Ⳓ' => 'ⳓ',
  44585. 'Ⳕ' => 'ⳕ',
  44586. 'â³–' => 'â³—',
  44587. 'Ⳙ' => 'ⳙ',
  44588. 'Ⳛ' => 'ⳛ',
  44589. 'Ⳝ' => '�',
  44590. 'Ⳟ' => 'ⳟ',
  44591. 'Ⳡ' => 'ⳡ',
  44592. 'â³¢' => 'â³£',
  44593. 'Ⳬ' => 'ⳬ',
  44594. 'â³­' => 'â³®',
  44595. 'â³²' => 'â³³',
  44596. 'Ꙁ' => '�',
  44597. 'Ꙃ' => 'ꙃ',
  44598. 'Ꙅ' => 'ꙅ',
  44599. 'Ꙇ' => 'ꙇ',
  44600. 'Ꙉ' => 'ꙉ',
  44601. 'Ꙋ' => 'ꙋ',
  44602. 'Ꙍ' => '�',
  44603. 'Ꙏ' => '�',
  44604. '�' => 'ꙑ',
  44605. 'Ꙓ' => 'ꙓ',
  44606. 'Ꙕ' => 'ꙕ',
  44607. 'ê™–' => 'ê™—',
  44608. 'Ꙙ' => 'ꙙ',
  44609. 'Ꙛ' => 'ꙛ',
  44610. 'Ꙝ' => '�',
  44611. 'Ꙟ' => 'ꙟ',
  44612. 'Ꙡ' => 'ꙡ',
  44613. 'Ꙣ' => 'ꙣ',
  44614. 'Ꙥ' => 'ꙥ',
  44615. 'Ꙧ' => 'ꙧ',
  44616. 'Ꙩ' => 'ꙩ',
  44617. 'Ꙫ' => 'ꙫ',
  44618. 'Ꙭ' => 'ꙭ',
  44619. 'Ꚁ' => '�',
  44620. 'Ꚃ' => 'ꚃ',
  44621. 'êš„' => 'êš…',
  44622. 'Ꚇ' => 'ꚇ',
  44623. 'Ꚉ' => 'ꚉ',
  44624. 'Ꚋ' => 'ꚋ',
  44625. 'Ꚍ' => '�',
  44626. 'Ꚏ' => '�',
  44627. '�' => 'ꚑ',
  44628. 'êš’' => 'êš“',
  44629. 'êš”' => 'êš•',
  44630. 'êš–' => 'êš—',
  44631. 'Ꚙ' => 'ꚙ',
  44632. 'êšš' => 'êš›',
  44633. 'Ꜣ' => 'ꜣ',
  44634. 'Ꜥ' => 'ꜥ',
  44635. 'Ꜧ' => 'ꜧ',
  44636. 'Ꜩ' => 'ꜩ',
  44637. 'Ꜫ' => 'ꜫ',
  44638. 'Ꜭ' => 'ꜭ',
  44639. 'Ꜯ' => 'ꜯ',
  44640. 'Ꜳ' => 'ꜳ',
  44641. 'Ꜵ' => 'ꜵ',
  44642. 'Ꜷ' => 'ꜷ',
  44643. 'Ꜹ' => 'ꜹ',
  44644. 'Ꜻ' => 'ꜻ',
  44645. 'Ꜽ' => 'ꜽ',
  44646. 'Ꜿ' => 'ꜿ',
  44647. '�' => '�',
  44648. '�' => '�',
  44649. '�' => '�',
  44650. '�' => '�',
  44651. '�' => '�',
  44652. '�' => '�',
  44653. '�' => '�',
  44654. '�' => '�',
  44655. '�' => '�',
  44656. '�' => '�',
  44657. '�' => '�',
  44658. '�' => '�',
  44659. '�' => '�',
  44660. '�' => '�',
  44661. '�' => '�',
  44662. '�' => '�',
  44663. '�' => '�',
  44664. '�' => '�',
  44665. '�' => '�',
  44666. '�' => '�',
  44667. '�' => '�',
  44668. '�' => '�',
  44669. '�' => '�',
  44670. '�' => '�',
  44671. '�' => '�',
  44672. '�' => '�',
  44673. '�' => 'ᵹ',
  44674. '�' => '�',
  44675. 'Ꞁ' => '�',
  44676. 'Ꞃ' => 'ꞃ',
  44677. 'êž„' => 'êž…',
  44678. 'Ꞇ' => 'ꞇ',
  44679. 'Ꞌ' => 'ꞌ',
  44680. '�' => 'ɥ',
  44681. '�' => 'ꞑ',
  44682. 'êž’' => 'êž“',
  44683. 'êž–' => 'êž—',
  44684. 'Ꞙ' => 'ꞙ',
  44685. 'êžš' => 'êž›',
  44686. 'Ꞝ' => '�',
  44687. 'Ꞟ' => 'ꞟ',
  44688. 'êž ' => 'êž¡',
  44689. 'Ꞣ' => 'ꞣ',
  44690. 'Ꞥ' => 'ꞥ',
  44691. 'Ꞧ' => 'ꞧ',
  44692. 'Ꞩ' => 'ꞩ',
  44693. 'Ɦ' => 'ɦ',
  44694. 'Ɜ' => 'ɜ',
  44695. 'Ɡ' => 'ɡ',
  44696. 'Ɬ' => 'ɬ',
  44697. 'êž°' => 'Êž',
  44698. 'Ʇ' => 'ʇ',
  44699. 'A' => '�',
  44700. 'B' => 'b',
  44701. 'C' => 'c',
  44702. 'D' => 'd',
  44703. 'ï¼¥' => 'ï½…',
  44704. 'F' => 'f',
  44705. 'G' => 'g',
  44706. 'H' => 'h',
  44707. 'I' => 'i',
  44708. 'J' => 'j',
  44709. 'K' => 'k',
  44710. 'L' => 'l',
  44711. 'M' => '�',
  44712. 'N' => 'n',
  44713. 'O' => '�',
  44714. 'P' => '�',
  44715. 'Q' => 'q',
  44716. 'ï¼²' => 'ï½’',
  44717. 'S' => 's',
  44718. 'ï¼´' => 'ï½”',
  44719. 'U' => 'u',
  44720. 'V' => 'v',
  44721. 'ï¼·' => 'ï½—',
  44722. 'X' => 'x',
  44723. 'ï¼¹' => 'ï½™',
  44724. 'Z' => 'z',
  44725. '�' => '�',
  44726. '�' => '�',
  44727. '�' => '�',
  44728. '�' => '�',
  44729. '�' => '�',
  44730. '�' => '�',
  44731. '�' => '�',
  44732. '�' => '�',
  44733. '�' => '�',
  44734. '�' => '�',
  44735. '�' => '�',
  44736. '�' => '�',
  44737. '�' => '�',
  44738. '�' => '�',
  44739. '�' => '�',
  44740. '�' => '�',
  44741. '�' => '�',
  44742. '�' => '�',
  44743. '�' => '�',
  44744. '�' => '�',
  44745. '�' => '�',
  44746. '�' => '�',
  44747. '�' => '�',
  44748. '�' => '�',
  44749. '�' => '�',
  44750. '�' => '�',
  44751. '�' => '�',
  44752. '�' => '�',
  44753. '�' => '�',
  44754. '�' => '�',
  44755. '�' => '�',
  44756. '�' => '�',
  44757. '�' => '�',
  44758. '�' => '�',
  44759. '�' => '�',
  44760. '�' => '�',
  44761. '�' => '�',
  44762. '�' => '�',
  44763. '�' => '�',
  44764. '�' => '�',
  44765. 'ð‘¢ ' => 'ð‘£€',
  44766. '𑢡' => '�',
  44767. '𑢢' => '𑣂',
  44768. '𑢣' => '𑣃',
  44769. '𑢤' => '𑣄',
  44770. 'ð‘¢¥' => 'ð‘£…',
  44771. '𑢦' => '𑣆',
  44772. '𑢧' => '𑣇',
  44773. '𑢨' => '𑣈',
  44774. '𑢩' => '𑣉',
  44775. '𑢪' => '𑣊',
  44776. '𑢫' => '𑣋',
  44777. '𑢬' => '𑣌',
  44778. '𑢭' => '�',
  44779. '𑢮' => '𑣎',
  44780. '𑢯' => '�',
  44781. '𑢰' => '�',
  44782. '𑢱' => '𑣑',
  44783. 'ð‘¢²' => 'ð‘£’',
  44784. '𑢳' => '𑣓',
  44785. 'ð‘¢´' => 'ð‘£”',
  44786. '𑢵' => '𑣕',
  44787. '𑢶' => '𑣖',
  44788. 'ð‘¢·' => 'ð‘£—',
  44789. '𑢸' => '𑣘',
  44790. 'ð‘¢¹' => 'ð‘£™',
  44791. '𑢺' => '𑣚',
  44792. 'ð‘¢»' => 'ð‘£›',
  44793. '𑢼' => '𑣜',
  44794. '𑢽' => '�',
  44795. '𑢾' => '𑣞',
  44796. '𑢿' => '𑣟',
  44797. );
  44798. <?php
  44799. 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';
  44800. <?php
  44801. return array(
  44802. 'a' => 'A',
  44803. 'b' => 'B',
  44804. 'c' => 'C',
  44805. 'd' => 'D',
  44806. 'e' => 'E',
  44807. 'f' => 'F',
  44808. 'g' => 'G',
  44809. 'h' => 'H',
  44810. 'i' => 'I',
  44811. 'j' => 'J',
  44812. 'k' => 'K',
  44813. 'l' => 'L',
  44814. 'm' => 'M',
  44815. 'n' => 'N',
  44816. 'o' => 'O',
  44817. 'p' => 'P',
  44818. 'q' => 'Q',
  44819. 'r' => 'R',
  44820. 's' => 'S',
  44821. 't' => 'T',
  44822. 'u' => 'U',
  44823. 'v' => 'V',
  44824. 'w' => 'W',
  44825. 'x' => 'X',
  44826. 'y' => 'Y',
  44827. 'z' => 'Z',
  44828. 'µ' => 'Μ',
  44829. 'à' => 'À',
  44830. 'á' => '�',
  44831. 'â' => 'Â',
  44832. 'ã' => 'Ã',
  44833. 'ä' => 'Ä',
  44834. 'Ã¥' => 'Ã…',
  44835. 'æ' => 'Æ',
  44836. 'ç' => 'Ç',
  44837. 'è' => 'È',
  44838. 'é' => 'É',
  44839. 'ê' => 'Ê',
  44840. 'ë' => 'Ë',
  44841. 'ì' => 'Ì',
  44842. 'í' => '�',
  44843. 'î' => 'Î',
  44844. 'ï' => '�',
  44845. 'ð' => '�',
  44846. 'ñ' => 'Ñ',
  44847. 'ò' => 'Ò',
  44848. 'ó' => 'Ó',
  44849. 'ô' => 'Ô',
  44850. 'õ' => 'Õ',
  44851. 'ö' => 'Ö',
  44852. 'ø' => 'Ø',
  44853. 'ù' => 'Ù',
  44854. 'ú' => 'Ú',
  44855. 'û' => 'Û',
  44856. 'ü' => 'Ü',
  44857. 'ý' => '�',
  44858. 'þ' => 'Þ',
  44859. 'ÿ' => 'Ÿ',
  44860. '�' => 'Ā',
  44861. 'ă' => 'Ă',
  44862. 'Ä…' => 'Ä„',
  44863. 'ć' => 'Ć',
  44864. 'ĉ' => 'Ĉ',
  44865. 'Ä‹' => 'ÄŠ',
  44866. '�' => 'Č',
  44867. '�' => 'Ď',
  44868. 'đ' => '�',
  44869. 'Ä“' => 'Ä’',
  44870. 'Ä•' => 'Ä”',
  44871. 'Ä—' => 'Ä–',
  44872. 'ę' => 'Ę',
  44873. 'Ä›' => 'Äš',
  44874. '�' => 'Ĝ',
  44875. 'ÄŸ' => 'Äž',
  44876. 'Ä¡' => 'Ä ',
  44877. 'Ä£' => 'Ä¢',
  44878. 'ĥ' => 'Ĥ',
  44879. 'ħ' => 'Ħ',
  44880. 'ĩ' => 'Ĩ',
  44881. 'ī' => 'Ī',
  44882. 'ĭ' => 'Ĭ',
  44883. 'į' => 'Į',
  44884. 'ı' => 'I',
  44885. 'ij' => 'IJ',
  44886. 'ĵ' => 'Ĵ',
  44887. 'ķ' => 'Ķ',
  44888. 'ĺ' => 'Ĺ',
  44889. 'ļ' => 'Ļ',
  44890. 'ľ' => 'Ľ',
  44891. 'Å€' => 'Ä¿',
  44892. 'ł' => '�',
  44893. 'ń' => 'Ń',
  44894. 'ņ' => 'Ņ',
  44895. 'ň' => 'Ň',
  44896. 'Å‹' => 'ÅŠ',
  44897. '�' => 'Ō',
  44898. '�' => 'Ŏ',
  44899. 'ő' => '�',
  44900. 'Å“' => 'Å’',
  44901. 'Å•' => 'Å”',
  44902. 'Å—' => 'Å–',
  44903. 'ř' => 'Ř',
  44904. 'Å›' => 'Åš',
  44905. '�' => 'Ŝ',
  44906. 'ÅŸ' => 'Åž',
  44907. 'Å¡' => 'Å ',
  44908. 'Å£' => 'Å¢',
  44909. 'ť' => 'Ť',
  44910. 'ŧ' => 'Ŧ',
  44911. 'ũ' => 'Ũ',
  44912. 'ū' => 'Ū',
  44913. 'ŭ' => 'Ŭ',
  44914. 'ů' => 'Ů',
  44915. 'ű' => 'Ű',
  44916. 'ų' => 'Ų',
  44917. 'ŵ' => 'Ŵ',
  44918. 'ŷ' => 'Ŷ',
  44919. 'ź' => 'Ź',
  44920. 'ż' => 'Ż',
  44921. 'ž' => 'Ž',
  44922. 'Å¿' => 'S',
  44923. 'ƀ' => 'Ƀ',
  44924. 'ƃ' => 'Ƃ',
  44925. 'Æ…' => 'Æ„',
  44926. 'ƈ' => 'Ƈ',
  44927. 'ƌ' => 'Ƌ',
  44928. 'Æ’' => 'Æ‘',
  44929. 'ƕ' => 'Ƕ',
  44930. 'ƙ' => 'Ƙ',
  44931. 'ƚ' => 'Ƚ',
  44932. 'Æž' => 'È ',
  44933. 'Æ¡' => 'Æ ',
  44934. 'Æ£' => 'Æ¢',
  44935. 'ƥ' => 'Ƥ',
  44936. 'ƨ' => 'Ƨ',
  44937. 'ƭ' => 'Ƭ',
  44938. 'ư' => 'Ư',
  44939. 'ƴ' => 'Ƴ',
  44940. 'ƶ' => 'Ƶ',
  44941. 'ƹ' => 'Ƹ',
  44942. 'ƽ' => 'Ƽ',
  44943. 'Æ¿' => 'Ç·',
  44944. 'Ç…' => 'Ç„',
  44945. 'dž' => 'DŽ',
  44946. 'Lj' => 'LJ',
  44947. 'lj' => 'LJ',
  44948. 'Ç‹' => 'ÇŠ',
  44949. 'nj' => 'NJ',
  44950. 'ǎ' => '�',
  44951. '�' => '�',
  44952. 'Ç’' => 'Ç‘',
  44953. 'Ç”' => 'Ç“',
  44954. 'Ç–' => 'Ç•',
  44955. 'ǘ' => 'Ǘ',
  44956. 'Çš' => 'Ç™',
  44957. 'ǜ' => 'Ǜ',
  44958. '�' => 'Ǝ',
  44959. 'ÇŸ' => 'Çž',
  44960. 'Ç¡' => 'Ç ',
  44961. 'Ç£' => 'Ç¢',
  44962. 'ǥ' => 'Ǥ',
  44963. 'ǧ' => 'Ǧ',
  44964. 'ǩ' => 'Ǩ',
  44965. 'ǫ' => 'Ǫ',
  44966. 'ǭ' => 'Ǭ',
  44967. 'ǯ' => 'Ǯ',
  44968. 'Dz' => 'DZ',
  44969. 'dz' => 'DZ',
  44970. 'ǵ' => 'Ǵ',
  44971. 'ǹ' => 'Ǹ',
  44972. 'ǻ' => 'Ǻ',
  44973. 'ǽ' => 'Ǽ',
  44974. 'ǿ' => 'Ǿ',
  44975. '�' => 'Ȁ',
  44976. 'ȃ' => 'Ȃ',
  44977. 'È…' => 'È„',
  44978. 'ȇ' => 'Ȇ',
  44979. 'ȉ' => 'Ȉ',
  44980. 'È‹' => 'ÈŠ',
  44981. '�' => 'Ȍ',
  44982. '�' => 'Ȏ',
  44983. 'ȑ' => '�',
  44984. 'È“' => 'È’',
  44985. 'È•' => 'È”',
  44986. 'È—' => 'È–',
  44987. 'ș' => 'Ș',
  44988. 'È›' => 'Èš',
  44989. '�' => 'Ȝ',
  44990. 'ÈŸ' => 'Èž',
  44991. 'È£' => 'È¢',
  44992. 'ȥ' => 'Ȥ',
  44993. 'ȧ' => 'Ȧ',
  44994. 'ȩ' => 'Ȩ',
  44995. 'ȫ' => 'Ȫ',
  44996. 'ȭ' => 'Ȭ',
  44997. 'ȯ' => 'Ȯ',
  44998. 'ȱ' => 'Ȱ',
  44999. 'ȳ' => 'Ȳ',
  45000. 'ȼ' => 'Ȼ',
  45001. 'È¿' => 'â±¾',
  45002. 'ɀ' => 'Ɀ',
  45003. 'ɂ' => '�',
  45004. 'ɇ' => 'Ɇ',
  45005. 'ɉ' => 'Ɉ',
  45006. 'É‹' => 'ÉŠ',
  45007. '�' => 'Ɍ',
  45008. '�' => 'Ɏ',
  45009. '�' => 'Ɐ',
  45010. 'É‘' => 'â±­',
  45011. 'É’' => 'â±°',
  45012. 'ɓ' => '�',
  45013. 'ɔ' => 'Ɔ',
  45014. 'ɖ' => 'Ɖ',
  45015. 'É—' => 'ÆŠ',
  45016. 'ə' => '�',
  45017. 'ɛ' => '�',
  45018. 'ɜ' => 'Ɜ',
  45019. 'É ' => 'Æ“',
  45020. 'ɡ' => 'Ɡ',
  45021. 'É£' => 'Æ”',
  45022. 'ɥ' => '�',
  45023. 'ɦ' => 'Ɦ',
  45024. 'ɨ' => 'Ɨ',
  45025. 'É©' => 'Æ–',
  45026. 'É«' => 'â±¢',
  45027. 'ɬ' => 'Ɬ',
  45028. 'ɯ' => 'Ɯ',
  45029. 'ɱ' => 'Ɱ',
  45030. 'ɲ' => '�',
  45031. 'ɵ' => 'Ɵ',
  45032. 'ɽ' => 'Ɽ',
  45033. 'ʀ' => 'Ʀ',
  45034. 'ʃ' => 'Ʃ',
  45035. 'ʇ' => 'Ʇ',
  45036. 'ʈ' => 'Ʈ',
  45037. 'ʉ' => 'Ʉ',
  45038. 'ʊ' => 'Ʊ',
  45039. 'ʋ' => 'Ʋ',
  45040. 'ʌ' => 'Ʌ',
  45041. 'Ê’' => 'Æ·',
  45042. 'Êž' => 'êž°',
  45043. 'ͅ' => 'Ι',
  45044. 'ͱ' => 'Ͱ',
  45045. 'ͳ' => 'Ͳ',
  45046. 'ͷ' => 'Ͷ',
  45047. 'ͻ' => 'Ͻ',
  45048. 'ͼ' => 'Ͼ',
  45049. 'ͽ' => 'Ͽ',
  45050. 'ά' => 'Ά',
  45051. 'έ' => 'Έ',
  45052. 'ή' => 'Ή',
  45053. 'ί' => 'Ί',
  45054. 'α' => 'Α',
  45055. 'β' => 'Β',
  45056. 'γ' => 'Γ',
  45057. 'δ' => 'Δ',
  45058. 'ε' => 'Ε',
  45059. 'ζ' => 'Ζ',
  45060. 'η' => 'Η',
  45061. 'θ' => 'Θ',
  45062. 'ι' => 'Ι',
  45063. 'κ' => 'Κ',
  45064. 'λ' => 'Λ',
  45065. 'μ' => 'Μ',
  45066. 'ν' => '�',
  45067. 'ξ' => 'Ξ',
  45068. 'ο' => 'Ο',
  45069. 'π' => 'Π',
  45070. '�' => 'Ρ',
  45071. 'ς' => 'Σ',
  45072. 'σ' => 'Σ',
  45073. 'τ' => 'Τ',
  45074. 'Ï…' => 'Î¥',
  45075. 'φ' => 'Φ',
  45076. 'χ' => 'Χ',
  45077. 'ψ' => 'Ψ',
  45078. 'ω' => 'Ω',
  45079. 'ϊ' => 'Ϊ',
  45080. 'ϋ' => 'Ϋ',
  45081. 'ό' => 'Ό',
  45082. '�' => 'Ύ',
  45083. 'ώ' => '�',
  45084. '�' => 'Β',
  45085. 'ϑ' => 'Θ',
  45086. 'ϕ' => 'Φ',
  45087. 'ϖ' => 'Π',
  45088. 'ϗ' => '�',
  45089. 'ϙ' => 'Ϙ',
  45090. 'Ï›' => 'Ïš',
  45091. '�' => 'Ϝ',
  45092. 'ÏŸ' => 'Ïž',
  45093. 'Ï¡' => 'Ï ',
  45094. 'Ï£' => 'Ï¢',
  45095. 'ϥ' => 'Ϥ',
  45096. 'ϧ' => 'Ϧ',
  45097. 'ϩ' => 'Ϩ',
  45098. 'ϫ' => 'Ϫ',
  45099. 'ϭ' => 'Ϭ',
  45100. 'ϯ' => 'Ϯ',
  45101. 'ϰ' => 'Κ',
  45102. 'ϱ' => 'Ρ',
  45103. 'ϲ' => 'Ϲ',
  45104. 'ϳ' => 'Ϳ',
  45105. 'ϵ' => 'Ε',
  45106. 'ϸ' => 'Ϸ',
  45107. 'ϻ' => 'Ϻ',
  45108. 'а' => '�',
  45109. 'б' => 'Б',
  45110. 'в' => 'В',
  45111. 'г' => 'Г',
  45112. 'д' => 'Д',
  45113. 'е' => 'Е',
  45114. 'ж' => 'Ж',
  45115. 'з' => 'З',
  45116. 'и' => 'И',
  45117. 'й' => 'Й',
  45118. 'к' => 'К',
  45119. 'л' => 'Л',
  45120. 'м' => 'М',
  45121. 'н' => '�',
  45122. 'о' => 'О',
  45123. 'п' => 'П',
  45124. 'р' => 'Р',
  45125. '�' => 'С',
  45126. 'т' => 'Т',
  45127. 'у' => 'У',
  45128. 'ф' => 'Ф',
  45129. 'Ñ…' => 'Ð¥',
  45130. 'ц' => 'Ц',
  45131. 'ч' => 'Ч',
  45132. 'ш' => 'Ш',
  45133. 'щ' => 'Щ',
  45134. 'ъ' => 'Ъ',
  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. 'Ò«' => 'Òª',
  45190. 'Ò­' => 'Ò¬',
  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. 'Õ©' => 'Ô¹',
  45265. 'Õª' => 'Ôº',
  45266. 'Õ«' => 'Ô»',
  45267. 'Õ¬' => 'Ô¼',
  45268. 'Õ­' => 'Ô½',
  45269. 'Õ®' => 'Ô¾',
  45270. 'Õ¯' => 'Ô¿',
  45271. 'Õ°' => 'Õ€',
  45272. 'Õ±' => 'Õ�',
  45273. 'Õ²' => 'Õ‚',
  45274. 'Õ³' => 'Õƒ',
  45275. 'Õ´' => 'Õ„',
  45276. 'Õµ' => 'Õ…',
  45277. 'Õ¶' => 'Õ†',
  45278. 'Õ·' => 'Õ‡',
  45279. 'Õ¸' => 'Õˆ',
  45280. 'Õ¹' => 'Õ‰',
  45281. 'Õº' => 'ÕŠ',
  45282. 'Õ»' => 'Õ‹',
  45283. 'ռ' => 'Ռ',
  45284. 'Õ½' => 'Õ�',
  45285. 'Õ¾' => 'ÕŽ',
  45286. 'Õ¿' => 'Õ�',
  45287. 'Ö€' => 'Õ�',
  45288. 'Ö�' => 'Õ‘',
  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. '�' => 'A',
  45805. 'b' => 'B',
  45806. 'c' => 'C',
  45807. 'd' => 'D',
  45808. 'ï½…' => 'ï¼¥',
  45809. 'f' => 'F',
  45810. 'g' => 'G',
  45811. 'h' => 'H',
  45812. 'i' => 'I',
  45813. 'j' => 'J',
  45814. 'k' => 'K',
  45815. 'l' => 'L',
  45816. '�' => 'M',
  45817. 'n' => 'N',
  45818. '�' => 'O',
  45819. '�' => 'P',
  45820. 'q' => 'Q',
  45821. 'ï½’' => 'ï¼²',
  45822. 's' => 'S',
  45823. 'ï½”' => 'ï¼´',
  45824. 'u' => 'U',
  45825. 'v' => 'V',
  45826. 'ï½—' => 'ï¼·',
  45827. 'x' => 'X',
  45828. 'ï½™' => 'ï¼¹',
  45829. 'z' => 'Z',
  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. <?php
  45904. use Symfony\Polyfill\Mbstring as p;
  45905. if (!function_exists('mb_strlen')) {
  45906. define('MB_CASE_UPPER', 0);
  45907. define('MB_CASE_LOWER', 1);
  45908. define('MB_CASE_TITLE', 2);
  45909. function mb_convert_encoding($s, $to, $from = null) { return p\Mbstring::mb_convert_encoding($s, $to, $from); }
  45910. function mb_decode_mimeheader($s) { return p\Mbstring::mb_decode_mimeheader($s); }
  45911. function mb_encode_mimeheader($s, $charset = null, $transferEnc = null, $lf = null, $indent = null) { return p\Mbstring::mb_encode_mimeheader($s, $charset, $transferEnc, $lf, $indent); }
  45912. function mb_decode_numericentity($s, $convmap, $enc = null) { return p\Mbstring::mb_decode_numericentity($s, $convmap, $enc); }
  45913. function mb_encode_numericentity($s, $convmap, $enc = null, $is_hex = false) { return p\Mbstring::mb_encode_numericentity($s, $convmap, $enc, $is_hex); }
  45914. function mb_convert_case($s, $mode, $enc = null) { return p\Mbstring::mb_convert_case($s, $mode, $enc); }
  45915. function mb_internal_encoding($enc = null) { return p\Mbstring::mb_internal_encoding($enc); }
  45916. function mb_language($lang = null) { return p\Mbstring::mb_language($lang); }
  45917. function mb_list_encodings() { return p\Mbstring::mb_list_encodings(); }
  45918. function mb_encoding_aliases($encoding) { return p\Mbstring::mb_encoding_aliases($encoding); }
  45919. function mb_check_encoding($var = null, $encoding = null) { return p\Mbstring::mb_check_encoding($var, $encoding); }
  45920. function mb_detect_encoding($str, $encodingList = null, $strict = false) { return p\Mbstring::mb_detect_encoding($str, $encodingList, $strict); }
  45921. function mb_detect_order($encodingList = null) { return p\Mbstring::mb_detect_order($encodingList); }
  45922. function mb_parse_str($s, &$result = array()) { parse_str($s, $result); }
  45923. function mb_strlen($s, $enc = null) { return p\Mbstring::mb_strlen($s, $enc); }
  45924. function mb_strpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strpos($s, $needle, $offset, $enc); }
  45925. function mb_strtolower($s, $enc = null) { return p\Mbstring::mb_strtolower($s, $enc); }
  45926. function mb_strtoupper($s, $enc = null) { return p\Mbstring::mb_strtoupper($s, $enc); }
  45927. function mb_substitute_character($char = null) { return p\Mbstring::mb_substitute_character($char); }
  45928. function mb_substr($s, $start, $length = 2147483647, $enc = null) { return p\Mbstring::mb_substr($s, $start, $length, $enc); }
  45929. function mb_stripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_stripos($s, $needle, $offset, $enc); }
  45930. function mb_stristr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_stristr($s, $needle, $part, $enc); }
  45931. function mb_strrchr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrchr($s, $needle, $part, $enc); }
  45932. function mb_strrichr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strrichr($s, $needle, $part, $enc); }
  45933. function mb_strripos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strripos($s, $needle, $offset, $enc); }
  45934. function mb_strrpos($s, $needle, $offset = 0, $enc = null) { return p\Mbstring::mb_strrpos($s, $needle, $offset, $enc); }
  45935. function mb_strstr($s, $needle, $part = false, $enc = null) { return p\Mbstring::mb_strstr($s, $needle, $part, $enc); }
  45936. function mb_get_info($type = 'all') { return p\Mbstring::mb_get_info($type); }
  45937. function mb_http_output($enc = null) { return p\Mbstring::mb_http_output($enc); }
  45938. function mb_strwidth($s, $enc = null) { return p\Mbstring::mb_strwidth($s, $enc); }
  45939. function mb_substr_count($haystack, $needle, $enc = null) { return p\Mbstring::mb_substr_count($haystack, $needle, $enc); }
  45940. function mb_output_handler($contents, $status) { return p\Mbstring::mb_output_handler($contents, $status); }
  45941. function mb_http_input($type = '') { return p\Mbstring::mb_http_input($type); }
  45942. 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); }
  45943. }
  45944. if (!function_exists('mb_chr')) {
  45945. function mb_ord($s, $enc = null) { return p\Mbstring::mb_ord($s, $enc); }
  45946. function mb_chr($code, $enc = null) { return p\Mbstring::mb_chr($code, $enc); }
  45947. function mb_scrub($s, $enc = null) { $enc = null === $enc ? mb_internal_encoding() : $enc; return mb_convert_encoding($s, $enc, $enc); }
  45948. }
  45949. if (!function_exists('mb_str_split')) {
  45950. function mb_str_split($string, $split_length = 1, $encoding = null) { return p\Mbstring::mb_str_split($string, $split_length, $encoding); }
  45951. }
  45952. <?php
  45953. namespace Symfony\Component\Process\Exception;
  45954. interface ExceptionInterface
  45955. {
  45956. }
  45957. <?php
  45958. namespace Symfony\Component\Process\Exception;
  45959. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  45960. {
  45961. }
  45962. <?php
  45963. namespace Symfony\Component\Process\Exception;
  45964. class LogicException extends \LogicException implements ExceptionInterface
  45965. {
  45966. }
  45967. <?php
  45968. namespace Symfony\Component\Process\Exception;
  45969. use Symfony\Component\Process\Process;
  45970. class ProcessFailedException extends RuntimeException
  45971. {
  45972. private $process;
  45973. public function __construct(Process $process)
  45974. {
  45975. if ($process->isSuccessful()) {
  45976. throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
  45977. }
  45978. $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
  45979. $process->getCommandLine(),
  45980. $process->getExitCode(),
  45981. $process->getExitCodeText(),
  45982. $process->getWorkingDirectory()
  45983. );
  45984. if (!$process->isOutputDisabled()) {
  45985. $error .= sprintf("\n\nOutput:\n================\n%s\n\nError Output:\n================\n%s",
  45986. $process->getOutput(),
  45987. $process->getErrorOutput()
  45988. );
  45989. }
  45990. parent::__construct($error);
  45991. $this->process = $process;
  45992. }
  45993. public function getProcess()
  45994. {
  45995. return $this->process;
  45996. }
  45997. }
  45998. <?php
  45999. namespace Symfony\Component\Process\Exception;
  46000. use Symfony\Component\Process\Process;
  46001. class ProcessTimedOutException extends RuntimeException
  46002. {
  46003. const TYPE_GENERAL = 1;
  46004. const TYPE_IDLE = 2;
  46005. private $process;
  46006. private $timeoutType;
  46007. public function __construct(Process $process, $timeoutType)
  46008. {
  46009. $this->process = $process;
  46010. $this->timeoutType = $timeoutType;
  46011. parent::__construct(sprintf(
  46012. 'The process "%s" exceeded the timeout of %s seconds.',
  46013. $process->getCommandLine(),
  46014. $this->getExceededTimeout()
  46015. ));
  46016. }
  46017. public function getProcess()
  46018. {
  46019. return $this->process;
  46020. }
  46021. public function isGeneralTimeout()
  46022. {
  46023. return self::TYPE_GENERAL === $this->timeoutType;
  46024. }
  46025. public function isIdleTimeout()
  46026. {
  46027. return self::TYPE_IDLE === $this->timeoutType;
  46028. }
  46029. public function getExceededTimeout()
  46030. {
  46031. switch ($this->timeoutType) {
  46032. case self::TYPE_GENERAL:
  46033. return $this->process->getTimeout();
  46034. case self::TYPE_IDLE:
  46035. return $this->process->getIdleTimeout();
  46036. default:
  46037. throw new \LogicException(sprintf('Unknown timeout type "%d".', $this->timeoutType));
  46038. }
  46039. }
  46040. }
  46041. <?php
  46042. namespace Symfony\Component\Process\Exception;
  46043. class RuntimeException extends \RuntimeException implements ExceptionInterface
  46044. {
  46045. }
  46046. <?php
  46047. namespace Symfony\Component\Process;
  46048. class ExecutableFinder
  46049. {
  46050. private $suffixes = array('.exe', '.bat', '.cmd', '.com');
  46051. public function setSuffixes(array $suffixes)
  46052. {
  46053. $this->suffixes = $suffixes;
  46054. }
  46055. public function addSuffix($suffix)
  46056. {
  46057. $this->suffixes[] = $suffix;
  46058. }
  46059. public function find($name, $default = null, array $extraDirs = array())
  46060. {
  46061. if (ini_get('open_basedir')) {
  46062. $searchPath = explode(PATH_SEPARATOR, ini_get('open_basedir'));
  46063. $dirs = array();
  46064. foreach ($searchPath as $path) {
  46065. if (@is_dir($path)) {
  46066. $dirs[] = $path;
  46067. } else {
  46068. if (basename($path) == $name && @is_executable($path)) {
  46069. return $path;
  46070. }
  46071. }
  46072. }
  46073. } else {
  46074. $dirs = array_merge(
  46075. explode(PATH_SEPARATOR, getenv('PATH') ?: getenv('Path')),
  46076. $extraDirs
  46077. );
  46078. }
  46079. $suffixes = array('');
  46080. if ('\\' === \DIRECTORY_SEPARATOR) {
  46081. $pathExt = getenv('PATHEXT');
  46082. $suffixes = array_merge($pathExt ? explode(PATH_SEPARATOR, $pathExt) : $this->suffixes, $suffixes);
  46083. }
  46084. foreach ($suffixes as $suffix) {
  46085. foreach ($dirs as $dir) {
  46086. if (@is_file($file = $dir.\DIRECTORY_SEPARATOR.$name.$suffix) && ('\\' === \DIRECTORY_SEPARATOR || @is_executable($file))) {
  46087. return $file;
  46088. }
  46089. }
  46090. }
  46091. return $default;
  46092. }
  46093. }
  46094. Copyright (c) 2004-2018 Fabien Potencier
  46095. Permission is hereby granted, free of charge, to any person obtaining a copy
  46096. of this software and associated documentation files (the "Software"), to deal
  46097. in the Software without restriction, including without limitation the rights
  46098. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  46099. copies of the Software, and to permit persons to whom the Software is furnished
  46100. to do so, subject to the following conditions:
  46101. The above copyright notice and this permission notice shall be included in all
  46102. copies or substantial portions of the Software.
  46103. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  46104. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  46105. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  46106. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  46107. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  46108. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  46109. THE SOFTWARE.
  46110. <?php
  46111. namespace Symfony\Component\Process;
  46112. class PhpExecutableFinder
  46113. {
  46114. private $executableFinder;
  46115. public function __construct()
  46116. {
  46117. $this->executableFinder = new ExecutableFinder();
  46118. }
  46119. public function find($includeArgs = true)
  46120. {
  46121. $args = $this->findArguments();
  46122. $args = $includeArgs && $args ? ' '.implode(' ', $args) : '';
  46123. if (\defined('HHVM_VERSION')) {
  46124. return (getenv('PHP_BINARY') ?: PHP_BINARY).$args;
  46125. }
  46126. if (\defined('PHP_BINARY') && PHP_BINARY && \in_array(\PHP_SAPI, array('cli', 'cli-server', 'phpdbg'), true)) {
  46127. return PHP_BINARY.$args;
  46128. }
  46129. if ($php = getenv('PHP_PATH')) {
  46130. if (!@is_executable($php)) {
  46131. return false;
  46132. }
  46133. return $php;
  46134. }
  46135. if ($php = getenv('PHP_PEAR_PHP_BIN')) {
  46136. if (@is_executable($php)) {
  46137. return $php;
  46138. }
  46139. }
  46140. if (@is_executable($php = PHP_BINDIR.('\\' === \DIRECTORY_SEPARATOR ? '\\php.exe' : '/php'))) {
  46141. return $php;
  46142. }
  46143. $dirs = array(PHP_BINDIR);
  46144. if ('\\' === \DIRECTORY_SEPARATOR) {
  46145. $dirs[] = 'C:\xampp\php\\';
  46146. }
  46147. return $this->executableFinder->find('php', false, $dirs);
  46148. }
  46149. public function findArguments()
  46150. {
  46151. $arguments = array();
  46152. if (\defined('HHVM_VERSION')) {
  46153. $arguments[] = '--php';
  46154. } elseif ('phpdbg' === \PHP_SAPI) {
  46155. $arguments[] = '-qrr';
  46156. }
  46157. return $arguments;
  46158. }
  46159. }
  46160. <?php
  46161. namespace Symfony\Component\Process;
  46162. use Symfony\Component\Process\Exception\RuntimeException;
  46163. class PhpProcess extends Process
  46164. {
  46165. public function __construct($script, $cwd = null, array $env = null, $timeout = 60, array $options = array())
  46166. {
  46167. $executableFinder = new PhpExecutableFinder();
  46168. if (false === $php = $executableFinder->find()) {
  46169. $php = null;
  46170. }
  46171. if ('phpdbg' === \PHP_SAPI) {
  46172. $file = tempnam(sys_get_temp_dir(), 'dbg');
  46173. file_put_contents($file, $script);
  46174. register_shutdown_function('unlink', $file);
  46175. $php .= ' '.ProcessUtils::escapeArgument($file);
  46176. $script = null;
  46177. }
  46178. if ('\\' !== \DIRECTORY_SEPARATOR && null !== $php) {
  46179. $php = 'exec '.$php;
  46180. }
  46181. parent::__construct($php, $cwd, $env, $script, $timeout, $options);
  46182. }
  46183. public function setPhpBinary($php)
  46184. {
  46185. $this->setCommandLine($php);
  46186. }
  46187. public function start($callback = null)
  46188. {
  46189. if (null === $this->getCommandLine()) {
  46190. throw new RuntimeException('Unable to find the PHP executable.');
  46191. }
  46192. parent::start($callback);
  46193. }
  46194. }
  46195. <?php
  46196. namespace Symfony\Component\Process\Pipes;
  46197. abstract class AbstractPipes implements PipesInterface
  46198. {
  46199. public $pipes = array();
  46200. private $inputBuffer = '';
  46201. private $input;
  46202. private $blocked = true;
  46203. private $lastError;
  46204. public function __construct($input)
  46205. {
  46206. if (\is_resource($input)) {
  46207. $this->input = $input;
  46208. } elseif (\is_string($input)) {
  46209. $this->inputBuffer = $input;
  46210. } else {
  46211. $this->inputBuffer = (string) $input;
  46212. }
  46213. }
  46214. public function close()
  46215. {
  46216. foreach ($this->pipes as $pipe) {
  46217. fclose($pipe);
  46218. }
  46219. $this->pipes = array();
  46220. }
  46221. protected function hasSystemCallBeenInterrupted()
  46222. {
  46223. $lastError = $this->lastError;
  46224. $this->lastError = null;
  46225. return null !== $lastError && false !== stripos($lastError, 'interrupted system call');
  46226. }
  46227. protected function unblock()
  46228. {
  46229. if (!$this->blocked) {
  46230. return;
  46231. }
  46232. foreach ($this->pipes as $pipe) {
  46233. stream_set_blocking($pipe, 0);
  46234. }
  46235. if (null !== $this->input) {
  46236. stream_set_blocking($this->input, 0);
  46237. }
  46238. $this->blocked = false;
  46239. }
  46240. protected function write()
  46241. {
  46242. if (!isset($this->pipes[0])) {
  46243. return;
  46244. }
  46245. $input = $this->input;
  46246. $r = $e = array();
  46247. $w = array($this->pipes[0]);
  46248. if (false === @stream_select($r, $w, $e, 0, 0)) {
  46249. return;
  46250. }
  46251. foreach ($w as $stdin) {
  46252. if (isset($this->inputBuffer[0])) {
  46253. $written = fwrite($stdin, $this->inputBuffer);
  46254. $this->inputBuffer = substr($this->inputBuffer, $written);
  46255. if (isset($this->inputBuffer[0])) {
  46256. return array($this->pipes[0]);
  46257. }
  46258. }
  46259. if ($input) {
  46260. for (;;) {
  46261. $data = fread($input, self::CHUNK_SIZE);
  46262. if (!isset($data[0])) {
  46263. break;
  46264. }
  46265. $written = fwrite($stdin, $data);
  46266. $data = substr($data, $written);
  46267. if (isset($data[0])) {
  46268. $this->inputBuffer = $data;
  46269. return array($this->pipes[0]);
  46270. }
  46271. }
  46272. if (feof($input)) {
  46273. $this->input = null;
  46274. }
  46275. }
  46276. }
  46277. if (null === $this->input && !isset($this->inputBuffer[0])) {
  46278. fclose($this->pipes[0]);
  46279. unset($this->pipes[0]);
  46280. } elseif (!$w) {
  46281. return array($this->pipes[0]);
  46282. }
  46283. }
  46284. public function handleError($type, $msg)
  46285. {
  46286. $this->lastError = $msg;
  46287. }
  46288. }
  46289. <?php
  46290. namespace Symfony\Component\Process\Pipes;
  46291. interface PipesInterface
  46292. {
  46293. const CHUNK_SIZE = 16384;
  46294. public function getDescriptors();
  46295. public function getFiles();
  46296. public function readAndWrite($blocking, $close = false);
  46297. public function areOpen();
  46298. public function close();
  46299. }
  46300. <?php
  46301. namespace Symfony\Component\Process\Pipes;
  46302. use Symfony\Component\Process\Process;
  46303. class UnixPipes extends AbstractPipes
  46304. {
  46305. private $ttyMode;
  46306. private $ptyMode;
  46307. private $disableOutput;
  46308. public function __construct($ttyMode, $ptyMode, $input, $disableOutput)
  46309. {
  46310. $this->ttyMode = (bool) $ttyMode;
  46311. $this->ptyMode = (bool) $ptyMode;
  46312. $this->disableOutput = (bool) $disableOutput;
  46313. parent::__construct($input);
  46314. }
  46315. public function __destruct()
  46316. {
  46317. $this->close();
  46318. }
  46319. public function getDescriptors()
  46320. {
  46321. if ($this->disableOutput) {
  46322. $nullstream = fopen('/dev/null', 'c');
  46323. return array(
  46324. array('pipe', 'r'),
  46325. $nullstream,
  46326. $nullstream,
  46327. );
  46328. }
  46329. if ($this->ttyMode) {
  46330. return array(
  46331. array('file', '/dev/tty', 'r'),
  46332. array('file', '/dev/tty', 'w'),
  46333. array('file', '/dev/tty', 'w'),
  46334. );
  46335. }
  46336. if ($this->ptyMode && Process::isPtySupported()) {
  46337. return array(
  46338. array('pty'),
  46339. array('pty'),
  46340. array('pty'),
  46341. );
  46342. }
  46343. return array(
  46344. array('pipe', 'r'),
  46345. array('pipe', 'w'),
  46346. array('pipe', 'w'),
  46347. );
  46348. }
  46349. public function getFiles()
  46350. {
  46351. return array();
  46352. }
  46353. public function readAndWrite($blocking, $close = false)
  46354. {
  46355. $this->unblock();
  46356. $w = $this->write();
  46357. $read = $e = array();
  46358. $r = $this->pipes;
  46359. unset($r[0]);
  46360. set_error_handler(array($this, 'handleError'));
  46361. if (($r || $w) && false === stream_select($r, $w, $e, 0, $blocking ? Process::TIMEOUT_PRECISION * 1E6 : 0)) {
  46362. restore_error_handler();
  46363. if (!$this->hasSystemCallBeenInterrupted()) {
  46364. $this->pipes = array();
  46365. }
  46366. return $read;
  46367. }
  46368. restore_error_handler();
  46369. foreach ($r as $pipe) {
  46370. $read[$type = array_search($pipe, $this->pipes, true)] = '';
  46371. do {
  46372. $data = fread($pipe, self::CHUNK_SIZE);
  46373. $read[$type] .= $data;
  46374. } while (isset($data[0]) && ($close || isset($data[self::CHUNK_SIZE - 1])));
  46375. if (!isset($read[$type][0])) {
  46376. unset($read[$type]);
  46377. }
  46378. if ($close && feof($pipe)) {
  46379. fclose($pipe);
  46380. unset($this->pipes[$type]);
  46381. }
  46382. }
  46383. return $read;
  46384. }
  46385. public function areOpen()
  46386. {
  46387. return (bool) $this->pipes;
  46388. }
  46389. public static function create(Process $process, $input)
  46390. {
  46391. return new static($process->isTty(), $process->isPty(), $input, $process->isOutputDisabled());
  46392. }
  46393. }
  46394. <?php
  46395. namespace Symfony\Component\Process\Pipes;
  46396. use Symfony\Component\Process\Exception\RuntimeException;
  46397. use Symfony\Component\Process\Process;
  46398. class WindowsPipes extends AbstractPipes
  46399. {
  46400. private $files = array();
  46401. private $fileHandles = array();
  46402. private $lockHandles = array();
  46403. private $readBytes = array(
  46404. Process::STDOUT => 0,
  46405. Process::STDERR => 0,
  46406. );
  46407. private $disableOutput;
  46408. public function __construct($disableOutput, $input)
  46409. {
  46410. $this->disableOutput = (bool) $disableOutput;
  46411. if (!$this->disableOutput) {
  46412. $pipes = array(
  46413. Process::STDOUT => Process::OUT,
  46414. Process::STDERR => Process::ERR,
  46415. );
  46416. $tmpDir = sys_get_temp_dir();
  46417. $lastError = 'unknown reason';
  46418. set_error_handler(function ($type, $msg) use (&$lastError) { $lastError = $msg; });
  46419. for ($i = 0;; ++$i) {
  46420. foreach ($pipes as $pipe => $name) {
  46421. $file = sprintf('%s\\sf_proc_%02X.%s', $tmpDir, $i, $name);
  46422. if (!$h = fopen($file.'.lock', 'w')) {
  46423. restore_error_handler();
  46424. throw new RuntimeException(sprintf('A temporary file could not be opened to write the process output: %s', $lastError));
  46425. }
  46426. if (!flock($h, LOCK_EX | LOCK_NB)) {
  46427. continue 2;
  46428. }
  46429. if (isset($this->lockHandles[$pipe])) {
  46430. flock($this->lockHandles[$pipe], LOCK_UN);
  46431. fclose($this->lockHandles[$pipe]);
  46432. }
  46433. $this->lockHandles[$pipe] = $h;
  46434. if (!fclose(fopen($file, 'w')) || !$h = fopen($file, 'r')) {
  46435. flock($this->lockHandles[$pipe], LOCK_UN);
  46436. fclose($this->lockHandles[$pipe]);
  46437. unset($this->lockHandles[$pipe]);
  46438. continue 2;
  46439. }
  46440. $this->fileHandles[$pipe] = $h;
  46441. $this->files[$pipe] = $file;
  46442. }
  46443. break;
  46444. }
  46445. restore_error_handler();
  46446. }
  46447. parent::__construct($input);
  46448. }
  46449. public function __destruct()
  46450. {
  46451. $this->close();
  46452. }
  46453. public function getDescriptors()
  46454. {
  46455. if ($this->disableOutput) {
  46456. $nullstream = fopen('NUL', 'c');
  46457. return array(
  46458. array('pipe', 'r'),
  46459. $nullstream,
  46460. $nullstream,
  46461. );
  46462. }
  46463. return array(
  46464. array('pipe', 'r'),
  46465. array('file', 'NUL', 'w'),
  46466. array('file', 'NUL', 'w'),
  46467. );
  46468. }
  46469. public function getFiles()
  46470. {
  46471. return $this->files;
  46472. }
  46473. public function readAndWrite($blocking, $close = false)
  46474. {
  46475. $this->unblock();
  46476. $w = $this->write();
  46477. $read = $r = $e = array();
  46478. if ($blocking) {
  46479. if ($w) {
  46480. @stream_select($r, $w, $e, 0, Process::TIMEOUT_PRECISION * 1E6);
  46481. } elseif ($this->fileHandles) {
  46482. usleep(Process::TIMEOUT_PRECISION * 1E6);
  46483. }
  46484. }
  46485. foreach ($this->fileHandles as $type => $fileHandle) {
  46486. $data = stream_get_contents($fileHandle, -1, $this->readBytes[$type]);
  46487. if (isset($data[0])) {
  46488. $this->readBytes[$type] += \strlen($data);
  46489. $read[$type] = $data;
  46490. }
  46491. if ($close) {
  46492. ftruncate($fileHandle, 0);
  46493. fclose($fileHandle);
  46494. flock($this->lockHandles[$type], LOCK_UN);
  46495. fclose($this->lockHandles[$type]);
  46496. unset($this->fileHandles[$type], $this->lockHandles[$type]);
  46497. }
  46498. }
  46499. return $read;
  46500. }
  46501. public function areOpen()
  46502. {
  46503. return $this->pipes && $this->fileHandles;
  46504. }
  46505. public function close()
  46506. {
  46507. parent::close();
  46508. foreach ($this->fileHandles as $type => $handle) {
  46509. ftruncate($handle, 0);
  46510. fclose($handle);
  46511. flock($this->lockHandles[$type], LOCK_UN);
  46512. fclose($this->lockHandles[$type]);
  46513. }
  46514. $this->fileHandles = $this->lockHandles = array();
  46515. }
  46516. public static function create(Process $process, $input)
  46517. {
  46518. return new static($process->isOutputDisabled(), $input);
  46519. }
  46520. }
  46521. <?php
  46522. namespace Symfony\Component\Process;
  46523. use Symfony\Component\Process\Exception\InvalidArgumentException;
  46524. use Symfony\Component\Process\Exception\LogicException;
  46525. use Symfony\Component\Process\Exception\ProcessFailedException;
  46526. use Symfony\Component\Process\Exception\ProcessTimedOutException;
  46527. use Symfony\Component\Process\Exception\RuntimeException;
  46528. use Symfony\Component\Process\Pipes\PipesInterface;
  46529. use Symfony\Component\Process\Pipes\UnixPipes;
  46530. use Symfony\Component\Process\Pipes\WindowsPipes;
  46531. class Process
  46532. {
  46533. const ERR = 'err';
  46534. const OUT = 'out';
  46535. const STATUS_READY = 'ready';
  46536. const STATUS_STARTED = 'started';
  46537. const STATUS_TERMINATED = 'terminated';
  46538. const STDIN = 0;
  46539. const STDOUT = 1;
  46540. const STDERR = 2;
  46541. const TIMEOUT_PRECISION = 0.2;
  46542. private $callback;
  46543. private $commandline;
  46544. private $cwd;
  46545. private $env;
  46546. private $input;
  46547. private $starttime;
  46548. private $lastOutputTime;
  46549. private $timeout;
  46550. private $idleTimeout;
  46551. private $options;
  46552. private $exitcode;
  46553. private $fallbackStatus = array();
  46554. private $processInformation;
  46555. private $outputDisabled = false;
  46556. private $stdout;
  46557. private $stderr;
  46558. private $enhanceWindowsCompatibility = true;
  46559. private $enhanceSigchildCompatibility;
  46560. private $process;
  46561. private $status = self::STATUS_READY;
  46562. private $incrementalOutputOffset = 0;
  46563. private $incrementalErrorOutputOffset = 0;
  46564. private $tty;
  46565. private $pty;
  46566. private $useFileHandles = false;
  46567. private $processPipes;
  46568. private $latestSignal;
  46569. private static $sigchild;
  46570. public static $exitCodes = array(
  46571. 0 => 'OK',
  46572. 1 => 'General error',
  46573. 2 => 'Misuse of shell builtins',
  46574. 126 => 'Invoked command cannot execute',
  46575. 127 => 'Command not found',
  46576. 128 => 'Invalid exit argument',
  46577. 129 => 'Hangup',
  46578. 130 => 'Interrupt',
  46579. 131 => 'Quit and dump core',
  46580. 132 => 'Illegal instruction',
  46581. 133 => 'Trace/breakpoint trap',
  46582. 134 => 'Process aborted',
  46583. 135 => 'Bus error: "access to undefined portion of memory object"',
  46584. 136 => 'Floating point exception: "erroneous arithmetic operation"',
  46585. 137 => 'Kill (terminate immediately)',
  46586. 138 => 'User-defined 1',
  46587. 139 => 'Segmentation violation',
  46588. 140 => 'User-defined 2',
  46589. 141 => 'Write to pipe with no one reading',
  46590. 142 => 'Signal raised by alarm',
  46591. 143 => 'Termination (request to terminate)',
  46592. 145 => 'Child process terminated, stopped (or continued*)',
  46593. 146 => 'Continue if stopped',
  46594. 147 => 'Stop executing temporarily',
  46595. 148 => 'Terminal stop signal',
  46596. 149 => 'Background process attempting to read from tty ("in")',
  46597. 150 => 'Background process attempting to write to tty ("out")',
  46598. 151 => 'Urgent data available on socket',
  46599. 152 => 'CPU time limit exceeded',
  46600. 153 => 'File size limit exceeded',
  46601. 154 => 'Signal raised by timer counting virtual time: "virtual timer expired"',
  46602. 155 => 'Profiling timer expired',
  46603. 157 => 'Pollable event',
  46604. 159 => 'Bad syscall',
  46605. );
  46606. public function __construct($commandline, $cwd = null, array $env = null, $input = null, $timeout = 60, array $options = array())
  46607. {
  46608. if (!\function_exists('proc_open')) {
  46609. throw new RuntimeException('The Process class relies on proc_open, which is not available on your PHP installation.');
  46610. }
  46611. $this->commandline = $commandline;
  46612. $this->cwd = $cwd;
  46613. if (null === $this->cwd && (\defined('ZEND_THREAD_SAFE') || '\\' === \DIRECTORY_SEPARATOR)) {
  46614. $this->cwd = getcwd();
  46615. }
  46616. if (null !== $env) {
  46617. $this->setEnv($env);
  46618. }
  46619. $this->setInput($input);
  46620. $this->setTimeout($timeout);
  46621. $this->useFileHandles = '\\' === \DIRECTORY_SEPARATOR;
  46622. $this->pty = false;
  46623. $this->enhanceSigchildCompatibility = '\\' !== \DIRECTORY_SEPARATOR && $this->isSigchildEnabled();
  46624. $this->options = array_replace(array('suppress_errors' => true, 'binary_pipes' => true), $options);
  46625. }
  46626. public function __destruct()
  46627. {
  46628. $this->stop(0);
  46629. }
  46630. public function __clone()
  46631. {
  46632. $this->resetProcessData();
  46633. }
  46634. public function run($callback = null)
  46635. {
  46636. $this->start($callback);
  46637. return $this->wait();
  46638. }
  46639. public function mustRun($callback = null)
  46640. {
  46641. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46642. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46643. }
  46644. if (0 !== $this->run($callback)) {
  46645. throw new ProcessFailedException($this);
  46646. }
  46647. return $this;
  46648. }
  46649. public function start($callback = null)
  46650. {
  46651. if ($this->isRunning()) {
  46652. throw new RuntimeException('Process is already running');
  46653. }
  46654. if ($this->outputDisabled && null !== $callback) {
  46655. throw new LogicException('Output has been disabled, enable it to allow the use of a callback.');
  46656. }
  46657. $this->resetProcessData();
  46658. $this->starttime = $this->lastOutputTime = microtime(true);
  46659. $this->callback = $this->buildCallback($callback);
  46660. $descriptors = $this->getDescriptors();
  46661. $commandline = $this->commandline;
  46662. if ('\\' === \DIRECTORY_SEPARATOR && $this->enhanceWindowsCompatibility) {
  46663. $commandline = 'cmd /V:ON /E:ON /D /C "('.$commandline.')';
  46664. foreach ($this->processPipes->getFiles() as $offset => $filename) {
  46665. $commandline .= ' '.$offset.'>'.ProcessUtils::escapeArgument($filename);
  46666. }
  46667. $commandline .= '"';
  46668. if (!isset($this->options['bypass_shell'])) {
  46669. $this->options['bypass_shell'] = true;
  46670. }
  46671. } elseif (!$this->useFileHandles && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46672. $descriptors[3] = array('pipe', 'w');
  46673. $commandline = '{ ('.$this->commandline.') <&3 3<&- 3>/dev/null & } 3<&0;';
  46674. $commandline .= 'pid=$!; echo $pid >&3; wait $pid; code=$?; echo $code >&3; exit $code';
  46675. $ptsWorkaround = fopen(__FILE__, 'r');
  46676. }
  46677. $this->process = proc_open($commandline, $descriptors, $this->processPipes->pipes, $this->cwd, $this->env, $this->options);
  46678. if (!\is_resource($this->process)) {
  46679. throw new RuntimeException('Unable to launch a new process.');
  46680. }
  46681. $this->status = self::STATUS_STARTED;
  46682. if (isset($descriptors[3])) {
  46683. $this->fallbackStatus['pid'] = (int) fgets($this->processPipes->pipes[3]);
  46684. }
  46685. if ($this->tty) {
  46686. return;
  46687. }
  46688. $this->updateStatus(false);
  46689. $this->checkTimeout();
  46690. }
  46691. public function restart($callback = null)
  46692. {
  46693. if ($this->isRunning()) {
  46694. throw new RuntimeException('Process is already running');
  46695. }
  46696. $process = clone $this;
  46697. $process->start($callback);
  46698. return $process;
  46699. }
  46700. public function wait($callback = null)
  46701. {
  46702. $this->requireProcessIsStarted(__FUNCTION__);
  46703. $this->updateStatus(false);
  46704. if (null !== $callback) {
  46705. $this->callback = $this->buildCallback($callback);
  46706. }
  46707. do {
  46708. $this->checkTimeout();
  46709. $running = '\\' === \DIRECTORY_SEPARATOR ? $this->isRunning() : $this->processPipes->areOpen();
  46710. $this->readPipes($running, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  46711. } while ($running);
  46712. while ($this->isRunning()) {
  46713. usleep(1000);
  46714. }
  46715. if ($this->processInformation['signaled'] && $this->processInformation['termsig'] !== $this->latestSignal) {
  46716. throw new RuntimeException(sprintf('The process has been signaled with signal "%s".', $this->processInformation['termsig']));
  46717. }
  46718. return $this->exitcode;
  46719. }
  46720. public function getPid()
  46721. {
  46722. return $this->isRunning() ? $this->processInformation['pid'] : null;
  46723. }
  46724. public function signal($signal)
  46725. {
  46726. $this->doSignal($signal, true);
  46727. return $this;
  46728. }
  46729. public function disableOutput()
  46730. {
  46731. if ($this->isRunning()) {
  46732. throw new RuntimeException('Disabling output while the process is running is not possible.');
  46733. }
  46734. if (null !== $this->idleTimeout) {
  46735. throw new LogicException('Output can not be disabled while an idle timeout is set.');
  46736. }
  46737. $this->outputDisabled = true;
  46738. return $this;
  46739. }
  46740. public function enableOutput()
  46741. {
  46742. if ($this->isRunning()) {
  46743. throw new RuntimeException('Enabling output while the process is running is not possible.');
  46744. }
  46745. $this->outputDisabled = false;
  46746. return $this;
  46747. }
  46748. public function isOutputDisabled()
  46749. {
  46750. return $this->outputDisabled;
  46751. }
  46752. public function getOutput()
  46753. {
  46754. $this->readPipesForOutput(__FUNCTION__);
  46755. if (false === $ret = stream_get_contents($this->stdout, -1, 0)) {
  46756. return '';
  46757. }
  46758. return $ret;
  46759. }
  46760. public function getIncrementalOutput()
  46761. {
  46762. $this->readPipesForOutput(__FUNCTION__);
  46763. $latest = stream_get_contents($this->stdout, -1, $this->incrementalOutputOffset);
  46764. $this->incrementalOutputOffset = ftell($this->stdout);
  46765. if (false === $latest) {
  46766. return '';
  46767. }
  46768. return $latest;
  46769. }
  46770. public function clearOutput()
  46771. {
  46772. ftruncate($this->stdout, 0);
  46773. fseek($this->stdout, 0);
  46774. $this->incrementalOutputOffset = 0;
  46775. return $this;
  46776. }
  46777. public function getErrorOutput()
  46778. {
  46779. $this->readPipesForOutput(__FUNCTION__);
  46780. if (false === $ret = stream_get_contents($this->stderr, -1, 0)) {
  46781. return '';
  46782. }
  46783. return $ret;
  46784. }
  46785. public function getIncrementalErrorOutput()
  46786. {
  46787. $this->readPipesForOutput(__FUNCTION__);
  46788. $latest = stream_get_contents($this->stderr, -1, $this->incrementalErrorOutputOffset);
  46789. $this->incrementalErrorOutputOffset = ftell($this->stderr);
  46790. if (false === $latest) {
  46791. return '';
  46792. }
  46793. return $latest;
  46794. }
  46795. public function clearErrorOutput()
  46796. {
  46797. ftruncate($this->stderr, 0);
  46798. fseek($this->stderr, 0);
  46799. $this->incrementalErrorOutputOffset = 0;
  46800. return $this;
  46801. }
  46802. public function getExitCode()
  46803. {
  46804. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46805. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. You must use setEnhanceSigchildCompatibility() to use this method.');
  46806. }
  46807. $this->updateStatus(false);
  46808. return $this->exitcode;
  46809. }
  46810. public function getExitCodeText()
  46811. {
  46812. if (null === $exitcode = $this->getExitCode()) {
  46813. return;
  46814. }
  46815. return isset(self::$exitCodes[$exitcode]) ? self::$exitCodes[$exitcode] : 'Unknown error';
  46816. }
  46817. public function isSuccessful()
  46818. {
  46819. return 0 === $this->getExitCode();
  46820. }
  46821. public function hasBeenSignaled()
  46822. {
  46823. $this->requireProcessIsTerminated(__FUNCTION__);
  46824. if (!$this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  46825. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46826. }
  46827. return $this->processInformation['signaled'];
  46828. }
  46829. public function getTermSignal()
  46830. {
  46831. $this->requireProcessIsTerminated(__FUNCTION__);
  46832. if ($this->isSigchildEnabled() && (!$this->enhanceSigchildCompatibility || -1 === $this->processInformation['termsig'])) {
  46833. throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal can not be retrieved.');
  46834. }
  46835. return $this->processInformation['termsig'];
  46836. }
  46837. public function hasBeenStopped()
  46838. {
  46839. $this->requireProcessIsTerminated(__FUNCTION__);
  46840. return $this->processInformation['stopped'];
  46841. }
  46842. public function getStopSignal()
  46843. {
  46844. $this->requireProcessIsTerminated(__FUNCTION__);
  46845. return $this->processInformation['stopsig'];
  46846. }
  46847. public function isRunning()
  46848. {
  46849. if (self::STATUS_STARTED !== $this->status) {
  46850. return false;
  46851. }
  46852. $this->updateStatus(false);
  46853. return $this->processInformation['running'];
  46854. }
  46855. public function isStarted()
  46856. {
  46857. return self::STATUS_READY != $this->status;
  46858. }
  46859. public function isTerminated()
  46860. {
  46861. $this->updateStatus(false);
  46862. return self::STATUS_TERMINATED == $this->status;
  46863. }
  46864. public function getStatus()
  46865. {
  46866. $this->updateStatus(false);
  46867. return $this->status;
  46868. }
  46869. public function stop($timeout = 10, $signal = null)
  46870. {
  46871. $timeoutMicro = microtime(true) + $timeout;
  46872. if ($this->isRunning()) {
  46873. $this->doSignal(15, false);
  46874. do {
  46875. usleep(1000);
  46876. } while ($this->isRunning() && microtime(true) < $timeoutMicro);
  46877. if ($this->isRunning()) {
  46878. $this->doSignal($signal ?: 9, false);
  46879. }
  46880. }
  46881. if ($this->isRunning()) {
  46882. if (isset($this->fallbackStatus['pid'])) {
  46883. unset($this->fallbackStatus['pid']);
  46884. return $this->stop(0, $signal);
  46885. }
  46886. $this->close();
  46887. }
  46888. return $this->exitcode;
  46889. }
  46890. public function addOutput($line)
  46891. {
  46892. $this->lastOutputTime = microtime(true);
  46893. fseek($this->stdout, 0, SEEK_END);
  46894. fwrite($this->stdout, $line);
  46895. fseek($this->stdout, $this->incrementalOutputOffset);
  46896. }
  46897. public function addErrorOutput($line)
  46898. {
  46899. $this->lastOutputTime = microtime(true);
  46900. fseek($this->stderr, 0, SEEK_END);
  46901. fwrite($this->stderr, $line);
  46902. fseek($this->stderr, $this->incrementalErrorOutputOffset);
  46903. }
  46904. public function getCommandLine()
  46905. {
  46906. return $this->commandline;
  46907. }
  46908. public function setCommandLine($commandline)
  46909. {
  46910. $this->commandline = $commandline;
  46911. return $this;
  46912. }
  46913. public function getTimeout()
  46914. {
  46915. return $this->timeout;
  46916. }
  46917. public function getIdleTimeout()
  46918. {
  46919. return $this->idleTimeout;
  46920. }
  46921. public function setTimeout($timeout)
  46922. {
  46923. $this->timeout = $this->validateTimeout($timeout);
  46924. return $this;
  46925. }
  46926. public function setIdleTimeout($timeout)
  46927. {
  46928. if (null !== $timeout && $this->outputDisabled) {
  46929. throw new LogicException('Idle timeout can not be set while the output is disabled.');
  46930. }
  46931. $this->idleTimeout = $this->validateTimeout($timeout);
  46932. return $this;
  46933. }
  46934. public function setTty($tty)
  46935. {
  46936. if ('\\' === \DIRECTORY_SEPARATOR && $tty) {
  46937. throw new RuntimeException('TTY mode is not supported on Windows platform.');
  46938. }
  46939. if ($tty) {
  46940. static $isTtySupported;
  46941. if (null === $isTtySupported) {
  46942. $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);
  46943. }
  46944. if (!$isTtySupported) {
  46945. throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
  46946. }
  46947. }
  46948. $this->tty = (bool) $tty;
  46949. return $this;
  46950. }
  46951. public function isTty()
  46952. {
  46953. return $this->tty;
  46954. }
  46955. public function setPty($bool)
  46956. {
  46957. $this->pty = (bool) $bool;
  46958. return $this;
  46959. }
  46960. public function isPty()
  46961. {
  46962. return $this->pty;
  46963. }
  46964. public function getWorkingDirectory()
  46965. {
  46966. if (null === $this->cwd) {
  46967. return getcwd() ?: null;
  46968. }
  46969. return $this->cwd;
  46970. }
  46971. public function setWorkingDirectory($cwd)
  46972. {
  46973. $this->cwd = $cwd;
  46974. return $this;
  46975. }
  46976. public function getEnv()
  46977. {
  46978. return $this->env;
  46979. }
  46980. public function setEnv(array $env)
  46981. {
  46982. $env = array_filter($env, function ($value) {
  46983. return !\is_array($value);
  46984. });
  46985. $this->env = array();
  46986. foreach ($env as $key => $value) {
  46987. $this->env[$key] = (string) $value;
  46988. }
  46989. return $this;
  46990. }
  46991. public function getStdin()
  46992. {
  46993. @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);
  46994. return $this->getInput();
  46995. }
  46996. public function getInput()
  46997. {
  46998. return $this->input;
  46999. }
  47000. public function setStdin($stdin)
  47001. {
  47002. @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);
  47003. return $this->setInput($stdin);
  47004. }
  47005. public function setInput($input)
  47006. {
  47007. if ($this->isRunning()) {
  47008. throw new LogicException('Input can not be set while the process is running.');
  47009. }
  47010. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  47011. return $this;
  47012. }
  47013. public function getOptions()
  47014. {
  47015. return $this->options;
  47016. }
  47017. public function setOptions(array $options)
  47018. {
  47019. $this->options = $options;
  47020. return $this;
  47021. }
  47022. public function getEnhanceWindowsCompatibility()
  47023. {
  47024. return $this->enhanceWindowsCompatibility;
  47025. }
  47026. public function setEnhanceWindowsCompatibility($enhance)
  47027. {
  47028. $this->enhanceWindowsCompatibility = (bool) $enhance;
  47029. return $this;
  47030. }
  47031. public function getEnhanceSigchildCompatibility()
  47032. {
  47033. return $this->enhanceSigchildCompatibility;
  47034. }
  47035. public function setEnhanceSigchildCompatibility($enhance)
  47036. {
  47037. $this->enhanceSigchildCompatibility = (bool) $enhance;
  47038. return $this;
  47039. }
  47040. public function checkTimeout()
  47041. {
  47042. if (self::STATUS_STARTED !== $this->status) {
  47043. return;
  47044. }
  47045. if (null !== $this->timeout && $this->timeout < microtime(true) - $this->starttime) {
  47046. $this->stop(0);
  47047. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_GENERAL);
  47048. }
  47049. if (null !== $this->idleTimeout && $this->idleTimeout < microtime(true) - $this->lastOutputTime) {
  47050. $this->stop(0);
  47051. throw new ProcessTimedOutException($this, ProcessTimedOutException::TYPE_IDLE);
  47052. }
  47053. }
  47054. public static function isPtySupported()
  47055. {
  47056. static $result;
  47057. if (null !== $result) {
  47058. return $result;
  47059. }
  47060. if ('\\' === \DIRECTORY_SEPARATOR) {
  47061. return $result = false;
  47062. }
  47063. return $result = (bool) @proc_open('echo 1 >/dev/null', array(array('pty'), array('pty'), array('pty')), $pipes);
  47064. }
  47065. private function getDescriptors()
  47066. {
  47067. if ('\\' === \DIRECTORY_SEPARATOR) {
  47068. $this->processPipes = WindowsPipes::create($this, $this->input);
  47069. } else {
  47070. $this->processPipes = UnixPipes::create($this, $this->input);
  47071. }
  47072. return $this->processPipes->getDescriptors();
  47073. }
  47074. protected function buildCallback($callback)
  47075. {
  47076. $that = $this;
  47077. $out = self::OUT;
  47078. $callback = function ($type, $data) use ($that, $callback, $out) {
  47079. if ($out == $type) {
  47080. $that->addOutput($data);
  47081. } else {
  47082. $that->addErrorOutput($data);
  47083. }
  47084. if (null !== $callback) {
  47085. \call_user_func($callback, $type, $data);
  47086. }
  47087. };
  47088. return $callback;
  47089. }
  47090. protected function updateStatus($blocking)
  47091. {
  47092. if (self::STATUS_STARTED !== $this->status) {
  47093. return;
  47094. }
  47095. $this->processInformation = proc_get_status($this->process);
  47096. $running = $this->processInformation['running'];
  47097. $this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
  47098. if ($this->fallbackStatus && $this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  47099. $this->processInformation = $this->fallbackStatus + $this->processInformation;
  47100. }
  47101. if (!$running) {
  47102. $this->close();
  47103. }
  47104. }
  47105. protected function isSigchildEnabled()
  47106. {
  47107. if (null !== self::$sigchild) {
  47108. return self::$sigchild;
  47109. }
  47110. if (!\function_exists('phpinfo') || \defined('HHVM_VERSION')) {
  47111. return self::$sigchild = false;
  47112. }
  47113. ob_start();
  47114. phpinfo(INFO_GENERAL);
  47115. return self::$sigchild = false !== strpos(ob_get_clean(), '--enable-sigchild');
  47116. }
  47117. private function readPipesForOutput($caller)
  47118. {
  47119. if ($this->outputDisabled) {
  47120. throw new LogicException('Output has been disabled.');
  47121. }
  47122. $this->requireProcessIsStarted($caller);
  47123. $this->updateStatus(false);
  47124. }
  47125. private function validateTimeout($timeout)
  47126. {
  47127. $timeout = (float) $timeout;
  47128. if (0.0 === $timeout) {
  47129. $timeout = null;
  47130. } elseif ($timeout < 0) {
  47131. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47132. }
  47133. return $timeout;
  47134. }
  47135. private function readPipes($blocking, $close)
  47136. {
  47137. $result = $this->processPipes->readAndWrite($blocking, $close);
  47138. $callback = $this->callback;
  47139. foreach ($result as $type => $data) {
  47140. if (3 !== $type) {
  47141. $callback(self::STDOUT === $type ? self::OUT : self::ERR, $data);
  47142. } elseif (!isset($this->fallbackStatus['signaled'])) {
  47143. $this->fallbackStatus['exitcode'] = (int) $data;
  47144. }
  47145. }
  47146. }
  47147. private function close()
  47148. {
  47149. $this->processPipes->close();
  47150. if (\is_resource($this->process)) {
  47151. proc_close($this->process);
  47152. }
  47153. $this->exitcode = $this->processInformation['exitcode'];
  47154. $this->status = self::STATUS_TERMINATED;
  47155. if (-1 === $this->exitcode) {
  47156. if ($this->processInformation['signaled'] && 0 < $this->processInformation['termsig']) {
  47157. $this->exitcode = 128 + $this->processInformation['termsig'];
  47158. } elseif ($this->enhanceSigchildCompatibility && $this->isSigchildEnabled()) {
  47159. $this->processInformation['signaled'] = true;
  47160. $this->processInformation['termsig'] = -1;
  47161. }
  47162. }
  47163. $this->callback = null;
  47164. return $this->exitcode;
  47165. }
  47166. private function resetProcessData()
  47167. {
  47168. $this->starttime = null;
  47169. $this->callback = null;
  47170. $this->exitcode = null;
  47171. $this->fallbackStatus = array();
  47172. $this->processInformation = null;
  47173. $this->stdout = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47174. $this->stderr = fopen('php://temp/maxmemory:'.(1024 * 1024), 'w+b');
  47175. $this->process = null;
  47176. $this->latestSignal = null;
  47177. $this->status = self::STATUS_READY;
  47178. $this->incrementalOutputOffset = 0;
  47179. $this->incrementalErrorOutputOffset = 0;
  47180. }
  47181. private function doSignal($signal, $throwException)
  47182. {
  47183. if (null === $pid = $this->getPid()) {
  47184. if ($throwException) {
  47185. throw new LogicException('Can not send signal on a non running process.');
  47186. }
  47187. return false;
  47188. }
  47189. if ('\\' === \DIRECTORY_SEPARATOR) {
  47190. exec(sprintf('taskkill /F /T /PID %d 2>&1', $pid), $output, $exitCode);
  47191. if ($exitCode && $this->isRunning()) {
  47192. if ($throwException) {
  47193. throw new RuntimeException(sprintf('Unable to kill the process (%s).', implode(' ', $output)));
  47194. }
  47195. return false;
  47196. }
  47197. } else {
  47198. if (!$this->enhanceSigchildCompatibility || !$this->isSigchildEnabled()) {
  47199. $ok = @proc_terminate($this->process, $signal);
  47200. } elseif (\function_exists('posix_kill')) {
  47201. $ok = @posix_kill($pid, $signal);
  47202. } elseif ($ok = proc_open(sprintf('kill -%d %d', $signal, $pid), array(2 => array('pipe', 'w')), $pipes)) {
  47203. $ok = false === fgets($pipes[2]);
  47204. }
  47205. if (!$ok) {
  47206. if ($throwException) {
  47207. throw new RuntimeException(sprintf('Error while sending signal `%s`.', $signal));
  47208. }
  47209. return false;
  47210. }
  47211. }
  47212. $this->latestSignal = (int) $signal;
  47213. $this->fallbackStatus['signaled'] = true;
  47214. $this->fallbackStatus['exitcode'] = -1;
  47215. $this->fallbackStatus['termsig'] = $this->latestSignal;
  47216. return true;
  47217. }
  47218. private function requireProcessIsStarted($functionName)
  47219. {
  47220. if (!$this->isStarted()) {
  47221. throw new LogicException(sprintf('Process must be started before calling %s.', $functionName));
  47222. }
  47223. }
  47224. private function requireProcessIsTerminated($functionName)
  47225. {
  47226. if (!$this->isTerminated()) {
  47227. throw new LogicException(sprintf('Process must be terminated before calling %s.', $functionName));
  47228. }
  47229. }
  47230. }
  47231. <?php
  47232. namespace Symfony\Component\Process;
  47233. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47234. use Symfony\Component\Process\Exception\LogicException;
  47235. class ProcessBuilder
  47236. {
  47237. private $arguments;
  47238. private $cwd;
  47239. private $env = array();
  47240. private $input;
  47241. private $timeout = 60;
  47242. private $options = array();
  47243. private $inheritEnv = true;
  47244. private $prefix = array();
  47245. private $outputDisabled = false;
  47246. public function __construct(array $arguments = array())
  47247. {
  47248. $this->arguments = $arguments;
  47249. }
  47250. public static function create(array $arguments = array())
  47251. {
  47252. return new static($arguments);
  47253. }
  47254. public function add($argument)
  47255. {
  47256. $this->arguments[] = $argument;
  47257. return $this;
  47258. }
  47259. public function setPrefix($prefix)
  47260. {
  47261. $this->prefix = \is_array($prefix) ? $prefix : array($prefix);
  47262. return $this;
  47263. }
  47264. public function setArguments(array $arguments)
  47265. {
  47266. $this->arguments = $arguments;
  47267. return $this;
  47268. }
  47269. public function setWorkingDirectory($cwd)
  47270. {
  47271. $this->cwd = $cwd;
  47272. return $this;
  47273. }
  47274. public function inheritEnvironmentVariables($inheritEnv = true)
  47275. {
  47276. $this->inheritEnv = $inheritEnv;
  47277. return $this;
  47278. }
  47279. public function setEnv($name, $value)
  47280. {
  47281. $this->env[$name] = $value;
  47282. return $this;
  47283. }
  47284. public function addEnvironmentVariables(array $variables)
  47285. {
  47286. $this->env = array_replace($this->env, $variables);
  47287. return $this;
  47288. }
  47289. public function setInput($input)
  47290. {
  47291. $this->input = ProcessUtils::validateInput(__METHOD__, $input);
  47292. return $this;
  47293. }
  47294. public function setTimeout($timeout)
  47295. {
  47296. if (null === $timeout) {
  47297. $this->timeout = null;
  47298. return $this;
  47299. }
  47300. $timeout = (float) $timeout;
  47301. if ($timeout < 0) {
  47302. throw new InvalidArgumentException('The timeout value must be a valid positive integer or float number.');
  47303. }
  47304. $this->timeout = $timeout;
  47305. return $this;
  47306. }
  47307. public function setOption($name, $value)
  47308. {
  47309. $this->options[$name] = $value;
  47310. return $this;
  47311. }
  47312. public function disableOutput()
  47313. {
  47314. $this->outputDisabled = true;
  47315. return $this;
  47316. }
  47317. public function enableOutput()
  47318. {
  47319. $this->outputDisabled = false;
  47320. return $this;
  47321. }
  47322. public function getProcess()
  47323. {
  47324. if (0 === \count($this->prefix) && 0 === \count($this->arguments)) {
  47325. throw new LogicException('You must add() command arguments before calling getProcess().');
  47326. }
  47327. $options = $this->options;
  47328. $arguments = array_merge($this->prefix, $this->arguments);
  47329. $script = implode(' ', array_map(array(__NAMESPACE__.'\\ProcessUtils', 'escapeArgument'), $arguments));
  47330. if ($this->inheritEnv) {
  47331. $env = array_replace($_ENV, $_SERVER, $this->env);
  47332. } else {
  47333. $env = $this->env;
  47334. }
  47335. $process = new Process($script, $this->cwd, $env, $this->input, $this->timeout, $options);
  47336. if ($this->outputDisabled) {
  47337. $process->disableOutput();
  47338. }
  47339. return $process;
  47340. }
  47341. }
  47342. <?php
  47343. namespace Symfony\Component\Process;
  47344. use Symfony\Component\Process\Exception\InvalidArgumentException;
  47345. class ProcessUtils
  47346. {
  47347. private function __construct()
  47348. {
  47349. }
  47350. public static function escapeArgument($argument)
  47351. {
  47352. if ('\\' === \DIRECTORY_SEPARATOR) {
  47353. if ('' === $argument) {
  47354. return escapeshellarg($argument);
  47355. }
  47356. $escapedArgument = '';
  47357. $quote = false;
  47358. foreach (preg_split('/(")/', $argument, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE) as $part) {
  47359. if ('"' === $part) {
  47360. $escapedArgument .= '\\"';
  47361. } elseif (self::isSurroundedBy($part, '%')) {
  47362. $escapedArgument .= '^%"'.substr($part, 1, -1).'"^%';
  47363. } else {
  47364. if ('\\' === substr($part, -1)) {
  47365. $part .= '\\';
  47366. }
  47367. $quote = true;
  47368. $escapedArgument .= $part;
  47369. }
  47370. }
  47371. if ($quote) {
  47372. $escapedArgument = '"'.$escapedArgument.'"';
  47373. }
  47374. return $escapedArgument;
  47375. }
  47376. return "'".str_replace("'", "'\\''", $argument)."'";
  47377. }
  47378. public static function validateInput($caller, $input)
  47379. {
  47380. if (null !== $input) {
  47381. if (\is_resource($input)) {
  47382. return $input;
  47383. }
  47384. if (\is_string($input)) {
  47385. return $input;
  47386. }
  47387. if (is_scalar($input)) {
  47388. return (string) $input;
  47389. }
  47390. if (\is_object($input) && method_exists($input, '__toString')) {
  47391. @trigger_error('Passing an object as an input is deprecated since Symfony 2.5 and will be removed in 3.0.', E_USER_DEPRECATED);
  47392. return (string) $input;
  47393. }
  47394. throw new InvalidArgumentException(sprintf('%s only accepts strings or stream resources.', $caller));
  47395. }
  47396. return $input;
  47397. }
  47398. private static function isSurroundedBy($arg, $char)
  47399. {
  47400. return 2 < \strlen($arg) && $char === $arg[0] && $char === $arg[\strlen($arg) - 1];
  47401. }
  47402. }
  47403. Copyright (c) 2011 Jordi Boggiano
  47404. Permission is hereby granted, free of charge, to any person obtaining a copy
  47405. of this software and associated documentation files (the "Software"), to deal
  47406. in the Software without restriction, including without limitation the rights
  47407. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  47408. copies of the Software, and to permit persons to whom the Software is furnished
  47409. to do so, subject to the following conditions:
  47410. The above copyright notice and this permission notice shall be included in all
  47411. copies or substantial portions of the Software.
  47412. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  47413. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  47414. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  47415. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  47416. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  47417. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  47418. THE SOFTWARE.
  47419. <?php
  47420. namespace Seld\JsonLint;
  47421. class DuplicateKeyException extends ParsingException
  47422. {
  47423. public function __construct($message, $key, array $details = array())
  47424. {
  47425. $details['key'] = $key;
  47426. parent::__construct($message, $details);
  47427. }
  47428. public function getKey()
  47429. {
  47430. return $this->details['key'];
  47431. }
  47432. }
  47433. <?php
  47434. namespace Seld\JsonLint;
  47435. use stdClass;
  47436. class JsonParser
  47437. {
  47438. const DETECT_KEY_CONFLICTS = 1;
  47439. const ALLOW_DUPLICATE_KEYS = 2;
  47440. const PARSE_TO_ASSOC = 4;
  47441. private $lexer;
  47442. private $flags;
  47443. private $stack;
  47444. private $vstack;
  47445. private $lstack;
  47446. private $symbols = array(
  47447. 'error' => 2,
  47448. 'JSONString' => 3,
  47449. 'STRING' => 4,
  47450. 'JSONNumber' => 5,
  47451. 'NUMBER' => 6,
  47452. 'JSONNullLiteral' => 7,
  47453. 'NULL' => 8,
  47454. 'JSONBooleanLiteral' => 9,
  47455. 'TRUE' => 10,
  47456. 'FALSE' => 11,
  47457. 'JSONText' => 12,
  47458. 'JSONValue' => 13,
  47459. 'EOF' => 14,
  47460. 'JSONObject' => 15,
  47461. 'JSONArray' => 16,
  47462. '{' => 17,
  47463. '}' => 18,
  47464. 'JSONMemberList' => 19,
  47465. 'JSONMember' => 20,
  47466. ':' => 21,
  47467. ',' => 22,
  47468. '[' => 23,
  47469. ']' => 24,
  47470. 'JSONElementList' => 25,
  47471. '$accept' => 0,
  47472. '$end' => 1,
  47473. );
  47474. private $terminals_ = array(
  47475. 2 => "error",
  47476. 4 => "STRING",
  47477. 6 => "NUMBER",
  47478. 8 => "NULL",
  47479. 10 => "TRUE",
  47480. 11 => "FALSE",
  47481. 14 => "EOF",
  47482. 17 => "{",
  47483. 18 => "}",
  47484. 21 => ":",
  47485. 22 => ",",
  47486. 23 => "[",
  47487. 24 => "]",
  47488. );
  47489. private $productions_ = array(
  47490. 0,
  47491. array(3, 1),
  47492. array(5, 1),
  47493. array(7, 1),
  47494. array(9, 1),
  47495. array(9, 1),
  47496. array(12, 2),
  47497. array(13, 1),
  47498. array(13, 1),
  47499. array(13, 1),
  47500. array(13, 1),
  47501. array(13, 1),
  47502. array(13, 1),
  47503. array(15, 2),
  47504. array(15, 3),
  47505. array(20, 3),
  47506. array(19, 1),
  47507. array(19, 3),
  47508. array(16, 2),
  47509. array(16, 3),
  47510. array(25, 1),
  47511. array(25, 3)
  47512. );
  47513. 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)),
  47514. );
  47515. private $defaultActions = array(
  47516. 16 => array(2, 6)
  47517. );
  47518. public function lint($input, $flags = 0)
  47519. {
  47520. try {
  47521. $this->parse($input, $flags);
  47522. } catch (ParsingException $e) {
  47523. return $e;
  47524. }
  47525. }
  47526. public function parse($input, $flags = 0)
  47527. {
  47528. $this->failOnBOM($input);
  47529. $this->flags = $flags;
  47530. $this->stack = array(0);
  47531. $this->vstack = array(null);
  47532. $this->lstack = array();
  47533. $yytext = '';
  47534. $yylineno = 0;
  47535. $yyleng = 0;
  47536. $recovering = 0;
  47537. $TERROR = 2;
  47538. $EOF = 1;
  47539. $this->lexer = new Lexer();
  47540. $this->lexer->setInput($input);
  47541. $yyloc = $this->lexer->yylloc;
  47542. $this->lstack[] = $yyloc;
  47543. $symbol = null;
  47544. $preErrorSymbol = null;
  47545. $state = null;
  47546. $action = null;
  47547. $a = null;
  47548. $r = null;
  47549. $yyval = new stdClass;
  47550. $p = null;
  47551. $len = null;
  47552. $newState = null;
  47553. $expected = null;
  47554. $errStr = null;
  47555. while (true) {
  47556. $state = $this->stack[count($this->stack)-1];
  47557. if (isset($this->defaultActions[$state])) {
  47558. $action = $this->defaultActions[$state];
  47559. } else {
  47560. if ($symbol == null) {
  47561. $symbol = $this->lex();
  47562. }
  47563. $action = isset($this->table[$state][$symbol]) ? $this->table[$state][$symbol] : false;
  47564. }
  47565. if (!$action || !$action[0]) {
  47566. if (!$recovering) {
  47567. $expected = array();
  47568. foreach ($this->table[$state] as $p => $ignore) {
  47569. if (isset($this->terminals_[$p]) && $p > 2) {
  47570. $expected[] = "'" . $this->terminals_[$p] . "'";
  47571. }
  47572. }
  47573. $message = null;
  47574. if (in_array("'STRING'", $expected) && in_array(substr($this->lexer->match, 0, 1), array('"', "'"))) {
  47575. $message = "Invalid string";
  47576. if ("'" === substr($this->lexer->match, 0, 1)) {
  47577. $message .= ", it appears you used single quotes instead of double quotes";
  47578. } elseif (preg_match('{".+?(\\\\[^"bfnrt/\\\\u])}', $this->lexer->getUpcomingInput(), $match)) {
  47579. $message .= ", it appears you have an unescaped backslash at: ".$match[1];
  47580. } elseif (preg_match('{"(?:[^"]+|\\\\")*$}m', $this->lexer->getUpcomingInput())) {
  47581. $message .= ", it appears you forgot to terminate a string, or attempted to write a multiline string which is invalid";
  47582. }
  47583. }
  47584. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47585. $errStr .= $this->lexer->showPosition() . "\n";
  47586. if ($message) {
  47587. $errStr .= $message;
  47588. } else {
  47589. $errStr .= (count($expected) > 1) ? "Expected one of: " : "Expected: ";
  47590. $errStr .= implode(', ', $expected);
  47591. }
  47592. if (',' === substr(trim($this->lexer->getPastInput()), -1)) {
  47593. $errStr .= " - It appears you have an extra trailing comma";
  47594. }
  47595. $this->parseError($errStr, array(
  47596. 'text' => $this->lexer->match,
  47597. 'token' => !empty($this->terminals_[$symbol]) ? $this->terminals_[$symbol] : $symbol,
  47598. 'line' => $this->lexer->yylineno,
  47599. 'loc' => $yyloc,
  47600. 'expected' => $expected,
  47601. ));
  47602. }
  47603. if ($recovering == 3) {
  47604. if ($symbol == $EOF) {
  47605. throw new ParsingException($errStr ?: 'Parsing halted.');
  47606. }
  47607. $yyleng = $this->lexer->yyleng;
  47608. $yytext = $this->lexer->yytext;
  47609. $yylineno = $this->lexer->yylineno;
  47610. $yyloc = $this->lexer->yylloc;
  47611. $symbol = $this->lex();
  47612. }
  47613. while (true) {
  47614. if (array_key_exists($TERROR, $this->table[$state])) {
  47615. break;
  47616. }
  47617. if ($state == 0) {
  47618. throw new ParsingException($errStr ?: 'Parsing halted.');
  47619. }
  47620. $this->popStack(1);
  47621. $state = $this->stack[count($this->stack)-1];
  47622. }
  47623. $preErrorSymbol = $symbol;
  47624. $symbol = $TERROR;
  47625. $state = $this->stack[count($this->stack)-1];
  47626. $action = isset($this->table[$state][$TERROR]) ? $this->table[$state][$TERROR] : false;
  47627. $recovering = 3;
  47628. }
  47629. if (is_array($action[0]) && count($action) > 1) {
  47630. throw new ParsingException('Parse Error: multiple actions possible at state: ' . $state . ', token: ' . $symbol);
  47631. }
  47632. switch ($action[0]) {
  47633. case 1:
  47634. $this->stack[] = $symbol;
  47635. $this->vstack[] = $this->lexer->yytext;
  47636. $this->lstack[] = $this->lexer->yylloc;
  47637. $this->stack[] = $action[1];
  47638. $symbol = null;
  47639. if (!$preErrorSymbol) {
  47640. $yyleng = $this->lexer->yyleng;
  47641. $yytext = $this->lexer->yytext;
  47642. $yylineno = $this->lexer->yylineno;
  47643. $yyloc = $this->lexer->yylloc;
  47644. if ($recovering > 0) {
  47645. $recovering--;
  47646. }
  47647. } else {
  47648. $symbol = $preErrorSymbol;
  47649. $preErrorSymbol = null;
  47650. }
  47651. break;
  47652. case 2:
  47653. $len = $this->productions_[$action[1]][1];
  47654. $yyval->token = $this->vstack[count($this->vstack) - $len];
  47655. $yyval->store = array(
  47656. 'first_line' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_line'],
  47657. 'last_line' => $this->lstack[count($this->lstack) - 1]['last_line'],
  47658. 'first_column' => $this->lstack[count($this->lstack) - ($len ?: 1)]['first_column'],
  47659. 'last_column' => $this->lstack[count($this->lstack) - 1]['last_column'],
  47660. );
  47661. $r = $this->performAction($yyval, $yytext, $yyleng, $yylineno, $action[1], $this->vstack, $this->lstack);
  47662. if (!$r instanceof Undefined) {
  47663. return $r;
  47664. }
  47665. if ($len) {
  47666. $this->popStack($len);
  47667. }
  47668. $this->stack[] = $this->productions_[$action[1]][0];
  47669. $this->vstack[] = $yyval->token;
  47670. $this->lstack[] = $yyval->store;
  47671. $newState = $this->table[$this->stack[count($this->stack)-2]][$this->stack[count($this->stack)-1]];
  47672. $this->stack[] = $newState;
  47673. break;
  47674. case 3:
  47675. return true;
  47676. }
  47677. }
  47678. return true;
  47679. }
  47680. protected function parseError($str, $hash)
  47681. {
  47682. throw new ParsingException($str, $hash);
  47683. }
  47684. private function performAction(stdClass $yyval, $yytext, $yyleng, $yylineno, $yystate, &$tokens)
  47685. {
  47686. $len = count($tokens) - 1;
  47687. switch ($yystate) {
  47688. case 1:
  47689. $yytext = preg_replace_callback('{(?:\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4})}', array($this, 'stringInterpolation'), $yytext);
  47690. $yyval->token = $yytext;
  47691. break;
  47692. case 2:
  47693. if (strpos($yytext, 'e') !== false || strpos($yytext, 'E') !== false) {
  47694. $yyval->token = floatval($yytext);
  47695. } else {
  47696. $yyval->token = strpos($yytext, '.') === false ? intval($yytext) : floatval($yytext);
  47697. }
  47698. break;
  47699. case 3:
  47700. $yyval->token = null;
  47701. break;
  47702. case 4:
  47703. $yyval->token = true;
  47704. break;
  47705. case 5:
  47706. $yyval->token = false;
  47707. break;
  47708. case 6:
  47709. return $yyval->token = $tokens[$len-1];
  47710. case 13:
  47711. if ($this->flags & self::PARSE_TO_ASSOC) {
  47712. $yyval->token = array();
  47713. } else {
  47714. $yyval->token = new stdClass;
  47715. }
  47716. break;
  47717. case 14:
  47718. $yyval->token = $tokens[$len-1];
  47719. break;
  47720. case 15:
  47721. $yyval->token = array($tokens[$len-2], $tokens[$len]);
  47722. break;
  47723. case 16:
  47724. if (PHP_VERSION_ID < 70100) {
  47725. $property = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47726. } else {
  47727. $property = $tokens[$len][0];
  47728. }
  47729. if ($this->flags & self::PARSE_TO_ASSOC) {
  47730. $yyval->token = array();
  47731. $yyval->token[$property] = $tokens[$len][1];
  47732. } else {
  47733. $yyval->token = new stdClass;
  47734. $yyval->token->$property = $tokens[$len][1];
  47735. }
  47736. break;
  47737. case 17:
  47738. if ($this->flags & self::PARSE_TO_ASSOC) {
  47739. $yyval->token =& $tokens[$len-2];
  47740. $key = $tokens[$len][0];
  47741. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2][$key])) {
  47742. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47743. $errStr .= $this->lexer->showPosition() . "\n";
  47744. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47745. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47746. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2][$key])) {
  47747. $duplicateCount = 1;
  47748. do {
  47749. $duplicateKey = $key . '.' . $duplicateCount++;
  47750. } while (isset($tokens[$len-2][$duplicateKey]));
  47751. $key = $duplicateKey;
  47752. }
  47753. $tokens[$len-2][$key] = $tokens[$len][1];
  47754. } else {
  47755. $yyval->token = $tokens[$len-2];
  47756. if (PHP_VERSION_ID < 70100) {
  47757. $key = $tokens[$len][0] === '' ? '_empty_' : $tokens[$len][0];
  47758. } else {
  47759. $key = $tokens[$len][0];
  47760. }
  47761. if (($this->flags & self::DETECT_KEY_CONFLICTS) && isset($tokens[$len-2]->{$key})) {
  47762. $errStr = 'Parse error on line ' . ($yylineno+1) . ":\n";
  47763. $errStr .= $this->lexer->showPosition() . "\n";
  47764. $errStr .= "Duplicate key: ".$tokens[$len][0];
  47765. throw new DuplicateKeyException($errStr, $tokens[$len][0], array('line' => $yylineno+1));
  47766. } elseif (($this->flags & self::ALLOW_DUPLICATE_KEYS) && isset($tokens[$len-2]->{$key})) {
  47767. $duplicateCount = 1;
  47768. do {
  47769. $duplicateKey = $key . '.' . $duplicateCount++;
  47770. } while (isset($tokens[$len-2]->$duplicateKey));
  47771. $key = $duplicateKey;
  47772. }
  47773. $tokens[$len-2]->$key = $tokens[$len][1];
  47774. }
  47775. break;
  47776. case 18:
  47777. $yyval->token = array();
  47778. break;
  47779. case 19:
  47780. $yyval->token = $tokens[$len-1];
  47781. break;
  47782. case 20:
  47783. $yyval->token = array($tokens[$len]);
  47784. break;
  47785. case 21:
  47786. $tokens[$len-2][] = $tokens[$len];
  47787. $yyval->token = $tokens[$len-2];
  47788. break;
  47789. }
  47790. return new Undefined();
  47791. }
  47792. private function stringInterpolation($match)
  47793. {
  47794. switch ($match[0]) {
  47795. case '\\\\':
  47796. return '\\';
  47797. case '\"':
  47798. return '"';
  47799. case '\b':
  47800. return chr(8);
  47801. case '\f':
  47802. return chr(12);
  47803. case '\n':
  47804. return "\n";
  47805. case '\r':
  47806. return "\r";
  47807. case '\t':
  47808. return "\t";
  47809. case '\/':
  47810. return "/";
  47811. default:
  47812. return html_entity_decode('&#x'.ltrim(substr($match[0], 2), '0').';', ENT_QUOTES, 'UTF-8');
  47813. }
  47814. }
  47815. private function popStack($n)
  47816. {
  47817. $this->stack = array_slice($this->stack, 0, - (2 * $n));
  47818. $this->vstack = array_slice($this->vstack, 0, - $n);
  47819. $this->lstack = array_slice($this->lstack, 0, - $n);
  47820. }
  47821. private function lex()
  47822. {
  47823. $token = $this->lexer->lex() ?: 1;
  47824. if (!is_numeric($token)) {
  47825. $token = isset($this->symbols[$token]) ? $this->symbols[$token] : $token;
  47826. }
  47827. return $token;
  47828. }
  47829. private function failOnBOM($input)
  47830. {
  47831. $bom = "\xEF\xBB\xBF";
  47832. if (substr($input, 0, 3) === $bom) {
  47833. $this->parseError("BOM detected, make sure your input does not include a Unicode Byte-Order-Mark", array());
  47834. }
  47835. }
  47836. }
  47837. <?php
  47838. namespace Seld\JsonLint;
  47839. class Lexer
  47840. {
  47841. private $EOF = 1;
  47842. private $rules = array(
  47843. 0 => '/^\s+/',
  47844. 1 => '/^-?([0-9]|[1-9][0-9]+)(\.[0-9]+)?([eE][+-]?[0-9]+)?\b/',
  47845. 2 => '{^"(?>\\\\["bfnrt/\\\\]|\\\\u[a-fA-F0-9]{4}|[^\0-\x1f\\\\"]++)*+"}',
  47846. 3 => '/^\{/',
  47847. 4 => '/^\}/',
  47848. 5 => '/^\[/',
  47849. 6 => '/^\]/',
  47850. 7 => '/^,/',
  47851. 8 => '/^:/',
  47852. 9 => '/^true\b/',
  47853. 10 => '/^false\b/',
  47854. 11 => '/^null\b/',
  47855. 12 => '/^$/',
  47856. 13 => '/^./',
  47857. );
  47858. private $conditions = array(
  47859. "INITIAL" => array(
  47860. "rules" => array(0,1,2,3,4,5,6,7,8,9,10,11,12,13),
  47861. "inclusive" => true,
  47862. ),
  47863. );
  47864. private $conditionStack;
  47865. private $input;
  47866. private $more;
  47867. private $done;
  47868. private $matched;
  47869. public $match;
  47870. public $yylineno;
  47871. public $yyleng;
  47872. public $yytext;
  47873. public $yylloc;
  47874. public function lex()
  47875. {
  47876. $r = $this->next();
  47877. if (!$r instanceof Undefined) {
  47878. return $r;
  47879. }
  47880. return $this->lex();
  47881. }
  47882. public function setInput($input)
  47883. {
  47884. $this->input = $input;
  47885. $this->more = false;
  47886. $this->done = false;
  47887. $this->yylineno = $this->yyleng = 0;
  47888. $this->yytext = $this->matched = $this->match = '';
  47889. $this->conditionStack = array('INITIAL');
  47890. $this->yylloc = array('first_line' => 1, 'first_column' => 0, 'last_line' => 1, 'last_column' => 0);
  47891. return $this;
  47892. }
  47893. public function showPosition()
  47894. {
  47895. $pre = str_replace("\n", '', $this->getPastInput());
  47896. $c = str_repeat('-', max(0, strlen($pre) - 1));
  47897. return $pre . str_replace("\n", '', $this->getUpcomingInput()) . "\n" . $c . "^";
  47898. }
  47899. public function getPastInput()
  47900. {
  47901. $past = substr($this->matched, 0, strlen($this->matched) - strlen($this->match));
  47902. return (strlen($past) > 20 ? '...' : '') . substr($past, -20);
  47903. }
  47904. public function getUpcomingInput()
  47905. {
  47906. $next = $this->match;
  47907. if (strlen($next) < 20) {
  47908. $next .= substr($this->input, 0, 20 - strlen($next));
  47909. }
  47910. return substr($next, 0, 20) . (strlen($next) > 20 ? '...' : '');
  47911. }
  47912. protected function parseError($str, $hash)
  47913. {
  47914. throw new \Exception($str);
  47915. }
  47916. private function next()
  47917. {
  47918. if ($this->done) {
  47919. return $this->EOF;
  47920. }
  47921. if ($this->input === '') {
  47922. $this->done = true;
  47923. }
  47924. $token = null;
  47925. $match = null;
  47926. $col = null;
  47927. $lines = null;
  47928. if (!$this->more) {
  47929. $this->yytext = '';
  47930. $this->match = '';
  47931. }
  47932. $rules = $this->getCurrentRules();
  47933. $rulesLen = count($rules);
  47934. for ($i=0; $i < $rulesLen; $i++) {
  47935. if (preg_match($this->rules[$rules[$i]], $this->input, $match)) {
  47936. preg_match_all('/\n.*/', $match[0], $lines);
  47937. $lines = $lines[0];
  47938. if ($lines) {
  47939. $this->yylineno += count($lines);
  47940. }
  47941. $this->yylloc = array(
  47942. 'first_line' => $this->yylloc['last_line'],
  47943. 'last_line' => $this->yylineno+1,
  47944. 'first_column' => $this->yylloc['last_column'],
  47945. 'last_column' => $lines ? strlen($lines[count($lines) - 1]) - 1 : $this->yylloc['last_column'] + strlen($match[0]),
  47946. );
  47947. $this->yytext .= $match[0];
  47948. $this->match .= $match[0];
  47949. $this->yyleng = strlen($this->yytext);
  47950. $this->more = false;
  47951. $this->input = substr($this->input, strlen($match[0]));
  47952. $this->matched .= $match[0];
  47953. $token = $this->performAction($rules[$i], $this->conditionStack[count($this->conditionStack)-1]);
  47954. if ($token) {
  47955. return $token;
  47956. }
  47957. return new Undefined();
  47958. }
  47959. }
  47960. if ($this->input === "") {
  47961. return $this->EOF;
  47962. }
  47963. $this->parseError(
  47964. 'Lexical error on line ' . ($this->yylineno+1) . ". Unrecognized text.\n" . $this->showPosition(),
  47965. array(
  47966. 'text' => "",
  47967. 'token' => null,
  47968. 'line' => $this->yylineno,
  47969. )
  47970. );
  47971. }
  47972. private function getCurrentRules()
  47973. {
  47974. return $this->conditions[$this->conditionStack[count($this->conditionStack)-1]]['rules'];
  47975. }
  47976. private function performAction($avoiding_name_collisions, $YY_START)
  47977. {
  47978. switch ($avoiding_name_collisions) {
  47979. case 0:
  47980. break;
  47981. case 1:
  47982. return 6;
  47983. break;
  47984. case 2:
  47985. $this->yytext = substr($this->yytext, 1, $this->yyleng-2);
  47986. return 4;
  47987. case 3:
  47988. return 17;
  47989. case 4:
  47990. return 18;
  47991. case 5:
  47992. return 23;
  47993. case 6:
  47994. return 24;
  47995. case 7:
  47996. return 22;
  47997. case 8:
  47998. return 21;
  47999. case 9:
  48000. return 10;
  48001. case 10:
  48002. return 11;
  48003. case 11:
  48004. return 8;
  48005. case 12:
  48006. return 14;
  48007. case 13:
  48008. return 'INVALID';
  48009. }
  48010. }
  48011. }
  48012. <?php
  48013. namespace Seld\JsonLint;
  48014. class ParsingException extends \Exception
  48015. {
  48016. protected $details;
  48017. public function __construct($message, $details = array())
  48018. {
  48019. $this->details = $details;
  48020. parent::__construct($message);
  48021. }
  48022. public function getDetails()
  48023. {
  48024. return $this->details;
  48025. }
  48026. }
  48027. <?php
  48028. namespace Seld\JsonLint;
  48029. class Undefined
  48030. {
  48031. }
  48032. MIT License
  48033. Copyright (c) 2016
  48034. Permission is hereby granted, free of charge, to any person obtaining a copy
  48035. of this software and associated documentation files (the "Software"), to deal
  48036. in the Software without restriction, including without limitation the rights
  48037. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  48038. copies of the Software, and to permit persons to whom the Software is
  48039. furnished to do so, subject to the following conditions:
  48040. The above copyright notice and this permission notice shall be included in all
  48041. copies or substantial portions of the Software.
  48042. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  48043. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  48044. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  48045. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  48046. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  48047. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  48048. SOFTWARE.
  48049. <?php
  48050. require __DIR__ . '/../vendor/autoload.php';
  48051. $data = json_decode(file_get_contents('data.json'));
  48052. $validator = new JsonSchema\Validator();
  48053. $validator->check($data, (object) array('$ref' => 'file://' . realpath('schema.json')));
  48054. if ($validator->isValid()) {
  48055. echo "The supplied JSON validates against the schema.\n";
  48056. } else {
  48057. echo "JSON does not validate. Violations:\n";
  48058. foreach ($validator->getErrors() as $error) {
  48059. echo sprintf("[%s] %s\n", $error['property'], $error['message']);
  48060. }
  48061. }
  48062. <?php
  48063. namespace JsonSchema\Constraints;
  48064. use JsonSchema\Entity\JsonPointer;
  48065. use JsonSchema\Exception\InvalidArgumentException;
  48066. use JsonSchema\Exception\ValidationException;
  48067. use JsonSchema\Validator;
  48068. class BaseConstraint
  48069. {
  48070. protected $errors = array();
  48071. protected $errorMask = Validator::ERROR_NONE;
  48072. protected $factory;
  48073. public function __construct(Factory $factory = null)
  48074. {
  48075. $this->factory = $factory ?: new Factory();
  48076. }
  48077. public function addError(JsonPointer $path = null, $message, $constraint = '', array $more = null)
  48078. {
  48079. $error = array(
  48080. 'property' => $this->convertJsonPointerIntoPropertyPath($path ?: new JsonPointer('')),
  48081. 'pointer' => ltrim(strval($path ?: new JsonPointer('')), '#'),
  48082. 'message' => $message,
  48083. 'constraint' => $constraint,
  48084. 'context' => $this->factory->getErrorContext(),
  48085. );
  48086. if ($this->factory->getConfig(Constraint::CHECK_MODE_EXCEPTIONS)) {
  48087. throw new ValidationException(sprintf('Error validating %s: %s', $error['pointer'], $error['message']));
  48088. }
  48089. if (is_array($more) && count($more) > 0) {
  48090. $error += $more;
  48091. }
  48092. $this->errors[] = $error;
  48093. $this->errorMask |= $error['context'];
  48094. }
  48095. public function addErrors(array $errors)
  48096. {
  48097. if ($errors) {
  48098. $this->errors = array_merge($this->errors, $errors);
  48099. $errorMask = &$this->errorMask;
  48100. array_walk($errors, function ($error) use (&$errorMask) {
  48101. if (isset($error['context'])) {
  48102. $errorMask |= $error['context'];
  48103. }
  48104. });
  48105. }
  48106. }
  48107. public function getErrors($errorContext = Validator::ERROR_ALL)
  48108. {
  48109. if ($errorContext === Validator::ERROR_ALL) {
  48110. return $this->errors;
  48111. }
  48112. return array_filter($this->errors, function ($error) use ($errorContext) {
  48113. if ($errorContext & $error['context']) {
  48114. return true;
  48115. }
  48116. });
  48117. }
  48118. public function numErrors($errorContext = Validator::ERROR_ALL)
  48119. {
  48120. if ($errorContext === Validator::ERROR_ALL) {
  48121. return count($this->errors);
  48122. }
  48123. return count($this->getErrors($errorContext));
  48124. }
  48125. public function isValid()
  48126. {
  48127. return !$this->getErrors();
  48128. }
  48129. public function reset()
  48130. {
  48131. $this->errors = array();
  48132. $this->errorMask = Validator::ERROR_NONE;
  48133. }
  48134. public function getErrorMask()
  48135. {
  48136. return $this->errorMask;
  48137. }
  48138. public static function arrayToObjectRecursive($array)
  48139. {
  48140. $json = json_encode($array);
  48141. if (json_last_error() !== \JSON_ERROR_NONE) {
  48142. $message = 'Unable to encode schema array as JSON';
  48143. if (function_exists('json_last_error_msg')) {
  48144. $message .= ': ' . json_last_error_msg();
  48145. }
  48146. throw new InvalidArgumentException($message);
  48147. }
  48148. return (object) json_decode($json);
  48149. }
  48150. }
  48151. <?php
  48152. namespace JsonSchema\Constraints;
  48153. use JsonSchema\Entity\JsonPointer;
  48154. class CollectionConstraint extends Constraint
  48155. {
  48156. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48157. {
  48158. if (isset($schema->minItems) && count($value) < $schema->minItems) {
  48159. $this->addError($path, 'There must be a minimum of ' . $schema->minItems . ' items in the array', 'minItems', array('minItems' => $schema->minItems));
  48160. }
  48161. if (isset($schema->maxItems) && count($value) > $schema->maxItems) {
  48162. $this->addError($path, 'There must be a maximum of ' . $schema->maxItems . ' items in the array', 'maxItems', array('maxItems' => $schema->maxItems));
  48163. }
  48164. if (isset($schema->uniqueItems) && $schema->uniqueItems) {
  48165. $unique = $value;
  48166. if (is_array($value) && count($value)) {
  48167. $unique = array_map(function ($e) {
  48168. return var_export($e, true);
  48169. }, $value);
  48170. }
  48171. if (count(array_unique($unique)) != count($value)) {
  48172. $this->addError($path, 'There are no duplicates allowed in the array', 'uniqueItems');
  48173. }
  48174. }
  48175. if (isset($schema->items)) {
  48176. $this->validateItems($value, $schema, $path, $i);
  48177. }
  48178. }
  48179. protected function validateItems(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48180. {
  48181. if (is_object($schema->items)) {
  48182. foreach ($value as $k => &$v) {
  48183. $initErrors = $this->getErrors();
  48184. $this->checkUndefined($v, $schema->items, $path, $k);
  48185. if (count($initErrors) < count($this->getErrors()) && (isset($schema->additionalItems) && $schema->additionalItems !== false)) {
  48186. $secondErrors = $this->getErrors();
  48187. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48188. }
  48189. if (isset($secondErrors) && count($secondErrors) < count($this->getErrors())) {
  48190. $this->errors = $secondErrors;
  48191. } elseif (isset($secondErrors) && count($secondErrors) === count($this->getErrors())) {
  48192. $this->errors = $initErrors;
  48193. }
  48194. }
  48195. unset($v);
  48196. } else {
  48197. foreach ($value as $k => &$v) {
  48198. if (array_key_exists($k, $schema->items)) {
  48199. $this->checkUndefined($v, $schema->items[$k], $path, $k);
  48200. } else {
  48201. if (property_exists($schema, 'additionalItems')) {
  48202. if ($schema->additionalItems !== false) {
  48203. $this->checkUndefined($v, $schema->additionalItems, $path, $k);
  48204. } else {
  48205. $this->addError(
  48206. $path, 'The item ' . $i . '[' . $k . '] is not defined and the definition does not allow additional items', 'additionalItems', array('additionalItems' => $schema->additionalItems));
  48207. }
  48208. } else {
  48209. $this->checkUndefined($v, new \stdClass(), $path, $k);
  48210. }
  48211. }
  48212. }
  48213. unset($v);
  48214. if (count($value) > 0) {
  48215. for ($k = count($value); $k < count($schema->items); $k++) {
  48216. $undefinedInstance = $this->factory->createInstanceFor('undefined');
  48217. $this->checkUndefined($undefinedInstance, $schema->items[$k], $path, $k);
  48218. }
  48219. }
  48220. }
  48221. }
  48222. }
  48223. <?php
  48224. namespace JsonSchema\Constraints;
  48225. use JsonSchema\Entity\JsonPointer;
  48226. abstract class Constraint extends BaseConstraint implements ConstraintInterface
  48227. {
  48228. protected $inlineSchemaProperty = '$schema';
  48229. const CHECK_MODE_NONE = 0x00000000;
  48230. const CHECK_MODE_NORMAL = 0x00000001;
  48231. const CHECK_MODE_TYPE_CAST = 0x00000002;
  48232. const CHECK_MODE_COERCE_TYPES = 0x00000004;
  48233. const CHECK_MODE_APPLY_DEFAULTS = 0x00000008;
  48234. const CHECK_MODE_EXCEPTIONS = 0x00000010;
  48235. const CHECK_MODE_DISABLE_FORMAT = 0x00000020;
  48236. const CHECK_MODE_ONLY_REQUIRED_DEFAULTS = 0x00000080;
  48237. const CHECK_MODE_VALIDATE_SCHEMA = 0x00000100;
  48238. protected function incrementPath(JsonPointer $path = null, $i)
  48239. {
  48240. $path = $path ?: new JsonPointer('');
  48241. $path = $path->withPropertyPaths(
  48242. array_merge(
  48243. $path->getPropertyPaths(),
  48244. array_filter(array($i), 'strlen')
  48245. )
  48246. );
  48247. return $path;
  48248. }
  48249. protected function checkArray(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48250. {
  48251. $validator = $this->factory->createInstanceFor('collection');
  48252. $validator->check($value, $schema, $path, $i);
  48253. $this->addErrors($validator->getErrors());
  48254. }
  48255. protected function checkObject(&$value, $schema = null, JsonPointer $path = null, $properties = null,
  48256. $additionalProperties = null, $patternProperties = null, $appliedDefaults = array())
  48257. {
  48258. $validator = $this->factory->createInstanceFor('object');
  48259. $validator->check($value, $schema, $path, $properties, $additionalProperties, $patternProperties, $appliedDefaults);
  48260. $this->addErrors($validator->getErrors());
  48261. }
  48262. protected function checkType(&$value, $schema = null, JsonPointer $path = null, $i = null)
  48263. {
  48264. $validator = $this->factory->createInstanceFor('type');
  48265. $validator->check($value, $schema, $path, $i);
  48266. $this->addErrors($validator->getErrors());
  48267. }
  48268. protected function checkUndefined(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  48269. {
  48270. $validator = $this->factory->createInstanceFor('undefined');
  48271. $validator->check($value, $this->factory->getSchemaStorage()->resolveRefSchema($schema), $path, $i, $fromDefault);
  48272. $this->addErrors($validator->getErrors());
  48273. }
  48274. protected function checkString($value, $schema = null, JsonPointer $path = null, $i = null)
  48275. {
  48276. $validator = $this->factory->createInstanceFor('string');
  48277. $validator->check($value, $schema, $path, $i);
  48278. $this->addErrors($validator->getErrors());
  48279. }
  48280. protected function checkNumber($value, $schema = null, JsonPointer $path = null, $i = null)
  48281. {
  48282. $validator = $this->factory->createInstanceFor('number');
  48283. $validator->check($value, $schema, $path, $i);
  48284. $this->addErrors($validator->getErrors());
  48285. }
  48286. protected function checkEnum($value, $schema = null, JsonPointer $path = null, $i = null)
  48287. {
  48288. $validator = $this->factory->createInstanceFor('enum');
  48289. $validator->check($value, $schema, $path, $i);
  48290. $this->addErrors($validator->getErrors());
  48291. }
  48292. protected function checkFormat($value, $schema = null, JsonPointer $path = null, $i = null)
  48293. {
  48294. $validator = $this->factory->createInstanceFor('format');
  48295. $validator->check($value, $schema, $path, $i);
  48296. $this->addErrors($validator->getErrors());
  48297. }
  48298. protected function getTypeCheck()
  48299. {
  48300. return $this->factory->getTypeCheck();
  48301. }
  48302. protected function convertJsonPointerIntoPropertyPath(JsonPointer $pointer)
  48303. {
  48304. $result = array_map(
  48305. function ($path) {
  48306. return sprintf(is_numeric($path) ? '[%d]' : '.%s', $path);
  48307. },
  48308. $pointer->getPropertyPaths()
  48309. );
  48310. return trim(implode('', $result), '.');
  48311. }
  48312. }
  48313. <?php
  48314. namespace JsonSchema\Constraints;
  48315. use JsonSchema\Entity\JsonPointer;
  48316. interface ConstraintInterface
  48317. {
  48318. public function getErrors();
  48319. public function addErrors(array $errors);
  48320. public function addError(JsonPointer $path = null, $message, $constraint='', array $more = null);
  48321. public function isValid();
  48322. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null);
  48323. }
  48324. <?php
  48325. namespace JsonSchema\Constraints;
  48326. use JsonSchema\Entity\JsonPointer;
  48327. class EnumConstraint extends Constraint
  48328. {
  48329. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48330. {
  48331. if ($element instanceof UndefinedConstraint && (!isset($schema->required) || !$schema->required)) {
  48332. return;
  48333. }
  48334. $type = gettype($element);
  48335. foreach ($schema->enum as $enum) {
  48336. $enumType = gettype($enum);
  48337. if ($this->factory->getConfig(self::CHECK_MODE_TYPE_CAST) && $type == 'array' && $enumType == 'object') {
  48338. if ((object) $element == $enum) {
  48339. return;
  48340. }
  48341. }
  48342. if ($type === gettype($enum)) {
  48343. if ($type == 'object') {
  48344. if ($element == $enum) {
  48345. return;
  48346. }
  48347. } elseif ($element === $enum) {
  48348. return;
  48349. }
  48350. }
  48351. }
  48352. $this->addError($path, 'Does not have a value in the enumeration ' . json_encode($schema->enum), 'enum', array('enum' => $schema->enum));
  48353. }
  48354. }
  48355. <?php
  48356. namespace JsonSchema\Constraints;
  48357. use JsonSchema\Exception\InvalidArgumentException;
  48358. use JsonSchema\SchemaStorage;
  48359. use JsonSchema\SchemaStorageInterface;
  48360. use JsonSchema\Uri\UriRetriever;
  48361. use JsonSchema\UriRetrieverInterface;
  48362. use JsonSchema\Validator;
  48363. class Factory
  48364. {
  48365. protected $schemaStorage;
  48366. protected $uriRetriever;
  48367. private $checkMode = Constraint::CHECK_MODE_NORMAL;
  48368. private $typeCheck = array();
  48369. protected $errorContext = Validator::ERROR_DOCUMENT_VALIDATION;
  48370. protected $constraintMap = array(
  48371. 'array' => 'JsonSchema\Constraints\CollectionConstraint',
  48372. 'collection' => 'JsonSchema\Constraints\CollectionConstraint',
  48373. 'object' => 'JsonSchema\Constraints\ObjectConstraint',
  48374. 'type' => 'JsonSchema\Constraints\TypeConstraint',
  48375. 'undefined' => 'JsonSchema\Constraints\UndefinedConstraint',
  48376. 'string' => 'JsonSchema\Constraints\StringConstraint',
  48377. 'number' => 'JsonSchema\Constraints\NumberConstraint',
  48378. 'enum' => 'JsonSchema\Constraints\EnumConstraint',
  48379. 'format' => 'JsonSchema\Constraints\FormatConstraint',
  48380. 'schema' => 'JsonSchema\Constraints\SchemaConstraint',
  48381. 'validator' => 'JsonSchema\Validator'
  48382. );
  48383. private $instanceCache = array();
  48384. public function __construct(
  48385. SchemaStorageInterface $schemaStorage = null,
  48386. UriRetrieverInterface $uriRetriever = null,
  48387. $checkMode = Constraint::CHECK_MODE_NORMAL
  48388. ) {
  48389. $this->setConfig($checkMode);
  48390. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  48391. $this->schemaStorage = $schemaStorage ?: new SchemaStorage($this->uriRetriever);
  48392. }
  48393. public function setConfig($checkMode = Constraint::CHECK_MODE_NORMAL)
  48394. {
  48395. $this->checkMode = $checkMode;
  48396. }
  48397. public function addConfig($options)
  48398. {
  48399. $this->checkMode |= $options;
  48400. }
  48401. public function removeConfig($options)
  48402. {
  48403. $this->checkMode &= ~$options;
  48404. }
  48405. public function getConfig($options = null)
  48406. {
  48407. if ($options === null) {
  48408. return $this->checkMode;
  48409. }
  48410. return $this->checkMode & $options;
  48411. }
  48412. public function getUriRetriever()
  48413. {
  48414. return $this->uriRetriever;
  48415. }
  48416. public function getSchemaStorage()
  48417. {
  48418. return $this->schemaStorage;
  48419. }
  48420. public function getTypeCheck()
  48421. {
  48422. if (!isset($this->typeCheck[$this->checkMode])) {
  48423. $this->typeCheck[$this->checkMode] = ($this->checkMode & Constraint::CHECK_MODE_TYPE_CAST)
  48424. ? new TypeCheck\LooseTypeCheck()
  48425. : new TypeCheck\StrictTypeCheck();
  48426. }
  48427. return $this->typeCheck[$this->checkMode];
  48428. }
  48429. public function setConstraintClass($name, $class)
  48430. {
  48431. if (!class_exists($class)) {
  48432. throw new InvalidArgumentException('Unknown constraint ' . $name);
  48433. }
  48434. if (!in_array('JsonSchema\Constraints\ConstraintInterface', class_implements($class))) {
  48435. throw new InvalidArgumentException('Invalid class ' . $name);
  48436. }
  48437. $this->constraintMap[$name] = $class;
  48438. return $this;
  48439. }
  48440. public function createInstanceFor($constraintName)
  48441. {
  48442. if (!isset($this->constraintMap[$constraintName])) {
  48443. throw new InvalidArgumentException('Unknown constraint ' . $constraintName);
  48444. }
  48445. if (!isset($this->instanceCache[$constraintName])) {
  48446. $this->instanceCache[$constraintName] = new $this->constraintMap[$constraintName]($this);
  48447. }
  48448. return clone $this->instanceCache[$constraintName];
  48449. }
  48450. public function getErrorContext()
  48451. {
  48452. return $this->errorContext;
  48453. }
  48454. public function setErrorContext($errorContext)
  48455. {
  48456. $this->errorContext = $errorContext;
  48457. }
  48458. }
  48459. <?php
  48460. namespace JsonSchema\Constraints;
  48461. use JsonSchema\Entity\JsonPointer;
  48462. use JsonSchema\Rfc3339;
  48463. class FormatConstraint extends Constraint
  48464. {
  48465. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48466. {
  48467. if (!isset($schema->format) || $this->factory->getConfig(self::CHECK_MODE_DISABLE_FORMAT)) {
  48468. return;
  48469. }
  48470. switch ($schema->format) {
  48471. case 'date':
  48472. if (!$date = $this->validateDateTime($element, 'Y-m-d')) {
  48473. $this->addError($path, sprintf('Invalid date %s, expected format YYYY-MM-DD', json_encode($element)), 'format', array('format' => $schema->format));
  48474. }
  48475. break;
  48476. case 'time':
  48477. if (!$this->validateDateTime($element, 'H:i:s')) {
  48478. $this->addError($path, sprintf('Invalid time %s, expected format hh:mm:ss', json_encode($element)), 'format', array('format' => $schema->format));
  48479. }
  48480. break;
  48481. case 'date-time':
  48482. if (null === Rfc3339::createFromString($element)) {
  48483. $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));
  48484. }
  48485. break;
  48486. case 'utc-millisec':
  48487. if (!$this->validateDateTime($element, 'U')) {
  48488. $this->addError($path, sprintf('Invalid time %s, expected integer of milliseconds since Epoch', json_encode($element)), 'format', array('format' => $schema->format));
  48489. }
  48490. break;
  48491. case 'regex':
  48492. if (!$this->validateRegex($element)) {
  48493. $this->addError($path, 'Invalid regex format ' . $element, 'format', array('format' => $schema->format));
  48494. }
  48495. break;
  48496. case 'color':
  48497. if (!$this->validateColor($element)) {
  48498. $this->addError($path, 'Invalid color', 'format', array('format' => $schema->format));
  48499. }
  48500. break;
  48501. case 'style':
  48502. if (!$this->validateStyle($element)) {
  48503. $this->addError($path, 'Invalid style', 'format', array('format' => $schema->format));
  48504. }
  48505. break;
  48506. case 'phone':
  48507. if (!$this->validatePhone($element)) {
  48508. $this->addError($path, 'Invalid phone number', 'format', array('format' => $schema->format));
  48509. }
  48510. break;
  48511. case 'uri':
  48512. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48513. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48514. }
  48515. break;
  48516. case 'uriref':
  48517. case 'uri-reference':
  48518. if (null === filter_var($element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE)) {
  48519. if (substr($element, 0, 2) === '//') {
  48520. $validURL = filter_var('scheme:' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48521. } elseif (substr($element, 0, 1) === '/') {
  48522. $validURL = filter_var('scheme://host' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48523. } elseif (strlen($element)) {
  48524. $pathParts = explode('/', $element, 2);
  48525. if (strpos($pathParts[0], ':') !== false) {
  48526. $validURL = null;
  48527. } else {
  48528. $validURL = filter_var('scheme://host/' . $element, FILTER_VALIDATE_URL, FILTER_NULL_ON_FAILURE);
  48529. }
  48530. } else {
  48531. $validURL = null;
  48532. }
  48533. if ($validURL === null) {
  48534. $this->addError($path, 'Invalid URL format', 'format', array('format' => $schema->format));
  48535. }
  48536. }
  48537. break;
  48538. case 'email':
  48539. $filterFlags = FILTER_NULL_ON_FAILURE;
  48540. if (defined('FILTER_FLAG_EMAIL_UNICODE')) {
  48541. $filterFlags |= constant('FILTER_FLAG_EMAIL_UNICODE');
  48542. }
  48543. if (null === filter_var($element, FILTER_VALIDATE_EMAIL, $filterFlags)) {
  48544. $this->addError($path, 'Invalid email', 'format', array('format' => $schema->format));
  48545. }
  48546. break;
  48547. case 'ip-address':
  48548. case 'ipv4':
  48549. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV4)) {
  48550. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48551. }
  48552. break;
  48553. case 'ipv6':
  48554. if (null === filter_var($element, FILTER_VALIDATE_IP, FILTER_NULL_ON_FAILURE | FILTER_FLAG_IPV6)) {
  48555. $this->addError($path, 'Invalid IP address', 'format', array('format' => $schema->format));
  48556. }
  48557. break;
  48558. case 'host-name':
  48559. case 'hostname':
  48560. if (!$this->validateHostname($element)) {
  48561. $this->addError($path, 'Invalid hostname', 'format', array('format' => $schema->format));
  48562. }
  48563. break;
  48564. default:
  48565. break;
  48566. }
  48567. }
  48568. protected function validateDateTime($datetime, $format)
  48569. {
  48570. $dt = \DateTime::createFromFormat($format, $datetime);
  48571. if (!$dt) {
  48572. return false;
  48573. }
  48574. if ($datetime === $dt->format($format)) {
  48575. return true;
  48576. }
  48577. if ((strpos('u', $format) !== -1) && (preg_match('/\.\d+Z$/', $datetime))) {
  48578. return true;
  48579. }
  48580. return false;
  48581. }
  48582. protected function validateRegex($regex)
  48583. {
  48584. return false !== @preg_match('/' . $regex . '/u', '');
  48585. }
  48586. protected function validateColor($color)
  48587. {
  48588. if (in_array(strtolower($color), array('aqua', 'black', 'blue', 'fuchsia',
  48589. 'gray', 'green', 'lime', 'maroon', 'navy', 'olive', 'orange', 'purple',
  48590. 'red', 'silver', 'teal', 'white', 'yellow'))) {
  48591. return true;
  48592. }
  48593. return preg_match('/^#([a-f0-9]{3}|[a-f0-9]{6})$/i', $color);
  48594. }
  48595. protected function validateStyle($style)
  48596. {
  48597. $properties = explode(';', rtrim($style, ';'));
  48598. $invalidEntries = preg_grep('/^\s*[-a-z]+\s*:\s*.+$/i', $properties, PREG_GREP_INVERT);
  48599. return empty($invalidEntries);
  48600. }
  48601. protected function validatePhone($phone)
  48602. {
  48603. return preg_match('/^\+?(\(\d{3}\)|\d{3}) \d{3} \d{4}$/', $phone);
  48604. }
  48605. protected function validateHostname($host)
  48606. {
  48607. $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';
  48608. return preg_match($hostnameRegex, $host);
  48609. }
  48610. }
  48611. <?php
  48612. namespace JsonSchema\Constraints;
  48613. use JsonSchema\Entity\JsonPointer;
  48614. class NumberConstraint extends Constraint
  48615. {
  48616. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48617. {
  48618. if (isset($schema->exclusiveMinimum)) {
  48619. if (isset($schema->minimum)) {
  48620. if ($schema->exclusiveMinimum && $element <= $schema->minimum) {
  48621. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'exclusiveMinimum', array('minimum' => $schema->minimum));
  48622. } elseif ($element < $schema->minimum) {
  48623. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48624. }
  48625. } else {
  48626. $this->addError($path, 'Use of exclusiveMinimum requires presence of minimum', 'missingMinimum');
  48627. }
  48628. } elseif (isset($schema->minimum) && $element < $schema->minimum) {
  48629. $this->addError($path, 'Must have a minimum value of ' . $schema->minimum, 'minimum', array('minimum' => $schema->minimum));
  48630. }
  48631. if (isset($schema->exclusiveMaximum)) {
  48632. if (isset($schema->maximum)) {
  48633. if ($schema->exclusiveMaximum && $element >= $schema->maximum) {
  48634. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'exclusiveMaximum', array('maximum' => $schema->maximum));
  48635. } elseif ($element > $schema->maximum) {
  48636. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48637. }
  48638. } else {
  48639. $this->addError($path, 'Use of exclusiveMaximum requires presence of maximum', 'missingMaximum');
  48640. }
  48641. } elseif (isset($schema->maximum) && $element > $schema->maximum) {
  48642. $this->addError($path, 'Must have a maximum value of ' . $schema->maximum, 'maximum', array('maximum' => $schema->maximum));
  48643. }
  48644. if (isset($schema->divisibleBy) && $this->fmod($element, $schema->divisibleBy) != 0) {
  48645. $this->addError($path, 'Is not divisible by ' . $schema->divisibleBy, 'divisibleBy', array('divisibleBy' => $schema->divisibleBy));
  48646. }
  48647. if (isset($schema->multipleOf) && $this->fmod($element, $schema->multipleOf) != 0) {
  48648. $this->addError($path, 'Must be a multiple of ' . $schema->multipleOf, 'multipleOf', array('multipleOf' => $schema->multipleOf));
  48649. }
  48650. $this->checkFormat($element, $schema, $path, $i);
  48651. }
  48652. private function fmod($number1, $number2)
  48653. {
  48654. $modulus = ($number1 - round($number1 / $number2) * $number2);
  48655. $precision = 0.0000000001;
  48656. if (-$precision < $modulus && $modulus < $precision) {
  48657. return 0.0;
  48658. }
  48659. return $modulus;
  48660. }
  48661. }
  48662. <?php
  48663. namespace JsonSchema\Constraints;
  48664. use JsonSchema\Entity\JsonPointer;
  48665. class ObjectConstraint extends Constraint
  48666. {
  48667. protected $appliedDefaults = array();
  48668. public function check(&$element, $schema = null, JsonPointer $path = null, $properties = null,
  48669. $additionalProp = null, $patternProperties = null, $appliedDefaults = array())
  48670. {
  48671. if ($element instanceof UndefinedConstraint) {
  48672. return;
  48673. }
  48674. $this->appliedDefaults = $appliedDefaults;
  48675. $matches = array();
  48676. if ($patternProperties) {
  48677. $matches = $this->validatePatternProperties($element, $path, $patternProperties);
  48678. }
  48679. if ($properties) {
  48680. $this->validateProperties($element, $properties, $path);
  48681. }
  48682. $this->validateElement($element, $matches, $schema, $path, $properties, $additionalProp);
  48683. }
  48684. public function validatePatternProperties($element, JsonPointer $path = null, $patternProperties)
  48685. {
  48686. $try = array('/', '#', '+', '~', '%');
  48687. $matches = array();
  48688. foreach ($patternProperties as $pregex => $schema) {
  48689. $delimiter = '/';
  48690. foreach ($try as $delimiter) {
  48691. if (strpos($pregex, $delimiter) === false) {
  48692. break;
  48693. }
  48694. }
  48695. if (@preg_match($delimiter . $pregex . $delimiter . 'u', '') === false) {
  48696. $this->addError($path, 'The pattern "' . $pregex . '" is invalid', 'pregex', array('pregex' => $pregex));
  48697. continue;
  48698. }
  48699. foreach ($element as $i => $value) {
  48700. if (preg_match($delimiter . $pregex . $delimiter . 'u', $i)) {
  48701. $matches[] = $i;
  48702. $this->checkUndefined($value, $schema ?: new \stdClass(), $path, $i, in_array($i, $this->appliedDefaults));
  48703. }
  48704. }
  48705. }
  48706. return $matches;
  48707. }
  48708. public function validateElement($element, $matches, $schema = null, JsonPointer $path = null,
  48709. $properties = null, $additionalProp = null)
  48710. {
  48711. $this->validateMinMaxConstraint($element, $schema, $path);
  48712. foreach ($element as $i => $value) {
  48713. $definition = $this->getProperty($properties, $i);
  48714. if (!in_array($i, $matches) && $additionalProp === false && $this->inlineSchemaProperty !== $i && !$definition) {
  48715. $this->addError($path, 'The property ' . $i . ' is not defined and the definition does not allow additional properties', 'additionalProp');
  48716. }
  48717. if (!in_array($i, $matches) && $additionalProp && !$definition) {
  48718. if ($additionalProp === true) {
  48719. $this->checkUndefined($value, null, $path, $i, in_array($i, $this->appliedDefaults));
  48720. } else {
  48721. $this->checkUndefined($value, $additionalProp, $path, $i, in_array($i, $this->appliedDefaults));
  48722. }
  48723. }
  48724. $require = $this->getProperty($definition, 'requires');
  48725. if ($require && !$this->getProperty($element, $require)) {
  48726. $this->addError($path, 'The presence of the property ' . $i . ' requires that ' . $require . ' also be present', 'requires');
  48727. }
  48728. $property = $this->getProperty($element, $i, $this->factory->createInstanceFor('undefined'));
  48729. if (is_object($property)) {
  48730. $this->validateMinMaxConstraint(!($property instanceof UndefinedConstraint) ? $property : $element, $definition, $path);
  48731. }
  48732. }
  48733. }
  48734. public function validateProperties(&$element, $properties = null, JsonPointer $path = null)
  48735. {
  48736. $undefinedConstraint = $this->factory->createInstanceFor('undefined');
  48737. foreach ($properties as $i => $value) {
  48738. $property = &$this->getProperty($element, $i, $undefinedConstraint);
  48739. $definition = $this->getProperty($properties, $i);
  48740. if (is_object($definition)) {
  48741. $this->checkUndefined($property, $definition, $path, $i, in_array($i, $this->appliedDefaults));
  48742. }
  48743. }
  48744. }
  48745. protected function &getProperty(&$element, $property, $fallback = null)
  48746. {
  48747. if (is_array($element) && (isset($element[$property]) || array_key_exists($property, $element)) ) {
  48748. return $element[$property];
  48749. } elseif (is_object($element) && property_exists($element, $property)) {
  48750. return $element->$property;
  48751. }
  48752. return $fallback;
  48753. }
  48754. protected function validateMinMaxConstraint($element, $objectDefinition, JsonPointer $path = null)
  48755. {
  48756. if (isset($objectDefinition->minProperties) && !is_object($objectDefinition->minProperties)) {
  48757. if ($this->getTypeCheck()->propertyCount($element) < $objectDefinition->minProperties) {
  48758. $this->addError($path, 'Must contain a minimum of ' . $objectDefinition->minProperties . ' properties', 'minProperties', array('minProperties' => $objectDefinition->minProperties));
  48759. }
  48760. }
  48761. if (isset($objectDefinition->maxProperties) && !is_object($objectDefinition->maxProperties)) {
  48762. if ($this->getTypeCheck()->propertyCount($element) > $objectDefinition->maxProperties) {
  48763. $this->addError($path, 'Must contain no more than ' . $objectDefinition->maxProperties . ' properties', 'maxProperties', array('maxProperties' => $objectDefinition->maxProperties));
  48764. }
  48765. }
  48766. }
  48767. }
  48768. <?php
  48769. namespace JsonSchema\Constraints;
  48770. use JsonSchema\Entity\JsonPointer;
  48771. use JsonSchema\Exception\InvalidArgumentException;
  48772. use JsonSchema\Exception\InvalidSchemaException;
  48773. use JsonSchema\Exception\RuntimeException;
  48774. use JsonSchema\Validator;
  48775. class SchemaConstraint extends Constraint
  48776. {
  48777. const DEFAULT_SCHEMA_SPEC = 'http://json-schema.org/draft-04/schema#';
  48778. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48779. {
  48780. if ($schema !== null) {
  48781. $validationSchema = $schema;
  48782. } elseif ($this->getTypeCheck()->propertyExists($element, $this->inlineSchemaProperty)) {
  48783. $validationSchema = $this->getTypeCheck()->propertyGet($element, $this->inlineSchemaProperty);
  48784. } else {
  48785. throw new InvalidArgumentException('no schema found to verify against');
  48786. }
  48787. if (is_array($validationSchema)) {
  48788. $validationSchema = BaseConstraint::arrayToObjectRecursive($validationSchema);
  48789. }
  48790. if ($this->factory->getConfig(self::CHECK_MODE_VALIDATE_SCHEMA)) {
  48791. if (!$this->getTypeCheck()->isObject($validationSchema)) {
  48792. throw new RuntimeException('Cannot validate the schema of a non-object');
  48793. }
  48794. if ($this->getTypeCheck()->propertyExists($validationSchema, '$schema')) {
  48795. $schemaSpec = $this->getTypeCheck()->propertyGet($validationSchema, '$schema');
  48796. } else {
  48797. $schemaSpec = self::DEFAULT_SCHEMA_SPEC;
  48798. }
  48799. $schemaStorage = $this->factory->getSchemaStorage();
  48800. if (!$this->getTypeCheck()->isObject($schemaSpec)) {
  48801. $schemaSpec = $schemaStorage->getSchema($schemaSpec);
  48802. }
  48803. $initialErrorCount = $this->numErrors();
  48804. $initialConfig = $this->factory->getConfig();
  48805. $initialContext = $this->factory->getErrorContext();
  48806. $this->factory->removeConfig(self::CHECK_MODE_VALIDATE_SCHEMA | self::CHECK_MODE_APPLY_DEFAULTS);
  48807. $this->factory->addConfig(self::CHECK_MODE_TYPE_CAST);
  48808. $this->factory->setErrorContext(Validator::ERROR_SCHEMA_VALIDATION);
  48809. try {
  48810. $this->check($validationSchema, $schemaSpec);
  48811. } catch (\Exception $e) {
  48812. if ($this->factory->getConfig(self::CHECK_MODE_EXCEPTIONS)) {
  48813. throw new InvalidSchemaException('Schema did not pass validation', 0, $e);
  48814. }
  48815. }
  48816. if ($this->numErrors() > $initialErrorCount) {
  48817. $this->addError($path, 'Schema is not valid', 'schema');
  48818. }
  48819. $this->factory->setConfig($initialConfig);
  48820. $this->factory->setErrorContext($initialContext);
  48821. }
  48822. $this->checkUndefined($element, $validationSchema, $path, $i);
  48823. }
  48824. }
  48825. <?php
  48826. namespace JsonSchema\Constraints;
  48827. use JsonSchema\Entity\JsonPointer;
  48828. class StringConstraint extends Constraint
  48829. {
  48830. public function check(&$element, $schema = null, JsonPointer $path = null, $i = null)
  48831. {
  48832. if (isset($schema->maxLength) && $this->strlen($element) > $schema->maxLength) {
  48833. $this->addError($path, 'Must be at most ' . $schema->maxLength . ' characters long', 'maxLength', array(
  48834. 'maxLength' => $schema->maxLength,
  48835. ));
  48836. }
  48837. if (isset($schema->minLength) && $this->strlen($element) < $schema->minLength) {
  48838. $this->addError($path, 'Must be at least ' . $schema->minLength . ' characters long', 'minLength', array(
  48839. 'minLength' => $schema->minLength,
  48840. ));
  48841. }
  48842. if (isset($schema->pattern) && !preg_match('#' . str_replace('#', '\\#', $schema->pattern) . '#u', $element)) {
  48843. $this->addError($path, 'Does not match the regex pattern ' . $schema->pattern, 'pattern', array(
  48844. 'pattern' => $schema->pattern,
  48845. ));
  48846. }
  48847. $this->checkFormat($element, $schema, $path, $i);
  48848. }
  48849. private function strlen($string)
  48850. {
  48851. if (extension_loaded('mbstring')) {
  48852. return mb_strlen($string, mb_detect_encoding($string));
  48853. }
  48854. return strlen($string);
  48855. }
  48856. }
  48857. <?php
  48858. namespace JsonSchema\Constraints\TypeCheck;
  48859. class LooseTypeCheck implements TypeCheckInterface
  48860. {
  48861. public static function isObject($value)
  48862. {
  48863. return
  48864. is_object($value) ||
  48865. (is_array($value) && (count($value) == 0 || self::isAssociativeArray($value)));
  48866. }
  48867. public static function isArray($value)
  48868. {
  48869. return
  48870. is_array($value) &&
  48871. (count($value) == 0 || !self::isAssociativeArray($value));
  48872. }
  48873. public static function propertyGet($value, $property)
  48874. {
  48875. if (is_object($value)) {
  48876. return $value->{$property};
  48877. }
  48878. return $value[$property];
  48879. }
  48880. public static function propertySet(&$value, $property, $data)
  48881. {
  48882. if (is_object($value)) {
  48883. $value->{$property} = $data;
  48884. } else {
  48885. $value[$property] = $data;
  48886. }
  48887. }
  48888. public static function propertyExists($value, $property)
  48889. {
  48890. if (is_object($value)) {
  48891. return property_exists($value, $property);
  48892. }
  48893. return array_key_exists($property, $value);
  48894. }
  48895. public static function propertyCount($value)
  48896. {
  48897. if (is_object($value)) {
  48898. return count(get_object_vars($value));
  48899. }
  48900. return count($value);
  48901. }
  48902. private static function isAssociativeArray($arr)
  48903. {
  48904. return array_keys($arr) !== range(0, count($arr) - 1);
  48905. }
  48906. }
  48907. <?php
  48908. namespace JsonSchema\Constraints\TypeCheck;
  48909. class StrictTypeCheck implements TypeCheckInterface
  48910. {
  48911. public static function isObject($value)
  48912. {
  48913. return is_object($value);
  48914. }
  48915. public static function isArray($value)
  48916. {
  48917. return is_array($value);
  48918. }
  48919. public static function propertyGet($value, $property)
  48920. {
  48921. return $value->{$property};
  48922. }
  48923. public static function propertySet(&$value, $property, $data)
  48924. {
  48925. $value->{$property} = $data;
  48926. }
  48927. public static function propertyExists($value, $property)
  48928. {
  48929. return property_exists($value, $property);
  48930. }
  48931. public static function propertyCount($value)
  48932. {
  48933. if (!is_object($value)) {
  48934. return 0;
  48935. }
  48936. return count(get_object_vars($value));
  48937. }
  48938. }
  48939. <?php
  48940. namespace JsonSchema\Constraints\TypeCheck;
  48941. interface TypeCheckInterface
  48942. {
  48943. public static function isObject($value);
  48944. public static function isArray($value);
  48945. public static function propertyGet($value, $property);
  48946. public static function propertySet(&$value, $property, $data);
  48947. public static function propertyExists($value, $property);
  48948. public static function propertyCount($value);
  48949. }
  48950. <?php
  48951. namespace JsonSchema\Constraints;
  48952. use JsonSchema\Entity\JsonPointer;
  48953. use JsonSchema\Exception\InvalidArgumentException;
  48954. use UnexpectedValueException as StandardUnexpectedValueException;
  48955. class TypeConstraint extends Constraint
  48956. {
  48957. public static $wording = array(
  48958. 'integer' => 'an integer',
  48959. 'number' => 'a number',
  48960. 'boolean' => 'a boolean',
  48961. 'object' => 'an object',
  48962. 'array' => 'an array',
  48963. 'string' => 'a string',
  48964. 'null' => 'a null',
  48965. 'any' => null,
  48966. 0 => null,
  48967. );
  48968. public function check(&$value = null, $schema = null, JsonPointer $path = null, $i = null)
  48969. {
  48970. $type = isset($schema->type) ? $schema->type : null;
  48971. $isValid = false;
  48972. $wording = array();
  48973. if (is_array($type)) {
  48974. $this->validateTypesArray($value, $type, $wording, $isValid, $path);
  48975. } elseif (is_object($type)) {
  48976. $this->checkUndefined($value, $type, $path);
  48977. return;
  48978. } else {
  48979. $isValid = $this->validateType($value, $type);
  48980. }
  48981. if ($isValid === false) {
  48982. if (!is_array($type)) {
  48983. $this->validateTypeNameWording($type);
  48984. $wording[] = self::$wording[$type];
  48985. }
  48986. $this->addError($path, ucwords(gettype($value)) . ' value found, but ' .
  48987. $this->implodeWith($wording, ', ', 'or') . ' is required', 'type');
  48988. }
  48989. }
  48990. protected function validateTypesArray(&$value, array $type, &$validTypesWording, &$isValid, $path)
  48991. {
  48992. foreach ($type as $tp) {
  48993. if (is_object($tp)) {
  48994. if (!$isValid) {
  48995. $validator = $this->factory->createInstanceFor('type');
  48996. $subSchema = new \stdClass();
  48997. $subSchema->type = $tp;
  48998. $validator->check($value, $subSchema, $path, null);
  48999. $error = $validator->getErrors();
  49000. $isValid = !(bool) $error;
  49001. $validTypesWording[] = self::$wording['object'];
  49002. }
  49003. } else {
  49004. $this->validateTypeNameWording($tp);
  49005. $validTypesWording[] = self::$wording[$tp];
  49006. if (!$isValid) {
  49007. $isValid = $this->validateType($value, $tp);
  49008. }
  49009. }
  49010. }
  49011. }
  49012. protected function implodeWith(array $elements, $delimiter = ', ', $listEnd = false)
  49013. {
  49014. if ($listEnd === false || !isset($elements[1])) {
  49015. return implode($delimiter, $elements);
  49016. }
  49017. $lastElement = array_slice($elements, -1);
  49018. $firsElements = join($delimiter, array_slice($elements, 0, -1));
  49019. $implodedElements = array_merge(array($firsElements), $lastElement);
  49020. return join(" $listEnd ", $implodedElements);
  49021. }
  49022. protected function validateTypeNameWording($type)
  49023. {
  49024. if (!isset(self::$wording[$type])) {
  49025. throw new StandardUnexpectedValueException(
  49026. sprintf(
  49027. 'No wording for %s available, expected wordings are: [%s]',
  49028. var_export($type, true),
  49029. implode(', ', array_filter(self::$wording)))
  49030. );
  49031. }
  49032. }
  49033. protected function validateType(&$value, $type)
  49034. {
  49035. if (!$type) {
  49036. return true;
  49037. }
  49038. if ('any' === $type) {
  49039. return true;
  49040. }
  49041. if ('object' === $type) {
  49042. return $this->getTypeCheck()->isObject($value);
  49043. }
  49044. if ('array' === $type) {
  49045. return $this->getTypeCheck()->isArray($value);
  49046. }
  49047. $coerce = $this->factory->getConfig(Constraint::CHECK_MODE_COERCE_TYPES);
  49048. if ('integer' === $type) {
  49049. if ($coerce) {
  49050. $value = $this->toInteger($value);
  49051. }
  49052. return is_int($value);
  49053. }
  49054. if ('number' === $type) {
  49055. if ($coerce) {
  49056. $value = $this->toNumber($value);
  49057. }
  49058. return is_numeric($value) && !is_string($value);
  49059. }
  49060. if ('boolean' === $type) {
  49061. if ($coerce) {
  49062. $value = $this->toBoolean($value);
  49063. }
  49064. return is_bool($value);
  49065. }
  49066. if ('string' === $type) {
  49067. return is_string($value);
  49068. }
  49069. if ('email' === $type) {
  49070. return is_string($value);
  49071. }
  49072. if ('null' === $type) {
  49073. return is_null($value);
  49074. }
  49075. throw new InvalidArgumentException((is_object($value) ? 'object' : $value) . ' is an invalid type for ' . $type);
  49076. }
  49077. protected function toBoolean($value)
  49078. {
  49079. if ($value === 'true') {
  49080. return true;
  49081. }
  49082. if ($value === 'false') {
  49083. return false;
  49084. }
  49085. return $value;
  49086. }
  49087. protected function toNumber($value)
  49088. {
  49089. if (is_numeric($value)) {
  49090. return $value + 0;
  49091. }
  49092. return $value;
  49093. }
  49094. protected function toInteger($value)
  49095. {
  49096. if (is_numeric($value) && (int) $value == $value) {
  49097. return (int) $value;
  49098. }
  49099. return $value;
  49100. }
  49101. }
  49102. <?php
  49103. namespace JsonSchema\Constraints;
  49104. use JsonSchema\Constraints\TypeCheck\LooseTypeCheck;
  49105. use JsonSchema\Entity\JsonPointer;
  49106. use JsonSchema\Exception\ValidationException;
  49107. use JsonSchema\Uri\UriResolver;
  49108. class UndefinedConstraint extends Constraint
  49109. {
  49110. protected $appliedDefaults = array();
  49111. public function check(&$value, $schema = null, JsonPointer $path = null, $i = null, $fromDefault = false)
  49112. {
  49113. if (is_null($schema) || !is_object($schema)) {
  49114. return;
  49115. }
  49116. $path = $this->incrementPath($path ?: new JsonPointer(''), $i);
  49117. if ($fromDefault) {
  49118. $path->setFromDefault();
  49119. }
  49120. $this->validateCommonProperties($value, $schema, $path, $i);
  49121. $this->validateOfProperties($value, $schema, $path, '');
  49122. $this->validateTypes($value, $schema, $path, $i);
  49123. }
  49124. public function validateTypes(&$value, $schema = null, JsonPointer $path, $i = null)
  49125. {
  49126. if ($this->getTypeCheck()->isArray($value)) {
  49127. $this->checkArray($value, $schema, $path, $i);
  49128. }
  49129. if (LooseTypeCheck::isObject($value)) {
  49130. $this->checkObject(
  49131. $value,
  49132. $schema,
  49133. $path,
  49134. isset($schema->properties) ? $schema->properties : null,
  49135. isset($schema->additionalProperties) ? $schema->additionalProperties : null,
  49136. isset($schema->patternProperties) ? $schema->patternProperties : null,
  49137. $this->appliedDefaults
  49138. );
  49139. }
  49140. if (is_string($value)) {
  49141. $this->checkString($value, $schema, $path, $i);
  49142. }
  49143. if (is_numeric($value)) {
  49144. $this->checkNumber($value, $schema, $path, $i);
  49145. }
  49146. if (isset($schema->enum)) {
  49147. $this->checkEnum($value, $schema, $path, $i);
  49148. }
  49149. }
  49150. protected function validateCommonProperties(&$value, $schema = null, JsonPointer $path, $i = '')
  49151. {
  49152. if (isset($schema->extends)) {
  49153. if (is_string($schema->extends)) {
  49154. $schema->extends = $this->validateUri($schema, $schema->extends);
  49155. }
  49156. if (is_array($schema->extends)) {
  49157. foreach ($schema->extends as $extends) {
  49158. $this->checkUndefined($value, $extends, $path, $i);
  49159. }
  49160. } else {
  49161. $this->checkUndefined($value, $schema->extends, $path, $i);
  49162. }
  49163. }
  49164. if (!$path->fromDefault()) {
  49165. $this->applyDefaultValues($value, $schema, $path);
  49166. }
  49167. if ($this->getTypeCheck()->isObject($value)) {
  49168. if (!($value instanceof self) && isset($schema->required) && is_array($schema->required)) {
  49169. foreach ($schema->required as $required) {
  49170. if (!$this->getTypeCheck()->propertyExists($value, $required)) {
  49171. $this->addError(
  49172. $this->incrementPath($path ?: new JsonPointer(''), $required),
  49173. 'The property ' . $required . ' is required',
  49174. 'required'
  49175. );
  49176. }
  49177. }
  49178. } elseif (isset($schema->required) && !is_array($schema->required)) {
  49179. if ($schema->required && $value instanceof self) {
  49180. $propertyPaths = $path->getPropertyPaths();
  49181. $propertyName = end($propertyPaths);
  49182. $this->addError(
  49183. $path,
  49184. 'The property ' . $propertyName . ' is required',
  49185. 'required'
  49186. );
  49187. }
  49188. } else {
  49189. if ($value instanceof self) {
  49190. return;
  49191. }
  49192. }
  49193. }
  49194. if (!($value instanceof self)) {
  49195. $this->checkType($value, $schema, $path, $i);
  49196. }
  49197. if (isset($schema->disallow)) {
  49198. $initErrors = $this->getErrors();
  49199. $typeSchema = new \stdClass();
  49200. $typeSchema->type = $schema->disallow;
  49201. $this->checkType($value, $typeSchema, $path);
  49202. if (count($this->getErrors()) == count($initErrors)) {
  49203. $this->addError($path, 'Disallowed value was matched', 'disallow');
  49204. } else {
  49205. $this->errors = $initErrors;
  49206. }
  49207. }
  49208. if (isset($schema->not)) {
  49209. $initErrors = $this->getErrors();
  49210. $this->checkUndefined($value, $schema->not, $path, $i);
  49211. if (count($this->getErrors()) == count($initErrors)) {
  49212. $this->addError($path, 'Matched a schema which it should not', 'not');
  49213. } else {
  49214. $this->errors = $initErrors;
  49215. }
  49216. }
  49217. if (isset($schema->dependencies) && $this->getTypeCheck()->isObject($value)) {
  49218. $this->validateDependencies($value, $schema->dependencies, $path);
  49219. }
  49220. }
  49221. private function shouldApplyDefaultValue($requiredOnly, $schema, $name = null, $parentSchema = null)
  49222. {
  49223. if (!$requiredOnly) {
  49224. return true;
  49225. }
  49226. if (
  49227. $name !== null
  49228. && isset($parentSchema->required)
  49229. && is_array($parentSchema->required)
  49230. && in_array($name, $parentSchema->required)
  49231. ) {
  49232. return true;
  49233. }
  49234. if (isset($schema->required) && !is_array($schema->required) && $schema->required) {
  49235. return true;
  49236. }
  49237. return false;
  49238. }
  49239. protected function applyDefaultValues(&$value, $schema, $path)
  49240. {
  49241. if (!$this->factory->getConfig(self::CHECK_MODE_APPLY_DEFAULTS)) {
  49242. return;
  49243. }
  49244. $requiredOnly = $this->factory->getConfig(self::CHECK_MODE_ONLY_REQUIRED_DEFAULTS);
  49245. if (isset($schema->properties) && LooseTypeCheck::isObject($value)) {
  49246. foreach ($schema->properties as $currentProperty => $propertyDefinition) {
  49247. $propertyDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($propertyDefinition);
  49248. if (
  49249. !LooseTypeCheck::propertyExists($value, $currentProperty)
  49250. && property_exists($propertyDefinition, 'default')
  49251. && $this->shouldApplyDefaultValue($requiredOnly, $propertyDefinition, $currentProperty, $schema)
  49252. ) {
  49253. if (is_object($propertyDefinition->default)) {
  49254. LooseTypeCheck::propertySet($value, $currentProperty, clone $propertyDefinition->default);
  49255. } else {
  49256. LooseTypeCheck::propertySet($value, $currentProperty, $propertyDefinition->default);
  49257. }
  49258. $this->appliedDefaults[] = $currentProperty;
  49259. }
  49260. }
  49261. } elseif (isset($schema->items) && LooseTypeCheck::isArray($value)) {
  49262. $items = array();
  49263. if (LooseTypeCheck::isArray($schema->items)) {
  49264. $items = $schema->items;
  49265. } elseif (isset($schema->minItems) && count($value) < $schema->minItems) {
  49266. $items = array_fill(count($value), $schema->minItems - count($value), $schema->items);
  49267. }
  49268. foreach ($items as $currentItem => $itemDefinition) {
  49269. $itemDefinition = $this->factory->getSchemaStorage()->resolveRefSchema($itemDefinition);
  49270. if (
  49271. !array_key_exists($currentItem, $value)
  49272. && property_exists($itemDefinition, 'default')
  49273. && $this->shouldApplyDefaultValue($requiredOnly, $itemDefinition)) {
  49274. if (is_object($itemDefinition->default)) {
  49275. $value[$currentItem] = clone $itemDefinition->default;
  49276. } else {
  49277. $value[$currentItem] = $itemDefinition->default;
  49278. }
  49279. }
  49280. $path->setFromDefault();
  49281. }
  49282. } elseif (
  49283. $value instanceof self
  49284. && property_exists($schema, 'default')
  49285. && $this->shouldApplyDefaultValue($requiredOnly, $schema)) {
  49286. $value = is_object($schema->default) ? clone $schema->default : $schema->default;
  49287. $path->setFromDefault();
  49288. }
  49289. }
  49290. protected function validateOfProperties(&$value, $schema, JsonPointer $path, $i = '')
  49291. {
  49292. if ($value instanceof self) {
  49293. return;
  49294. }
  49295. if (isset($schema->allOf)) {
  49296. $isValid = true;
  49297. foreach ($schema->allOf as $allOf) {
  49298. $initErrors = $this->getErrors();
  49299. $this->checkUndefined($value, $allOf, $path, $i);
  49300. $isValid = $isValid && (count($this->getErrors()) == count($initErrors));
  49301. }
  49302. if (!$isValid) {
  49303. $this->addError($path, 'Failed to match all schemas', 'allOf');
  49304. }
  49305. }
  49306. if (isset($schema->anyOf)) {
  49307. $isValid = false;
  49308. $startErrors = $this->getErrors();
  49309. $caughtException = null;
  49310. foreach ($schema->anyOf as $anyOf) {
  49311. $initErrors = $this->getErrors();
  49312. try {
  49313. $this->checkUndefined($value, $anyOf, $path, $i);
  49314. if ($isValid = (count($this->getErrors()) == count($initErrors))) {
  49315. break;
  49316. }
  49317. } catch (ValidationException $e) {
  49318. $isValid = false;
  49319. }
  49320. }
  49321. if (!$isValid) {
  49322. $this->addError($path, 'Failed to match at least one schema', 'anyOf');
  49323. } else {
  49324. $this->errors = $startErrors;
  49325. }
  49326. }
  49327. if (isset($schema->oneOf)) {
  49328. $allErrors = array();
  49329. $matchedSchemas = 0;
  49330. $startErrors = $this->getErrors();
  49331. foreach ($schema->oneOf as $oneOf) {
  49332. try {
  49333. $this->errors = array();
  49334. $this->checkUndefined($value, $oneOf, $path, $i);
  49335. if (count($this->getErrors()) == 0) {
  49336. $matchedSchemas++;
  49337. }
  49338. $allErrors = array_merge($allErrors, array_values($this->getErrors()));
  49339. } catch (ValidationException $e) {
  49340. }
  49341. }
  49342. if ($matchedSchemas !== 1) {
  49343. $this->addErrors(array_merge($allErrors, $startErrors));
  49344. $this->addError($path, 'Failed to match exactly one schema', 'oneOf');
  49345. } else {
  49346. $this->errors = $startErrors;
  49347. }
  49348. }
  49349. }
  49350. protected function validateDependencies($value, $dependencies, JsonPointer $path, $i = '')
  49351. {
  49352. foreach ($dependencies as $key => $dependency) {
  49353. if ($this->getTypeCheck()->propertyExists($value, $key)) {
  49354. if (is_string($dependency)) {
  49355. if (!$this->getTypeCheck()->propertyExists($value, $dependency)) {
  49356. $this->addError($path, "$key depends on $dependency and $dependency is missing", 'dependencies');
  49357. }
  49358. } elseif (is_array($dependency)) {
  49359. foreach ($dependency as $d) {
  49360. if (!$this->getTypeCheck()->propertyExists($value, $d)) {
  49361. $this->addError($path, "$key depends on $d and $d is missing", 'dependencies');
  49362. }
  49363. }
  49364. } elseif (is_object($dependency)) {
  49365. $this->checkUndefined($value, $dependency, $path, $i);
  49366. }
  49367. }
  49368. }
  49369. }
  49370. protected function validateUri($schema, $schemaUri = null)
  49371. {
  49372. $resolver = new UriResolver();
  49373. $retriever = $this->factory->getUriRetriever();
  49374. $jsonSchema = null;
  49375. if ($resolver->isValid($schemaUri)) {
  49376. $schemaId = property_exists($schema, 'id') ? $schema->id : null;
  49377. $jsonSchema = $retriever->retrieve($schemaId, $schemaUri);
  49378. }
  49379. return $jsonSchema;
  49380. }
  49381. }
  49382. <?php
  49383. namespace JsonSchema\Entity;
  49384. use JsonSchema\Exception\InvalidArgumentException;
  49385. class JsonPointer
  49386. {
  49387. private $filename;
  49388. private $propertyPaths = array();
  49389. private $fromDefault = false;
  49390. public function __construct($value)
  49391. {
  49392. if (!is_string($value)) {
  49393. throw new InvalidArgumentException('Ref value must be a string');
  49394. }
  49395. $splitRef = explode('#', $value, 2);
  49396. $this->filename = $splitRef[0];
  49397. if (array_key_exists(1, $splitRef)) {
  49398. $this->propertyPaths = $this->decodePropertyPaths($splitRef[1]);
  49399. }
  49400. }
  49401. private function decodePropertyPaths($propertyPathString)
  49402. {
  49403. $paths = array();
  49404. foreach (explode('/', trim($propertyPathString, '/')) as $path) {
  49405. $path = $this->decodePath($path);
  49406. if (is_string($path) && '' !== $path) {
  49407. $paths[] = $path;
  49408. }
  49409. }
  49410. return $paths;
  49411. }
  49412. private function encodePropertyPaths()
  49413. {
  49414. return array_map(
  49415. array($this, 'encodePath'),
  49416. $this->getPropertyPaths()
  49417. );
  49418. }
  49419. private function decodePath($path)
  49420. {
  49421. return strtr($path, array('~1' => '/', '~0' => '~', '%25' => '%'));
  49422. }
  49423. private function encodePath($path)
  49424. {
  49425. return strtr($path, array('/' => '~1', '~' => '~0', '%' => '%25'));
  49426. }
  49427. public function getFilename()
  49428. {
  49429. return $this->filename;
  49430. }
  49431. public function getPropertyPaths()
  49432. {
  49433. return $this->propertyPaths;
  49434. }
  49435. public function withPropertyPaths(array $propertyPaths)
  49436. {
  49437. $new = clone $this;
  49438. $new->propertyPaths = $propertyPaths;
  49439. return $new;
  49440. }
  49441. public function getPropertyPathAsString()
  49442. {
  49443. return rtrim('#/' . implode('/', $this->encodePropertyPaths()), '/');
  49444. }
  49445. public function __toString()
  49446. {
  49447. return $this->getFilename() . $this->getPropertyPathAsString();
  49448. }
  49449. public function setFromDefault()
  49450. {
  49451. $this->fromDefault = true;
  49452. }
  49453. public function fromDefault()
  49454. {
  49455. return $this->fromDefault;
  49456. }
  49457. }
  49458. <?php
  49459. namespace JsonSchema\Exception;
  49460. interface ExceptionInterface
  49461. {
  49462. }
  49463. <?php
  49464. namespace JsonSchema\Exception;
  49465. class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
  49466. {
  49467. }
  49468. <?php
  49469. namespace JsonSchema\Exception;
  49470. class InvalidConfigException extends RuntimeException
  49471. {
  49472. }
  49473. <?php
  49474. namespace JsonSchema\Exception;
  49475. class InvalidSchemaException extends RuntimeException
  49476. {
  49477. }
  49478. <?php
  49479. namespace JsonSchema\Exception;
  49480. class InvalidSchemaMediaTypeException extends RuntimeException
  49481. {
  49482. }
  49483. <?php
  49484. namespace JsonSchema\Exception;
  49485. class InvalidSourceUriException extends InvalidArgumentException
  49486. {
  49487. }
  49488. <?php
  49489. namespace JsonSchema\Exception;
  49490. class JsonDecodingException extends RuntimeException
  49491. {
  49492. public function __construct($code = JSON_ERROR_NONE, \Exception $previous = null)
  49493. {
  49494. switch ($code) {
  49495. case JSON_ERROR_DEPTH:
  49496. $message = 'The maximum stack depth has been exceeded';
  49497. break;
  49498. case JSON_ERROR_STATE_MISMATCH:
  49499. $message = 'Invalid or malformed JSON';
  49500. break;
  49501. case JSON_ERROR_CTRL_CHAR:
  49502. $message = 'Control character error, possibly incorrectly encoded';
  49503. break;
  49504. case JSON_ERROR_UTF8:
  49505. $message = 'Malformed UTF-8 characters, possibly incorrectly encoded';
  49506. break;
  49507. case JSON_ERROR_SYNTAX:
  49508. $message = 'JSON syntax is malformed';
  49509. break;
  49510. default:
  49511. $message = 'Syntax error';
  49512. }
  49513. parent::__construct($message, $code, $previous);
  49514. }
  49515. }
  49516. <?php
  49517. namespace JsonSchema\Exception;
  49518. class ResourceNotFoundException extends RuntimeException
  49519. {
  49520. }
  49521. <?php
  49522. namespace JsonSchema\Exception;
  49523. class RuntimeException extends \RuntimeException implements ExceptionInterface
  49524. {
  49525. }
  49526. <?php
  49527. namespace JsonSchema\Exception;
  49528. class UnresolvableJsonPointerException extends InvalidArgumentException
  49529. {
  49530. }
  49531. <?php
  49532. namespace JsonSchema\Exception;
  49533. class UriResolverException extends RuntimeException
  49534. {
  49535. }
  49536. <?php
  49537. namespace JsonSchema\Exception;
  49538. class ValidationException extends RuntimeException
  49539. {
  49540. }
  49541. <?php
  49542. namespace JsonSchema\Iterator;
  49543. class ObjectIterator implements \Iterator, \Countable
  49544. {
  49545. private $object;
  49546. private $position = 0;
  49547. private $data = array();
  49548. private $initialized = false;
  49549. public function __construct($object)
  49550. {
  49551. $this->object = $object;
  49552. }
  49553. public function current()
  49554. {
  49555. $this->initialize();
  49556. return $this->data[$this->position];
  49557. }
  49558. public function next()
  49559. {
  49560. $this->initialize();
  49561. $this->position++;
  49562. }
  49563. public function key()
  49564. {
  49565. $this->initialize();
  49566. return $this->position;
  49567. }
  49568. public function valid()
  49569. {
  49570. $this->initialize();
  49571. return isset($this->data[$this->position]);
  49572. }
  49573. public function rewind()
  49574. {
  49575. $this->initialize();
  49576. $this->position = 0;
  49577. }
  49578. public function count()
  49579. {
  49580. $this->initialize();
  49581. return count($this->data);
  49582. }
  49583. private function initialize()
  49584. {
  49585. if (!$this->initialized) {
  49586. $this->data = $this->buildDataFromObject($this->object);
  49587. $this->initialized = true;
  49588. }
  49589. }
  49590. private function buildDataFromObject($object)
  49591. {
  49592. $result = array();
  49593. $stack = new \SplStack();
  49594. $stack->push($object);
  49595. while (!$stack->isEmpty()) {
  49596. $current = $stack->pop();
  49597. if (is_object($current)) {
  49598. array_push($result, $current);
  49599. }
  49600. foreach ($this->getDataFromItem($current) as $propertyName => $propertyValue) {
  49601. if (is_object($propertyValue) || is_array($propertyValue)) {
  49602. $stack->push($propertyValue);
  49603. }
  49604. }
  49605. }
  49606. return $result;
  49607. }
  49608. private function getDataFromItem($item)
  49609. {
  49610. if (!is_object($item) && !is_array($item)) {
  49611. return array();
  49612. }
  49613. return is_object($item) ? get_object_vars($item) : $item;
  49614. }
  49615. }
  49616. <?php
  49617. namespace JsonSchema;
  49618. class Rfc3339
  49619. {
  49620. const REGEX = '/^(\d{4}-\d{2}-\d{2}[T ]{1}\d{2}:\d{2}:\d{2})(\.\d+)?(Z|([+-]\d{2}):?(\d{2}))$/';
  49621. public static function createFromString($string)
  49622. {
  49623. if (!preg_match(self::REGEX, strtoupper($string), $matches)) {
  49624. return null;
  49625. }
  49626. $dateAndTime = $matches[1];
  49627. $microseconds = $matches[2] ?: '.000000';
  49628. $timeZone = 'Z' !== $matches[3] ? $matches[4] . ':' . $matches[5] : '+00:00';
  49629. $dateFormat = strpos($dateAndTime, 'T') === false ? 'Y-m-d H:i:s.uP' : 'Y-m-d\TH:i:s.uP';
  49630. $dateTime = \DateTime::createFromFormat($dateFormat, $dateAndTime . $microseconds . $timeZone, new \DateTimeZone('UTC'));
  49631. return $dateTime ?: null;
  49632. }
  49633. }
  49634. <?php
  49635. namespace JsonSchema;
  49636. use JsonSchema\Constraints\BaseConstraint;
  49637. use JsonSchema\Entity\JsonPointer;
  49638. use JsonSchema\Exception\UnresolvableJsonPointerException;
  49639. use JsonSchema\Uri\UriResolver;
  49640. use JsonSchema\Uri\UriRetriever;
  49641. class SchemaStorage implements SchemaStorageInterface
  49642. {
  49643. const INTERNAL_PROVIDED_SCHEMA_URI = 'internal://provided-schema/';
  49644. protected $uriRetriever;
  49645. protected $uriResolver;
  49646. protected $schemas = array();
  49647. public function __construct(
  49648. UriRetrieverInterface $uriRetriever = null,
  49649. UriResolverInterface $uriResolver = null
  49650. ) {
  49651. $this->uriRetriever = $uriRetriever ?: new UriRetriever();
  49652. $this->uriResolver = $uriResolver ?: new UriResolver();
  49653. }
  49654. public function getUriRetriever()
  49655. {
  49656. return $this->uriRetriever;
  49657. }
  49658. public function getUriResolver()
  49659. {
  49660. return $this->uriResolver;
  49661. }
  49662. public function addSchema($id, $schema = null)
  49663. {
  49664. if (is_null($schema) && $id !== self::INTERNAL_PROVIDED_SCHEMA_URI) {
  49665. $schema = $this->uriRetriever->retrieve($id);
  49666. }
  49667. if (is_array($schema)) {
  49668. $schema = BaseConstraint::arrayToObjectRecursive($schema);
  49669. }
  49670. if (is_object($schema) && property_exists($schema, 'id')) {
  49671. if ($schema->id == 'http://json-schema.org/draft-04/schema#') {
  49672. $schema->properties->id->format = 'uri-reference';
  49673. } elseif ($schema->id == 'http://json-schema.org/draft-03/schema#') {
  49674. $schema->properties->id->format = 'uri-reference';
  49675. $schema->properties->{'$ref'}->format = 'uri-reference';
  49676. }
  49677. }
  49678. $this->expandRefs($schema, $id);
  49679. $this->schemas[$id] = $schema;
  49680. }
  49681. private function expandRefs(&$schema, $base = null)
  49682. {
  49683. if (!is_object($schema)) {
  49684. if (is_array($schema)) {
  49685. foreach ($schema as &$member) {
  49686. $this->expandRefs($member, $base);
  49687. }
  49688. }
  49689. return;
  49690. }
  49691. if (property_exists($schema, 'id') && is_string($schema->id) && $base != $schema->id) {
  49692. $base = $this->uriResolver->resolve($schema->id, $base);
  49693. }
  49694. if (property_exists($schema, '$ref') && is_string($schema->{'$ref'})) {
  49695. $refPointer = new JsonPointer($this->uriResolver->resolve($schema->{'$ref'}, $base));
  49696. $schema->{'$ref'} = (string) $refPointer;
  49697. }
  49698. foreach ($schema as &$member) {
  49699. $this->expandRefs($member, $base);
  49700. }
  49701. }
  49702. public function getSchema($id)
  49703. {
  49704. if (!array_key_exists($id, $this->schemas)) {
  49705. $this->addSchema($id);
  49706. }
  49707. return $this->schemas[$id];
  49708. }
  49709. public function resolveRef($ref)
  49710. {
  49711. $jsonPointer = new JsonPointer($ref);
  49712. $fileName = $jsonPointer->getFilename();
  49713. if (!strlen($fileName)) {
  49714. throw new UnresolvableJsonPointerException(sprintf(
  49715. "Could not resolve fragment '%s': no file is defined",
  49716. $jsonPointer->getPropertyPathAsString()
  49717. ));
  49718. }
  49719. $refSchema = $this->getSchema($fileName);
  49720. foreach ($jsonPointer->getPropertyPaths() as $path) {
  49721. if (is_object($refSchema) && property_exists($refSchema, $path)) {
  49722. $refSchema = $this->resolveRefSchema($refSchema->{$path});
  49723. } elseif (is_array($refSchema) && array_key_exists($path, $refSchema)) {
  49724. $refSchema = $this->resolveRefSchema($refSchema[$path]);
  49725. } else {
  49726. throw new UnresolvableJsonPointerException(sprintf(
  49727. 'File: %s is found, but could not resolve fragment: %s',
  49728. $jsonPointer->getFilename(),
  49729. $jsonPointer->getPropertyPathAsString()
  49730. ));
  49731. }
  49732. }
  49733. return $refSchema;
  49734. }
  49735. public function resolveRefSchema($refSchema)
  49736. {
  49737. if (is_object($refSchema) && property_exists($refSchema, '$ref') && is_string($refSchema->{'$ref'})) {
  49738. $newSchema = $this->resolveRef($refSchema->{'$ref'});
  49739. $refSchema = (object) (get_object_vars($refSchema) + get_object_vars($newSchema));
  49740. unset($refSchema->{'$ref'});
  49741. }
  49742. return $refSchema;
  49743. }
  49744. }
  49745. <?php
  49746. namespace JsonSchema;
  49747. interface SchemaStorageInterface
  49748. {
  49749. public function addSchema($id, $schema = null);
  49750. public function getSchema($id);
  49751. public function resolveRef($ref);
  49752. public function resolveRefSchema($refSchema);
  49753. }
  49754. <?php
  49755. namespace JsonSchema\Uri\Retrievers;
  49756. abstract class AbstractRetriever implements UriRetrieverInterface
  49757. {
  49758. protected $contentType;
  49759. public function getContentType()
  49760. {
  49761. return $this->contentType;
  49762. }
  49763. }
  49764. <?php
  49765. namespace JsonSchema\Uri\Retrievers;
  49766. use JsonSchema\Exception\RuntimeException;
  49767. use JsonSchema\Validator;
  49768. class Curl extends AbstractRetriever
  49769. {
  49770. protected $messageBody;
  49771. public function __construct()
  49772. {
  49773. if (!function_exists('curl_init')) {
  49774. throw new RuntimeException('cURL not installed');
  49775. }
  49776. }
  49777. public function retrieve($uri)
  49778. {
  49779. $ch = curl_init();
  49780. curl_setopt($ch, CURLOPT_URL, $uri);
  49781. curl_setopt($ch, CURLOPT_HEADER, true);
  49782. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  49783. curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: ' . Validator::SCHEMA_MEDIA_TYPE));
  49784. $response = curl_exec($ch);
  49785. if (false === $response) {
  49786. throw new \JsonSchema\Exception\ResourceNotFoundException('JSON schema not found');
  49787. }
  49788. $this->fetchMessageBody($response);
  49789. $this->fetchContentType($response);
  49790. curl_close($ch);
  49791. return $this->messageBody;
  49792. }
  49793. private function fetchMessageBody($response)
  49794. {
  49795. preg_match("/(?:\r\n){2}(.*)$/ms", $response, $match);
  49796. $this->messageBody = $match[1];
  49797. }
  49798. protected function fetchContentType($response)
  49799. {
  49800. if (0 < preg_match("/Content-Type:(\V*)/ims", $response, $match)) {
  49801. $this->contentType = trim($match[1]);
  49802. return true;
  49803. }
  49804. return false;
  49805. }
  49806. }
  49807. <?php
  49808. namespace JsonSchema\Uri\Retrievers;
  49809. use JsonSchema\Exception\ResourceNotFoundException;
  49810. class FileGetContents extends AbstractRetriever
  49811. {
  49812. protected $messageBody;
  49813. public function retrieve($uri)
  49814. {
  49815. $errorMessage = null;
  49816. set_error_handler(function ($errno, $errstr) use (&$errorMessage) {
  49817. $errorMessage = $errstr;
  49818. });
  49819. $response = file_get_contents($uri);
  49820. restore_error_handler();
  49821. if ($errorMessage) {
  49822. throw new ResourceNotFoundException($errorMessage);
  49823. }
  49824. if (false === $response) {
  49825. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49826. }
  49827. if ($response == ''
  49828. && substr($uri, 0, 7) == 'file://' && substr($uri, -1) == '/'
  49829. ) {
  49830. throw new ResourceNotFoundException('JSON schema not found at ' . $uri);
  49831. }
  49832. $this->messageBody = $response;
  49833. if (!empty($http_response_header)) {
  49834. $this->fetchContentType($http_response_header);
  49835. } else {
  49836. $this->contentType = null;
  49837. }
  49838. return $this->messageBody;
  49839. }
  49840. private function fetchContentType(array $headers)
  49841. {
  49842. foreach ($headers as $header) {
  49843. if ($this->contentType = self::getContentTypeMatchInHeader($header)) {
  49844. return true;
  49845. }
  49846. }
  49847. return false;
  49848. }
  49849. protected static function getContentTypeMatchInHeader($header)
  49850. {
  49851. if (0 < preg_match("/Content-Type:(\V*)/ims", $header, $match)) {
  49852. return trim($match[1]);
  49853. }
  49854. return null;
  49855. }
  49856. }
  49857. <?php
  49858. namespace JsonSchema\Uri\Retrievers;
  49859. use JsonSchema\Validator;
  49860. class PredefinedArray extends AbstractRetriever
  49861. {
  49862. private $schemas;
  49863. public function __construct(array $schemas, $contentType = Validator::SCHEMA_MEDIA_TYPE)
  49864. {
  49865. $this->schemas = $schemas;
  49866. $this->contentType = $contentType;
  49867. }
  49868. public function retrieve($uri)
  49869. {
  49870. if (!array_key_exists($uri, $this->schemas)) {
  49871. throw new \JsonSchema\Exception\ResourceNotFoundException(sprintf(
  49872. 'The JSON schema "%s" was not found.',
  49873. $uri
  49874. ));
  49875. }
  49876. return $this->schemas[$uri];
  49877. }
  49878. }
  49879. <?php
  49880. namespace JsonSchema\Uri\Retrievers;
  49881. interface UriRetrieverInterface
  49882. {
  49883. public function retrieve($uri);
  49884. public function getContentType();
  49885. }
  49886. <?php
  49887. namespace JsonSchema\Uri;
  49888. use JsonSchema\Exception\UriResolverException;
  49889. use JsonSchema\UriResolverInterface;
  49890. class UriResolver implements UriResolverInterface
  49891. {
  49892. public function parse($uri)
  49893. {
  49894. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  49895. $components = array();
  49896. if (5 < count($match)) {
  49897. $components = array(
  49898. 'scheme' => $match[2],
  49899. 'authority' => $match[4],
  49900. 'path' => $match[5]
  49901. );
  49902. }
  49903. if (7 < count($match)) {
  49904. $components['query'] = $match[7];
  49905. }
  49906. if (9 < count($match)) {
  49907. $components['fragment'] = $match[9];
  49908. }
  49909. return $components;
  49910. }
  49911. public function generate(array $components)
  49912. {
  49913. $uri = $components['scheme'] . '://'
  49914. . $components['authority']
  49915. . $components['path'];
  49916. if (array_key_exists('query', $components) && strlen($components['query'])) {
  49917. $uri .= '?' . $components['query'];
  49918. }
  49919. if (array_key_exists('fragment', $components)) {
  49920. $uri .= '#' . $components['fragment'];
  49921. }
  49922. return $uri;
  49923. }
  49924. public function resolve($uri, $baseUri = null)
  49925. {
  49926. if (
  49927. !is_null($baseUri) &&
  49928. !filter_var($baseUri, \FILTER_VALIDATE_URL) &&
  49929. !preg_match('|^[^/]+://|u', $baseUri)
  49930. ) {
  49931. if (is_file($baseUri)) {
  49932. $baseUri = 'file://' . realpath($baseUri);
  49933. } elseif (is_dir($baseUri)) {
  49934. $baseUri = 'file://' . realpath($baseUri) . '/';
  49935. } else {
  49936. $baseUri = 'file://' . getcwd() . '/' . $baseUri;
  49937. }
  49938. }
  49939. if ($uri == '') {
  49940. return $baseUri;
  49941. }
  49942. $components = $this->parse($uri);
  49943. $path = $components['path'];
  49944. if (!empty($components['scheme'])) {
  49945. return $uri;
  49946. }
  49947. $baseComponents = $this->parse($baseUri);
  49948. $basePath = $baseComponents['path'];
  49949. $baseComponents['path'] = self::combineRelativePathWithBasePath($path, $basePath);
  49950. if (isset($components['fragment'])) {
  49951. $baseComponents['fragment'] = $components['fragment'];
  49952. }
  49953. return $this->generate($baseComponents);
  49954. }
  49955. public static function combineRelativePathWithBasePath($relativePath, $basePath)
  49956. {
  49957. $relativePath = self::normalizePath($relativePath);
  49958. if ($relativePath == '') {
  49959. return $basePath;
  49960. }
  49961. if ($relativePath[0] == '/') {
  49962. return $relativePath;
  49963. }
  49964. $basePathSegments = explode('/', $basePath);
  49965. preg_match('|^/?(\.\./(?:\./)*)*|', $relativePath, $match);
  49966. $numLevelUp = strlen($match[0]) /3 + 1;
  49967. if ($numLevelUp >= count($basePathSegments)) {
  49968. throw new UriResolverException(sprintf("Unable to resolve URI '%s' from base '%s'", $relativePath, $basePath));
  49969. }
  49970. $basePathSegments = array_slice($basePathSegments, 0, -$numLevelUp);
  49971. $path = preg_replace('|^/?(\.\./(\./)*)*|', '', $relativePath);
  49972. return implode('/', $basePathSegments) . '/' . $path;
  49973. }
  49974. private static function normalizePath($path)
  49975. {
  49976. $path = preg_replace('|((?<!\.)\./)*|', '', $path);
  49977. $path = preg_replace('|//|', '/', $path);
  49978. return $path;
  49979. }
  49980. public function isValid($uri)
  49981. {
  49982. $components = $this->parse($uri);
  49983. return !empty($components);
  49984. }
  49985. }
  49986. <?php
  49987. namespace JsonSchema\Uri;
  49988. use JsonSchema\Exception\InvalidSchemaMediaTypeException;
  49989. use JsonSchema\Exception\JsonDecodingException;
  49990. use JsonSchema\Exception\ResourceNotFoundException;
  49991. use JsonSchema\Uri\Retrievers\FileGetContents;
  49992. use JsonSchema\Uri\Retrievers\UriRetrieverInterface;
  49993. use JsonSchema\UriRetrieverInterface as BaseUriRetrieverInterface;
  49994. use JsonSchema\Validator;
  49995. class UriRetriever implements BaseUriRetrieverInterface
  49996. {
  49997. protected $translationMap = array(
  49998. '|^https?://json-schema.org/draft-(0[34])/schema#?|' => 'package://dist/schema/json-schema-draft-$1.json'
  49999. );
  50000. protected $allowedInvalidContentTypeEndpoints = array(
  50001. 'http://json-schema.org/',
  50002. 'https://json-schema.org/'
  50003. );
  50004. protected $uriRetriever = null;
  50005. private $schemaCache = array();
  50006. public function addInvalidContentTypeEndpoint($endpoint)
  50007. {
  50008. $this->allowedInvalidContentTypeEndpoints[] = $endpoint;
  50009. }
  50010. public function confirmMediaType($uriRetriever, $uri)
  50011. {
  50012. $contentType = $uriRetriever->getContentType();
  50013. if (is_null($contentType)) {
  50014. return;
  50015. }
  50016. if (in_array($contentType, array(Validator::SCHEMA_MEDIA_TYPE, 'application/json'))) {
  50017. return;
  50018. }
  50019. foreach ($this->allowedInvalidContentTypeEndpoints as $endpoint) {
  50020. if (strpos($uri, $endpoint) === 0) {
  50021. return true;
  50022. }
  50023. }
  50024. throw new InvalidSchemaMediaTypeException(sprintf('Media type %s expected', Validator::SCHEMA_MEDIA_TYPE));
  50025. }
  50026. public function getUriRetriever()
  50027. {
  50028. if (is_null($this->uriRetriever)) {
  50029. $this->setUriRetriever(new FileGetContents());
  50030. }
  50031. return $this->uriRetriever;
  50032. }
  50033. public function resolvePointer($jsonSchema, $uri)
  50034. {
  50035. $resolver = new UriResolver();
  50036. $parsed = $resolver->parse($uri);
  50037. if (empty($parsed['fragment'])) {
  50038. return $jsonSchema;
  50039. }
  50040. $path = explode('/', $parsed['fragment']);
  50041. while ($path) {
  50042. $pathElement = array_shift($path);
  50043. if (!empty($pathElement)) {
  50044. $pathElement = str_replace('~1', '/', $pathElement);
  50045. $pathElement = str_replace('~0', '~', $pathElement);
  50046. if (!empty($jsonSchema->$pathElement)) {
  50047. $jsonSchema = $jsonSchema->$pathElement;
  50048. } else {
  50049. throw new ResourceNotFoundException(
  50050. 'Fragment "' . $parsed['fragment'] . '" not found'
  50051. . ' in ' . $uri
  50052. );
  50053. }
  50054. if (!is_object($jsonSchema)) {
  50055. throw new ResourceNotFoundException(
  50056. 'Fragment part "' . $pathElement . '" is no object '
  50057. . ' in ' . $uri
  50058. );
  50059. }
  50060. }
  50061. }
  50062. return $jsonSchema;
  50063. }
  50064. public function retrieve($uri, $baseUri = null, $translate = true)
  50065. {
  50066. $resolver = new UriResolver();
  50067. $resolvedUri = $fetchUri = $resolver->resolve($uri, $baseUri);
  50068. $arParts = $resolver->parse($resolvedUri);
  50069. if (isset($arParts['fragment'])) {
  50070. unset($arParts['fragment']);
  50071. $fetchUri = $resolver->generate($arParts);
  50072. }
  50073. if ($translate) {
  50074. $fetchUri = $this->translate($fetchUri);
  50075. }
  50076. $jsonSchema = $this->loadSchema($fetchUri);
  50077. $jsonSchema = $this->resolvePointer($jsonSchema, $resolvedUri);
  50078. if ($jsonSchema instanceof \stdClass) {
  50079. $jsonSchema->id = $resolvedUri;
  50080. }
  50081. return $jsonSchema;
  50082. }
  50083. protected function loadSchema($fetchUri)
  50084. {
  50085. if (isset($this->schemaCache[$fetchUri])) {
  50086. return $this->schemaCache[$fetchUri];
  50087. }
  50088. $uriRetriever = $this->getUriRetriever();
  50089. $contents = $this->uriRetriever->retrieve($fetchUri);
  50090. $this->confirmMediaType($uriRetriever, $fetchUri);
  50091. $jsonSchema = json_decode($contents);
  50092. if (JSON_ERROR_NONE < $error = json_last_error()) {
  50093. throw new JsonDecodingException($error);
  50094. }
  50095. $this->schemaCache[$fetchUri] = $jsonSchema;
  50096. return $jsonSchema;
  50097. }
  50098. public function setUriRetriever(UriRetrieverInterface $uriRetriever)
  50099. {
  50100. $this->uriRetriever = $uriRetriever;
  50101. return $this;
  50102. }
  50103. public function parse($uri)
  50104. {
  50105. preg_match('|^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?|', $uri, $match);
  50106. $components = array();
  50107. if (5 < count($match)) {
  50108. $components = array(
  50109. 'scheme' => $match[2],
  50110. 'authority' => $match[4],
  50111. 'path' => $match[5]
  50112. );
  50113. }
  50114. if (7 < count($match)) {
  50115. $components['query'] = $match[7];
  50116. }
  50117. if (9 < count($match)) {
  50118. $components['fragment'] = $match[9];
  50119. }
  50120. return $components;
  50121. }
  50122. public function generate(array $components)
  50123. {
  50124. $uri = $components['scheme'] . '://'
  50125. . $components['authority']
  50126. . $components['path'];
  50127. if (array_key_exists('query', $components)) {
  50128. $uri .= $components['query'];
  50129. }
  50130. if (array_key_exists('fragment', $components)) {
  50131. $uri .= $components['fragment'];
  50132. }
  50133. return $uri;
  50134. }
  50135. public function resolve($uri, $baseUri = null)
  50136. {
  50137. $components = $this->parse($uri);
  50138. $path = $components['path'];
  50139. if ((array_key_exists('scheme', $components)) && ('http' === $components['scheme'])) {
  50140. return $uri;
  50141. }
  50142. $baseComponents = $this->parse($baseUri);
  50143. $basePath = $baseComponents['path'];
  50144. $baseComponents['path'] = UriResolver::combineRelativePathWithBasePath($path, $basePath);
  50145. return $this->generate($baseComponents);
  50146. }
  50147. public function isValid($uri)
  50148. {
  50149. $components = $this->parse($uri);
  50150. return !empty($components);
  50151. }
  50152. public function setTranslation($from, $to)
  50153. {
  50154. $this->translationMap[$from] = $to;
  50155. }
  50156. public function translate($uri)
  50157. {
  50158. foreach ($this->translationMap as $from => $to) {
  50159. $uri = preg_replace($from, $to, $uri);
  50160. }
  50161. $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
  50162. return $uri;
  50163. }
  50164. }
  50165. <?php
  50166. namespace JsonSchema;
  50167. interface UriResolverInterface
  50168. {
  50169. public function resolve($uri, $baseUri = null);
  50170. }
  50171. <?php
  50172. namespace JsonSchema;
  50173. interface UriRetrieverInterface
  50174. {
  50175. public function retrieve($uri, $baseUri = null);
  50176. }
  50177. <?php
  50178. namespace JsonSchema;
  50179. use JsonSchema\Constraints\BaseConstraint;
  50180. use JsonSchema\Constraints\Constraint;
  50181. class Validator extends BaseConstraint
  50182. {
  50183. const SCHEMA_MEDIA_TYPE = 'application/schema+json';
  50184. const ERROR_NONE = 0x00000000;
  50185. const ERROR_ALL = 0xFFFFFFFF;
  50186. const ERROR_DOCUMENT_VALIDATION = 0x00000001;
  50187. const ERROR_SCHEMA_VALIDATION = 0x00000002;
  50188. public function validate(&$value, $schema = null, $checkMode = null)
  50189. {
  50190. if (is_array($schema)) {
  50191. $schema = self::arrayToObjectRecursive($schema);
  50192. }
  50193. $initialCheckMode = $this->factory->getConfig();
  50194. if ($checkMode !== null) {
  50195. $this->factory->setConfig($checkMode);
  50196. }
  50197. if (is_object($schema) && property_exists($schema, 'id')) {
  50198. $schemaURI = $schema->id;
  50199. } else {
  50200. $schemaURI = SchemaStorage::INTERNAL_PROVIDED_SCHEMA_URI;
  50201. }
  50202. $this->factory->getSchemaStorage()->addSchema($schemaURI, $schema);
  50203. $validator = $this->factory->createInstanceFor('schema');
  50204. $validator->check(
  50205. $value,
  50206. $this->factory->getSchemaStorage()->getSchema($schemaURI)
  50207. );
  50208. $this->factory->setConfig($initialCheckMode);
  50209. $this->addErrors(array_unique($validator->getErrors(), SORT_REGULAR));
  50210. return $validator->getErrorMask();
  50211. }
  50212. public function check($value, $schema)
  50213. {
  50214. return $this->validate($value, $schema);
  50215. }
  50216. public function coerce(&$value, $schema)
  50217. {
  50218. return $this->validate($value, $schema, Constraint::CHECK_MODE_COERCE_TYPES);
  50219. }
  50220. }
  50221. Copyright (C) 2015 Composer
  50222. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50223. this software and associated documentation files (the "Software"), to deal in
  50224. the Software without restriction, including without limitation the rights to
  50225. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50226. of the Software, and to permit persons to whom the Software is furnished to do
  50227. so, subject to the following conditions:
  50228. The above copyright notice and this permission notice shall be included in all
  50229. copies or substantial portions of the Software.
  50230. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50231. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50232. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50233. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50234. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50235. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50236. SOFTWARE.
  50237. <?php
  50238. namespace Composer\Spdx;
  50239. class SpdxLicenses
  50240. {
  50241. const LICENSES_FILE = 'spdx-licenses.json';
  50242. const EXCEPTIONS_FILE = 'spdx-exceptions.json';
  50243. private $licenses;
  50244. private $licensesExpression;
  50245. private $exceptions;
  50246. private $exceptionsExpression;
  50247. public function __construct()
  50248. {
  50249. $this->loadLicenses();
  50250. $this->loadExceptions();
  50251. }
  50252. public function getLicenseByIdentifier($identifier)
  50253. {
  50254. $key = strtolower($identifier);
  50255. if (!isset($this->licenses[$key])) {
  50256. return;
  50257. }
  50258. list($identifier, $name, $isOsiApproved, $isDeprecatedLicenseId) = $this->licenses[$key];
  50259. return array(
  50260. $name,
  50261. $isOsiApproved,
  50262. 'https://spdx.org/licenses/' . $identifier . '.html#licenseText',
  50263. $isDeprecatedLicenseId,
  50264. );
  50265. }
  50266. public function getLicenses()
  50267. {
  50268. return $this->licenses;
  50269. }
  50270. public function getExceptionByIdentifier($identifier)
  50271. {
  50272. $key = strtolower($identifier);
  50273. if (!isset($this->exceptions[$key])) {
  50274. return;
  50275. }
  50276. list($identifier, $name) = $this->exceptions[$key];
  50277. return array(
  50278. $name,
  50279. 'https://spdx.org/licenses/' . $identifier . '.html#licenseExceptionText',
  50280. );
  50281. }
  50282. public function getIdentifierByName($name)
  50283. {
  50284. foreach ($this->licenses as $licenseData) {
  50285. if ($licenseData[1] === $name) {
  50286. return $licenseData[0];
  50287. }
  50288. }
  50289. foreach ($this->exceptions as $licenseData) {
  50290. if ($licenseData[1] === $name) {
  50291. return $licenseData[0];
  50292. }
  50293. }
  50294. }
  50295. public function isOsiApprovedByIdentifier($identifier)
  50296. {
  50297. return $this->licenses[strtolower($identifier)][2];
  50298. }
  50299. public function isDeprecatedByIdentifier($identifier)
  50300. {
  50301. return $this->licenses[strtolower($identifier)][3];
  50302. }
  50303. public function validate($license)
  50304. {
  50305. if (is_array($license)) {
  50306. $count = count($license);
  50307. if ($count !== count(array_filter($license, 'is_string'))) {
  50308. throw new \InvalidArgumentException('Array of strings expected.');
  50309. }
  50310. $license = $count > 1 ? '(' . implode(' OR ', $license) . ')' : (string) reset($license);
  50311. }
  50312. if (!is_string($license)) {
  50313. throw new \InvalidArgumentException(sprintf(
  50314. 'Array or String expected, %s given.',
  50315. gettype($license)
  50316. ));
  50317. }
  50318. return $this->isValidLicenseString($license);
  50319. }
  50320. public static function getResourcesDir()
  50321. {
  50322. return dirname(__DIR__) . '/res';
  50323. }
  50324. private function loadLicenses()
  50325. {
  50326. if (null !== $this->licenses) {
  50327. return;
  50328. }
  50329. $json = file_get_contents(self::getResourcesDir() . '/' . self::LICENSES_FILE);
  50330. $this->licenses = array();
  50331. foreach (json_decode($json, true) as $identifier => $license) {
  50332. $this->licenses[strtolower($identifier)] = array($identifier, $license[0], $license[1], $license[2]);
  50333. }
  50334. }
  50335. private function loadExceptions()
  50336. {
  50337. if (null !== $this->exceptions) {
  50338. return;
  50339. }
  50340. $json = file_get_contents(self::getResourcesDir() . '/' . self::EXCEPTIONS_FILE);
  50341. $this->exceptions = array();
  50342. foreach (json_decode($json, true) as $identifier => $exception) {
  50343. $this->exceptions[strtolower($identifier)] = array($identifier, $exception[0]);
  50344. }
  50345. }
  50346. private function getLicensesExpression()
  50347. {
  50348. if (null === $this->licensesExpression) {
  50349. $licenses = array_map('preg_quote', array_keys($this->licenses));
  50350. rsort($licenses);
  50351. $licenses = implode('|', $licenses);
  50352. $this->licensesExpression = $licenses;
  50353. }
  50354. return $this->licensesExpression;
  50355. }
  50356. private function getExceptionsExpression()
  50357. {
  50358. if (null === $this->exceptionsExpression) {
  50359. $exceptions = array_map('preg_quote', array_keys($this->exceptions));
  50360. rsort($exceptions);
  50361. $exceptions = implode('|', $exceptions);
  50362. $this->exceptionsExpression = $exceptions;
  50363. }
  50364. return $this->exceptionsExpression;
  50365. }
  50366. private function isValidLicenseString($license)
  50367. {
  50368. if (isset($this->licenses[strtolower($license)])) {
  50369. return true;
  50370. }
  50371. $licenses = $this->getLicensesExpression();
  50372. $exceptions = $this->getExceptionsExpression();
  50373. $regex = <<<REGEX
  50374. {
  50375. (?(DEFINE)
  50376. # idstring: 1*( ALPHA / DIGIT / - / . )
  50377. (?<idstring>[\pL\pN.-]{1,})
  50378. # license-id: taken from list
  50379. (?<licenseid>${licenses})
  50380. # license-exception-id: taken from list
  50381. (?<licenseexceptionid>${exceptions})
  50382. # license-ref: [DocumentRef-1*(idstring):]LicenseRef-1*(idstring)
  50383. (?<licenseref>(?:DocumentRef-(?&idstring):)?LicenseRef-(?&idstring))
  50384. # simple-expresssion: license-id / license-id+ / license-ref
  50385. (?<simple_expression>(?&licenseid)\+? | (?&licenseid) | (?&licenseref))
  50386. # compound-expression: 1*(
  50387. # simple-expression /
  50388. # simple-expression WITH license-exception-id /
  50389. # compound-expression AND compound-expression /
  50390. # compound-expression OR compound-expression
  50391. # ) / ( compound-expression ) )
  50392. (?<compound_head>
  50393. (?&simple_expression) ( \s+ WITH \s+ (?&licenseexceptionid))?
  50394. | \( \s* (?&compound_expression) \s* \)
  50395. )
  50396. (?<compound_expression>
  50397. (?&compound_head) (?: \s+ (?:AND|OR) \s+ (?&compound_expression))?
  50398. )
  50399. # license-expression: 1*1(simple-expression / compound-expression)
  50400. (?<license_expression>(?&compound_expression) | (?&simple_expression))
  50401. ) # end of define
  50402. ^(NONE | NOASSERTION | (?&license_expression))$
  50403. }xi
  50404. REGEX;
  50405. $match = preg_match($regex, $license);
  50406. if (0 === $match) {
  50407. return false;
  50408. }
  50409. if (false === $match) {
  50410. throw new \RuntimeException('Regex failed to compile/run.');
  50411. }
  50412. return true;
  50413. }
  50414. }
  50415. Copyright (C) 2015 Composer
  50416. Permission is hereby granted, free of charge, to any person obtaining a copy of
  50417. this software and associated documentation files (the "Software"), to deal in
  50418. the Software without restriction, including without limitation the rights to
  50419. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  50420. of the Software, and to permit persons to whom the Software is furnished to do
  50421. so, subject to the following conditions:
  50422. The above copyright notice and this permission notice shall be included in all
  50423. copies or substantial portions of the Software.
  50424. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  50425. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  50426. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  50427. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  50428. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  50429. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  50430. SOFTWARE.
  50431. <?php
  50432. namespace Composer\Semver;
  50433. use Composer\Semver\Constraint\Constraint;
  50434. class Comparator
  50435. {
  50436. public static function greaterThan($version1, $version2)
  50437. {
  50438. return self::compare($version1, '>', $version2);
  50439. }
  50440. public static function greaterThanOrEqualTo($version1, $version2)
  50441. {
  50442. return self::compare($version1, '>=', $version2);
  50443. }
  50444. public static function lessThan($version1, $version2)
  50445. {
  50446. return self::compare($version1, '<', $version2);
  50447. }
  50448. public static function lessThanOrEqualTo($version1, $version2)
  50449. {
  50450. return self::compare($version1, '<=', $version2);
  50451. }
  50452. public static function equalTo($version1, $version2)
  50453. {
  50454. return self::compare($version1, '==', $version2);
  50455. }
  50456. public static function notEqualTo($version1, $version2)
  50457. {
  50458. return self::compare($version1, '!=', $version2);
  50459. }
  50460. public static function compare($version1, $operator, $version2)
  50461. {
  50462. $constraint = new Constraint($operator, $version2);
  50463. return $constraint->matches(new Constraint('==', $version1));
  50464. }
  50465. }
  50466. <?php
  50467. namespace Composer\Semver\Constraint;
  50468. 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);
  50469. abstract class AbstractConstraint implements ConstraintInterface
  50470. {
  50471. protected $prettyString;
  50472. public function matches(ConstraintInterface $provider)
  50473. {
  50474. if ($provider instanceof $this) {
  50475. return $this->matchSpecific($provider);
  50476. }
  50477. return $provider->matches($this);
  50478. }
  50479. public function setPrettyString($prettyString)
  50480. {
  50481. $this->prettyString = $prettyString;
  50482. }
  50483. public function getPrettyString()
  50484. {
  50485. if ($this->prettyString) {
  50486. return $this->prettyString;
  50487. }
  50488. return $this->__toString();
  50489. }
  50490. }
  50491. <?php
  50492. namespace Composer\Semver\Constraint;
  50493. class Constraint implements ConstraintInterface
  50494. {
  50495. const OP_EQ = 0;
  50496. const OP_LT = 1;
  50497. const OP_LE = 2;
  50498. const OP_GT = 3;
  50499. const OP_GE = 4;
  50500. const OP_NE = 5;
  50501. private static $transOpStr = array(
  50502. '=' => self::OP_EQ,
  50503. '==' => self::OP_EQ,
  50504. '<' => self::OP_LT,
  50505. '<=' => self::OP_LE,
  50506. '>' => self::OP_GT,
  50507. '>=' => self::OP_GE,
  50508. '<>' => self::OP_NE,
  50509. '!=' => self::OP_NE,
  50510. );
  50511. private static $transOpInt = array(
  50512. self::OP_EQ => '==',
  50513. self::OP_LT => '<',
  50514. self::OP_LE => '<=',
  50515. self::OP_GT => '>',
  50516. self::OP_GE => '>=',
  50517. self::OP_NE => '!=',
  50518. );
  50519. protected $operator;
  50520. protected $version;
  50521. protected $prettyString;
  50522. public function matches(ConstraintInterface $provider)
  50523. {
  50524. if ($provider instanceof $this) {
  50525. return $this->matchSpecific($provider);
  50526. }
  50527. return $provider->matches($this);
  50528. }
  50529. public function setPrettyString($prettyString)
  50530. {
  50531. $this->prettyString = $prettyString;
  50532. }
  50533. public function getPrettyString()
  50534. {
  50535. if ($this->prettyString) {
  50536. return $this->prettyString;
  50537. }
  50538. return $this->__toString();
  50539. }
  50540. public static function getSupportedOperators()
  50541. {
  50542. return array_keys(self::$transOpStr);
  50543. }
  50544. public function __construct($operator, $version)
  50545. {
  50546. if (!isset(self::$transOpStr[$operator])) {
  50547. throw new \InvalidArgumentException(sprintf(
  50548. 'Invalid operator "%s" given, expected one of: %s',
  50549. $operator,
  50550. implode(', ', self::getSupportedOperators())
  50551. ));
  50552. }
  50553. $this->operator = self::$transOpStr[$operator];
  50554. $this->version = $version;
  50555. }
  50556. public function versionCompare($a, $b, $operator, $compareBranches = false)
  50557. {
  50558. if (!isset(self::$transOpStr[$operator])) {
  50559. throw new \InvalidArgumentException(sprintf(
  50560. 'Invalid operator "%s" given, expected one of: %s',
  50561. $operator,
  50562. implode(', ', self::getSupportedOperators())
  50563. ));
  50564. }
  50565. $aIsBranch = 'dev-' === substr($a, 0, 4);
  50566. $bIsBranch = 'dev-' === substr($b, 0, 4);
  50567. if ($aIsBranch && $bIsBranch) {
  50568. return $operator === '==' && $a === $b;
  50569. }
  50570. if (!$compareBranches && ($aIsBranch || $bIsBranch)) {
  50571. return false;
  50572. }
  50573. return version_compare($a, $b, $operator);
  50574. }
  50575. public function matchSpecific(Constraint $provider, $compareBranches = false)
  50576. {
  50577. $noEqualOp = str_replace('=', '', self::$transOpInt[$this->operator]);
  50578. $providerNoEqualOp = str_replace('=', '', self::$transOpInt[$provider->operator]);
  50579. $isEqualOp = self::OP_EQ === $this->operator;
  50580. $isNonEqualOp = self::OP_NE === $this->operator;
  50581. $isProviderEqualOp = self::OP_EQ === $provider->operator;
  50582. $isProviderNonEqualOp = self::OP_NE === $provider->operator;
  50583. if ($isNonEqualOp || $isProviderNonEqualOp) {
  50584. return !$isEqualOp && !$isProviderEqualOp
  50585. || $this->versionCompare($provider->version, $this->version, '!=', $compareBranches);
  50586. }
  50587. if ($this->operator !== self::OP_EQ && $noEqualOp === $providerNoEqualOp) {
  50588. return true;
  50589. }
  50590. if ($this->versionCompare($provider->version, $this->version, self::$transOpInt[$this->operator], $compareBranches)) {
  50591. if ($provider->version === $this->version
  50592. && self::$transOpInt[$provider->operator] === $providerNoEqualOp
  50593. && self::$transOpInt[$this->operator] !== $noEqualOp) {
  50594. return false;
  50595. }
  50596. return true;
  50597. }
  50598. return false;
  50599. }
  50600. public function __toString()
  50601. {
  50602. return self::$transOpInt[$this->operator] . ' ' . $this->version;
  50603. }
  50604. }
  50605. <?php
  50606. namespace Composer\Semver\Constraint;
  50607. interface ConstraintInterface
  50608. {
  50609. public function matches(ConstraintInterface $provider);
  50610. public function getPrettyString();
  50611. public function __toString();
  50612. }
  50613. <?php
  50614. namespace Composer\Semver\Constraint;
  50615. class EmptyConstraint implements ConstraintInterface
  50616. {
  50617. protected $prettyString;
  50618. public function matches(ConstraintInterface $provider)
  50619. {
  50620. return true;
  50621. }
  50622. public function setPrettyString($prettyString)
  50623. {
  50624. $this->prettyString = $prettyString;
  50625. }
  50626. public function getPrettyString()
  50627. {
  50628. if ($this->prettyString) {
  50629. return $this->prettyString;
  50630. }
  50631. return $this->__toString();
  50632. }
  50633. public function __toString()
  50634. {
  50635. return '[]';
  50636. }
  50637. }
  50638. <?php
  50639. namespace Composer\Semver\Constraint;
  50640. class MultiConstraint implements ConstraintInterface
  50641. {
  50642. protected $constraints;
  50643. protected $prettyString;
  50644. protected $conjunctive;
  50645. public function __construct(array $constraints, $conjunctive = true)
  50646. {
  50647. $this->constraints = $constraints;
  50648. $this->conjunctive = $conjunctive;
  50649. }
  50650. public function getConstraints()
  50651. {
  50652. return $this->constraints;
  50653. }
  50654. public function isConjunctive()
  50655. {
  50656. return $this->conjunctive;
  50657. }
  50658. public function isDisjunctive()
  50659. {
  50660. return !$this->conjunctive;
  50661. }
  50662. public function matches(ConstraintInterface $provider)
  50663. {
  50664. if (false === $this->conjunctive) {
  50665. foreach ($this->constraints as $constraint) {
  50666. if ($constraint->matches($provider)) {
  50667. return true;
  50668. }
  50669. }
  50670. return false;
  50671. }
  50672. foreach ($this->constraints as $constraint) {
  50673. if (!$constraint->matches($provider)) {
  50674. return false;
  50675. }
  50676. }
  50677. return true;
  50678. }
  50679. public function setPrettyString($prettyString)
  50680. {
  50681. $this->prettyString = $prettyString;
  50682. }
  50683. public function getPrettyString()
  50684. {
  50685. if ($this->prettyString) {
  50686. return $this->prettyString;
  50687. }
  50688. return $this->__toString();
  50689. }
  50690. public function __toString()
  50691. {
  50692. $constraints = array();
  50693. foreach ($this->constraints as $constraint) {
  50694. $constraints[] = (string) $constraint;
  50695. }
  50696. return '[' . implode($this->conjunctive ? ' ' : ' || ', $constraints) . ']';
  50697. }
  50698. }
  50699. <?php
  50700. namespace Composer\Semver;
  50701. use Composer\Semver\Constraint\Constraint;
  50702. class Semver
  50703. {
  50704. const SORT_ASC = 1;
  50705. const SORT_DESC = -1;
  50706. private static $versionParser;
  50707. public static function satisfies($version, $constraints)
  50708. {
  50709. if (null === self::$versionParser) {
  50710. self::$versionParser = new VersionParser();
  50711. }
  50712. $versionParser = self::$versionParser;
  50713. $provider = new Constraint('==', $versionParser->normalize($version));
  50714. $constraints = $versionParser->parseConstraints($constraints);
  50715. return $constraints->matches($provider);
  50716. }
  50717. public static function satisfiedBy(array $versions, $constraints)
  50718. {
  50719. $versions = array_filter($versions, function ($version) use ($constraints) {
  50720. return Semver::satisfies($version, $constraints);
  50721. });
  50722. return array_values($versions);
  50723. }
  50724. public static function sort(array $versions)
  50725. {
  50726. return self::usort($versions, self::SORT_ASC);
  50727. }
  50728. public static function rsort(array $versions)
  50729. {
  50730. return self::usort($versions, self::SORT_DESC);
  50731. }
  50732. private static function usort(array $versions, $direction)
  50733. {
  50734. if (null === self::$versionParser) {
  50735. self::$versionParser = new VersionParser();
  50736. }
  50737. $versionParser = self::$versionParser;
  50738. $normalized = array();
  50739. foreach ($versions as $key => $version) {
  50740. $normalized[] = array($versionParser->normalize($version), $key);
  50741. }
  50742. usort($normalized, function (array $left, array $right) use ($direction) {
  50743. if ($left[0] === $right[0]) {
  50744. return 0;
  50745. }
  50746. if (Comparator::lessThan($left[0], $right[0])) {
  50747. return -$direction;
  50748. }
  50749. return $direction;
  50750. });
  50751. $sorted = array();
  50752. foreach ($normalized as $item) {
  50753. $sorted[] = $versions[$item[1]];
  50754. }
  50755. return $sorted;
  50756. }
  50757. }
  50758. <?php
  50759. namespace Composer\Semver;
  50760. use Composer\Semver\Constraint\ConstraintInterface;
  50761. use Composer\Semver\Constraint\EmptyConstraint;
  50762. use Composer\Semver\Constraint\MultiConstraint;
  50763. use Composer\Semver\Constraint\Constraint;
  50764. class VersionParser
  50765. {
  50766. private static $modifierRegex = '[._-]?(?:(stable|beta|b|RC|alpha|a|patch|pl|p)((?:[.-]?\d+)*+)?)?([.-]?dev)?';
  50767. private static $stabilities = array('stable', 'RC', 'beta', 'alpha', 'dev');
  50768. public static function parseStability($version)
  50769. {
  50770. $version = preg_replace('{#.+$}i', '', $version);
  50771. if ('dev-' === substr($version, 0, 4) || '-dev' === substr($version, -4)) {
  50772. return 'dev';
  50773. }
  50774. preg_match('{' . self::$modifierRegex . '(?:\+.*)?$}i', strtolower($version), $match);
  50775. if (!empty($match[3])) {
  50776. return 'dev';
  50777. }
  50778. if (!empty($match[1])) {
  50779. if ('beta' === $match[1] || 'b' === $match[1]) {
  50780. return 'beta';
  50781. }
  50782. if ('alpha' === $match[1] || 'a' === $match[1]) {
  50783. return 'alpha';
  50784. }
  50785. if ('rc' === $match[1]) {
  50786. return 'RC';
  50787. }
  50788. }
  50789. return 'stable';
  50790. }
  50791. public static function normalizeStability($stability)
  50792. {
  50793. $stability = strtolower($stability);
  50794. return $stability === 'rc' ? 'RC' : $stability;
  50795. }
  50796. public function normalize($version, $fullVersion = null)
  50797. {
  50798. $version = trim($version);
  50799. if (null === $fullVersion) {
  50800. $fullVersion = $version;
  50801. }
  50802. if (preg_match('{^([^,\s]++) ++as ++([^,\s]++)$}', $version, $match)) {
  50803. $version = $match[1];
  50804. }
  50805. if (preg_match('{^(?:dev-)?(?:master|trunk|default)$}i', $version)) {
  50806. return '9999999-dev';
  50807. }
  50808. if ('dev-' === strtolower(substr($version, 0, 4))) {
  50809. return 'dev-' . substr($version, 4);
  50810. }
  50811. if (preg_match('{^([^,\s+]++)\+[^\s]++$}', $version, $match)) {
  50812. $version = $match[1];
  50813. }
  50814. if (preg_match('{^v?(\d{1,5})(\.\d++)?(\.\d++)?(\.\d++)?' . self::$modifierRegex . '$}i', $version, $matches)) {
  50815. $version = $matches[1]
  50816. . (!empty($matches[2]) ? $matches[2] : '.0')
  50817. . (!empty($matches[3]) ? $matches[3] : '.0')
  50818. . (!empty($matches[4]) ? $matches[4] : '.0');
  50819. $index = 5;
  50820. } elseif (preg_match('{^v?(\d{4}(?:[.:-]?\d{2}){1,6}(?:[.:-]?\d{1,3})?)' . self::$modifierRegex . '$}i', $version, $matches)) {
  50821. $version = preg_replace('{\D}', '.', $matches[1]);
  50822. $index = 2;
  50823. }
  50824. if (isset($index)) {
  50825. if (!empty($matches[$index])) {
  50826. if ('stable' === $matches[$index]) {
  50827. return $version;
  50828. }
  50829. $version .= '-' . $this->expandStability($matches[$index]) . (!empty($matches[$index + 1]) ? ltrim($matches[$index + 1], '.-') : '');
  50830. }
  50831. if (!empty($matches[$index + 2])) {
  50832. $version .= '-dev';
  50833. }
  50834. return $version;
  50835. }
  50836. if (preg_match('{(.*?)[.-]?dev$}i', $version, $match)) {
  50837. try {
  50838. return $this->normalizeBranch($match[1]);
  50839. } catch (\Exception $e) {
  50840. }
  50841. }
  50842. $extraMessage = '';
  50843. if (preg_match('{ +as +' . preg_quote($version) . '$}', $fullVersion)) {
  50844. $extraMessage = ' in "' . $fullVersion . '", the alias must be an exact version';
  50845. } elseif (preg_match('{^' . preg_quote($version) . ' +as +}', $fullVersion)) {
  50846. $extraMessage = ' in "' . $fullVersion . '", the alias source must be an exact version, if it is a branch name you should prefix it with dev-';
  50847. }
  50848. throw new \UnexpectedValueException('Invalid version string "' . $version . '"' . $extraMessage);
  50849. }
  50850. public function parseNumericAliasPrefix($branch)
  50851. {
  50852. if (preg_match('{^(?P<version>(\d++\\.)*\d++)(?:\.x)?-dev$}i', $branch, $matches)) {
  50853. return $matches['version'] . '.';
  50854. }
  50855. return false;
  50856. }
  50857. public function normalizeBranch($name)
  50858. {
  50859. $name = trim($name);
  50860. if (in_array($name, array('master', 'trunk', 'default'))) {
  50861. return $this->normalize($name);
  50862. }
  50863. if (preg_match('{^v?(\d++)(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?(\.(?:\d++|[xX*]))?$}i', $name, $matches)) {
  50864. $version = '';
  50865. for ($i = 1; $i < 5; ++$i) {
  50866. $version .= isset($matches[$i]) ? str_replace(array('*', 'X'), 'x', $matches[$i]) : '.x';
  50867. }
  50868. return str_replace('x', '9999999', $version) . '-dev';
  50869. }
  50870. return 'dev-' . $name;
  50871. }
  50872. public function parseConstraints($constraints)
  50873. {
  50874. $prettyConstraint = $constraints;
  50875. if (preg_match('{^([^,\s]*?)@(' . implode('|', self::$stabilities) . ')$}i', $constraints, $match)) {
  50876. $constraints = empty($match[1]) ? '*' : $match[1];
  50877. }
  50878. if (preg_match('{^(dev-[^,\s@]+?|[^,\s@]+?\.x-dev)#.+$}i', $constraints, $match)) {
  50879. $constraints = $match[1];
  50880. }
  50881. $orConstraints = preg_split('{\s*\|\|?\s*}', trim($constraints));
  50882. $orGroups = array();
  50883. foreach ($orConstraints as $constraints) {
  50884. $andConstraints = preg_split('{(?<!^|as|[=>< ,]) *(?<!-)[, ](?!-) *(?!,|as|$)}', $constraints);
  50885. if (count($andConstraints) > 1) {
  50886. $constraintObjects = array();
  50887. foreach ($andConstraints as $constraint) {
  50888. foreach ($this->parseConstraint($constraint) as $parsedConstraint) {
  50889. $constraintObjects[] = $parsedConstraint;
  50890. }
  50891. }
  50892. } else {
  50893. $constraintObjects = $this->parseConstraint($andConstraints[0]);
  50894. }
  50895. if (1 === count($constraintObjects)) {
  50896. $constraint = $constraintObjects[0];
  50897. } else {
  50898. $constraint = new MultiConstraint($constraintObjects);
  50899. }
  50900. $orGroups[] = $constraint;
  50901. }
  50902. if (1 === count($orGroups)) {
  50903. $constraint = $orGroups[0];
  50904. } elseif (2 === count($orGroups)
  50905. && $orGroups[0] instanceof MultiConstraint
  50906. && $orGroups[1] instanceof MultiConstraint
  50907. && 2 === count($orGroups[0]->getConstraints())
  50908. && 2 === count($orGroups[1]->getConstraints())
  50909. && ($a = (string) $orGroups[0])
  50910. && substr($a, 0, 3) === '[>=' && (false !== ($posA = strpos($a, '<', 4)))
  50911. && ($b = (string) $orGroups[1])
  50912. && substr($b, 0, 3) === '[>=' && (false !== ($posB = strpos($b, '<', 4)))
  50913. && substr($a, $posA + 2, -1) === substr($b, 4, $posB - 5)
  50914. ) {
  50915. $constraint = new MultiConstraint(array(
  50916. new Constraint('>=', substr($a, 4, $posA - 5)),
  50917. new Constraint('<', substr($b, $posB + 2, -1)),
  50918. ));
  50919. } else {
  50920. $constraint = new MultiConstraint($orGroups, false);
  50921. }
  50922. $constraint->setPrettyString($prettyConstraint);
  50923. return $constraint;
  50924. }
  50925. private function parseConstraint($constraint)
  50926. {
  50927. if (preg_match('{^([^,\s]+?)@(' . implode('|', self::$stabilities) . ')$}i', $constraint, $match)) {
  50928. $constraint = $match[1];
  50929. if ($match[2] !== 'stable') {
  50930. $stabilityModifier = $match[2];
  50931. }
  50932. }
  50933. if (preg_match('{^v?[xX*](\.[xX*])*$}i', $constraint)) {
  50934. return array(new EmptyConstraint());
  50935. }
  50936. $versionRegex = 'v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.(\d++))?' . self::$modifierRegex . '(?:\+[^\s]+)?';
  50937. if (preg_match('{^~>?' . $versionRegex . '$}i', $constraint, $matches)) {
  50938. if (substr($constraint, 0, 2) === '~>') {
  50939. throw new \UnexpectedValueException(
  50940. 'Could not parse version constraint ' . $constraint . ': ' .
  50941. 'Invalid operator "~>", you probably meant to use the "~" operator'
  50942. );
  50943. }
  50944. if (isset($matches[4]) && '' !== $matches[4] && null !== $matches[4]) {
  50945. $position = 4;
  50946. } elseif (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50947. $position = 3;
  50948. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50949. $position = 2;
  50950. } else {
  50951. $position = 1;
  50952. }
  50953. $stabilitySuffix = '';
  50954. if (empty($matches[5]) && empty($matches[7])) {
  50955. $stabilitySuffix .= '-dev';
  50956. }
  50957. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50958. $lowerBound = new Constraint('>=', $lowVersion);
  50959. $highPosition = max(1, $position - 1);
  50960. $highVersion = $this->manipulateVersionString($matches, $highPosition, 1) . '-dev';
  50961. $upperBound = new Constraint('<', $highVersion);
  50962. return array(
  50963. $lowerBound,
  50964. $upperBound,
  50965. );
  50966. }
  50967. if (preg_match('{^\^' . $versionRegex . '($)}i', $constraint, $matches)) {
  50968. if ('0' !== $matches[1] || '' === $matches[2] || null === $matches[2]) {
  50969. $position = 1;
  50970. } elseif ('0' !== $matches[2] || '' === $matches[3] || null === $matches[3]) {
  50971. $position = 2;
  50972. } else {
  50973. $position = 3;
  50974. }
  50975. $stabilitySuffix = '';
  50976. if (empty($matches[5]) && empty($matches[7])) {
  50977. $stabilitySuffix .= '-dev';
  50978. }
  50979. $lowVersion = $this->normalize(substr($constraint . $stabilitySuffix, 1));
  50980. $lowerBound = new Constraint('>=', $lowVersion);
  50981. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50982. $upperBound = new Constraint('<', $highVersion);
  50983. return array(
  50984. $lowerBound,
  50985. $upperBound,
  50986. );
  50987. }
  50988. if (preg_match('{^v?(\d++)(?:\.(\d++))?(?:\.(\d++))?(?:\.[xX*])++$}', $constraint, $matches)) {
  50989. if (isset($matches[3]) && '' !== $matches[3] && null !== $matches[3]) {
  50990. $position = 3;
  50991. } elseif (isset($matches[2]) && '' !== $matches[2] && null !== $matches[2]) {
  50992. $position = 2;
  50993. } else {
  50994. $position = 1;
  50995. }
  50996. $lowVersion = $this->manipulateVersionString($matches, $position) . '-dev';
  50997. $highVersion = $this->manipulateVersionString($matches, $position, 1) . '-dev';
  50998. if ($lowVersion === '0.0.0.0-dev') {
  50999. return array(new Constraint('<', $highVersion));
  51000. }
  51001. return array(
  51002. new Constraint('>=', $lowVersion),
  51003. new Constraint('<', $highVersion),
  51004. );
  51005. }
  51006. if (preg_match('{^(?P<from>' . $versionRegex . ') +- +(?P<to>' . $versionRegex . ')($)}i', $constraint, $matches)) {
  51007. $lowStabilitySuffix = '';
  51008. if (empty($matches[6]) && empty($matches[8])) {
  51009. $lowStabilitySuffix = '-dev';
  51010. }
  51011. $lowVersion = $this->normalize($matches['from']);
  51012. $lowerBound = new Constraint('>=', $lowVersion . $lowStabilitySuffix);
  51013. $empty = function ($x) {
  51014. return ($x === 0 || $x === '0') ? false : empty($x);
  51015. };
  51016. if ((!$empty($matches[11]) && !$empty($matches[12])) || !empty($matches[14]) || !empty($matches[16])) {
  51017. $highVersion = $this->normalize($matches['to']);
  51018. $upperBound = new Constraint('<=', $highVersion);
  51019. } else {
  51020. $highMatch = array('', $matches[10], $matches[11], $matches[12], $matches[13]);
  51021. $highVersion = $this->manipulateVersionString($highMatch, $empty($matches[11]) ? 1 : 2, 1) . '-dev';
  51022. $upperBound = new Constraint('<', $highVersion);
  51023. }
  51024. return array(
  51025. $lowerBound,
  51026. $upperBound,
  51027. );
  51028. }
  51029. if (preg_match('{^(<>|!=|>=?|<=?|==?)?\s*(.*)}', $constraint, $matches)) {
  51030. try {
  51031. $version = $this->normalize($matches[2]);
  51032. if (!empty($stabilityModifier) && $this->parseStability($version) === 'stable') {
  51033. $version .= '-' . $stabilityModifier;
  51034. } elseif ('<' === $matches[1] || '>=' === $matches[1]) {
  51035. if (!preg_match('/-' . self::$modifierRegex . '$/', strtolower($matches[2]))) {
  51036. if (substr($matches[2], 0, 4) !== 'dev-') {
  51037. $version .= '-dev';
  51038. }
  51039. }
  51040. }
  51041. return array(new Constraint($matches[1] ?: '=', $version));
  51042. } catch (\Exception $e) {
  51043. }
  51044. }
  51045. $message = 'Could not parse version constraint ' . $constraint;
  51046. if (isset($e)) {
  51047. $message .= ': ' . $e->getMessage();
  51048. }
  51049. throw new \UnexpectedValueException($message);
  51050. }
  51051. private function manipulateVersionString($matches, $position, $increment = 0, $pad = '0')
  51052. {
  51053. for ($i = 4; $i > 0; --$i) {
  51054. if ($i > $position) {
  51055. $matches[$i] = $pad;
  51056. } elseif ($i === $position && $increment) {
  51057. $matches[$i] += $increment;
  51058. if ($matches[$i] < 0) {
  51059. $matches[$i] = $pad;
  51060. --$position;
  51061. if ($i === 1) {
  51062. return;
  51063. }
  51064. }
  51065. }
  51066. }
  51067. return $matches[1] . '.' . $matches[2] . '.' . $matches[3] . '.' . $matches[4];
  51068. }
  51069. private function expandStability($stability)
  51070. {
  51071. $stability = strtolower($stability);
  51072. switch ($stability) {
  51073. case 'a':
  51074. return 'alpha';
  51075. case 'b':
  51076. return 'beta';
  51077. case 'p':
  51078. case 'pl':
  51079. return 'patch';
  51080. case 'rc':
  51081. return 'RC';
  51082. default:
  51083. return $stability;
  51084. }
  51085. }
  51086. }
  51087. Copyright (C) 2016 Composer
  51088. Permission is hereby granted, free of charge, to any person obtaining a copy of
  51089. this software and associated documentation files (the "Software"), to deal in
  51090. the Software without restriction, including without limitation the rights to
  51091. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  51092. of the Software, and to permit persons to whom the Software is furnished to do
  51093. so, subject to the following conditions:
  51094. The above copyright notice and this permission notice shall be included in all
  51095. copies or substantial portions of the Software.
  51096. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51097. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51098. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51099. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51100. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51101. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51102. SOFTWARE.
  51103. <?php
  51104. namespace Composer\CaBundle;
  51105. use Psr\Log\LoggerInterface;
  51106. use Symfony\Component\Process\PhpProcess;
  51107. class CaBundle
  51108. {
  51109. private static $caPath;
  51110. private static $caFileValidity = array();
  51111. private static $useOpensslParse;
  51112. public static function getSystemCaRootBundlePath(LoggerInterface $logger = null)
  51113. {
  51114. if (self::$caPath !== null) {
  51115. return self::$caPath;
  51116. }
  51117. $caBundlePaths = array();
  51118. $caBundlePaths[] = getenv('SSL_CERT_FILE');
  51119. $caBundlePaths[] = getenv('SSL_CERT_DIR');
  51120. $caBundlePaths[] = ini_get('openssl.cafile');
  51121. $caBundlePaths[] = ini_get('openssl.capath');
  51122. $otherLocations = array(
  51123. '/etc/pki/tls/certs/ca-bundle.crt',
  51124. '/etc/ssl/certs/ca-certificates.crt',
  51125. '/etc/ssl/ca-bundle.pem',
  51126. '/usr/local/share/certs/ca-root-nss.crt',
  51127. '/usr/ssl/certs/ca-bundle.crt',
  51128. '/opt/local/share/curl/curl-ca-bundle.crt',
  51129. '/usr/local/share/curl/curl-ca-bundle.crt',
  51130. '/usr/share/ssl/certs/ca-bundle.crt',
  51131. '/etc/ssl/cert.pem',
  51132. '/usr/local/etc/ssl/cert.pem',
  51133. '/usr/local/etc/openssl/cert.pem',
  51134. );
  51135. foreach($otherLocations as $location) {
  51136. $otherLocations[] = dirname($location);
  51137. }
  51138. $caBundlePaths = array_merge($caBundlePaths, $otherLocations);
  51139. foreach ($caBundlePaths as $caBundle) {
  51140. if (self::caFileUsable($caBundle, $logger)) {
  51141. return self::$caPath = $caBundle;
  51142. }
  51143. if (self::caDirUsable($caBundle)) {
  51144. return self::$caPath = $caBundle;
  51145. }
  51146. }
  51147. return self::$caPath = static::getBundledCaBundlePath();
  51148. }
  51149. public static function getBundledCaBundlePath()
  51150. {
  51151. $caBundleFile = __DIR__.'/../res/cacert.pem';
  51152. if (0 === strpos($caBundleFile, 'phar://')) {
  51153. file_put_contents(
  51154. $tempCaBundleFile = tempnam(sys_get_temp_dir(), 'openssl-ca-bundle-'),
  51155. file_get_contents($caBundleFile)
  51156. );
  51157. register_shutdown_function(function() use ($tempCaBundleFile) {
  51158. @unlink($tempCaBundleFile);
  51159. });
  51160. $caBundleFile = $tempCaBundleFile;
  51161. }
  51162. return $caBundleFile;
  51163. }
  51164. public static function validateCaFile($filename, LoggerInterface $logger = null)
  51165. {
  51166. static $warned = false;
  51167. if (isset(self::$caFileValidity[$filename])) {
  51168. return self::$caFileValidity[$filename];
  51169. }
  51170. $contents = file_get_contents($filename);
  51171. if (!static::isOpensslParseSafe()) {
  51172. if (!$warned && $logger) {
  51173. $logger->warning(sprintf(
  51174. 'Your version of PHP, %s, is affected by CVE-2013-6420 and cannot safely perform certificate validation, we strongly suggest you upgrade.',
  51175. PHP_VERSION
  51176. ));
  51177. $warned = true;
  51178. }
  51179. $isValid = !empty($contents);
  51180. } else {
  51181. $isValid = (bool) openssl_x509_parse($contents);
  51182. }
  51183. if ($logger) {
  51184. $logger->debug('Checked CA file '.realpath($filename).': '.($isValid ? 'valid' : 'invalid'));
  51185. }
  51186. return self::$caFileValidity[$filename] = $isValid;
  51187. }
  51188. public static function isOpensslParseSafe()
  51189. {
  51190. if (null !== self::$useOpensslParse) {
  51191. return self::$useOpensslParse;
  51192. }
  51193. if (PHP_VERSION_ID >= 50600) {
  51194. return self::$useOpensslParse = true;
  51195. }
  51196. if (
  51197. (PHP_VERSION_ID < 50400 && PHP_VERSION_ID >= 50328)
  51198. || (PHP_VERSION_ID < 50500 && PHP_VERSION_ID >= 50423)
  51199. || (PHP_VERSION_ID < 50600 && PHP_VERSION_ID >= 50507)
  51200. ) {
  51201. return self::$useOpensslParse = true;
  51202. }
  51203. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51204. return self::$useOpensslParse = false;
  51205. }
  51206. $compareDistroVersionPrefix = function ($prefix, $fixedVersion) {
  51207. $regex = '{^'.preg_quote($prefix).'([0-9]+)$}';
  51208. if (preg_match($regex, PHP_VERSION, $m)) {
  51209. return ((int) $m[1]) >= $fixedVersion;
  51210. }
  51211. return false;
  51212. };
  51213. if (
  51214. $compareDistroVersionPrefix('5.3.3-7+squeeze', 18)
  51215. || $compareDistroVersionPrefix('5.4.4-14+deb7u', 7)
  51216. || $compareDistroVersionPrefix('5.3.10-1ubuntu3.', 9)
  51217. ) {
  51218. return self::$useOpensslParse = true;
  51219. }
  51220. if (!class_exists('Symfony\Component\Process\PhpProcess')) {
  51221. return self::$useOpensslParse = false;
  51222. }
  51223. $cert = 'LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVwRENDQTR5Z0F3SUJBZ0lKQUp6dThyNnU2ZUJjTUEwR0NTcUdTSWIzRFFFQkJRVUFNSUhETVFzd0NRWUQKVlFRR0V3SkVSVEVjTUJvR0ExVUVDQXdUVG05eVpISm9aV2x1TFZkbGMzUm1ZV3hsYmpFUU1BNEdBMVVFQnd3SApTOE9Ed3Jac2JqRVVNQklHQTFVRUNnd0xVMlZyZEdsdmJrVnBibk14SHpBZEJnTlZCQXNNRmsxaGJHbGphVzkxCmN5QkRaWEowSUZObFkzUnBiMjR4SVRBZkJnTlZCQU1NR0cxaGJHbGphVzkxY3k1elpXdDBhVzl1WldsdWN5NWsKWlRFcU1DZ0dDU3FHU0liM0RRRUpBUlliYzNSbFptRnVMbVZ6YzJWeVFITmxhM1JwYjI1bGFXNXpMbVJsTUhVWQpaREU1TnpBd01UQXhNREF3TURBd1dnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBCkFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUEKQUFBQUFBQVhEVEUwTVRFeU9ERXhNemt6TlZvd2djTXhDekFKQmdOVkJBWVRBa1JGTVJ3d0dnWURWUVFJREJOTwpiM0prY21obGFXNHRWMlZ6ZEdaaGJHVnVNUkF3RGdZRFZRUUhEQWRMdzRQQ3RteHVNUlF3RWdZRFZRUUtEQXRUClpXdDBhVzl1UldsdWN6RWZNQjBHQTFVRUN3d1dUV0ZzYVdOcGIzVnpJRU5sY25RZ1UyVmpkR2x2YmpFaE1COEcKQTFVRUF3d1liV0ZzYVdOcGIzVnpMbk5sYTNScGIyNWxhVzV6TG1SbE1Tb3dLQVlKS29aSWh2Y05BUWtCRmh0egpkR1ZtWVc0dVpYTnpaWEpBYzJWcmRHbHZibVZwYm5NdVpHVXdnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCCkR3QXdnZ0VLQW9JQkFRRERBZjNobDdKWTBYY0ZuaXlFSnBTU0RxbjBPcUJyNlFQNjV1c0pQUnQvOFBhRG9xQnUKd0VZVC9OYSs2ZnNnUGpDMHVLOURaZ1dnMnRIV1dvYW5TYmxBTW96NVBINlorUzRTSFJaN2UyZERJalBqZGhqaAowbUxnMlVNTzV5cDBWNzk3R2dzOWxOdDZKUmZIODFNTjJvYlhXczROdHp0TE11RDZlZ3FwcjhkRGJyMzRhT3M4CnBrZHVpNVVhd1Raa3N5NXBMUEhxNWNNaEZHbTA2djY1Q0xvMFYyUGQ5K0tBb2tQclBjTjVLTEtlYno3bUxwazYKU01lRVhPS1A0aWRFcXh5UTdPN2ZCdUhNZWRzUWh1K3ByWTNzaTNCVXlLZlF0UDVDWm5YMmJwMHdLSHhYMTJEWAoxbmZGSXQ5RGJHdkhUY3lPdU4rblpMUEJtM3ZXeG50eUlJdlZBZ01CQUFHalFqQkFNQWtHQTFVZEV3UUNNQUF3CkVRWUpZSVpJQVliNFFnRUJCQVFEQWdlQU1Bc0dBMVVkRHdRRUF3SUZvREFUQmdOVkhTVUVEREFLQmdnckJnRUYKQlFjREFqQU5CZ2txaGtpRzl3MEJBUVVGQUFPQ0FRRUFHMGZaWVlDVGJkajFYWWMrMVNub2FQUit2SThDOENhRAo4KzBVWWhkbnlVNGdnYTBCQWNEclk5ZTk0ZUVBdTZacXljRjZGakxxWFhkQWJvcHBXb2NyNlQ2R0QxeDMzQ2tsClZBcnpHL0t4UW9oR0QySmVxa2hJTWxEb214SE83a2EzOStPYThpMnZXTFZ5alU4QVp2V01BcnVIYTRFRU55RzcKbFcyQWFnYUZLRkNyOVRuWFRmcmR4R1ZFYnY3S1ZRNmJkaGc1cDVTanBXSDErTXEwM3VSM1pYUEJZZHlWODMxOQpvMGxWajFLRkkyRENML2xpV2lzSlJvb2YrMWNSMzVDdGQwd1lCY3BCNlRac2xNY09QbDc2ZHdLd0pnZUpvMlFnClpzZm1jMnZDMS9xT2xOdU5xLzBUenprVkd2OEVUVDNDZ2FVK1VYZTRYT1Z2a2NjZWJKbjJkZz09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K';
  51224. $script = <<<'EOT'
  51225. error_reporting(-1);
  51226. $info = openssl_x509_parse(base64_decode('%s'));
  51227. var_dump(PHP_VERSION, $info['issuer']['emailAddress'], $info['validFrom_time_t']);
  51228. EOT;
  51229. $script = '<'."?php\n".sprintf($script, $cert);
  51230. try {
  51231. $process = new PhpProcess($script);
  51232. $process->mustRun();
  51233. } catch (\Exception $e) {
  51234. return self::$useOpensslParse = false;
  51235. }
  51236. $output = preg_split('{\r?\n}', trim($process->getOutput()));
  51237. $errorOutput = trim($process->getErrorOutput());
  51238. if (
  51239. count($output) === 3
  51240. && $output[0] === sprintf('string(%d) "%s"', strlen(PHP_VERSION), PHP_VERSION)
  51241. && $output[1] === 'string(27) "stefan.esser@sektioneins.de"'
  51242. && $output[2] === 'int(-1)'
  51243. && preg_match('{openssl_x509_parse\(\): illegal (?:ASN1 data type for|length in) timestamp in - on line \d+}', $errorOutput)
  51244. ) {
  51245. return self::$useOpensslParse = true;
  51246. }
  51247. return self::$useOpensslParse = false;
  51248. }
  51249. public static function reset()
  51250. {
  51251. self::$caFileValidity = array();
  51252. self::$caPath = null;
  51253. self::$useOpensslParse = null;
  51254. }
  51255. private static function caFileUsable($certFile, LoggerInterface $logger = null)
  51256. {
  51257. return $certFile && @is_file($certFile) && @is_readable($certFile) && static::validateCaFile($certFile, $logger);
  51258. }
  51259. private static function caDirUsable($certDir)
  51260. {
  51261. return $certDir && @is_dir($certDir) && @is_readable($certDir) && glob($certDir . '/*');
  51262. }
  51263. }
  51264. MIT License
  51265. Copyright (c) 2017 Composer
  51266. Permission is hereby granted, free of charge, to any person obtaining a copy
  51267. of this software and associated documentation files (the "Software"), to deal
  51268. in the Software without restriction, including without limitation the rights
  51269. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51270. copies of the Software, and to permit persons to whom the Software is
  51271. furnished to do so, subject to the following conditions:
  51272. The above copyright notice and this permission notice shall be included in all
  51273. copies or substantial portions of the Software.
  51274. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51275. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51276. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51277. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51278. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51279. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  51280. SOFTWARE.
  51281. <?php
  51282. namespace Composer\XdebugHandler;
  51283. class PhpConfig
  51284. {
  51285. public function useOriginal()
  51286. {
  51287. $this->getDataAndReset();
  51288. return array();
  51289. }
  51290. public function useStandard()
  51291. {
  51292. if ($data = $this->getDataAndReset()) {
  51293. return array('-n', '-c', $data['tmpIni']);
  51294. }
  51295. return array();
  51296. }
  51297. public function usePersistent()
  51298. {
  51299. if ($data = $this->getDataAndReset()) {
  51300. Process::setEnv('PHPRC', $data['tmpIni']);
  51301. Process::setEnv('PHP_INI_SCAN_DIR', '');
  51302. }
  51303. return array();
  51304. }
  51305. private function getDataAndReset()
  51306. {
  51307. if ($data = XdebugHandler::getRestartSettings()) {
  51308. Process::setEnv('PHPRC', $data['phprc']);
  51309. Process::setEnv('PHP_INI_SCAN_DIR', $data['scanDir']);
  51310. }
  51311. return $data;
  51312. }
  51313. }
  51314. <?php
  51315. namespace Composer\XdebugHandler;
  51316. class Process
  51317. {
  51318. public static function addColorOption(array $args, $colorOption)
  51319. {
  51320. if (!$colorOption
  51321. || in_array($colorOption, $args)
  51322. || !preg_match('/^--([a-z]+$)|(^--[a-z]+=)/', $colorOption, $matches)) {
  51323. return $args;
  51324. }
  51325. if (isset($matches[2])) {
  51326. if (false !== ($index = array_search($matches[2].'auto', $args))) {
  51327. $args[$index] = $colorOption;
  51328. return $args;
  51329. } elseif (preg_grep('/^'.$matches[2].'/', $args)) {
  51330. return $args;
  51331. }
  51332. } elseif (in_array('--no-'.$matches[1], $args)) {
  51333. return $args;
  51334. }
  51335. if (false !== ($index = array_search('--', $args))) {
  51336. array_splice($args, $index, 0, $colorOption);
  51337. } else {
  51338. $args[] = $colorOption;
  51339. }
  51340. return $args;
  51341. }
  51342. public static function escape($arg, $meta = true, $module = false)
  51343. {
  51344. if (!defined('PHP_WINDOWS_VERSION_BUILD')) {
  51345. return "'".str_replace("'", "'\\''", $arg)."'";
  51346. }
  51347. $quote = strpbrk($arg, " \t") !== false || $arg === '';
  51348. $arg = preg_replace('/(\\\\*)"/', '$1$1\\"', $arg, -1, $dquotes);
  51349. if ($meta) {
  51350. $meta = $dquotes || preg_match('/%[^%]+%/', $arg);
  51351. if (!$meta) {
  51352. $quote = $quote || strpbrk($arg, '^&|<>()') !== false;
  51353. } elseif ($module && !$dquotes && $quote) {
  51354. $meta = false;
  51355. }
  51356. }
  51357. if ($quote) {
  51358. $arg = '"'.preg_replace('/(\\\\*)$/', '$1$1', $arg).'"';
  51359. }
  51360. if ($meta) {
  51361. $arg = preg_replace('/(["^&|<>()%])/', '^$1', $arg);
  51362. }
  51363. return $arg;
  51364. }
  51365. public static function supportsColor($output)
  51366. {
  51367. if (defined('PHP_WINDOWS_VERSION_BUILD')) {
  51368. return (function_exists('sapi_windows_vt100_support')
  51369. && sapi_windows_vt100_support($output))
  51370. || false !== getenv('ANSICON')
  51371. || 'ON' === getenv('ConEmuANSI')
  51372. || 'xterm' === getenv('TERM');
  51373. }
  51374. if (function_exists('stream_isatty')) {
  51375. return stream_isatty($output);
  51376. } elseif (function_exists('posix_isatty')) {
  51377. return posix_isatty($output);
  51378. }
  51379. $stat = fstat($output);
  51380. return $stat ? 0020000 === ($stat['mode'] & 0170000) : false;
  51381. }
  51382. public static function setEnv($name, $value = false)
  51383. {
  51384. $unset = false === $value;
  51385. if (!putenv($unset ? $name : $name.'='.$value)) {
  51386. return false;
  51387. }
  51388. if ($unset) {
  51389. unset($_SERVER[$name]);
  51390. } else {
  51391. $_SERVER[$name] = $value;
  51392. }
  51393. if (false !== stripos((string) ini_get('variables_order'), 'E')) {
  51394. if ($unset) {
  51395. unset($_ENV[$name]);
  51396. } else {
  51397. $_ENV[$name] = $value;
  51398. }
  51399. }
  51400. return true;
  51401. }
  51402. }
  51403. <?php
  51404. namespace Composer\XdebugHandler;
  51405. use Psr\Log\LoggerInterface;
  51406. use Psr\Log\LogLevel;
  51407. class Status
  51408. {
  51409. const ENV_RESTART = 'XDEBUG_HANDLER_RESTART';
  51410. const CHECK = 'Check';
  51411. const ERROR = 'Error';
  51412. const INFO = 'Info';
  51413. const NORESTART = 'NoRestart';
  51414. const RESTART = 'Restart';
  51415. const RESTARTING = 'Restarting';
  51416. const RESTARTED = 'Restarted';
  51417. private $debug;
  51418. private $envAllowXdebug;
  51419. private $loaded;
  51420. private $logger;
  51421. private $time;
  51422. public function __construct($envAllowXdebug, $debug)
  51423. {
  51424. $start = getenv(self::ENV_RESTART);
  51425. Process::setEnv(self::ENV_RESTART);
  51426. $this->time = $start ? round((microtime(true) - $start) * 1000) : 0;
  51427. $this->envAllowXdebug = $envAllowXdebug;
  51428. $this->debug = $debug && defined('STDERR');
  51429. }
  51430. public function setLogger(LoggerInterface $logger)
  51431. {
  51432. $this->logger = $logger;
  51433. }
  51434. public function report($op, $data)
  51435. {
  51436. if ($this->logger || $this->debug) {
  51437. call_user_func(array($this, 'report'.$op), $data);
  51438. }
  51439. }
  51440. private function output($text, $level = null)
  51441. {
  51442. if ($this->logger) {
  51443. $this->logger->log($level ?: LogLevel::DEBUG, $text);
  51444. }
  51445. if ($this->debug) {
  51446. fwrite(STDERR, sprintf('xdebug-handler[%d] %s', getmypid(), $text.PHP_EOL));
  51447. }
  51448. }
  51449. private function reportCheck($loaded)
  51450. {
  51451. $this->loaded = $loaded;
  51452. $this->output('Checking '.$this->envAllowXdebug);
  51453. }
  51454. private function reportError($error)
  51455. {
  51456. $this->output(sprintf('No restart (%s)', $error), LogLevel::WARNING);
  51457. }
  51458. private function reportInfo($info)
  51459. {
  51460. $this->output($info);
  51461. }
  51462. private function reportNoRestart()
  51463. {
  51464. $this->output($this->getLoadedMessage());
  51465. if ($this->loaded) {
  51466. $text = sprintf('No restart (%s)', $this->getEnvAllow());
  51467. if (!getenv($this->envAllowXdebug)) {
  51468. $text .= ' Allowed by application';
  51469. }
  51470. $this->output($text);
  51471. }
  51472. }
  51473. private function reportRestart()
  51474. {
  51475. $this->output($this->getLoadedMessage());
  51476. Process::setEnv(self::ENV_RESTART, (string) microtime(true));
  51477. }
  51478. private function reportRestarted()
  51479. {
  51480. $loaded = $this->getLoadedMessage();
  51481. $text = sprintf('Restarted (%d ms). %s', $this->time, $loaded);
  51482. $level = $this->loaded ? LogLevel::WARNING : null;
  51483. $this->output($text, $level);
  51484. }
  51485. private function reportRestarting($command)
  51486. {
  51487. $text = sprintf('Process restarting (%s)', $this->getEnvAllow());
  51488. $this->output($text);
  51489. $text = 'Running '.$command;
  51490. $this->output($text);
  51491. }
  51492. private function getEnvAllow()
  51493. {
  51494. return $this->envAllowXdebug.'='.getenv($this->envAllowXdebug);
  51495. }
  51496. private function getLoadedMessage()
  51497. {
  51498. $loaded = $this->loaded ? sprintf('loaded (%s)', $this->loaded) : 'not loaded';
  51499. return 'The xdebug extension is '.$loaded;
  51500. }
  51501. }
  51502. <?php
  51503. namespace Composer\XdebugHandler;
  51504. use Psr\Log\LoggerInterface;
  51505. class XdebugHandler
  51506. {
  51507. const SUFFIX_ALLOW = '_ALLOW_XDEBUG';
  51508. const SUFFIX_INIS = '_ORIGINAL_INIS';
  51509. const RESTART_ID = 'internal';
  51510. const RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS';
  51511. const DEBUG = 'XDEBUG_HANDLER_DEBUG';
  51512. protected $tmpIni;
  51513. private static $inRestart;
  51514. private static $name;
  51515. private static $skipped;
  51516. private $cli;
  51517. private $colorOption;
  51518. private $debug;
  51519. private $envAllowXdebug;
  51520. private $envOriginalInis;
  51521. private $loaded;
  51522. private $persistent;
  51523. private $script;
  51524. private $statusWriter;
  51525. public function __construct($envPrefix, $colorOption = '')
  51526. {
  51527. if (!is_string($envPrefix) || empty($envPrefix) || !is_string($colorOption)) {
  51528. throw new \RuntimeException('Invalid constructor parameter');
  51529. }
  51530. self::$name = strtoupper($envPrefix);
  51531. $this->envAllowXdebug = self::$name.self::SUFFIX_ALLOW;
  51532. $this->envOriginalInis = self::$name.self::SUFFIX_INIS;
  51533. $this->colorOption = $colorOption;
  51534. if (extension_loaded('xdebug')) {
  51535. $ext = new \ReflectionExtension('xdebug');
  51536. $this->loaded = $ext->getVersion() ?: 'unknown';
  51537. }
  51538. if ($this->cli = PHP_SAPI === 'cli') {
  51539. $this->debug = getenv(self::DEBUG);
  51540. }
  51541. $this->statusWriter = new Status($this->envAllowXdebug, (bool) $this->debug);
  51542. }
  51543. public function setLogger(LoggerInterface $logger)
  51544. {
  51545. $this->statusWriter->setLogger($logger);
  51546. return $this;
  51547. }
  51548. public function setMainScript($script)
  51549. {
  51550. $this->script = $script;
  51551. return $this;
  51552. }
  51553. public function setPersistent()
  51554. {
  51555. $this->persistent = true;
  51556. return $this;
  51557. }
  51558. public function check()
  51559. {
  51560. $this->notify(Status::CHECK, $this->loaded);
  51561. $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
  51562. if (empty($envArgs[0]) && $this->requiresRestart((bool) $this->loaded)) {
  51563. $this->notify(Status::RESTART);
  51564. if ($this->prepareRestart()) {
  51565. $command = $this->getCommand();
  51566. $this->notify(Status::RESTARTING, $command);
  51567. $this->restart($command);
  51568. }
  51569. return;
  51570. }
  51571. if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
  51572. $this->notify(Status::RESTARTED);
  51573. Process::setEnv($this->envAllowXdebug);
  51574. self::$inRestart = true;
  51575. if (!$this->loaded) {
  51576. self::$skipped = $envArgs[1];
  51577. }
  51578. $this->setEnvRestartSettings($envArgs);
  51579. return;
  51580. }
  51581. $this->notify(Status::NORESTART);
  51582. if ($settings = self::getRestartSettings()) {
  51583. $this->syncSettings($settings);
  51584. }
  51585. }
  51586. public static function getAllIniFiles()
  51587. {
  51588. if (!empty(self::$name)) {
  51589. $env = getenv(self::$name.self::SUFFIX_INIS);
  51590. if (false !== $env) {
  51591. return explode(PATH_SEPARATOR, $env);
  51592. }
  51593. }
  51594. $paths = array((string) php_ini_loaded_file());
  51595. if ($scanned = php_ini_scanned_files()) {
  51596. $paths = array_merge($paths, array_map('trim', explode(',', $scanned)));
  51597. }
  51598. return $paths;
  51599. }
  51600. public static function getRestartSettings()
  51601. {
  51602. $envArgs = explode('|', (string) getenv(self::RESTART_SETTINGS));
  51603. if (count($envArgs) !== 6
  51604. || (!self::$inRestart && php_ini_loaded_file() !== $envArgs[0])) {
  51605. return;
  51606. }
  51607. return array(
  51608. 'tmpIni' => $envArgs[0],
  51609. 'scannedInis' => (bool) $envArgs[1],
  51610. 'scanDir' => '*' === $envArgs[2] ? false : $envArgs[2],
  51611. 'phprc' => '*' === $envArgs[3] ? false : $envArgs[3],
  51612. 'inis' => explode(PATH_SEPARATOR, $envArgs[4]),
  51613. 'skipped' => $envArgs[5],
  51614. );
  51615. }
  51616. public static function getSkippedVersion()
  51617. {
  51618. return (string) self::$skipped;
  51619. }
  51620. protected function requiresRestart($isLoaded)
  51621. {
  51622. return $isLoaded;
  51623. }
  51624. protected function restart($command)
  51625. {
  51626. $this->doRestart($command);
  51627. }
  51628. private function doRestart($command)
  51629. {
  51630. passthru($command, $exitCode);
  51631. $this->notify(Status::INFO, 'Restarted process exited '.$exitCode);
  51632. if ($this->debug === '2') {
  51633. $this->notify(Status::INFO, 'Temp ini saved: '.$this->tmpIni);
  51634. } else {
  51635. @unlink($this->tmpIni);
  51636. }
  51637. exit($exitCode);
  51638. }
  51639. private function prepareRestart()
  51640. {
  51641. $error = '';
  51642. $iniFiles = self::getAllIniFiles();
  51643. $scannedInis = count($iniFiles) > 1;
  51644. $tmpDir = sys_get_temp_dir();
  51645. if (!$this->cli) {
  51646. $error = 'Unsupported SAPI: '.PHP_SAPI;
  51647. } elseif (!defined('PHP_BINARY')) {
  51648. $error = 'PHP version is too old: '.PHP_VERSION;
  51649. } elseif (!$this->checkConfiguration($info)) {
  51650. $error = $info;
  51651. } elseif (!$this->checkScanDirConfig()) {
  51652. $error = 'PHP version does not report scanned inis: '.PHP_VERSION;
  51653. } elseif (!$this->checkMainScript()) {
  51654. $error = 'Unable to access main script: '.$this->script;
  51655. } elseif (!$this->writeTmpIni($iniFiles, $tmpDir, $error)) {
  51656. $error = $error ?: 'Unable to create temp ini file at: '.$tmpDir;
  51657. } elseif (!$this->setEnvironment($scannedInis, $iniFiles)) {
  51658. $error = 'Unable to set environment variables';
  51659. }
  51660. if ($error) {
  51661. $this->notify(Status::ERROR, $error);
  51662. }
  51663. return empty($error);
  51664. }
  51665. private function writeTmpIni(array $iniFiles, $tmpDir, &$error)
  51666. {
  51667. if (!$this->tmpIni = @tempnam($tmpDir, '')) {
  51668. return false;
  51669. }
  51670. if (empty($iniFiles[0])) {
  51671. array_shift($iniFiles);
  51672. }
  51673. $content = '';
  51674. $regex = '/^\s*(zend_extension\s*=.*xdebug.*)$/mi';
  51675. foreach ($iniFiles as $file) {
  51676. if (!$data = @file_get_contents($file)) {
  51677. $error = 'Unable to read ini: '.$file;
  51678. return false;
  51679. }
  51680. $content .= preg_replace($regex, ';$1', $data).PHP_EOL;
  51681. }
  51682. if ($config = parse_ini_string($content)) {
  51683. $loaded = ini_get_all(null, false);
  51684. $content .= $this->mergeLoadedConfig($loaded, $config);
  51685. }
  51686. $content .= 'opcache.enable_cli=0'.PHP_EOL;
  51687. return @file_put_contents($this->tmpIni, $content);
  51688. }
  51689. private function getCommand()
  51690. {
  51691. $php = array(PHP_BINARY);
  51692. $args = array_slice($_SERVER['argv'], 1);
  51693. if (!$this->persistent) {
  51694. array_push($php, '-n', '-c', $this->tmpIni);
  51695. }
  51696. if (defined('STDOUT') && Process::supportsColor(STDOUT)) {
  51697. $args = Process::addColorOption($args, $this->colorOption);
  51698. }
  51699. $args = array_merge($php, array($this->script), $args);
  51700. $cmd = Process::escape(array_shift($args), true, true);
  51701. foreach ($args as $arg) {
  51702. $cmd .= ' '.Process::escape($arg);
  51703. }
  51704. return $cmd;
  51705. }
  51706. private function setEnvironment($scannedInis, array $iniFiles)
  51707. {
  51708. $scanDir = getenv('PHP_INI_SCAN_DIR');
  51709. $phprc = getenv('PHPRC');
  51710. if (!putenv($this->envOriginalInis.'='.implode(PATH_SEPARATOR, $iniFiles))) {
  51711. return false;
  51712. }
  51713. if ($this->persistent) {
  51714. if (!putenv('PHP_INI_SCAN_DIR=') || !putenv('PHPRC='.$this->tmpIni)) {
  51715. return false;
  51716. }
  51717. }
  51718. $envArgs = array(
  51719. self::RESTART_ID,
  51720. $this->loaded,
  51721. (int) $scannedInis,
  51722. false === $scanDir ? '*' : $scanDir,
  51723. false === $phprc ? '*' : $phprc,
  51724. );
  51725. return putenv($this->envAllowXdebug.'='.implode('|', $envArgs));
  51726. }
  51727. private function notify($op, $data = null)
  51728. {
  51729. $this->statusWriter->report($op, $data);
  51730. }
  51731. private function mergeLoadedConfig(array $loadedConfig, array $iniConfig)
  51732. {
  51733. $content = '';
  51734. foreach ($loadedConfig as $name => $value) {
  51735. if (!is_string($value)
  51736. || strpos($name, 'xdebug') === 0
  51737. || $name === 'apc.mmap_file_mask') {
  51738. continue;
  51739. }
  51740. if (!isset($iniConfig[$name]) || $iniConfig[$name] !== $value) {
  51741. $content .= $name.'="'.addcslashes($value, '\\"').'"'.PHP_EOL;
  51742. }
  51743. }
  51744. return $content;
  51745. }
  51746. private function checkMainScript()
  51747. {
  51748. if (null !== $this->script) {
  51749. return file_exists($this->script) || '--' === $this->script;
  51750. }
  51751. if (file_exists($this->script = $_SERVER['argv'][0])) {
  51752. return true;
  51753. }
  51754. $options = PHP_VERSION_ID >= 50306 ? DEBUG_BACKTRACE_IGNORE_ARGS : false;
  51755. $trace = debug_backtrace($options);
  51756. if (($main = end($trace)) && isset($main['file'])) {
  51757. return file_exists($this->script = $main['file']);
  51758. }
  51759. return false;
  51760. }
  51761. private function setEnvRestartSettings($envArgs)
  51762. {
  51763. $settings = array(
  51764. php_ini_loaded_file(),
  51765. $envArgs[2],
  51766. $envArgs[3],
  51767. $envArgs[4],
  51768. getenv($this->envOriginalInis),
  51769. self::$skipped,
  51770. );
  51771. Process::setEnv(self::RESTART_SETTINGS, implode('|', $settings));
  51772. }
  51773. private function syncSettings(array $settings)
  51774. {
  51775. if (false === getenv($this->envOriginalInis)) {
  51776. Process::setEnv($this->envOriginalInis, implode(PATH_SEPARATOR, $settings['inis']));
  51777. }
  51778. self::$skipped = $settings['skipped'];
  51779. $this->notify(Status::INFO, 'Process called with existing restart settings');
  51780. }
  51781. private function checkScanDirConfig()
  51782. {
  51783. return !(getenv('PHP_INI_SCAN_DIR')
  51784. && !PHP_CONFIG_FILE_SCAN_DIR
  51785. && (PHP_VERSION_ID < 70113
  51786. || PHP_VERSION_ID === 70200));
  51787. }
  51788. private function checkConfiguration(&$info)
  51789. {
  51790. if (false !== strpos(ini_get('disable_functions'), 'passthru')) {
  51791. $info = 'passthru function is disabled';
  51792. return false;
  51793. }
  51794. if (extension_loaded('uopz')) {
  51795. if (function_exists('uopz_allow_exit')) {
  51796. @uopz_allow_exit(true);
  51797. } else {
  51798. $info = 'uopz extension is not compatible';
  51799. return false;
  51800. }
  51801. }
  51802. return true;
  51803. }
  51804. }
  51805. Copyright (c) 2012 PHP Framework Interoperability Group
  51806. Permission is hereby granted, free of charge, to any person obtaining a copy
  51807. of this software and associated documentation files (the "Software"), to deal
  51808. in the Software without restriction, including without limitation the rights
  51809. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  51810. copies of the Software, and to permit persons to whom the Software is
  51811. furnished to do so, subject to the following conditions:
  51812. The above copyright notice and this permission notice shall be included in
  51813. all copies or substantial portions of the Software.
  51814. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  51815. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  51816. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  51817. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  51818. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  51819. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  51820. THE SOFTWARE.
  51821. <?php
  51822. namespace Psr\Log;
  51823. abstract class AbstractLogger implements LoggerInterface
  51824. {
  51825. public function emergency($message, array $context = array())
  51826. {
  51827. $this->log(LogLevel::EMERGENCY, $message, $context);
  51828. }
  51829. public function alert($message, array $context = array())
  51830. {
  51831. $this->log(LogLevel::ALERT, $message, $context);
  51832. }
  51833. public function critical($message, array $context = array())
  51834. {
  51835. $this->log(LogLevel::CRITICAL, $message, $context);
  51836. }
  51837. public function error($message, array $context = array())
  51838. {
  51839. $this->log(LogLevel::ERROR, $message, $context);
  51840. }
  51841. public function warning($message, array $context = array())
  51842. {
  51843. $this->log(LogLevel::WARNING, $message, $context);
  51844. }
  51845. public function notice($message, array $context = array())
  51846. {
  51847. $this->log(LogLevel::NOTICE, $message, $context);
  51848. }
  51849. public function info($message, array $context = array())
  51850. {
  51851. $this->log(LogLevel::INFO, $message, $context);
  51852. }
  51853. public function debug($message, array $context = array())
  51854. {
  51855. $this->log(LogLevel::DEBUG, $message, $context);
  51856. }
  51857. }
  51858. <?php
  51859. namespace Psr\Log;
  51860. class InvalidArgumentException extends \InvalidArgumentException
  51861. {
  51862. }
  51863. <?php
  51864. namespace Psr\Log;
  51865. class LogLevel
  51866. {
  51867. const EMERGENCY = 'emergency';
  51868. const ALERT = 'alert';
  51869. const CRITICAL = 'critical';
  51870. const ERROR = 'error';
  51871. const WARNING = 'warning';
  51872. const NOTICE = 'notice';
  51873. const INFO = 'info';
  51874. const DEBUG = 'debug';
  51875. }
  51876. <?php
  51877. namespace Psr\Log;
  51878. interface LoggerAwareInterface
  51879. {
  51880. public function setLogger(LoggerInterface $logger);
  51881. }
  51882. <?php
  51883. namespace Psr\Log;
  51884. trait LoggerAwareTrait
  51885. {
  51886. protected $logger;
  51887. public function setLogger(LoggerInterface $logger)
  51888. {
  51889. $this->logger = $logger;
  51890. }
  51891. }
  51892. <?php
  51893. namespace Psr\Log;
  51894. interface LoggerInterface
  51895. {
  51896. public function emergency($message, array $context = array());
  51897. public function alert($message, array $context = array());
  51898. public function critical($message, array $context = array());
  51899. public function error($message, array $context = array());
  51900. public function warning($message, array $context = array());
  51901. public function notice($message, array $context = array());
  51902. public function info($message, array $context = array());
  51903. public function debug($message, array $context = array());
  51904. public function log($level, $message, array $context = array());
  51905. }
  51906. <?php
  51907. namespace Psr\Log;
  51908. trait LoggerTrait
  51909. {
  51910. public function emergency($message, array $context = array())
  51911. {
  51912. $this->log(LogLevel::EMERGENCY, $message, $context);
  51913. }
  51914. public function alert($message, array $context = array())
  51915. {
  51916. $this->log(LogLevel::ALERT, $message, $context);
  51917. }
  51918. public function critical($message, array $context = array())
  51919. {
  51920. $this->log(LogLevel::CRITICAL, $message, $context);
  51921. }
  51922. public function error($message, array $context = array())
  51923. {
  51924. $this->log(LogLevel::ERROR, $message, $context);
  51925. }
  51926. public function warning($message, array $context = array())
  51927. {
  51928. $this->log(LogLevel::WARNING, $message, $context);
  51929. }
  51930. public function notice($message, array $context = array())
  51931. {
  51932. $this->log(LogLevel::NOTICE, $message, $context);
  51933. }
  51934. public function info($message, array $context = array())
  51935. {
  51936. $this->log(LogLevel::INFO, $message, $context);
  51937. }
  51938. public function debug($message, array $context = array())
  51939. {
  51940. $this->log(LogLevel::DEBUG, $message, $context);
  51941. }
  51942. abstract public function log($level, $message, array $context = array());
  51943. }
  51944. <?php
  51945. namespace Psr\Log;
  51946. class NullLogger extends AbstractLogger
  51947. {
  51948. public function log($level, $message, array $context = array())
  51949. {
  51950. }
  51951. }
  51952. <?php
  51953. namespace Psr\Log\Test;
  51954. use Psr\Log\LoggerInterface;
  51955. use Psr\Log\LogLevel;
  51956. use PHPUnit\Framework\TestCase;
  51957. abstract class LoggerInterfaceTest extends TestCase
  51958. {
  51959. abstract public function getLogger();
  51960. abstract public function getLogs();
  51961. public function testImplements()
  51962. {
  51963. $this->assertInstanceOf('Psr\Log\LoggerInterface', $this->getLogger());
  51964. }
  51965. public function testLogsAtAllLevels($level, $message)
  51966. {
  51967. $logger = $this->getLogger();
  51968. $logger->{$level}($message, array('user' => 'Bob'));
  51969. $logger->log($level, $message, array('user' => 'Bob'));
  51970. $expected = array(
  51971. $level.' message of level '.$level.' with context: Bob',
  51972. $level.' message of level '.$level.' with context: Bob',
  51973. );
  51974. $this->assertEquals($expected, $this->getLogs());
  51975. }
  51976. public function provideLevelsAndMessages()
  51977. {
  51978. return array(
  51979. LogLevel::EMERGENCY => array(LogLevel::EMERGENCY, 'message of level emergency with context: {user}'),
  51980. LogLevel::ALERT => array(LogLevel::ALERT, 'message of level alert with context: {user}'),
  51981. LogLevel::CRITICAL => array(LogLevel::CRITICAL, 'message of level critical with context: {user}'),
  51982. LogLevel::ERROR => array(LogLevel::ERROR, 'message of level error with context: {user}'),
  51983. LogLevel::WARNING => array(LogLevel::WARNING, 'message of level warning with context: {user}'),
  51984. LogLevel::NOTICE => array(LogLevel::NOTICE, 'message of level notice with context: {user}'),
  51985. LogLevel::INFO => array(LogLevel::INFO, 'message of level info with context: {user}'),
  51986. LogLevel::DEBUG => array(LogLevel::DEBUG, 'message of level debug with context: {user}'),
  51987. );
  51988. }
  51989. public function testThrowsOnInvalidLevel()
  51990. {
  51991. $logger = $this->getLogger();
  51992. $logger->log('invalid level', 'Foo');
  51993. }
  51994. public function testContextReplacement()
  51995. {
  51996. $logger = $this->getLogger();
  51997. $logger->info('{Message {nothing} {user} {foo.bar} a}', array('user' => 'Bob', 'foo.bar' => 'Bar'));
  51998. $expected = array('info {Message {nothing} Bob Bar a}');
  51999. $this->assertEquals($expected, $this->getLogs());
  52000. }
  52001. public function testObjectCastToString()
  52002. {
  52003. if (method_exists($this, 'createPartialMock')) {
  52004. $dummy = $this->createPartialMock('Psr\Log\Test\DummyTest', array('__toString'));
  52005. } else {
  52006. $dummy = $this->getMock('Psr\Log\Test\DummyTest', array('__toString'));
  52007. }
  52008. $dummy->expects($this->once())
  52009. ->method('__toString')
  52010. ->will($this->returnValue('DUMMY'));
  52011. $this->getLogger()->warning($dummy);
  52012. $expected = array('warning DUMMY');
  52013. $this->assertEquals($expected, $this->getLogs());
  52014. }
  52015. public function testContextCanContainAnything()
  52016. {
  52017. $closed = fopen('php://memory', 'r');
  52018. fclose($closed);
  52019. $context = array(
  52020. 'bool' => true,
  52021. 'null' => null,
  52022. 'string' => 'Foo',
  52023. 'int' => 0,
  52024. 'float' => 0.5,
  52025. 'nested' => array('with object' => new DummyTest),
  52026. 'object' => new \DateTime,
  52027. 'resource' => fopen('php://memory', 'r'),
  52028. 'closed' => $closed,
  52029. );
  52030. $this->getLogger()->warning('Crazy context data', $context);
  52031. $expected = array('warning Crazy context data');
  52032. $this->assertEquals($expected, $this->getLogs());
  52033. }
  52034. public function testContextExceptionKeyCanBeExceptionOrOtherValues()
  52035. {
  52036. $logger = $this->getLogger();
  52037. $logger->warning('Random message', array('exception' => 'oops'));
  52038. $logger->critical('Uncaught Exception!', array('exception' => new \LogicException('Fail')));
  52039. $expected = array(
  52040. 'warning Random message',
  52041. 'critical Uncaught Exception!'
  52042. );
  52043. $this->assertEquals($expected, $this->getLogs());
  52044. }
  52045. }
  52046. class DummyTest
  52047. {
  52048. public function __toString()
  52049. {
  52050. return 'DummyTest';
  52051. }
  52052. }
  52053. <?php
  52054. namespace Psr\Log\Test;
  52055. use Psr\Log\AbstractLogger;
  52056. class TestLogger extends AbstractLogger
  52057. {
  52058. public $records = [];
  52059. public $recordsByLevel = [];
  52060. public function log($level, $message, array $context = [])
  52061. {
  52062. $record = [
  52063. 'level' => $level,
  52064. 'message' => $message,
  52065. 'context' => $context,
  52066. ];
  52067. $this->recordsByLevel[$record['level']][] = $record;
  52068. $this->records[] = $record;
  52069. }
  52070. public function hasRecords($level)
  52071. {
  52072. return isset($this->recordsByLevel[$level]);
  52073. }
  52074. public function hasRecord($record, $level)
  52075. {
  52076. if (is_string($record)) {
  52077. $record = ['message' => $record];
  52078. }
  52079. return $this->hasRecordThatPasses(function ($rec) use ($record) {
  52080. if ($rec['message'] !== $record['message']) {
  52081. return false;
  52082. }
  52083. if (isset($record['context']) && $rec['context'] !== $record['context']) {
  52084. return false;
  52085. }
  52086. return true;
  52087. }, $level);
  52088. }
  52089. public function hasRecordThatContains($message, $level)
  52090. {
  52091. return $this->hasRecordThatPasses(function ($rec) use ($message) {
  52092. return strpos($rec['message'], $message) !== false;
  52093. }, $level);
  52094. }
  52095. public function hasRecordThatMatches($regex, $level)
  52096. {
  52097. return $this->hasRecordThatPasses(function ($rec) use ($regex) {
  52098. return preg_match($regex, $rec['message']) > 0;
  52099. }, $level);
  52100. }
  52101. public function hasRecordThatPasses(callable $predicate, $level)
  52102. {
  52103. if (!isset($this->recordsByLevel[$level])) {
  52104. return false;
  52105. }
  52106. foreach ($this->recordsByLevel[$level] as $i => $rec) {
  52107. if (call_user_func($predicate, $rec, $i)) {
  52108. return true;
  52109. }
  52110. }
  52111. return false;
  52112. }
  52113. public function __call($method, $args)
  52114. {
  52115. if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) {
  52116. $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3];
  52117. $level = strtolower($matches[2]);
  52118. if (method_exists($this, $genericMethod)) {
  52119. $args[] = $level;
  52120. return call_user_func_array([$this, $genericMethod], $args);
  52121. }
  52122. }
  52123. throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()');
  52124. }
  52125. public function reset()
  52126. {
  52127. $this->records = [];
  52128. $this->recordsByLevel = [];
  52129. }
  52130. }
  52131. <?php
  52132. require_once __DIR__ . '/composer/autoload_real.php';
  52133. return ComposerAutoloaderInitComposerPhar1572625217::getLoader();
  52134. <?php
  52135. $vendorDir = dirname(dirname(__FILE__));
  52136. $baseDir = dirname($vendorDir);
  52137. return array(
  52138. );
  52139. <?php
  52140. $vendorDir = dirname(dirname(__FILE__));
  52141. $baseDir = dirname($vendorDir);
  52142. return array(
  52143. 'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
  52144. 'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
  52145. 'Symfony\\Component\\Process\\' => array($vendorDir . '/symfony/process'),
  52146. 'Symfony\\Component\\Finder\\' => array($vendorDir . '/symfony/finder'),
  52147. 'Symfony\\Component\\Filesystem\\' => array($vendorDir . '/symfony/filesystem'),
  52148. 'Symfony\\Component\\Debug\\' => array($vendorDir . '/symfony/debug'),
  52149. 'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
  52150. 'Seld\\PharUtils\\' => array($vendorDir . '/seld/phar-utils/src'),
  52151. 'Seld\\JsonLint\\' => array($vendorDir . '/seld/jsonlint/src/Seld/JsonLint'),
  52152. 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'),
  52153. 'JsonSchema\\' => array($vendorDir . '/justinrainbow/json-schema/src/JsonSchema'),
  52154. 'Composer\\XdebugHandler\\' => array($vendorDir . '/composer/xdebug-handler/src'),
  52155. 'Composer\\Spdx\\' => array($vendorDir . '/composer/spdx-licenses/src'),
  52156. 'Composer\\Semver\\' => array($vendorDir . '/composer/semver/src'),
  52157. 'Composer\\CaBundle\\' => array($vendorDir . '/composer/ca-bundle/src'),
  52158. 'Composer\\' => array($baseDir . '/src/Composer'),
  52159. );
  52160. <?php
  52161. $vendorDir = dirname(dirname(__FILE__));
  52162. $baseDir = dirname($vendorDir);
  52163. return array(
  52164. );
  52165. <?php
  52166. $vendorDir = dirname(dirname(__FILE__));
  52167. $baseDir = dirname($vendorDir);
  52168. return array(
  52169. '320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
  52170. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
  52171. );
  52172. <?php
  52173. class ComposerAutoloaderInitComposerPhar1572625217
  52174. {
  52175. private static $loader;
  52176. public static function loadClassLoader($class)
  52177. {
  52178. if ('Composer\Autoload\ClassLoader' === $class) {
  52179. require __DIR__ . '/ClassLoader.php';
  52180. }
  52181. }
  52182. public static function getLoader()
  52183. {
  52184. if (null !== self::$loader) {
  52185. return self::$loader;
  52186. }
  52187. spl_autoload_register(array('ComposerAutoloaderInitComposerPhar1572625217', 'loadClassLoader'), true, true);
  52188. self::$loader = $loader = new \Composer\Autoload\ClassLoader();
  52189. spl_autoload_unregister(array('ComposerAutoloaderInitComposerPhar1572625217', 'loadClassLoader'));
  52190. $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
  52191. if ($useStaticLoader) {
  52192. require_once __DIR__ . '/autoload_static.php';
  52193. call_user_func(\Composer\Autoload\ComposerStaticInitComposerPhar1572625217::getInitializer($loader));
  52194. } else {
  52195. $map = require __DIR__ . '/autoload_namespaces.php';
  52196. foreach ($map as $namespace => $path) {
  52197. $loader->set($namespace, $path);
  52198. }
  52199. $map = require __DIR__ . '/autoload_psr4.php';
  52200. foreach ($map as $namespace => $path) {
  52201. $loader->setPsr4($namespace, $path);
  52202. }
  52203. $classMap = require __DIR__ . '/autoload_classmap.php';
  52204. if ($classMap) {
  52205. $loader->addClassMap($classMap);
  52206. }
  52207. }
  52208. $loader->register(true);
  52209. if ($useStaticLoader) {
  52210. $includeFiles = Composer\Autoload\ComposerStaticInitComposerPhar1572625217::$files;
  52211. } else {
  52212. $includeFiles = require __DIR__ . '/autoload_files.php';
  52213. }
  52214. foreach ($includeFiles as $fileIdentifier => $file) {
  52215. composerRequireComposerPhar1572625217($fileIdentifier, $file);
  52216. }
  52217. return $loader;
  52218. }
  52219. }
  52220. function composerRequireComposerPhar1572625217($fileIdentifier, $file)
  52221. {
  52222. if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  52223. require $file;
  52224. $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
  52225. }
  52226. }
  52227. <?php
  52228. namespace Composer\Autoload;
  52229. class ComposerStaticInitComposerPhar1572625217
  52230. {
  52231. public static $files = array (
  52232. '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
  52233. '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
  52234. );
  52235. public static $prefixLengthsPsr4 = array (
  52236. 'S' =>
  52237. array (
  52238. 'Symfony\\Polyfill\\Mbstring\\' => 26,
  52239. 'Symfony\\Polyfill\\Ctype\\' => 23,
  52240. 'Symfony\\Component\\Process\\' => 26,
  52241. 'Symfony\\Component\\Finder\\' => 25,
  52242. 'Symfony\\Component\\Filesystem\\' => 29,
  52243. 'Symfony\\Component\\Debug\\' => 24,
  52244. 'Symfony\\Component\\Console\\' => 26,
  52245. 'Seld\\PharUtils\\' => 15,
  52246. 'Seld\\JsonLint\\' => 14,
  52247. ),
  52248. 'P' =>
  52249. array (
  52250. 'Psr\\Log\\' => 8,
  52251. ),
  52252. 'J' =>
  52253. array (
  52254. 'JsonSchema\\' => 11,
  52255. ),
  52256. 'C' =>
  52257. array (
  52258. 'Composer\\XdebugHandler\\' => 23,
  52259. 'Composer\\Spdx\\' => 14,
  52260. 'Composer\\Semver\\' => 16,
  52261. 'Composer\\CaBundle\\' => 18,
  52262. 'Composer\\' => 9,
  52263. ),
  52264. );
  52265. public static $prefixDirsPsr4 = array (
  52266. 'Symfony\\Polyfill\\Mbstring\\' =>
  52267. array (
  52268. 0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
  52269. ),
  52270. 'Symfony\\Polyfill\\Ctype\\' =>
  52271. array (
  52272. 0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
  52273. ),
  52274. 'Symfony\\Component\\Process\\' =>
  52275. array (
  52276. 0 => __DIR__ . '/..' . '/symfony/process',
  52277. ),
  52278. 'Symfony\\Component\\Finder\\' =>
  52279. array (
  52280. 0 => __DIR__ . '/..' . '/symfony/finder',
  52281. ),
  52282. 'Symfony\\Component\\Filesystem\\' =>
  52283. array (
  52284. 0 => __DIR__ . '/..' . '/symfony/filesystem',
  52285. ),
  52286. 'Symfony\\Component\\Debug\\' =>
  52287. array (
  52288. 0 => __DIR__ . '/..' . '/symfony/debug',
  52289. ),
  52290. 'Symfony\\Component\\Console\\' =>
  52291. array (
  52292. 0 => __DIR__ . '/..' . '/symfony/console',
  52293. ),
  52294. 'Seld\\PharUtils\\' =>
  52295. array (
  52296. 0 => __DIR__ . '/..' . '/seld/phar-utils/src',
  52297. ),
  52298. 'Seld\\JsonLint\\' =>
  52299. array (
  52300. 0 => __DIR__ . '/..' . '/seld/jsonlint/src/Seld/JsonLint',
  52301. ),
  52302. 'Psr\\Log\\' =>
  52303. array (
  52304. 0 => __DIR__ . '/..' . '/psr/log/Psr/Log',
  52305. ),
  52306. 'JsonSchema\\' =>
  52307. array (
  52308. 0 => __DIR__ . '/..' . '/justinrainbow/json-schema/src/JsonSchema',
  52309. ),
  52310. 'Composer\\XdebugHandler\\' =>
  52311. array (
  52312. 0 => __DIR__ . '/..' . '/composer/xdebug-handler/src',
  52313. ),
  52314. 'Composer\\Spdx\\' =>
  52315. array (
  52316. 0 => __DIR__ . '/..' . '/composer/spdx-licenses/src',
  52317. ),
  52318. 'Composer\\Semver\\' =>
  52319. array (
  52320. 0 => __DIR__ . '/..' . '/composer/semver/src',
  52321. ),
  52322. 'Composer\\CaBundle\\' =>
  52323. array (
  52324. 0 => __DIR__ . '/..' . '/composer/ca-bundle/src',
  52325. ),
  52326. 'Composer\\' =>
  52327. array (
  52328. 0 => __DIR__ . '/../..' . '/src/Composer',
  52329. ),
  52330. );
  52331. public static function getInitializer(ClassLoader $loader)
  52332. {
  52333. return \Closure::bind(function () use ($loader) {
  52334. $loader->prefixLengthsPsr4 = ComposerStaticInitComposerPhar1572625217::$prefixLengthsPsr4;
  52335. $loader->prefixDirsPsr4 = ComposerStaticInitComposerPhar1572625217::$prefixDirsPsr4;
  52336. }, null, ClassLoader::class);
  52337. }
  52338. }
  52339. <?php
  52340. namespace Composer\Autoload;
  52341. class ClassLoader
  52342. {
  52343. private $prefixLengthsPsr4 = array();
  52344. private $prefixDirsPsr4 = array();
  52345. private $fallbackDirsPsr4 = array();
  52346. private $prefixesPsr0 = array();
  52347. private $fallbackDirsPsr0 = array();
  52348. private $useIncludePath = false;
  52349. private $classMap = array();
  52350. private $classMapAuthoritative = false;
  52351. private $missingClasses = array();
  52352. private $apcuPrefix;
  52353. public function getPrefixes()
  52354. {
  52355. if (!empty($this->prefixesPsr0)) {
  52356. return call_user_func_array('array_merge', $this->prefixesPsr0);
  52357. }
  52358. return array();
  52359. }
  52360. public function getPrefixesPsr4()
  52361. {
  52362. return $this->prefixDirsPsr4;
  52363. }
  52364. public function getFallbackDirs()
  52365. {
  52366. return $this->fallbackDirsPsr0;
  52367. }
  52368. public function getFallbackDirsPsr4()
  52369. {
  52370. return $this->fallbackDirsPsr4;
  52371. }
  52372. public function getClassMap()
  52373. {
  52374. return $this->classMap;
  52375. }
  52376. public function addClassMap(array $classMap)
  52377. {
  52378. if ($this->classMap) {
  52379. $this->classMap = array_merge($this->classMap, $classMap);
  52380. } else {
  52381. $this->classMap = $classMap;
  52382. }
  52383. }
  52384. public function add($prefix, $paths, $prepend = false)
  52385. {
  52386. if (!$prefix) {
  52387. if ($prepend) {
  52388. $this->fallbackDirsPsr0 = array_merge(
  52389. (array) $paths,
  52390. $this->fallbackDirsPsr0
  52391. );
  52392. } else {
  52393. $this->fallbackDirsPsr0 = array_merge(
  52394. $this->fallbackDirsPsr0,
  52395. (array) $paths
  52396. );
  52397. }
  52398. return;
  52399. }
  52400. $first = $prefix[0];
  52401. if (!isset($this->prefixesPsr0[$first][$prefix])) {
  52402. $this->prefixesPsr0[$first][$prefix] = (array) $paths;
  52403. return;
  52404. }
  52405. if ($prepend) {
  52406. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52407. (array) $paths,
  52408. $this->prefixesPsr0[$first][$prefix]
  52409. );
  52410. } else {
  52411. $this->prefixesPsr0[$first][$prefix] = array_merge(
  52412. $this->prefixesPsr0[$first][$prefix],
  52413. (array) $paths
  52414. );
  52415. }
  52416. }
  52417. public function addPsr4($prefix, $paths, $prepend = false)
  52418. {
  52419. if (!$prefix) {
  52420. if ($prepend) {
  52421. $this->fallbackDirsPsr4 = array_merge(
  52422. (array) $paths,
  52423. $this->fallbackDirsPsr4
  52424. );
  52425. } else {
  52426. $this->fallbackDirsPsr4 = array_merge(
  52427. $this->fallbackDirsPsr4,
  52428. (array) $paths
  52429. );
  52430. }
  52431. } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
  52432. $length = strlen($prefix);
  52433. if ('\\' !== $prefix[$length - 1]) {
  52434. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52435. }
  52436. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52437. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52438. } elseif ($prepend) {
  52439. $this->prefixDirsPsr4[$prefix] = array_merge(
  52440. (array) $paths,
  52441. $this->prefixDirsPsr4[$prefix]
  52442. );
  52443. } else {
  52444. $this->prefixDirsPsr4[$prefix] = array_merge(
  52445. $this->prefixDirsPsr4[$prefix],
  52446. (array) $paths
  52447. );
  52448. }
  52449. }
  52450. public function set($prefix, $paths)
  52451. {
  52452. if (!$prefix) {
  52453. $this->fallbackDirsPsr0 = (array) $paths;
  52454. } else {
  52455. $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
  52456. }
  52457. }
  52458. public function setPsr4($prefix, $paths)
  52459. {
  52460. if (!$prefix) {
  52461. $this->fallbackDirsPsr4 = (array) $paths;
  52462. } else {
  52463. $length = strlen($prefix);
  52464. if ('\\' !== $prefix[$length - 1]) {
  52465. throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
  52466. }
  52467. $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
  52468. $this->prefixDirsPsr4[$prefix] = (array) $paths;
  52469. }
  52470. }
  52471. public function setUseIncludePath($useIncludePath)
  52472. {
  52473. $this->useIncludePath = $useIncludePath;
  52474. }
  52475. public function getUseIncludePath()
  52476. {
  52477. return $this->useIncludePath;
  52478. }
  52479. public function setClassMapAuthoritative($classMapAuthoritative)
  52480. {
  52481. $this->classMapAuthoritative = $classMapAuthoritative;
  52482. }
  52483. public function isClassMapAuthoritative()
  52484. {
  52485. return $this->classMapAuthoritative;
  52486. }
  52487. public function setApcuPrefix($apcuPrefix)
  52488. {
  52489. $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
  52490. }
  52491. public function getApcuPrefix()
  52492. {
  52493. return $this->apcuPrefix;
  52494. }
  52495. public function register($prepend = false)
  52496. {
  52497. spl_autoload_register(array($this, 'loadClass'), true, $prepend);
  52498. }
  52499. public function unregister()
  52500. {
  52501. spl_autoload_unregister(array($this, 'loadClass'));
  52502. }
  52503. public function loadClass($class)
  52504. {
  52505. if ($file = $this->findFile($class)) {
  52506. includeFile($file);
  52507. return true;
  52508. }
  52509. }
  52510. public function findFile($class)
  52511. {
  52512. if (isset($this->classMap[$class])) {
  52513. return $this->classMap[$class];
  52514. }
  52515. if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
  52516. return false;
  52517. }
  52518. if (null !== $this->apcuPrefix) {
  52519. $file = apcu_fetch($this->apcuPrefix.$class, $hit);
  52520. if ($hit) {
  52521. return $file;
  52522. }
  52523. }
  52524. $file = $this->findFileWithExtension($class, '.php');
  52525. if (false === $file && defined('HHVM_VERSION')) {
  52526. $file = $this->findFileWithExtension($class, '.hh');
  52527. }
  52528. if (null !== $this->apcuPrefix) {
  52529. apcu_add($this->apcuPrefix.$class, $file);
  52530. }
  52531. if (false === $file) {
  52532. $this->missingClasses[$class] = true;
  52533. }
  52534. return $file;
  52535. }
  52536. private function findFileWithExtension($class, $ext)
  52537. {
  52538. $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
  52539. $first = $class[0];
  52540. if (isset($this->prefixLengthsPsr4[$first])) {
  52541. $subPath = $class;
  52542. while (false !== $lastPos = strrpos($subPath, '\\')) {
  52543. $subPath = substr($subPath, 0, $lastPos);
  52544. $search = $subPath . '\\';
  52545. if (isset($this->prefixDirsPsr4[$search])) {
  52546. $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
  52547. foreach ($this->prefixDirsPsr4[$search] as $dir) {
  52548. if (file_exists($file = $dir . $pathEnd)) {
  52549. return $file;
  52550. }
  52551. }
  52552. }
  52553. }
  52554. }
  52555. foreach ($this->fallbackDirsPsr4 as $dir) {
  52556. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
  52557. return $file;
  52558. }
  52559. }
  52560. if (false !== $pos = strrpos($class, '\\')) {
  52561. $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
  52562. . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
  52563. } else {
  52564. $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
  52565. }
  52566. if (isset($this->prefixesPsr0[$first])) {
  52567. foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
  52568. if (0 === strpos($class, $prefix)) {
  52569. foreach ($dirs as $dir) {
  52570. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52571. return $file;
  52572. }
  52573. }
  52574. }
  52575. }
  52576. }
  52577. foreach ($this->fallbackDirsPsr0 as $dir) {
  52578. if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
  52579. return $file;
  52580. }
  52581. }
  52582. if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
  52583. return $file;
  52584. }
  52585. return false;
  52586. }
  52587. }
  52588. function includeFile($file)
  52589. {
  52590. include $file;
  52591. }
  52592. ##
  52593. ## Bundle of CA Root Certificates
  52594. ##
  52595. ## Certificate data from Mozilla as of: Wed Aug 28 03:12:10 2019 GMT
  52596. ##
  52597. ## This is a bundle of X.509 certificates of public Certificate Authorities
  52598. ## (CA). These were automatically extracted from Mozilla's root certificates
  52599. ## file (certdata.txt). This file can be found in the mozilla source tree:
  52600. ## https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt
  52601. ##
  52602. ## It contains the certificates in PEM format and therefore
  52603. ## can be directly used with curl / libcurl / php_curl, or with
  52604. ## an Apache+mod_ssl webserver for SSL client authentication.
  52605. ## Just configure this file as the SSLCACertificateFile.
  52606. ##
  52607. ## Conversion done with mk-ca-bundle.pl version 1.27.
  52608. ## SHA256: fffa309937c3be940649293f749b8207fabc6eb224e50e4bb3f2c5e44e0d6a6b
  52609. ##
  52610. GlobalSign Root CA
  52611. ==================
  52612. -----BEGIN CERTIFICATE-----
  52613. MIIDdTCCAl2gAwIBAgILBAAAAAABFUtaw5QwDQYJKoZIhvcNAQEFBQAwVzELMAkGA1UEBhMCQkUx
  52614. GTAXBgNVBAoTEEdsb2JhbFNpZ24gbnYtc2ExEDAOBgNVBAsTB1Jvb3QgQ0ExGzAZBgNVBAMTEkds
  52615. b2JhbFNpZ24gUm9vdCBDQTAeFw05ODA5MDExMjAwMDBaFw0yODAxMjgxMjAwMDBaMFcxCzAJBgNV
  52616. BAYTAkJFMRkwFwYDVQQKExBHbG9iYWxTaWduIG52LXNhMRAwDgYDVQQLEwdSb290IENBMRswGQYD
  52617. VQQDExJHbG9iYWxTaWduIFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDa
  52618. DuaZjc6j40+Kfvvxi4Mla+pIH/EqsLmVEQS98GPR4mdmzxzdzxtIK+6NiY6arymAZavpxy0Sy6sc
  52619. THAHoT0KMM0VjU/43dSMUBUc71DuxC73/OlS8pF94G3VNTCOXkNz8kHp1Wrjsok6Vjk4bwY8iGlb
  52620. Kk3Fp1S4bInMm/k8yuX9ifUSPJJ4ltbcdG6TRGHRjcdGsnUOhugZitVtbNV4FpWi6cgKOOvyJBNP
  52621. c1STE4U6G7weNLWLBYy5d4ux2x8gkasJU26Qzns3dLlwR5EiUWMWea6xrkEmCMgZK9FGqkjWZCrX
  52622. gzT/LCrBbBlDSgeF59N89iFo7+ryUp9/k5DPAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNV
  52623. HRMBAf8EBTADAQH/MB0GA1UdDgQWBBRge2YaRQ2XyolQL30EzTSo//z9SzANBgkqhkiG9w0BAQUF
  52624. AAOCAQEA1nPnfE920I2/7LqivjTFKDK1fPxsnCwrvQmeU79rXqoRSLblCKOzyj1hTdNGCbM+w6Dj
  52625. Y1Ub8rrvrTnhQ7k4o+YviiY776BQVvnGCv04zcQLcFGUl5gE38NflNUVyRRBnMRddWQVDf9VMOyG
  52626. j/8N7yy5Y0b2qvzfvGn9LhJIZJrglfCm7ymPAbEVtQwdpf5pLGkkeB6zpxxxYu7KyJesF12KwvhH
  52627. hm4qxFYxldBniYUr+WymXUadDKqC5JlR3XC321Y9YeRq4VzW9v493kHMB65jUr9TU/Qr6cf9tveC
  52628. X4XSQRjbgbMEHMUfpIBvFSDJ3gyICh3WZlXi/EjJKSZp4A==
  52629. -----END CERTIFICATE-----
  52630. GlobalSign Root CA - R2
  52631. =======================
  52632. -----BEGIN CERTIFICATE-----
  52633. MIIDujCCAqKgAwIBAgILBAAAAAABD4Ym5g0wDQYJKoZIhvcNAQEFBQAwTDEgMB4GA1UECxMXR2xv
  52634. YmFsU2lnbiBSb290IENBIC0gUjIxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  52635. bFNpZ24wHhcNMDYxMjE1MDgwMDAwWhcNMjExMjE1MDgwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  52636. aWduIFJvb3QgQ0EgLSBSMjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  52637. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKbPJA6+Lm8omUVCxKs+IVSbC9N/hHD6
  52638. ErPLv4dfxn+G07IwXNb9rfF73OX4YJYJkhD10FPe+3t+c4isUoh7SqbKSaZeqKeMWhG8eoLrvozp
  52639. s6yWJQeXSpkqBy+0Hne/ig+1AnwblrjFuTosvNYSuetZfeLQBoZfXklqtTleiDTsvHgMCJiEbKjN
  52640. S7SgfQx5TfC4LcshytVsW33hoCmEofnTlEnLJGKRILzdC9XZzPnqJworc5HGnRusyMvo4KD0L5CL
  52641. TfuwNhv2GXqF4G3yYROIXJ/gkwpRl4pazq+r1feqCapgvdzZX99yqWATXgAByUr6P6TqBwMhAo6C
  52642. ygPCm48CAwEAAaOBnDCBmTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4E
  52643. FgQUm+IHV2ccHsBqBt5ZtJot39wZhi4wNgYDVR0fBC8wLTAroCmgJ4YlaHR0cDovL2NybC5nbG9i
  52644. YWxzaWduLm5ldC9yb290LXIyLmNybDAfBgNVHSMEGDAWgBSb4gdXZxwewGoG3lm0mi3f3BmGLjAN
  52645. BgkqhkiG9w0BAQUFAAOCAQEAmYFThxxol4aR7OBKuEQLq4GsJ0/WwbgcQ3izDJr86iw8bmEbTUsp
  52646. 9Z8FHSbBuOmDAGJFtqkIk7mpM0sYmsL4h4hO291xNBrBVNpGP+DTKqttVCL1OmLNIG+6KYnX3ZHu
  52647. 01yiPqFbQfXf5WRDLenVOavSot+3i9DAgBkcRcAtjOj4LaR0VknFBbVPFd5uRHg5h6h+u/N5GJG7
  52648. 9G+dwfCMNYxdAfvDbbnvRG15RjF+Cv6pgsH/76tuIMRQyV+dTZsXjAzlAcmgQWpzU/qlULRuJQ/7
  52649. TBj0/VLZjmmx6BEP3ojY+x1J96relc8geMJgEtslQIxq/H5COEBkEveegeGTLg==
  52650. -----END CERTIFICATE-----
  52651. Verisign Class 3 Public Primary Certification Authority - G3
  52652. ============================================================
  52653. -----BEGIN CERTIFICATE-----
  52654. MIIEGjCCAwICEQCbfgZJoz5iudXukEhxKe9XMA0GCSqGSIb3DQEBBQUAMIHKMQswCQYDVQQGEwJV
  52655. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  52656. cmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  52657. IG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkgQ2VydGlmaWNh
  52658. dGlvbiBBdXRob3JpdHkgLSBHMzAeFw05OTEwMDEwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMIHKMQsw
  52659. CQYDVQQGEwJVUzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRy
  52660. dXN0IE5ldHdvcmsxOjA4BgNVBAsTMShjKSAxOTk5IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhv
  52661. cml6ZWQgdXNlIG9ubHkxRTBDBgNVBAMTPFZlcmlTaWduIENsYXNzIDMgUHVibGljIFByaW1hcnkg
  52662. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52663. ggEBAMu6nFL8eB8aHm8bN3O9+MlrlBIwT/A2R/XQkQr1F8ilYcEWQE37imGQ5XYgwREGfassbqb1
  52664. EUGO+i2tKmFZpGcmTNDovFJbcCAEWNF6yaRpvIMXZK0Fi7zQWM6NjPXr8EJJC52XJ2cybuGukxUc
  52665. cLwgTS8Y3pKI6GyFVxEa6X7jJhFUokWWVYPKMIno3Nij7SqAP395ZVc+FSBmCC+Vk7+qRy+oRpfw
  52666. EuL+wgorUeZ25rdGt+INpsyow0xZVYnm6FNcHOqd8GIWC6fJXwzw3sJ2zq/3avL6QaaiMxTJ5Xpj
  52667. 055iN9WFZZ4O5lMkdBteHRJTW8cs54NJOxWuimi5V5cCAwEAATANBgkqhkiG9w0BAQUFAAOCAQEA
  52668. ERSWwauSCPc/L8my/uRan2Te2yFPhpk0djZX3dAVL8WtfxUfN2JzPtTnX84XA9s1+ivbrmAJXx5f
  52669. j267Cz3qWhMeDGBvtcC1IyIuBwvLqXTLR7sdwdela8wv0kL9Sd2nic9TutoAWii/gt/4uhMdUIaC
  52670. /Y4wjylGsB49Ndo4YhYYSq3mtlFs3q9i6wHQHiT+eo8SGhJouPtmmRQURVyu565pF4ErWjfJXir0
  52671. xuKhXFSbplQAz/DxwceYMBo7Nhbbo27q/a2ywtrvAkcTisDxszGtTxzhT5yvDwyd93gN2PQ1VoDa
  52672. t20Xj50egWTh/sVFuq1ruQp6Tk9LhO5L8X3dEQ==
  52673. -----END CERTIFICATE-----
  52674. Entrust.net Premium 2048 Secure Server CA
  52675. =========================================
  52676. -----BEGIN CERTIFICATE-----
  52677. MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChMLRW50cnVzdC5u
  52678. ZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBpbmNvcnAuIGJ5IHJlZi4gKGxp
  52679. bWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNV
  52680. BAMTKkVudHJ1c3QubmV0IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQx
  52681. NzUwNTFaFw0yOTA3MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3
  52682. d3d3LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxpYWIuKTEl
  52683. MCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEGA1UEAxMqRW50cnVzdC5u
  52684. ZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  52685. MIIBCgKCAQEArU1LqRKGsuqjIAcVFmQqK0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOL
  52686. Gp18EzoOH1u3Hs/lJBQesYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSr
  52687. hRSGlVuXMlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVTXTzW
  52688. nLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/HoZdenoVve8AjhUi
  52689. VBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH4QIDAQABo0IwQDAOBgNVHQ8BAf8E
  52690. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJ
  52691. KoZIhvcNAQEFBQADggEBADubj1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPy
  52692. T/4xmf3IDExoU8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf
  52693. zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5bu/8j72gZyxKT
  52694. J1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+bYQLCIt+jerXmCHG8+c8eS9e
  52695. nNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/ErfF6adulZkMV8gzURZVE=
  52696. -----END CERTIFICATE-----
  52697. Baltimore CyberTrust Root
  52698. =========================
  52699. -----BEGIN CERTIFICATE-----
  52700. MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJRTESMBAGA1UE
  52701. ChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYDVQQDExlCYWx0aW1vcmUgQ3li
  52702. ZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoXDTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMC
  52703. SUUxEjAQBgNVBAoTCUJhbHRpbW9yZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFs
  52704. dGltb3JlIEN5YmVyVHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKME
  52705. uyKrmD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjrIZ3AQSsB
  52706. UnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeKmpYcqWe4PwzV9/lSEy/C
  52707. G9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSuXmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9
  52708. XbIGevOF6uvUA65ehD5f/xXtabz5OTZydc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjpr
  52709. l3RjM71oGDHweI12v/yejl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoI
  52710. VDaGezq1BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEB
  52711. BQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT929hkTI7gQCvlYpNRh
  52712. cL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3WgxjkzSswF07r51XgdIGn9w/xZchMB5
  52713. hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsa
  52714. Y71k5h+3zvDyny67G7fyUIhzksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9H
  52715. RCwBXbsdtTLSR9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp
  52716. -----END CERTIFICATE-----
  52717. AddTrust External Root
  52718. ======================
  52719. -----BEGIN CERTIFICATE-----
  52720. MIIENjCCAx6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBvMQswCQYDVQQGEwJTRTEUMBIGA1UEChML
  52721. QWRkVHJ1c3QgQUIxJjAkBgNVBAsTHUFkZFRydXN0IEV4dGVybmFsIFRUUCBOZXR3b3JrMSIwIAYD
  52722. VQQDExlBZGRUcnVzdCBFeHRlcm5hbCBDQSBSb290MB4XDTAwMDUzMDEwNDgzOFoXDTIwMDUzMDEw
  52723. NDgzOFowbzELMAkGA1UEBhMCU0UxFDASBgNVBAoTC0FkZFRydXN0IEFCMSYwJAYDVQQLEx1BZGRU
  52724. cnVzdCBFeHRlcm5hbCBUVFAgTmV0d29yazEiMCAGA1UEAxMZQWRkVHJ1c3QgRXh0ZXJuYWwgQ0Eg
  52725. Um9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALf3GjPm8gAELTngTlvtH7xsD821
  52726. +iO2zt6bETOXpClMfZOfvUq8k+0DGuOPz+VtUFrWlymUWoCwSXrbLpX9uMq/NzgtHj6RQa1wVsfw
  52727. Tz/oMp50ysiQVOnGXw94nZpAPA6sYapeFI+eh6FqUNzXmk6vBbOmcZSccbNQYArHE504B4YCqOmo
  52728. aSYYkKtMsE8jqzpPhNjfzp/haW+710LXa0Tkx63ubUFfclpxCDezeWWkWaCUN/cALw3CknLa0Dhy
  52729. 2xSoRcRdKn23tNbE7qzNE0S3ySvdQwAl+mG5aWpYIxG3pzOPVnVZ9c0p10a3CitlttNCbxWyuHv7
  52730. 7+ldU9U0WicCAwEAAaOB3DCB2TAdBgNVHQ4EFgQUrb2YejS0Jvf6xCZU7wO94CTLVBowCwYDVR0P
  52731. BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wgZkGA1UdIwSBkTCBjoAUrb2YejS0Jvf6xCZU7wO94CTL
  52732. VBqhc6RxMG8xCzAJBgNVBAYTAlNFMRQwEgYDVQQKEwtBZGRUcnVzdCBBQjEmMCQGA1UECxMdQWRk
  52733. VHJ1c3QgRXh0ZXJuYWwgVFRQIE5ldHdvcmsxIjAgBgNVBAMTGUFkZFRydXN0IEV4dGVybmFsIENB
  52734. IFJvb3SCAQEwDQYJKoZIhvcNAQEFBQADggEBALCb4IUlwtYj4g+WBpKdQZic2YR5gdkeWxQHIzZl
  52735. j7DYd7usQWxHYINRsPkyPef89iYTx4AWpb9a/IfPeHmJIZriTAcKhjW88t5RxNKWt9x+Tu5w/Rw5
  52736. 6wwCURQtjr0W4MHfRnXnJK3s9EK0hZNwEGe6nQY1ShjTK3rMUUKhemPR5ruhxSvCNr4TDea9Y355
  52737. e6cJDUCrat2PisP29owaQgVR1EX1n6diIWgVIEM8med8vSTYqZEXc4g/VhsxOBi0cQ+azcgOno4u
  52738. G+GMmIPLHzHxREzGBHNJdmAPx/i9F4BrLunMTA5amnkPIAou1Z5jJh5VkpTYghdae9C8x49OhgQ=
  52739. -----END CERTIFICATE-----
  52740. Entrust Root Certification Authority
  52741. ====================================
  52742. -----BEGIN CERTIFICATE-----
  52743. MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMCVVMxFjAUBgNV
  52744. BAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0Lm5ldC9DUFMgaXMgaW5jb3Jw
  52745. b3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMWKGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsG
  52746. A1UEAxMkRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0
  52747. MloXDTI2MTEyNzIwNTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMu
  52748. MTkwNwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSByZWZlcmVu
  52749. Y2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNVBAMTJEVudHJ1c3QgUm9v
  52750. dCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  52751. ALaVtkNC+sZtKm9I35RMOVcF7sN5EUFoNu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYsz
  52752. A9u3g3s+IIRe7bJWKKf44LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOww
  52753. Cj0Yzfv9KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGIrb68
  52754. j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi94DkZfs0Nw4pgHBN
  52755. rziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOBsDCBrTAOBgNVHQ8BAf8EBAMCAQYw
  52756. DwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAigA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1
  52757. MzQyWjAfBgNVHSMEGDAWgBRokORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DH
  52758. hmak8fdLQ/uEvW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA
  52759. A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9tO1KzKtvn1ISM
  52760. Y/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6ZuaAGAT/3B+XxFNSRuzFVJ7yVTa
  52761. v52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTS
  52762. W3iDVuycNsMm4hH2Z0kdkquM++v/eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0
  52763. tHuu2guQOHXvgR1m0vdXcDazv/wor3ElhVsT/h5/WrQ8
  52764. -----END CERTIFICATE-----
  52765. GeoTrust Global CA
  52766. ==================
  52767. -----BEGIN CERTIFICATE-----
  52768. MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVTMRYwFAYDVQQK
  52769. Ew1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9iYWwgQ0EwHhcNMDIwNTIxMDQw
  52770. MDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5j
  52771. LjEbMBkGA1UEAxMSR2VvVHJ1c3QgR2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  52772. CgKCAQEA2swYYzD99BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjo
  52773. BbdqfnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDviS2Aelet
  52774. 8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU1XupGc1V3sjs0l44U+Vc
  52775. T4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+bw8HHa8sHo9gOeL6NlMTOdReJivbPagU
  52776. vTLrGAMoUgRx5aszPeE4uwc2hGKceeoWMPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTAD
  52777. AQH/MB0GA1UdDgQWBBTAephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVk
  52778. DBF9qn1luMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKInZ57Q
  52779. zxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfStQWVYrmm3ok9Nns4
  52780. d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcFPseKUgzbFbS9bZvlxrFUaKnjaZC2
  52781. mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Unhw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6p
  52782. XE0zX5IJL4hmXXeXxx12E6nV5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvm
  52783. Mw==
  52784. -----END CERTIFICATE-----
  52785. GeoTrust Universal CA
  52786. =====================
  52787. -----BEGIN CERTIFICATE-----
  52788. MIIFaDCCA1CgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52789. R2VvVHJ1c3QgSW5jLjEeMBwGA1UEAxMVR2VvVHJ1c3QgVW5pdmVyc2FsIENBMB4XDTA0MDMwNDA1
  52790. MDAwMFoXDTI5MDMwNDA1MDAwMFowRTELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IElu
  52791. Yy4xHjAcBgNVBAMTFUdlb1RydXN0IFVuaXZlcnNhbCBDQTCCAiIwDQYJKoZIhvcNAQEBBQADggIP
  52792. ADCCAgoCggIBAKYVVaCjxuAfjJ0hUNfBvitbtaSeodlyWL0AG0y/YckUHUWCq8YdgNY96xCcOq9t
  52793. JPi8cQGeBvV8Xx7BDlXKg5pZMK4ZyzBIle0iN430SppyZj6tlcDgFgDgEB8rMQ7XlFTTQjOgNB0e
  52794. RXbdT8oYN+yFFXoZCPzVx5zw8qkuEKmS5j1YPakWaDwvdSEYfyh3peFhF7em6fgemdtzbvQKoiFs
  52795. 7tqqhZJmr/Z6a4LauiIINQ/PQvE1+mrufislzDoR5G2vc7J2Ha3QsnhnGqQ5HFELZ1aD/ThdDc7d
  52796. 8Lsrlh/eezJS/R27tQahsiFepdaVaH/wmZ7cRQg+59IJDTWU3YBOU5fXtQlEIGQWFwMCTFMNaN7V
  52797. qnJNk22CDtucvc+081xdVHppCZbW2xHBjXWotM85yM48vCR85mLK4b19p71XZQvk/iXttmkQ3Cga
  52798. Rr0BHdCXteGYO8A3ZNY9lO4L4fUorgtWv3GLIylBjobFS1J72HGrH4oVpjuDWtdYAVHGTEHZf9hB
  52799. Z3KiKN9gg6meyHv8U3NyWfWTehd2Ds735VzZC1U0oqpbtWpU5xPKV+yXbfReBi9Fi1jUIxaS5BZu
  52800. KGNZMN9QAZxjiRqf2xeUgnA3wySemkfWWspOqGmJch+RbNt+nhutxx9z3SxPGWX9f5NAEC7S8O08
  52801. ni4oPmkmM8V7AgMBAAGjYzBhMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNq7LqqwDLiIJlF0
  52802. XG0D08DYj3rWMB8GA1UdIwQYMBaAFNq7LqqwDLiIJlF0XG0D08DYj3rWMA4GA1UdDwEB/wQEAwIB
  52803. hjANBgkqhkiG9w0BAQUFAAOCAgEAMXjmx7XfuJRAyXHEqDXsRh3ChfMoWIawC/yOsjmPRFWrZIRc
  52804. aanQmjg8+uUfNeVE44B5lGiku8SfPeE0zTBGi1QrlaXv9z+ZhP015s8xxtxqv6fXIwjhmF7DWgh2
  52805. qaavdy+3YL1ERmrvl/9zlcGO6JP7/TG37FcREUWbMPEaiDnBTzynANXH/KttgCJwpQzgXQQpAvvL
  52806. oJHRfNbDflDVnVi+QTjruXU8FdmbyUqDWcDaU/0zuzYYm4UPFd3uLax2k7nZAY1IEKj79TiG8dsK
  52807. xr2EoyNB3tZ3b4XUhRxQ4K5RirqNPnbiucon8l+f725ZDQbYKxek0nxru18UGkiPGkzns0ccjkxF
  52808. KyDuSN/n3QmOGKjaQI2SJhFTYXNd673nxE0pN2HrrDktZy4W1vUAg4WhzH92xH3kt0tm7wNFYGm2
  52809. DFKWkoRepqO1pD4r2czYG0eq8kTaT/kD6PAUyz/zg97QwVTjt+gKN02LIFkDMBmhLMi9ER/frslK
  52810. xfMnZmaGrGiR/9nmUxwPi1xpZQomyB40w11Re9epnAahNt3ViZS82eQtDF4JbAiXfKM9fJP/P6EU
  52811. p8+1Xevb2xzEdt+Iub1FBZUbrvxGakyvSOPOrg/SfuvmbJxPgWp6ZKy7PtXny3YuxadIwVyQD8vI
  52812. P/rmMuGNG2+k5o7Y+SlIis5z/iw=
  52813. -----END CERTIFICATE-----
  52814. GeoTrust Universal CA 2
  52815. =======================
  52816. -----BEGIN CERTIFICATE-----
  52817. MIIFbDCCA1SgAwIBAgIBATANBgkqhkiG9w0BAQUFADBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMN
  52818. R2VvVHJ1c3QgSW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwHhcNMDQwMzA0
  52819. MDUwMDAwWhcNMjkwMzA0MDUwMDAwWjBHMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3Qg
  52820. SW5jLjEgMB4GA1UEAxMXR2VvVHJ1c3QgVW5pdmVyc2FsIENBIDIwggIiMA0GCSqGSIb3DQEBAQUA
  52821. A4ICDwAwggIKAoICAQCzVFLByT7y2dyxUxpZKeexw0Uo5dfR7cXFS6GqdHtXr0om/Nj1XqduGdt0
  52822. DE81WzILAePb63p3NeqqWuDW6KFXlPCQo3RWlEQwAx5cTiuFJnSCegx2oG9NzkEtoBUGFF+3Qs17
  52823. j1hhNNwqCPkuwwGmIkQcTAeC5lvO0Ep8BNMZcyfwqph/Lq9O64ceJHdqXbboW0W63MOhBW9Wjo8Q
  52824. JqVJwy7XQYci4E+GymC16qFjwAGXEHm9ADwSbSsVsaxLse4YuU6W3Nx2/zu+z18DwPw76L5GG//a
  52825. QMJS9/7jOvdqdzXQ2o3rXhhqMcceujwbKNZrVMaqW9eiLBsZzKIC9ptZvTdrhrVtgrrY6slWvKk2
  52826. WP0+GfPtDCapkzj4T8FdIgbQl+rhrcZV4IErKIM6+vR7IVEAvlI4zs1meaj0gVbi0IMJR1FbUGrP
  52827. 20gaXT73y/Zl92zxlfgCOzJWgjl6W70viRu/obTo/3+NjN8D8WBOWBFM66M/ECuDmgFz2ZRthAAn
  52828. ZqzwcEAJQpKtT5MNYQlRJNiS1QuUYbKHsu3/mjX/hVTK7URDrBs8FmtISgocQIgfksILAAX/8sgC
  52829. SqSqqcyZlpwvWOB94b67B9xfBHJcMTTD7F8t4D1kkCLm0ey4Lt1ZrtmhN79UNdxzMk+MBB4zsslG
  52830. 8dhcyFVQyWi9qLo2CQIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR281Xh+qQ2
  52831. +/CfXGJx7Tz0RzgQKzAfBgNVHSMEGDAWgBR281Xh+qQ2+/CfXGJx7Tz0RzgQKzAOBgNVHQ8BAf8E
  52832. BAMCAYYwDQYJKoZIhvcNAQEFBQADggIBAGbBxiPz2eAubl/oz66wsCVNK/g7WJtAJDday6sWSf+z
  52833. dXkzoS9tcBc0kf5nfo/sm+VegqlVHy/c1FEHEv6sFj4sNcZj/NwQ6w2jqtB8zNHQL1EuxBRa3ugZ
  52834. 4T7GzKQp5y6EqgYweHZUcyiYWTjgAA1i00J9IZ+uPTqM1fp3DRgrFg5fNuH8KrUwJM/gYwx7WBr+
  52835. mbpCErGR9Hxo4sjoryzqyX6uuyo9DRXcNJW2GHSoag/HtPQTxORb7QrSpJdMKu0vbBKJPfEncKpq
  52836. A1Ihn0CoZ1Dy81of398j9tx4TuaYT1U6U+Pv8vSfx3zYWK8pIpe44L2RLrB27FcRz+8pRPPphXpg
  52837. Y+RdM4kX2TGq2tbzGDVyz4crL2MjhF2EjD9XoIj8mZEoJmmZ1I+XRL6O1UixpCgp8RW04eWe3fiP
  52838. pm8m1wk8OhwRDqZsN/etRIcsKMfYdIKz0G9KV7s1KSegi+ghp4dkNl3M2Basx7InQJJVOCiNUW7d
  52839. FGdTbHFcJoRNdVq2fmBWqU2t+5sel/MN2dKXVHfaPRK34B7vCAas+YWH6aLcr34YEoP9VhdBLtUp
  52840. gn2Z9DH2canPLAEnpQW5qrJITirvn5NSUZU8UnOOVkwXQMAJKOSLakhT2+zNVVXxxvjpoixMptEm
  52841. X36vWkzaH6byHCx+rgIW0lbQL1dTR+iS
  52842. -----END CERTIFICATE-----
  52843. Comodo AAA Services root
  52844. ========================
  52845. -----BEGIN CERTIFICATE-----
  52846. MIIEMjCCAxqgAwIBAgIBATANBgkqhkiG9w0BAQUFADB7MQswCQYDVQQGEwJHQjEbMBkGA1UECAwS
  52847. R3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHDAdTYWxmb3JkMRowGAYDVQQKDBFDb21vZG8gQ0Eg
  52848. TGltaXRlZDEhMB8GA1UEAwwYQUFBIENlcnRpZmljYXRlIFNlcnZpY2VzMB4XDTA0MDEwMTAwMDAw
  52849. MFoXDTI4MTIzMTIzNTk1OVowezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hl
  52850. c3RlcjEQMA4GA1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
  52851. BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  52852. ggEBAL5AnfRu4ep2hxxNRUSOvkbIgwadwSr+GB+O5AL686tdUIoWMQuaBtDFcCLNSS1UY8y2bmhG
  52853. C1Pqy0wkwLxyTurxFa70VJoSCsN6sjNg4tqJVfMiWPPe3M/vg4aijJRPn2jymJBGhCfHdr/jzDUs
  52854. i14HZGWCwEiwqJH5YZ92IFCokcdmtet4YgNW8IoaE+oxox6gmf049vYnMlhvB/VruPsUK6+3qszW
  52855. Y19zjNoFmag4qMsXeDZRrOme9Hg6jc8P2ULimAyrL58OAd7vn5lJ8S3frHRNG5i1R8XlKdH5kBjH
  52856. Ypy+g8cmez6KJcfA3Z3mNWgQIJ2P2N7Sw4ScDV7oL8kCAwEAAaOBwDCBvTAdBgNVHQ4EFgQUoBEK
  52857. Iz6W8Qfs4q8p74Klf9AwpLQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wewYDVR0f
  52858. BHQwcjA4oDagNIYyaHR0cDovL2NybC5jb21vZG9jYS5jb20vQUFBQ2VydGlmaWNhdGVTZXJ2aWNl
  52859. cy5jcmwwNqA0oDKGMGh0dHA6Ly9jcmwuY29tb2RvLm5ldC9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2Vz
  52860. LmNybDANBgkqhkiG9w0BAQUFAAOCAQEACFb8AvCb6P+k+tZ7xkSAzk/ExfYAWMymtrwUSWgEdujm
  52861. 7l3sAg9g1o1QGE8mTgHj5rCl7r+8dFRBv/38ErjHT1r0iWAFf2C3BUrz9vHCv8S5dIa2LX1rzNLz
  52862. Rt0vxuBqw8M0Ayx9lt1awg6nCpnBBYurDC/zXDrPbDdVCYfeU0BsWO/8tqtlbgT2G9w84FoVxp7Z
  52863. 8VlIMCFlA2zs6SFz7JsDoeA3raAVGI/6ugLOpyypEBMs1OUIJqsil2D4kF501KKaU73yqWjgom7C
  52864. 12yxow+ev+to51byrvLjKzg6CYG1a4XXvi3tPxq3smPi9WIsgtRqAEFQ8TmDn5XpNpaYbg==
  52865. -----END CERTIFICATE-----
  52866. QuoVadis Root CA
  52867. ================
  52868. -----BEGIN CERTIFICATE-----
  52869. MIIF0DCCBLigAwIBAgIEOrZQizANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJCTTEZMBcGA1UE
  52870. ChMQUXVvVmFkaXMgTGltaXRlZDElMCMGA1UECxMcUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0
  52871. eTEuMCwGA1UEAxMlUXVvVmFkaXMgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wMTAz
  52872. MTkxODMzMzNaFw0yMTAzMTcxODMzMzNaMH8xCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRp
  52873. cyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MS4wLAYDVQQD
  52874. EyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEF
  52875. AAOCAQ8AMIIBCgKCAQEAv2G1lVO6V/z68mcLOhrfEYBklbTRvM16z/Ypli4kVEAkOPcahdxYTMuk
  52876. J0KX0J+DisPkBgNbAKVRHnAEdOLB1Dqr1607BxgFjv2DrOpm2RgbaIr1VxqYuvXtdj182d6UajtL
  52877. F8HVj71lODqV0D1VNk7feVcxKh7YWWVJWCCYfqtffp/p1k3sg3Spx2zY7ilKhSoGFPlU5tPaZQeL
  52878. YzcS19Dsw3sgQUSj7cugF+FxZc4dZjH3dgEZyH0DWLaVSR2mEiboxgx24ONmy+pdpibu5cxfvWen
  52879. AScOospUxbF6lR1xHkopigPcakXBpBlebzbNw6Kwt/5cOOJSvPhEQ+aQuwIDAQABo4ICUjCCAk4w
  52880. PQYIKwYBBQUHAQEEMTAvMC0GCCsGAQUFBzABhiFodHRwczovL29jc3AucXVvdmFkaXNvZmZzaG9y
  52881. ZS5jb20wDwYDVR0TAQH/BAUwAwEB/zCCARoGA1UdIASCAREwggENMIIBCQYJKwYBBAG+WAABMIH7
  52882. MIHUBggrBgEFBQcCAjCBxxqBxFJlbGlhbmNlIG9uIHRoZSBRdW9WYWRpcyBSb290IENlcnRpZmlj
  52883. YXRlIGJ5IGFueSBwYXJ0eSBhc3N1bWVzIGFjY2VwdGFuY2Ugb2YgdGhlIHRoZW4gYXBwbGljYWJs
  52884. ZSBzdGFuZGFyZCB0ZXJtcyBhbmQgY29uZGl0aW9ucyBvZiB1c2UsIGNlcnRpZmljYXRpb24gcHJh
  52885. Y3RpY2VzLCBhbmQgdGhlIFF1b1ZhZGlzIENlcnRpZmljYXRlIFBvbGljeS4wIgYIKwYBBQUHAgEW
  52886. Fmh0dHA6Ly93d3cucXVvdmFkaXMuYm0wHQYDVR0OBBYEFItLbe3TKbkGGew5Oanwl4Rqy+/fMIGu
  52887. BgNVHSMEgaYwgaOAFItLbe3TKbkGGew5Oanwl4Rqy+/foYGEpIGBMH8xCzAJBgNVBAYTAkJNMRkw
  52888. FwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMSUwIwYDVQQLExxSb290IENlcnRpZmljYXRpb24gQXV0
  52889. aG9yaXR5MS4wLAYDVQQDEyVRdW9WYWRpcyBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggQ6
  52890. tlCLMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAitQUtf70mpKnGdSkfnIYj9lo
  52891. fFIk3WdvOXrEql494liwTXCYhGHoG+NpGA7O+0dQoE7/8CQfvbLO9Sf87C9TqnN7Az10buYWnuul
  52892. LsS/VidQK2K6vkscPFVcQR0kvoIgR13VRH56FmjffU1RcHhXHTMe/QKZnAzNCgVPx7uOpHX6Sm2x
  52893. gI4JVrmcGmD+XcHXetwReNDWXcG31a0ymQM6isxUJTkxgXsTIlG6Rmyhu576BGxJJnSP0nPrzDCi
  52894. 5upZIof4l/UO/erMkqQWxFIY6iHOsfHmhIHluqmGKPJDWl0Snawe2ajlCmqnf6CHKc/yiU3U7MXi
  52895. 5nrQNiOKSnQ2+Q==
  52896. -----END CERTIFICATE-----
  52897. QuoVadis Root CA 2
  52898. ==================
  52899. -----BEGIN CERTIFICATE-----
  52900. MIIFtzCCA5+gAwIBAgICBQkwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52901. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMjAeFw0wNjExMjQx
  52902. ODI3MDBaFw0zMTExMjQxODIzMzNaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52903. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDIwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52904. DwAwggIKAoICAQCaGMpLlA0ALa8DKYrwD4HIrkwZhR0In6spRIXzL4GtMh6QRr+jhiYaHv5+HBg6
  52905. XJxgFyo6dIMzMH1hVBHL7avg5tKifvVrbxi3Cgst/ek+7wrGsxDp3MJGF/hd/aTa/55JWpzmM+Yk
  52906. lvc/ulsrHHo1wtZn/qtmUIttKGAr79dgw8eTvI02kfN/+NsRE8Scd3bBrrcCaoF6qUWD4gXmuVbB
  52907. lDePSHFjIuwXZQeVikvfj8ZaCuWw419eaxGrDPmF60Tp+ARz8un+XJiM9XOva7R+zdRcAitMOeGy
  52908. lZUtQofX1bOQQ7dsE/He3fbE+Ik/0XX1ksOR1YqI0JDs3G3eicJlcZaLDQP9nL9bFqyS2+r+eXyt
  52909. 66/3FsvbzSUr5R/7mp/iUcw6UwxI5g69ybR2BlLmEROFcmMDBOAENisgGQLodKcftslWZvB1Jdxn
  52910. wQ5hYIizPtGo/KPaHbDRsSNU30R2be1B2MGyIrZTHN81Hdyhdyox5C315eXbyOD/5YDXC2Og/zOh
  52911. D7osFRXql7PSorW+8oyWHhqPHWykYTe5hnMz15eWniN9gqRMgeKh0bpnX5UHoycR7hYQe7xFSkyy
  52912. BNKr79X9DFHOUGoIMfmR2gyPZFwDwzqLID9ujWc9Otb+fVuIyV77zGHcizN300QyNQliBJIWENie
  52913. J0f7OyHj+OsdWwIDAQABo4GwMIGtMA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1Ud
  52914. DgQWBBQahGK8SEwzJQTU7tD2A8QZRtGUazBuBgNVHSMEZzBlgBQahGK8SEwzJQTU7tD2A8QZRtGU
  52915. a6FJpEcwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMT
  52916. ElF1b1ZhZGlzIFJvb3QgQ0EgMoICBQkwDQYJKoZIhvcNAQEFBQADggIBAD4KFk2fBluornFdLwUv
  52917. Z+YTRYPENvbzwCYMDbVHZF34tHLJRqUDGCdViXh9duqWNIAXINzng/iN/Ae42l9NLmeyhP3ZRPx3
  52918. UIHmfLTJDQtyU/h2BwdBR5YM++CCJpNVjP4iH2BlfF/nJrP3MpCYUNQ3cVX2kiF495V5+vgtJodm
  52919. VjB3pjd4M1IQWK4/YY7yarHvGH5KWWPKjaJW1acvvFYfzznB4vsKqBUsfU16Y8Zsl0Q80m/DShcK
  52920. +JDSV6IZUaUtl0HaB0+pUNqQjZRG4T7wlP0QADj1O+hA4bRuVhogzG9Yje0uRY/W6ZM/57Es3zrW
  52921. IozchLsib9D45MY56QSIPMO661V6bYCZJPVsAfv4l7CUW+v90m/xd2gNNWQjrLhVoQPRTUIZ3Ph1
  52922. WVaj+ahJefivDrkRoHy3au000LYmYjgahwz46P0u05B/B5EqHdZ+XIWDmbA4CD/pXvk1B+TJYm5X
  52923. f6dQlfe6yJvmjqIBxdZmv3lh8zwc4bmCXF2gw+nYSL0ZohEUGW6yhhtoPkg3Goi3XZZenMfvJ2II
  52924. 4pEZXNLxId26F0KCl3GBUzGpn/Z9Yr9y4aOTHcyKJloJONDO1w2AFrR4pTqHTI2KpdVGl/IsELm8
  52925. VCLAAVBpQ570su9t+Oza8eOx79+Rj1QqCyXBJhnEUhAFZdWCEOrCMc0u
  52926. -----END CERTIFICATE-----
  52927. QuoVadis Root CA 3
  52928. ==================
  52929. -----BEGIN CERTIFICATE-----
  52930. MIIGnTCCBIWgAwIBAgICBcYwDQYJKoZIhvcNAQEFBQAwRTELMAkGA1UEBhMCQk0xGTAXBgNVBAoT
  52931. EFF1b1ZhZGlzIExpbWl0ZWQxGzAZBgNVBAMTElF1b1ZhZGlzIFJvb3QgQ0EgMzAeFw0wNjExMjQx
  52932. OTExMjNaFw0zMTExMjQxOTA2NDRaMEUxCzAJBgNVBAYTAkJNMRkwFwYDVQQKExBRdW9WYWRpcyBM
  52933. aW1pdGVkMRswGQYDVQQDExJRdW9WYWRpcyBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  52934. DwAwggIKAoICAQDMV0IWVJzmmNPTTe7+7cefQzlKZbPoFog02w1ZkXTPkrgEQK0CSzGrvI2RaNgg
  52935. DhoB4hp7Thdd4oq3P5kazethq8Jlph+3t723j/z9cI8LoGe+AaJZz3HmDyl2/7FWeUUrH556VOij
  52936. KTVopAFPD6QuN+8bv+OPEKhyq1hX51SGyMnzW9os2l2ObjyjPtr7guXd8lyyBTNvijbO0BNO/79K
  52937. DDRMpsMhvVAEVeuxu537RR5kFd5VAYwCdrXLoT9CabwvvWhDFlaJKjdhkf2mrk7AyxRllDdLkgbv
  52938. BNDInIjbC3uBr7E9KsRlOni27tyAsdLTmZw67mtaa7ONt9XOnMK+pUsvFrGeaDsGb659n/je7Mwp
  52939. p5ijJUMv7/FfJuGITfhebtfZFG4ZM2mnO4SJk8RTVROhUXhA+LjJou57ulJCg54U7QVSWllWp5f8
  52940. nT8KKdjcT5EOE7zelaTfi5m+rJsziO+1ga8bxiJTyPbH7pcUsMV8eFLI8M5ud2CEpukqdiDtWAEX
  52941. MJPpGovgc2PZapKUSU60rUqFxKMiMPwJ7Wgic6aIDFUhWMXhOp8q3crhkODZc6tsgLjoC2SToJyM
  52942. Gf+z0gzskSaHirOi4XCPLArlzW1oUevaPwV/izLmE1xr/l9A4iLItLRkT9a6fUg+qGkM17uGcclz
  52943. uD87nSVL2v9A6wIDAQABo4IBlTCCAZEwDwYDVR0TAQH/BAUwAwEB/zCB4QYDVR0gBIHZMIHWMIHT
  52944. BgkrBgEEAb5YAAMwgcUwgZMGCCsGAQUFBwICMIGGGoGDQW55IHVzZSBvZiB0aGlzIENlcnRpZmlj
  52945. YXRlIGNvbnN0aXR1dGVzIGFjY2VwdGFuY2Ugb2YgdGhlIFF1b1ZhZGlzIFJvb3QgQ0EgMyBDZXJ0
  52946. aWZpY2F0ZSBQb2xpY3kgLyBDZXJ0aWZpY2F0aW9uIFByYWN0aWNlIFN0YXRlbWVudC4wLQYIKwYB
  52947. BQUHAgEWIWh0dHA6Ly93d3cucXVvdmFkaXNnbG9iYWwuY29tL2NwczALBgNVHQ8EBAMCAQYwHQYD
  52948. VR0OBBYEFPLAE+CCQz777i9nMpY1XNu4ywLQMG4GA1UdIwRnMGWAFPLAE+CCQz777i9nMpY1XNu4
  52949. ywLQoUmkRzBFMQswCQYDVQQGEwJCTTEZMBcGA1UEChMQUXVvVmFkaXMgTGltaXRlZDEbMBkGA1UE
  52950. AxMSUXVvVmFkaXMgUm9vdCBDQSAzggIFxjANBgkqhkiG9w0BAQUFAAOCAgEAT62gLEz6wPJv92ZV
  52951. qyM07ucp2sNbtrCD2dDQ4iH782CnO11gUyeim/YIIirnv6By5ZwkajGxkHon24QRiSemd1o417+s
  52952. hvzuXYO8BsbRd2sPbSQvS3pspweWyuOEn62Iix2rFo1bZhfZFvSLgNLd+LJ2w/w4E6oM3kJpK27z
  52953. POuAJ9v1pkQNn1pVWQvVDVJIxa6f8i+AxeoyUDUSly7B4f/xI4hROJ/yZlZ25w9Rl6VSDE1JUZU2
  52954. Pb+iSwwQHYaZTKrzchGT5Or2m9qoXadNt54CrnMAyNojA+j56hl0YgCUyyIgvpSnWbWCar6ZeXqp
  52955. 8kokUvd0/bpO5qgdAm6xDYBEwa7TIzdfu4V8K5Iu6H6li92Z4b8nby1dqnuH/grdS/yO9SbkbnBC
  52956. bjPsMZ57k8HkyWkaPcBrTiJt7qtYTcbQQcEr6k8Sh17rRdhs9ZgC06DYVYoGmRmioHfRMJ6szHXu
  52957. g/WwYjnPbFfiTNKRCw51KBuav/0aQ/HKd/s7j2G4aSgWQgRecCocIdiP4b0jWy10QJLZYxkNc91p
  52958. vGJHvOB0K7Lrfb5BG7XARsWhIstfTsEokt4YutUqKLsRixeTmJlglFwjz1onl14LBQaTNx47aTbr
  52959. qZ5hHY8y2o4M1nQ+ewkk2gF3R8Q7zTSMmfXK4SVhM7JZG+Ju1zdXtg2pEto=
  52960. -----END CERTIFICATE-----
  52961. Security Communication Root CA
  52962. ==============================
  52963. -----BEGIN CERTIFICATE-----
  52964. MIIDWjCCAkKgAwIBAgIBADANBgkqhkiG9w0BAQUFADBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52965. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52966. HhcNMDMwOTMwMDQyMDQ5WhcNMjMwOTMwMDQyMDQ5WjBQMQswCQYDVQQGEwJKUDEYMBYGA1UEChMP
  52967. U0VDT00gVHJ1c3QubmV0MScwJQYDVQQLEx5TZWN1cml0eSBDb21tdW5pY2F0aW9uIFJvb3RDQTEw
  52968. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCzs/5/022x7xZ8V6UMbXaKL0u/ZPtM7orw
  52969. 8yl89f/uKuDp6bpbZCKamm8sOiZpUQWZJtzVHGpxxpp9Hp3dfGzGjGdnSj74cbAZJ6kJDKaVv0uM
  52970. DPpVmDvY6CKhS3E4eayXkmmziX7qIWgGmBSWh9JhNrxtJ1aeV+7AwFb9Ms+k2Y7CI9eNqPPYJayX
  52971. 5HA49LY6tJ07lyZDo6G8SVlyTCMwhwFY9k6+HGhWZq/NQV3Is00qVUarH9oe4kA92819uZKAnDfd
  52972. DJZkndwi92SL32HeFZRSFaB9UslLqCHJxrHty8OVYNEP8Ktw+N/LTX7s1vqr2b1/VPKl6Xn62dZ2
  52973. JChzAgMBAAGjPzA9MB0GA1UdDgQWBBSgc0mZaNyFW2XjmygvV5+9M7wHSDALBgNVHQ8EBAMCAQYw
  52974. DwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAaECpqLvkT115swW1F7NgE+vGkl3g
  52975. 0dNq/vu+m22/xwVtWSDEHPC32oRYAmP6SBbvT6UL90qY8j+eG61Ha2POCEfrUj94nK9NrvjVT8+a
  52976. mCoQQTlSxN3Zmw7vkwGusi7KaEIkQmywszo+zenaSMQVy+n5Bw+SUEmK3TGXX8npN6o7WWWXlDLJ
  52977. s58+OmJYxUmtYg5xpTKqL8aJdkNAExNnPaJUJRDL8Try2frbSVa7pv6nQTXD4IhhyYjH3zYQIphZ
  52978. 6rBK+1YWc26sTfcioU+tHXotRSflMMFe8toTyyVCUZVHA4xsIcx0Qu1T/zOLjw9XARYvz6buyXAi
  52979. FL39vmwLAw==
  52980. -----END CERTIFICATE-----
  52981. Sonera Class 2 Root CA
  52982. ======================
  52983. -----BEGIN CERTIFICATE-----
  52984. MIIDIDCCAgigAwIBAgIBHTANBgkqhkiG9w0BAQUFADA5MQswCQYDVQQGEwJGSTEPMA0GA1UEChMG
  52985. U29uZXJhMRkwFwYDVQQDExBTb25lcmEgQ2xhc3MyIENBMB4XDTAxMDQwNjA3Mjk0MFoXDTIxMDQw
  52986. NjA3Mjk0MFowOTELMAkGA1UEBhMCRkkxDzANBgNVBAoTBlNvbmVyYTEZMBcGA1UEAxMQU29uZXJh
  52987. IENsYXNzMiBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJAXSjWdyvANlsdE+hY3
  52988. /Ei9vX+ALTU74W+oZ6m/AxxNjG8yR9VBaKQTBME1DJqEQ/xcHf+Js+gXGM2RX/uJ4+q/Tl18GybT
  52989. dXnt5oTjV+WtKcT0OijnpXuENmmz/V52vaMtmdOQTiMofRhj8VQ7Jp12W5dCsv+u8E7s3TmVToMG
  52990. f+dJQMjFAbJUWmYdPfz56TwKnoG4cPABi+QjVHzIrviQHgCWctRUz2EjvOr7nQKV0ba5cTppCD8P
  52991. tOFCx4j1P5iop7oc4HFx71hXgVB6XGt0Rg6DA5jDjqhu8nYybieDwnPz3BjotJPqdURrBGAgcVeH
  52992. nfO+oJAjPYok4doh28MCAwEAAaMzMDEwDwYDVR0TAQH/BAUwAwEB/zARBgNVHQ4ECgQISqCqWITT
  52993. XjwwCwYDVR0PBAQDAgEGMA0GCSqGSIb3DQEBBQUAA4IBAQBazof5FnIVV0sd2ZvnoiYw7JNn39Yt
  52994. 0jSv9zilzqsWuasvfDXLrNAPtEwr/IDva4yRXzZ299uzGxnq9LIR/WFxRL8oszodv7ND6J+/3DEI
  52995. cbCdjdY0RzKQxmUk96BKfARzjzlvF4xytb1LyHr4e4PDKE6cCepnP7JnBBvDFNr450kkkdAdavph
  52996. Oe9r5yF1BgfYErQhIHBCcYHaPJo2vqZbDWpsmh+Re/n570K6Tk6ezAyNlNzZRZxe7EJQY670XcSx
  52997. EtzKO6gunRRaBXW37Ndj4ro1tgQIkejanZz2ZrUYrAqmVCY0M9IbwdR/GjqOC6oybtv8TyWf2TLH
  52998. llpwrN9M
  52999. -----END CERTIFICATE-----
  53000. XRamp Global CA Root
  53001. ====================
  53002. -----BEGIN CERTIFICATE-----
  53003. MIIEMDCCAxigAwIBAgIQUJRs7Bjq1ZxN1ZfvdY+grTANBgkqhkiG9w0BAQUFADCBgjELMAkGA1UE
  53004. BhMCVVMxHjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2Vj
  53005. dXJpdHkgU2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBB
  53006. dXRob3JpdHkwHhcNMDQxMTAxMTcxNDA0WhcNMzUwMTAxMDUzNzE5WjCBgjELMAkGA1UEBhMCVVMx
  53007. HjAcBgNVBAsTFXd3dy54cmFtcHNlY3VyaXR5LmNvbTEkMCIGA1UEChMbWFJhbXAgU2VjdXJpdHkg
  53008. U2VydmljZXMgSW5jMS0wKwYDVQQDEyRYUmFtcCBHbG9iYWwgQ2VydGlmaWNhdGlvbiBBdXRob3Jp
  53009. dHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCYJB69FbS638eMpSe2OAtp87ZOqCwu
  53010. IR1cRN8hXX4jdP5efrRKt6atH67gBhbim1vZZ3RrXYCPKZ2GG9mcDZhtdhAoWORlsH9KmHmf4MMx
  53011. foArtYzAQDsRhtDLooY2YKTVMIJt2W7QDxIEM5dfT2Fa8OT5kavnHTu86M/0ay00fOJIYRyO82FE
  53012. zG+gSqmUsE3a56k0enI4qEHMPJQRfevIpoy3hsvKMzvZPTeL+3o+hiznc9cKV6xkmxnr9A8ECIqs
  53013. AxcZZPRaJSKNNCyy9mgdEm3Tih4U2sSPpuIjhdV6Db1q4Ons7Be7QhtnqiXtRYMh/MHJfNViPvry
  53014. xS3T/dRlAgMBAAGjgZ8wgZwwEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  53015. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFMZPoj0GY4QJnM5i5ASsjVy16bYbMDYGA1UdHwQvMC0wK6Ap
  53016. oCeGJWh0dHA6Ly9jcmwueHJhbXBzZWN1cml0eS5jb20vWEdDQS5jcmwwEAYJKwYBBAGCNxUBBAMC
  53017. AQEwDQYJKoZIhvcNAQEFBQADggEBAJEVOQMBG2f7Shz5CmBbodpNl2L5JFMn14JkTpAuw0kbK5rc
  53018. /Kh4ZzXxHfARvbdI4xD2Dd8/0sm2qlWkSLoC295ZLhVbO50WfUfXN+pfTXYSNrsf16GBBEYgoyxt
  53019. qZ4Bfj8pzgCT3/3JknOJiWSe5yvkHJEs0rnOfc5vMZnT5r7SHpDwCRR5XCOrTdLaIR9NmXmd4c8n
  53020. nxCbHIgNsIpkQTG4DmyQJKSbXHGPurt+HBvbaoAPIbzp26a3QPSyi6mx5O+aGtA9aZnuqCij4Tyz
  53021. 8LIRnM98QObd50N9otg6tamN8jSZxNQQ4Qb9CYQQO+7ETPTsJ3xCwnR8gooJybQDJbw=
  53022. -----END CERTIFICATE-----
  53023. Go Daddy Class 2 CA
  53024. ===================
  53025. -----BEGIN CERTIFICATE-----
  53026. MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMY
  53027. VGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRp
  53028. ZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkG
  53029. A1UEBhMCVVMxITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g
  53030. RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQAD
  53031. ggENADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCAPVYYYwhv
  53032. 2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6wwdhFJ2+qN1j3hybX2C32
  53033. qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXiEqITLdiOr18SPaAIBQi2XKVlOARFmR6j
  53034. YGB0xUGlcmIbYsUfb18aQr4CUWWoriMYavx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmY
  53035. vLEHZ6IVDd2gWMZEewo+YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0O
  53036. BBYEFNLEsNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h/t2o
  53037. atTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMu
  53038. MTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5ggEAMAwG
  53039. A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wim
  53040. PQoZ+YeAEW5p5JYXMP80kWNyOO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKt
  53041. I3lpjbi2Tc7PTMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ
  53042. HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mERdEr/VxqHD3VI
  53043. Ls9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5CufReYNnyicsbkqWletNw+vHX/b
  53044. vZ8=
  53045. -----END CERTIFICATE-----
  53046. Starfield Class 2 CA
  53047. ====================
  53048. -----BEGIN CERTIFICATE-----
  53049. MIIEDzCCAvegAwIBAgIBADANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJVUzElMCMGA1UEChMc
  53050. U3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAGA1UECxMpU3RhcmZpZWxkIENsYXNzIDIg
  53051. Q2VydGlmaWNhdGlvbiBBdXRob3JpdHkwHhcNMDQwNjI5MTczOTE2WhcNMzQwNjI5MTczOTE2WjBo
  53052. MQswCQYDVQQGEwJVUzElMCMGA1UEChMcU3RhcmZpZWxkIFRlY2hub2xvZ2llcywgSW5jLjEyMDAG
  53053. A1UECxMpU3RhcmZpZWxkIENsYXNzIDIgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEgMA0GCSqG
  53054. SIb3DQEBAQUAA4IBDQAwggEIAoIBAQC3Msj+6XGmBIWtDBFk385N78gDGIc/oav7PKaf8MOh2tTY
  53055. bitTkPskpD6E8J7oX+zlJ0T1KKY/e97gKvDIr1MvnsoFAZMej2YcOadN+lq2cwQlZut3f+dZxkqZ
  53056. JRRU6ybH838Z1TBwj6+wRir/resp7defqgSHo9T5iaU0X9tDkYI22WY8sbi5gv2cOj4QyDvvBmVm
  53057. epsZGD3/cVE8MC5fvj13c7JdBmzDI1aaK4UmkhynArPkPw2vCHmCuDY96pzTNbO8acr1zJ3o/WSN
  53058. F4Azbl5KXZnJHoe0nRrA1W4TNSNe35tfPe/W93bC6j67eA0cQmdrBNj41tpvi/JEoAGrAgEDo4HF
  53059. MIHCMB0GA1UdDgQWBBS/X7fRzt0fhvRbVazc1xDCDqmI5zCBkgYDVR0jBIGKMIGHgBS/X7fRzt0f
  53060. hvRbVazc1xDCDqmI56FspGowaDELMAkGA1UEBhMCVVMxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNo
  53061. bm9sb2dpZXMsIEluYy4xMjAwBgNVBAsTKVN0YXJmaWVsZCBDbGFzcyAyIENlcnRpZmljYXRpb24g
  53062. QXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAAWdP4id0ckaVaGs
  53063. afPzWdqbAYcaT1epoXkJKtv3L7IezMdeatiDh6GX70k1PncGQVhiv45YuApnP+yz3SFmH8lU+nLM
  53064. PUxA2IGvd56Deruix/U0F47ZEUD0/CwqTRV/p2JdLiXTAAsgGh1o+Re49L2L7ShZ3U0WixeDyLJl
  53065. xy16paq8U4Zt3VekyvggQQto8PT7dL5WXXp59fkdheMtlb71cZBDzI0fmgAKhynpVSJYACPq4xJD
  53066. KVtHCN2MQWplBqjlIapBtJUhlbl90TSrE9atvNziPTnNvT51cKEYWQPJIrSPnNVeKtelttQKbfi3
  53067. QBFGmh95DmK/D5fs4C8fF5Q=
  53068. -----END CERTIFICATE-----
  53069. Taiwan GRCA
  53070. ===========
  53071. -----BEGIN CERTIFICATE-----
  53072. MIIFcjCCA1qgAwIBAgIQH51ZWtcvwgZEpYAIaeNe9jANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQG
  53073. EwJUVzEwMC4GA1UECgwnR292ZXJubWVudCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4X
  53074. DTAyMTIwNTEzMjMzM1oXDTMyMTIwNTEzMjMzM1owPzELMAkGA1UEBhMCVFcxMDAuBgNVBAoMJ0dv
  53075. dmVybm1lbnQgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQAD
  53076. ggIPADCCAgoCggIBAJoluOzMonWoe/fOW1mKydGGEghU7Jzy50b2iPN86aXfTEc2pBsBHH8eV4qN
  53077. w8XRIePaJD9IK/ufLqGU5ywck9G/GwGHU5nOp/UKIXZ3/6m3xnOUT0b3EEk3+qhZSV1qgQdW8or5
  53078. BtD3cCJNtLdBuTK4sfCxw5w/cP1T3YGq2GN49thTbqGsaoQkclSGxtKyyhwOeYHWtXBiCAEuTk8O
  53079. 1RGvqa/lmr/czIdtJuTJV6L7lvnM4T9TjGxMfptTCAtsF/tnyMKtsc2AtJfcdgEWFelq16TheEfO
  53080. htX7MfP6Mb40qij7cEwdScevLJ1tZqa2jWR+tSBqnTuBto9AAGdLiYa4zGX+FVPpBMHWXx1E1wov
  53081. J5pGfaENda1UhhXcSTvxls4Pm6Dso3pdvtUqdULle96ltqqvKKyskKw4t9VoNSZ63Pc78/1Fm9G7
  53082. Q3hub/FCVGqY8A2tl+lSXunVanLeavcbYBT0peS2cWeqH+riTcFCQP5nRhc4L0c/cZyu5SHKYS1t
  53083. B6iEfC3uUSXxY5Ce/eFXiGvviiNtsea9P63RPZYLhY3Naye7twWb7LuRqQoHEgKXTiCQ8P8NHuJB
  53084. O9NAOueNXdpm5AKwB1KYXA6OM5zCppX7VRluTI6uSw+9wThNXo+EHWbNxWCWtFJaBYmOlXqYwZE8
  53085. lSOyDvR5tMl8wUohAgMBAAGjajBoMB0GA1UdDgQWBBTMzO/MKWCkO7GStjz6MmKPrCUVOzAMBgNV
  53086. HRMEBTADAQH/MDkGBGcqBwAEMTAvMC0CAQAwCQYFKw4DAhoFADAHBgVnKgMAAAQUA5vwIhP/lSg2
  53087. 09yewDL7MTqKUWUwDQYJKoZIhvcNAQEFBQADggIBAECASvomyc5eMN1PhnR2WPWus4MzeKR6dBcZ
  53088. TulStbngCnRiqmjKeKBMmo4sIy7VahIkv9Ro04rQ2JyftB8M3jh+Vzj8jeJPXgyfqzvS/3WXy6Tj
  53089. Zwj/5cAWtUgBfen5Cv8b5Wppv3ghqMKnI6mGq3ZW6A4M9hPdKmaKZEk9GhiHkASfQlK3T8v+R0F2
  53090. Ne//AHY2RTKbxkaFXeIksB7jSJaYV0eUVXoPQbFEJPPB/hprv4j9wabak2BegUqZIJxIZhm1AHlU
  53091. D7gsL0u8qV1bYH+Mh6XgUmMqvtg7hUAV/h62ZT/FS9p+tXo1KaMuephgIqP0fSdOLeq0dDzpD6Qz
  53092. DxARvBMB1uUO07+1EqLhRSPAzAhuYbeJq4PjJB7mXQfnHyA+z2fI56wwbSdLaG5LKlwCCDTb+Hbk
  53093. Z6MmnD+iMsJKxYEYMRBWqoTvLQr/uB930r+lWKBi5NdLkXWNiYCYfm3LU05er/ayl4WXudpVBrkk
  53094. 7tfGOB5jGxI7leFYrPLfhNVfmS8NVVvmONsuP3LpSIXLuykTjx44VbnzssQwmSNOXfJIoRIM3BKQ
  53095. CZBUkQM8R+XVyWXgt0t97EfTsws+rZ7QdAAO671RrcDeLMDDav7v3Aun+kbfYNucpllQdSNpc5Oy
  53096. +fwC00fmcc4QAu4njIT/rEUNE1yDMuAlpYYsfPQS
  53097. -----END CERTIFICATE-----
  53098. DigiCert Assured ID Root CA
  53099. ===========================
  53100. -----BEGIN CERTIFICATE-----
  53101. MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBlMQswCQYDVQQG
  53102. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  53103. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzEx
  53104. MTEwMDAwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  53105. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0Ew
  53106. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7cJpSIqvTO
  53107. 9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYPmDI2dsze3Tyoou9q+yHy
  53108. UmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW
  53109. /lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpy
  53110. oeb6pNnVFzF1roV9Iq4/AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whf
  53111. GHdPAgMBAAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRF
  53112. 66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYunpyGd823IDzANBgkq
  53113. hkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRCdWKuh+vy1dneVrOfzM4UKLkNl2Bc
  53114. EkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTffwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38Fn
  53115. SbNd67IJKusm7Xi+fT8r87cmNW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i
  53116. 8b5QZ7dsvfPxH2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe
  53117. +o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g==
  53118. -----END CERTIFICATE-----
  53119. DigiCert Global Root CA
  53120. =======================
  53121. -----BEGIN CERTIFICATE-----
  53122. MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBhMQswCQYDVQQG
  53123. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  53124. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBDQTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAw
  53125. MDAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  53126. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkq
  53127. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsBCSDMAZOn
  53128. TjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97nh6Vfe63SKMI2tavegw5
  53129. BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt43C/dxC//AH2hdmoRBBYMql1GNXRor5H
  53130. 4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7PT19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y
  53131. 7vrTC0LUq7dBMtoM1O/4gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQAB
  53132. o2MwYTAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbRTLtm
  53133. 8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUwDQYJKoZIhvcNAQEF
  53134. BQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/EsrhMAtudXH/vTBH1jLuG2cenTnmCmr
  53135. EbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIt
  53136. tep3Sp+dWOIrWcBAI+0tKIJFPnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886
  53137. UAb3LujEV0lsYSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk
  53138. CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4=
  53139. -----END CERTIFICATE-----
  53140. DigiCert High Assurance EV Root CA
  53141. ==================================
  53142. -----BEGIN CERTIFICATE-----
  53143. MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBsMQswCQYDVQQG
  53144. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSsw
  53145. KQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5jZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAw
  53146. MFoXDTMxMTExMDAwMDAwMFowbDELMAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZ
  53147. MBcGA1UECxMQd3d3LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFu
  53148. Y2UgRVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm+9S75S0t
  53149. Mqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTWPNt0OKRKzE0lgvdKpVMS
  53150. OO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEMxChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3
  53151. MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFBIk5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQ
  53152. NAQTXKFx01p8VdteZOE3hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUe
  53153. h10aUAsgEsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMB
  53154. Af8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaAFLE+w2kD+L9HAdSY
  53155. JhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3NecnzyIZgYIVyHbIUf4KmeqvxgydkAQ
  53156. V8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6zeM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFp
  53157. myPInngiK3BD41VHMWEZ71jFhS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkK
  53158. mNEVX58Svnw2Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe
  53159. vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep+OkuE6N36B9K
  53160. -----END CERTIFICATE-----
  53161. Certplus Class 2 Primary CA
  53162. ===========================
  53163. -----BEGIN CERTIFICATE-----
  53164. MIIDkjCCAnqgAwIBAgIRAIW9S/PY2uNp9pTXX8OlRCMwDQYJKoZIhvcNAQEFBQAwPTELMAkGA1UE
  53165. BhMCRlIxETAPBgNVBAoTCENlcnRwbHVzMRswGQYDVQQDExJDbGFzcyAyIFByaW1hcnkgQ0EwHhcN
  53166. OTkwNzA3MTcwNTAwWhcNMTkwNzA2MjM1OTU5WjA9MQswCQYDVQQGEwJGUjERMA8GA1UEChMIQ2Vy
  53167. dHBsdXMxGzAZBgNVBAMTEkNsYXNzIDIgUHJpbWFyeSBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEP
  53168. ADCCAQoCggEBANxQltAS+DXSCHh6tlJw/W/uz7kRy1134ezpfgSN1sxvc0NXYKwzCkTsA18cgCSR
  53169. 5aiRVhKC9+Ar9NuuYS6JEI1rbLqzAr3VNsVINyPi8Fo3UjMXEuLRYE2+L0ER4/YXJQyLkcAbmXuZ
  53170. Vg2v7tK8R1fjeUl7NIknJITesezpWE7+Tt9avkGtrAjFGA7v0lPubNCdEgETjdyAYveVqUSISnFO
  53171. YFWe2yMZeVYHDD9jC1yw4r5+FfyUM1hBOHTE4Y+L3yasH7WLO7dDWWuwJKZtkIvEcupdM5i3y95e
  53172. e++U8Rs+yskhwcWYAqqi9lt3m/V+llU0HGdpwPFC40es/CgcZlUCAwEAAaOBjDCBiTAPBgNVHRME
  53173. CDAGAQH/AgEKMAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQU43Mt38sOKAze3bOkynm4jrvoMIkwEQYJ
  53174. YIZIAYb4QgEBBAQDAgEGMDcGA1UdHwQwMC4wLKAqoCiGJmh0dHA6Ly93d3cuY2VydHBsdXMuY29t
  53175. L0NSTC9jbGFzczIuY3JsMA0GCSqGSIb3DQEBBQUAA4IBAQCnVM+IRBnL39R/AN9WM2K191EBkOvD
  53176. P9GIROkkXe/nFL0gt5o8AP5tn9uQ3Nf0YtaLcF3n5QRIqWh8yfFC82x/xXp8HVGIutIKPidd3i1R
  53177. TtMTZGnkLuPT55sJmabglZvOGtd/vjzOUrMRFcEPF80Du5wlFbqidon8BvEY0JNLDnyCt6X09l/+
  53178. 7UCmnYR0ObncHoUW2ikbhiMAybuJfm6AiB4vFLQDJKgybwOaRywwvlbGp0ICcBvqQNi6BQNwB6SW
  53179. //1IMwrh3KWBkJtN3X3n57LNXMhqlfil9o3EXXgIvnsG1knPGTZQIy4I5p4FTUcY1Rbpsda2ENW7
  53180. l7+ijrRU
  53181. -----END CERTIFICATE-----
  53182. DST Root CA X3
  53183. ==============
  53184. -----BEGIN CERTIFICATE-----
  53185. MIIDSjCCAjKgAwIBAgIQRK+wgNajJ7qJMDmGLvhAazANBgkqhkiG9w0BAQUFADA/MSQwIgYDVQQK
  53186. ExtEaWdpdGFsIFNpZ25hdHVyZSBUcnVzdCBDby4xFzAVBgNVBAMTDkRTVCBSb290IENBIFgzMB4X
  53187. DTAwMDkzMDIxMTIxOVoXDTIxMDkzMDE0MDExNVowPzEkMCIGA1UEChMbRGlnaXRhbCBTaWduYXR1
  53188. cmUgVHJ1c3QgQ28uMRcwFQYDVQQDEw5EU1QgUm9vdCBDQSBYMzCCASIwDQYJKoZIhvcNAQEBBQAD
  53189. ggEPADCCAQoCggEBAN+v6ZdQCINXtMxiZfaQguzH0yxrMMpb7NnDfcdAwRgUi+DoM3ZJKuM/IUmT
  53190. rE4Orz5Iy2Xu/NMhD2XSKtkyj4zl93ewEnu1lcCJo6m67XMuegwGMoOifooUMM0RoOEqOLl5CjH9
  53191. UL2AZd+3UWODyOKIYepLYYHsUmu5ouJLGiifSKOeDNoJjj4XLh7dIN9bxiqKqy69cK3FCxolkHRy
  53192. xXtqqzTWMIn/5WgTe1QLyNau7Fqckh49ZLOMxt+/yUFw7BZy1SbsOFU5Q9D8/RhcQPGX69Wam40d
  53193. utolucbY38EVAjqr2m7xPi71XAicPNaDaeQQmxkqtilX4+U9m5/wAl0CAwEAAaNCMEAwDwYDVR0T
  53194. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMSnsaR7LHH62+FLkHX/xBVghYkQ
  53195. MA0GCSqGSIb3DQEBBQUAA4IBAQCjGiybFwBcqR7uKGY3Or+Dxz9LwwmglSBd49lZRNI+DT69ikug
  53196. dB/OEIKcdBodfpga3csTS7MgROSR6cz8faXbauX+5v3gTt23ADq1cEmv8uXrAvHRAosZy5Q6XkjE
  53197. GB5YGV8eAlrwDPGxrancWYaLbumR9YbK+rlmM6pZW87ipxZzR8srzJmwN0jP41ZL9c8PDHIyh8bw
  53198. RLtTcm1D9SZImlJnt1ir/md2cXjbDaJWFBM5JDGFoqgCWjBH4d1QB7wCCZAA62RjYJsWvIjJEubS
  53199. fZGL+T0yjWW06XyxV3bqxbYoOb8VZRzI9neWagqNdwvYkQsEjgfbKbYK7p2CNTUQ
  53200. -----END CERTIFICATE-----
  53201. SwissSign Gold CA - G2
  53202. ======================
  53203. -----BEGIN CERTIFICATE-----
  53204. MIIFujCCA6KgAwIBAgIJALtAHEP1Xk+wMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNVBAYTAkNIMRUw
  53205. EwYDVQQKEwxTd2lzc1NpZ24gQUcxHzAdBgNVBAMTFlN3aXNzU2lnbiBHb2xkIENBIC0gRzIwHhcN
  53206. MDYxMDI1MDgzMDM1WhcNMzYxMDI1MDgzMDM1WjBFMQswCQYDVQQGEwJDSDEVMBMGA1UEChMMU3dp
  53207. c3NTaWduIEFHMR8wHQYDVQQDExZTd2lzc1NpZ24gR29sZCBDQSAtIEcyMIICIjANBgkqhkiG9w0B
  53208. AQEFAAOCAg8AMIICCgKCAgEAr+TufoskDhJuqVAtFkQ7kpJcyrhdhJJCEyq8ZVeCQD5XJM1QiyUq
  53209. t2/876LQwB8CJEoTlo8jE+YoWACjR8cGp4QjK7u9lit/VcyLwVcfDmJlD909Vopz2q5+bbqBHH5C
  53210. jCA12UNNhPqE21Is8w4ndwtrvxEvcnifLtg+5hg3Wipy+dpikJKVyh+c6bM8K8vzARO/Ws/BtQpg
  53211. vd21mWRTuKCWs2/iJneRjOBiEAKfNA+k1ZIzUd6+jbqEemA8atufK+ze3gE/bk3lUIbLtK/tREDF
  53212. ylqM2tIrfKjuvqblCqoOpd8FUrdVxyJdMmqXl2MT28nbeTZ7hTpKxVKJ+STnnXepgv9VHKVxaSvR
  53213. AiTysybUa9oEVeXBCsdtMDeQKuSeFDNeFhdVxVu1yzSJkvGdJo+hB9TGsnhQ2wwMC3wLjEHXuend
  53214. jIj3o02yMszYF9rNt85mndT9Xv+9lz4pded+p2JYryU0pUHHPbwNUMoDAw8IWh+Vc3hiv69yFGkO
  53215. peUDDniOJihC8AcLYiAQZzlG+qkDzAQ4embvIIO1jEpWjpEA/I5cgt6IoMPiaG59je883WX0XaxR
  53216. 7ySArqpWl2/5rX3aYT+YdzylkbYcjCbaZaIJbcHiVOO5ykxMgI93e2CaHt+28kgeDrpOVG2Y4OGi
  53217. GqJ3UM/EY5LsRxmd6+ZrzsECAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUw
  53218. AwEB/zAdBgNVHQ4EFgQUWyV7lqRlUX64OfPAeGZe6Drn8O4wHwYDVR0jBBgwFoAUWyV7lqRlUX64
  53219. OfPAeGZe6Drn8O4wRgYDVR0gBD8wPTA7BglghXQBWQECAQEwLjAsBggrBgEFBQcCARYgaHR0cDov
  53220. L3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBACe645R88a7A3hfm
  53221. 5djV9VSwg/S7zV4Fe0+fdWavPOhWfvxyeDgD2StiGwC5+OlgzczOUYrHUDFu4Up+GC9pWbY9ZIEr
  53222. 44OE5iKHjn3g7gKZYbge9LgriBIWhMIxkziWMaa5O1M/wySTVltpkuzFwbs4AOPsF6m43Md8AYOf
  53223. Mke6UiI0HTJ6CVanfCU2qT1L2sCCbwq7EsiHSycR+R4tx5M/nttfJmtS2S6K8RTGRI0Vqbe/vd6m
  53224. Gu6uLftIdxf+u+yvGPUqUfA5hJeVbG4bwyvEdGB5JbAKJ9/fXtI5z0V9QkvfsywexcZdylU6oJxp
  53225. mo/a77KwPJ+HbBIrZXAVUjEaJM9vMSNQH4xPjyPDdEFjHFWoFN0+4FFQz/EbMFYOkrCChdiDyyJk
  53226. vC24JdVUorgG6q2SpCSgwYa1ShNqR88uC1aVVMvOmttqtKay20EIhid392qgQmwLOM7XdVAyksLf
  53227. KzAiSNDVQTglXaTpXZ/GlHXQRf0wl0OPkKsKx4ZzYEppLd6leNcG2mqeSz53OiATIgHQv2ieY2Br
  53228. NU0LbbqhPcCT4H8js1WtciVORvnSFu+wZMEBnunKoGqYDs/YYPIvSbjkQuE4NRb0yG5P94FW6Lqj
  53229. viOvrv1vA+ACOzB2+httQc8Bsem4yWb02ybzOqR08kkkW8mw0FfB+j564ZfJ
  53230. -----END CERTIFICATE-----
  53231. SwissSign Silver CA - G2
  53232. ========================
  53233. -----BEGIN CERTIFICATE-----
  53234. MIIFvTCCA6WgAwIBAgIITxvUL1S7L0swDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCQ0gxFTAT
  53235. BgNVBAoTDFN3aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMB4X
  53236. DTA2MTAyNTA4MzI0NloXDTM2MTAyNTA4MzI0NlowRzELMAkGA1UEBhMCQ0gxFTATBgNVBAoTDFN3
  53237. aXNzU2lnbiBBRzEhMB8GA1UEAxMYU3dpc3NTaWduIFNpbHZlciBDQSAtIEcyMIICIjANBgkqhkiG
  53238. 9w0BAQEFAAOCAg8AMIICCgKCAgEAxPGHf9N4Mfc4yfjDmUO8x/e8N+dOcbpLj6VzHVxumK4DV644
  53239. N0MvFz0fyM5oEMF4rhkDKxD6LHmD9ui5aLlV8gREpzn5/ASLHvGiTSf5YXu6t+WiE7brYT7QbNHm
  53240. +/pe7R20nqA1W6GSy/BJkv6FCgU+5tkL4k+73JU3/JHpMjUi0R86TieFnbAVlDLaYQ1HTWBCrpJH
  53241. 6INaUFjpiou5XaHc3ZlKHzZnu0jkg7Y360g6rw9njxcH6ATK72oxh9TAtvmUcXtnZLi2kUpCe2Uu
  53242. MGoM9ZDulebyzYLs2aFK7PayS+VFheZteJMELpyCbTapxDFkH4aDCyr0NQp4yVXPQbBH6TCfmb5h
  53243. qAaEuSh6XzjZG6k4sIN/c8HDO0gqgg8hm7jMqDXDhBuDsz6+pJVpATqJAHgE2cn0mRmrVn5bi4Y5
  53244. FZGkECwJMoBgs5PAKrYYC51+jUnyEEp/+dVGLxmSo5mnJqy7jDzmDrxHB9xzUfFwZC8I+bRHHTBs
  53245. ROopN4WSaGa8gzj+ezku01DwH/teYLappvonQfGbGHLy9YR0SslnxFSuSGTfjNFusB3hB48IHpmc
  53246. celM2KX3RxIfdNFRnobzwqIjQAtz20um53MGjMGg6cFZrEb65i/4z3GcRm25xBWNOHkDRUjvxF3X
  53247. CO6HOSKGsg0PWEP3calILv3q1h8CAwEAAaOBrDCBqTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/
  53248. BAUwAwEB/zAdBgNVHQ4EFgQUF6DNweRBtjpbO8tFnb0cwpj6hlgwHwYDVR0jBBgwFoAUF6DNweRB
  53249. tjpbO8tFnb0cwpj6hlgwRgYDVR0gBD8wPTA7BglghXQBWQEDAQEwLjAsBggrBgEFBQcCARYgaHR0
  53250. cDovL3JlcG9zaXRvcnkuc3dpc3NzaWduLmNvbS8wDQYJKoZIhvcNAQEFBQADggIBAHPGgeAn0i0P
  53251. 4JUw4ppBf1AsX19iYamGamkYDHRJ1l2E6kFSGG9YrVBWIGrGvShpWJHckRE1qTodvBqlYJ7YH39F
  53252. kWnZfrt4csEGDyrOj4VwYaygzQu4OSlWhDJOhrs9xCrZ1x9y7v5RoSJBsXECYxqCsGKrXlcSH9/L
  53253. 3XWgwF15kIwb4FDm3jH+mHtwX6WQ2K34ArZv02DdQEsixT2tOnqfGhpHkXkzuoLcMmkDlm4fS/Bx
  53254. /uNncqCxv1yL5PqZIseEuRuNI5c/7SXgz2W79WEE790eslpBIlqhn10s6FvJbakMDHiqYMZWjwFa
  53255. DGi8aRl5xB9+lwW/xekkUV7U1UtT7dkjWjYDZaPBA61BMPNGG4WQr2W11bHkFlt4dR2Xem1ZqSqP
  53256. e97Dh4kQmUlzeMg9vVE1dCrV8X5pGyq7O70luJpaPXJhkGaH7gzWTdQRdAtq/gsD/KNVV4n+Ssuu
  53257. WxcFyPKNIzFTONItaj+CuY0IavdeQXRuwxF+B6wpYJE/OMpXEA29MC/HpeZBoNquBYeaoKRlbEwJ
  53258. DIm6uNO5wJOKMPqN5ZprFQFOZ6raYlY+hAhm0sQ2fac+EPyI4NSA5QC9qvNOBqN6avlicuMJT+ub
  53259. DgEj8Z+7fNzcbBGXJbLytGMU0gYqZ4yD9c7qB9iaah7s5Aq7KkzrCWA5zspi2C5u
  53260. -----END CERTIFICATE-----
  53261. GeoTrust Primary Certification Authority
  53262. ========================================
  53263. -----BEGIN CERTIFICATE-----
  53264. MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQG
  53265. EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMoR2VvVHJ1c3QgUHJpbWFyeSBD
  53266. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgx
  53267. CzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQ
  53268. cmltYXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
  53269. CgKCAQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9AWbK7hWN
  53270. b6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjAZIVcFU2Ix7e64HXprQU9
  53271. nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE07e9GceBrAqg1cmuXm2bgyxx5X9gaBGge
  53272. RwLmnWDiNpcB3841kt++Z8dtd1k7j53WkBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGt
  53273. tm/81w7a4DSwDRp35+MImO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  53274. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJKoZI
  53275. hvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ16CePbJC/kRYkRj5K
  53276. Ts4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl4b7UVXGYNTq+k+qurUKykG/g/CFN
  53277. NWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6KoKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHa
  53278. Floxt/m0cYASSJlyc1pZU8FjUjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG
  53279. 1riR/aYNKxoUAT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk=
  53280. -----END CERTIFICATE-----
  53281. thawte Primary Root CA
  53282. ======================
  53283. -----BEGIN CERTIFICATE-----
  53284. MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCBqTELMAkGA1UE
  53285. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53286. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53287. cml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3
  53288. MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwg
  53289. SW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMv
  53290. KGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNVBAMT
  53291. FnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCs
  53292. oPD7gFnUnMekz52hWXMJEEUMDSxuaPFsW0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ
  53293. 1CRfBsDMRJSUjQJib+ta3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGc
  53294. q/gcfomk6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6Sk/K
  53295. aAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94JNqR32HuHUETVPm4p
  53296. afs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYD
  53297. VR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XPr87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUF
  53298. AAOCAQEAeRHAS7ORtvzw6WfUDW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeE
  53299. uzLlQRHAd9mzYJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX
  53300. xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2/qxAeeWsEG89
  53301. jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/LHbTY5xZ3Y+m4Q6gLkH3LpVH
  53302. z7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7jVaMaA==
  53303. -----END CERTIFICATE-----
  53304. VeriSign Class 3 Public Primary Certification Authority - G5
  53305. ============================================================
  53306. -----BEGIN CERTIFICATE-----
  53307. MIIE0zCCA7ugAwIBAgIQGNrRniZ96LtKIVjNzGs7SjANBgkqhkiG9w0BAQUFADCByjELMAkGA1UE
  53308. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53309. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53310. IHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRp
  53311. ZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwHhcNMDYxMTA4MDAwMDAwWhcNMzYwNzE2MjM1OTU5WjCB
  53312. yjELMAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2ln
  53313. biBUcnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNiBWZXJpU2lnbiwgSW5jLiAtIEZvciBh
  53314. dXRob3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmlt
  53315. YXJ5IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw
  53316. ggEKAoIBAQCvJAgIKXo1nmAMqudLO07cfLw8RRy7K+D+KQL5VwijZIUVJ/XxrcgxiV0i6CqqpkKz
  53317. j/i5Vbext0uz/o9+B1fs70PbZmIVYc9gDaTY3vjgw2IIPVQT60nKWVSFJuUrjxuf6/WhkcIzSdhD
  53318. Y2pSS9KP6HBRTdGJaXvHcPaz3BJ023tdS1bTlr8Vd6Gw9KIl8q8ckmcY5fQGBO+QueQA5N06tRn/
  53319. Arr0PO7gi+s3i+z016zy9vA9r911kTMZHRxAy3QkGSGT2RT+rCpSx4/VBEnkjWNHiDxpg8v+R70r
  53320. fk/Fla4OndTRQ8Bnc+MUCH7lP59zuDMKz10/NIeWiu5T6CUVAgMBAAGjgbIwga8wDwYDVR0TAQH/
  53321. BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2Uv
  53322. Z2lmMCEwHzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVy
  53323. aXNpZ24uY29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFH/TZafC3ey78DAJ80M5+gKvMzEzMA0GCSqG
  53324. SIb3DQEBBQUAA4IBAQCTJEowX2LP2BqYLz3q3JktvXf2pXkiOOzEp6B4Eq1iDkVwZMXnl2YtmAl+
  53325. X6/WzChl8gGqCBpH3vn5fJJaCGkgDdk+bW48DW7Y5gaRQBi5+MHt39tBquCWIMnNZBU4gcmU7qKE
  53326. KQsTb47bDN0lAtukixlE0kF6BWlKWE9gyn6CagsCqiUXObXbf+eEZSqVir2G3l6BFoMtEMze/aiC
  53327. Km0oHw0LxOXnGiYZ4fQRbxC1lfznQgUy286dUV4otp6F01vvpX1FQHKOtw5rDgb7MzVIcbidJ4vE
  53328. ZV8NhnacRHr2lVz2XTIIM6RUthg/aFzyQkqFOFSDX9HoLPKsEdao7WNq
  53329. -----END CERTIFICATE-----
  53330. SecureTrust CA
  53331. ==============
  53332. -----BEGIN CERTIFICATE-----
  53333. MIIDuDCCAqCgAwIBAgIQDPCOXAgWpa1Cf/DrJxhZ0DANBgkqhkiG9w0BAQUFADBIMQswCQYDVQQG
  53334. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xFzAVBgNVBAMTDlNlY3VyZVRy
  53335. dXN0IENBMB4XDTA2MTEwNzE5MzExOFoXDTI5MTIzMTE5NDA1NVowSDELMAkGA1UEBhMCVVMxIDAe
  53336. BgNVBAoTF1NlY3VyZVRydXN0IENvcnBvcmF0aW9uMRcwFQYDVQQDEw5TZWN1cmVUcnVzdCBDQTCC
  53337. ASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKukgeWVzfX2FI7CT8rU4niVWJxB4Q2ZQCQX
  53338. OZEzZum+4YOvYlyJ0fwkW2Gz4BERQRwdbvC4u/jep4G6pkjGnx29vo6pQT64lO0pGtSO0gMdA+9t
  53339. DWccV9cGrcrI9f4Or2YlSASWC12juhbDCE/RRvgUXPLIXgGZbf2IzIaowW8xQmxSPmjL8xk037uH
  53340. GFaAJsTQ3MBv396gwpEWoGQRS0S8Hvbn+mPeZqx2pHGj7DaUaHp3pLHnDi+BeuK1cobvomuL8A/b
  53341. 01k/unK8RCSc43Oz969XL0Imnal0ugBS8kvNU3xHCzaFDmapCJcWNFfBZveA4+1wVMeT4C4oFVmH
  53342. ursCAwEAAaOBnTCBmjATBgkrBgEEAYI3FAIEBh4EAEMAQTALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/
  53343. BAUwAwEB/zAdBgNVHQ4EFgQUQjK2FvoE/f5dS3rD/fdMQB1aQ68wNAYDVR0fBC0wKzApoCegJYYj
  53344. aHR0cDovL2NybC5zZWN1cmV0cnVzdC5jb20vU1RDQS5jcmwwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53345. KoZIhvcNAQEFBQADggEBADDtT0rhWDpSclu1pqNlGKa7UTt36Z3q059c4EVlew3KW+JwULKUBRSu
  53346. SceNQQcSc5R+DCMh/bwQf2AQWnL1mA6s7Ll/3XpvXdMc9P+IBWlCqQVxyLesJugutIxq/3HcuLHf
  53347. mbx8IVQr5Fiiu1cprp6poxkmD5kuCLDv/WnPmRoJjeOnnyvJNjR7JLN4TJUXpAYmHrZkUjZfYGfZ
  53348. nMUFdAvnZyPSCPyI6a6Lf+Ew9Dd+/cYy2i2eRDAwbO4H3tI0/NL/QPZL9GZGBlSm8jIKYyYwa5vR
  53349. 3ItHuuG51WLQoqD0ZwV4KWMabwTW+MZMo5qxN7SN5ShLHZ4swrhovO0C7jE=
  53350. -----END CERTIFICATE-----
  53351. Secure Global CA
  53352. ================
  53353. -----BEGIN CERTIFICATE-----
  53354. MIIDvDCCAqSgAwIBAgIQB1YipOjUiolN9BPI8PjqpTANBgkqhkiG9w0BAQUFADBKMQswCQYDVQQG
  53355. EwJVUzEgMB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBH
  53356. bG9iYWwgQ0EwHhcNMDYxMTA3MTk0MjI4WhcNMjkxMjMxMTk1MjA2WjBKMQswCQYDVQQGEwJVUzEg
  53357. MB4GA1UEChMXU2VjdXJlVHJ1c3QgQ29ycG9yYXRpb24xGTAXBgNVBAMTEFNlY3VyZSBHbG9iYWwg
  53358. Q0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCvNS7YrGxVaQZx5RNoJLNP2MwhR/jx
  53359. YDiJiQPpvepeRlMJ3Fz1Wuj3RSoC6zFh1ykzTM7HfAo3fg+6MpjhHZevj8fcyTiW89sa/FHtaMbQ
  53360. bqR8JNGuQsiWUGMu4P51/pinX0kuleM5M2SOHqRfkNJnPLLZ/kG5VacJjnIFHovdRIWCQtBJwB1g
  53361. 8NEXLJXr9qXBkqPFwqcIYA1gBBCWeZ4WNOaptvolRTnIHmX5k/Wq8VLcmZg9pYYaDDUz+kulBAYV
  53362. HDGA76oYa8J719rO+TMg1fW9ajMtgQT7sFzUnKPiXB3jqUJ1XnvUd+85VLrJChgbEplJL4hL/VBi
  53363. 0XPnj3pDAgMBAAGjgZ0wgZowEwYJKwYBBAGCNxQCBAYeBABDAEEwCwYDVR0PBAQDAgGGMA8GA1Ud
  53364. EwEB/wQFMAMBAf8wHQYDVR0OBBYEFK9EBMJBfkiD2045AuzshHrmzsmkMDQGA1UdHwQtMCswKaAn
  53365. oCWGI2h0dHA6Ly9jcmwuc2VjdXJldHJ1c3QuY29tL1NHQ0EuY3JsMBAGCSsGAQQBgjcVAQQDAgEA
  53366. MA0GCSqGSIb3DQEBBQUAA4IBAQBjGghAfaReUw132HquHw0LURYD7xh8yOOvaliTFGCRsoTciE6+
  53367. OYo68+aCiV0BN7OrJKQVDpI1WkpEXk5X+nXOH0jOZvQ8QCaSmGwb7iRGDBezUqXbpZGRzzfTb+cn
  53368. CDpOGR86p1hcF895P4vkp9MmI50mD1hp/Ed+stCNi5O/KU9DaXR2Z0vPB4zmAve14bRDtUstFJ/5
  53369. 3CYNv6ZHdAbYiNE6KTCEztI5gGIbqMdXSbxqVVFnFUq+NQfk1XWYN3kwFNspnWzFacxHVaIw98xc
  53370. f8LDmBxrThaA63p4ZUWiABqvDA1VZDRIuJK58bRQKfJPIx/abKwfROHdI3hRW8cW
  53371. -----END CERTIFICATE-----
  53372. COMODO Certification Authority
  53373. ==============================
  53374. -----BEGIN CERTIFICATE-----
  53375. MIIEHTCCAwWgAwIBAgIQToEtioJl4AsC7j41AkblPTANBgkqhkiG9w0BAQUFADCBgTELMAkGA1UE
  53376. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  53377. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxJzAlBgNVBAMTHkNPTU9ETyBDZXJ0aWZpY2F0aW9uIEF1
  53378. dGhvcml0eTAeFw0wNjEyMDEwMDAwMDBaFw0yOTEyMzEyMzU5NTlaMIGBMQswCQYDVQQGEwJHQjEb
  53379. MBkGA1UECBMSR3JlYXRlciBNYW5jaGVzdGVyMRAwDgYDVQQHEwdTYWxmb3JkMRowGAYDVQQKExFD
  53380. T01PRE8gQ0EgTGltaXRlZDEnMCUGA1UEAxMeQ09NT0RPIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  53381. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0ECLi3LjkRv3UcEbVASY06m/weaKXTuH
  53382. +7uIzg3jLz8GlvCiKVCZrts7oVewdFFxze1CkU1B/qnI2GqGd0S7WWaXUF601CxwRM/aN5VCaTww
  53383. xHGzUvAhTaHYujl8HJ6jJJ3ygxaYqhZ8Q5sVW7euNJH+1GImGEaaP+vB+fGQV+useg2L23IwambV
  53384. 4EajcNxo2f8ESIl33rXp+2dtQem8Ob0y2WIC8bGoPW43nOIv4tOiJovGuFVDiOEjPqXSJDlqR6sA
  53385. 1KGzqSX+DT+nHbrTUcELpNqsOO9VUCQFZUaTNE8tja3G1CEZ0o7KBWFxB3NH5YoZEr0ETc5OnKVI
  53386. rLsm9wIDAQABo4GOMIGLMB0GA1UdDgQWBBQLWOWLxkwVN6RAqTCpIb5HNlpW/zAOBgNVHQ8BAf8E
  53387. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLmNvbW9k
  53388. b2NhLmNvbS9DT01PRE9DZXJ0aWZpY2F0aW9uQXV0aG9yaXR5LmNybDANBgkqhkiG9w0BAQUFAAOC
  53389. AQEAPpiem/Yb6dc5t3iuHXIYSdOH5EOC6z/JqvWote9VfCFSZfnVDeFs9D6Mk3ORLgLETgdxb8CP
  53390. OGEIqB6BCsAvIC9Bi5HcSEW88cbeunZrM8gALTFGTO3nnc+IlP8zwFboJIYmuNg4ON8qa90SzMc/
  53391. RxdMosIGlgnW2/4/PEZB31jiVg88O8EckzXZOFKs7sjsLjBOlDW0JB9LeGna8gI4zJVSk/BwJVmc
  53392. IGfE7vmLV2H0knZ9P4SNVbfo5azV8fUZVqZa+5Acr5Pr5RzUZ5ddBA6+C4OmF4O5MBKgxTMVBbkN
  53393. +8cFduPYSo38NBejxiEovjBFMR7HeL5YYTisO+IBZQ==
  53394. -----END CERTIFICATE-----
  53395. Network Solutions Certificate Authority
  53396. =======================================
  53397. -----BEGIN CERTIFICATE-----
  53398. MIID5jCCAs6gAwIBAgIQV8szb8JcFuZHFhfjkDFo4DANBgkqhkiG9w0BAQUFADBiMQswCQYDVQQG
  53399. EwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMuMTAwLgYDVQQDEydOZXR3b3Jr
  53400. IFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDYxMjAxMDAwMDAwWhcNMjkxMjMx
  53401. MjM1OTU5WjBiMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYTmV0d29yayBTb2x1dGlvbnMgTC5MLkMu
  53402. MTAwLgYDVQQDEydOZXR3b3JrIFNvbHV0aW9ucyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkwggEiMA0G
  53403. CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDkvH6SMG3G2I4rC7xGzuAnlt7e+foS0zwzc7MEL7xx
  53404. jOWftiJgPl9dzgn/ggwbmlFQGiaJ3dVhXRncEg8tCqJDXRfQNJIg6nPPOCwGJgl6cvf6UDL4wpPT
  53405. aaIjzkGxzOTVHzbRijr4jGPiFFlp7Q3Tf2vouAPlT2rlmGNpSAW+Lv8ztumXWWn4Zxmuk2GWRBXT
  53406. crA/vGp97Eh/jcOrqnErU2lBUzS1sLnFBgrEsEX1QV1uiUV7PTsmjHTC5dLRfbIR1PtYMiKagMnc
  53407. /Qzpf14Dl847ABSHJ3A4qY5usyd2mFHgBeMhqxrVhSI8KbWaFsWAqPS7azCPL0YCorEMIuDTAgMB
  53408. AAGjgZcwgZQwHQYDVR0OBBYEFCEwyfsA106Y2oeqKtCnLrFAMadMMA4GA1UdDwEB/wQEAwIBBjAP
  53409. BgNVHRMBAf8EBTADAQH/MFIGA1UdHwRLMEkwR6BFoEOGQWh0dHA6Ly9jcmwubmV0c29sc3NsLmNv
  53410. bS9OZXR3b3JrU29sdXRpb25zQ2VydGlmaWNhdGVBdXRob3JpdHkuY3JsMA0GCSqGSIb3DQEBBQUA
  53411. A4IBAQC7rkvnt1frf6ott3NHhWrB5KUd5Oc86fRZZXe1eltajSU24HqXLjjAV2CDmAaDn7l2em5Q
  53412. 4LqILPxFzBiwmZVRDuwduIj/h1AcgsLj4DKAv6ALR8jDMe+ZZzKATxcheQxpXN5eNK4CtSbqUN9/
  53413. GGUsyfJj4akH/nxxH2szJGoeBfcFaMBqEssuXmHLrijTfsK0ZpEmXzwuJF/LWA/rKOyvEZbz3Htv
  53414. wKeI8lN3s2Berq4o2jUsbzRF0ybh3uxbTydrFny9RAQYgrOJeRcQcT16ohZO9QHNpGxlaKFJdlxD
  53415. ydi8NmdspZS11My5vWo1ViHe2MPr+8ukYEywVaCge1ey
  53416. -----END CERTIFICATE-----
  53417. COMODO ECC Certification Authority
  53418. ==================================
  53419. -----BEGIN CERTIFICATE-----
  53420. MIICiTCCAg+gAwIBAgIQH0evqmIAcFBUTAGem2OZKjAKBggqhkjOPQQDAzCBhTELMAkGA1UEBhMC
  53421. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  53422. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBB
  53423. dXRob3JpdHkwHhcNMDgwMzA2MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMCR0Ix
  53424. GzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UEChMR
  53425. Q09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBFQ0MgQ2VydGlmaWNhdGlvbiBBdXRo
  53426. b3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQDR3svdcmCFYX7deSRFtSrYpn1PlILBs5BAH+X
  53427. 4QokPB0BBO490o0JlwzgdeT6+3eKKvUDYEs2ixYjFq0JcfRK9ChQtP6IHG4/bC8vCVlbpVsLM5ni
  53428. wz2J+Wos77LTBumjQjBAMB0GA1UdDgQWBBR1cacZSBm8nZ3qQUfflMRId5nTeTAOBgNVHQ8BAf8E
  53429. BAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjEA7wNbeqy3eApyt4jf/7VG
  53430. FAkK+qDmfQjGGoe9GKhzvSbKYAydzpmfz1wPMOG+FDHqAjAU9JM8SaczepBGR7NjfRObTrdvGDeA
  53431. U/7dIOA1mjbRxwG55tzd8/8dLDoWV9mSOdY=
  53432. -----END CERTIFICATE-----
  53433. OISTE WISeKey Global Root GA CA
  53434. ===============================
  53435. -----BEGIN CERTIFICATE-----
  53436. MIID8TCCAtmgAwIBAgIQQT1yx/RrH4FDffHSKFTfmjANBgkqhkiG9w0BAQUFADCBijELMAkGA1UE
  53437. BhMCQ0gxEDAOBgNVBAoTB1dJU2VLZXkxGzAZBgNVBAsTEkNvcHlyaWdodCAoYykgMjAwNTEiMCAG
  53438. A1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBH
  53439. bG9iYWwgUm9vdCBHQSBDQTAeFw0wNTEyMTExNjAzNDRaFw0zNzEyMTExNjA5NTFaMIGKMQswCQYD
  53440. VQQGEwJDSDEQMA4GA1UEChMHV0lTZUtleTEbMBkGA1UECxMSQ29weXJpZ2h0IChjKSAyMDA1MSIw
  53441. IAYDVQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5
  53442. IEdsb2JhbCBSb290IEdBIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAy0+zAJs9
  53443. Nt350UlqaxBJH+zYK7LG+DKBKUOVTJoZIyEVRd7jyBxRVVuuk+g3/ytr6dTqvirdqFEr12bDYVxg
  53444. Asj1znJ7O7jyTmUIms2kahnBAbtzptf2w93NvKSLtZlhuAGio9RN1AU9ka34tAhxZK9w8RxrfvbD
  53445. d50kc3vkDIzh2TbhmYsFmQvtRTEJysIA2/dyoJaqlYfQjse2YXMNdmaM3Bu0Y6Kff5MTMPGhJ9vZ
  53446. /yxViJGg4E8HsChWjBgbl0SOid3gF27nKu+POQoxhILYQBRJLnpB5Kf+42TMwVlxSywhp1t94B3R
  53447. LoGbw9ho972WG6xwsRYUC9tguSYBBQIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUw
  53448. AwEB/zAdBgNVHQ4EFgQUswN+rja8sHnR3JQmthG+IbJphpQwEAYJKwYBBAGCNxUBBAMCAQAwDQYJ
  53449. KoZIhvcNAQEFBQADggEBAEuh/wuHbrP5wUOxSPMowB0uyQlB+pQAHKSkq0lPjz0e701vvbyk9vIm
  53450. MMkQyh2I+3QZH4VFvbBsUfk2ftv1TDI6QU9bR8/oCy22xBmddMVHxjtqD6wU2zz0c5ypBd8A3HR4
  53451. +vg1YFkCExh8vPtNsCBtQ7tgMHpnM1zFmdH4LTlSc/uMqpclXHLZCB6rTjzjgTGfA6b7wP4piFXa
  53452. hNVQA7bihKOmNqoROgHhGEvWRGizPflTdISzRpFGlgC3gCy24eMQ4tui5yiPAZZiFj4A4xylNoEY
  53453. okxSdsARo27mHbrjWr42U8U+dY+GaSlYU7Wcu2+fXMUY7N0v4ZjJ/L7fCg0=
  53454. -----END CERTIFICATE-----
  53455. Certigna
  53456. ========
  53457. -----BEGIN CERTIFICATE-----
  53458. MIIDqDCCApCgAwIBAgIJAP7c4wEPyUj/MA0GCSqGSIb3DQEBBQUAMDQxCzAJBgNVBAYTAkZSMRIw
  53459. EAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hMB4XDTA3MDYyOTE1MTMwNVoXDTI3
  53460. MDYyOTE1MTMwNVowNDELMAkGA1UEBhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczERMA8GA1UEAwwI
  53461. Q2VydGlnbmEwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDIaPHJ1tazNHUmgh7stL7q
  53462. XOEm7RFHYeGifBZ4QCHkYJ5ayGPhxLGWkv8YbWkj4Sti993iNi+RB7lIzw7sebYs5zRLcAglozyH
  53463. GxnygQcPOJAZ0xH+hrTy0V4eHpbNgGzOOzGTtvKg0KmVEn2lmsxryIRWijOp5yIVUxbwzBfsV1/p
  53464. ogqYCd7jX5xv3EjjhQsVWqa6n6xI4wmy9/Qy3l40vhx4XUJbzg4ij02Q130yGLMLLGq/jj8UEYkg
  53465. DncUtT2UCIf3JR7VsmAA7G8qKCVuKj4YYxclPz5EIBb2JsglrgVKtOdjLPOMFlN+XPsRGgjBRmKf
  53466. Irjxwo1p3Po6WAbfAgMBAAGjgbwwgbkwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUGu3+QTmQ
  53467. tCRZvgHyUtVF9lo53BEwZAYDVR0jBF0wW4AUGu3+QTmQtCRZvgHyUtVF9lo53BGhOKQ2MDQxCzAJ
  53468. BgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxETAPBgNVBAMMCENlcnRpZ25hggkA/tzjAQ/J
  53469. SP8wDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIABzANBgkqhkiG9w0BAQUFAAOCAQEA
  53470. hQMeknH2Qq/ho2Ge6/PAD/Kl1NqV5ta+aDY9fm4fTIrv0Q8hbV6lUmPOEvjvKtpv6zf+EwLHyzs+
  53471. ImvaYS5/1HI93TDhHkxAGYwP15zRgzB7mFncfca5DClMoTOi62c6ZYTTluLtdkVwj7Ur3vkj1klu
  53472. PBS1xp81HlDQwY9qcEQCYsuuHWhBp6pX6FOqB9IG9tUUBguRA3UsbHK1YZWaDYu5Def131TN3ubY
  53473. 1gkIl2PlwS6wt0QmwCbAr1UwnjvVNioZBPRcHv/PLLf/0P2HQBHVESO7SMAhqaQoLf0V+LBOK/Qw
  53474. WyH8EZE0vkHve52Xdf+XlcCWWC/qu0bXu+TZLg==
  53475. -----END CERTIFICATE-----
  53476. Deutsche Telekom Root CA 2
  53477. ==========================
  53478. -----BEGIN CERTIFICATE-----
  53479. MIIDnzCCAoegAwIBAgIBJjANBgkqhkiG9w0BAQUFADBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMT
  53480. RGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0GA1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEG
  53481. A1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBSb290IENBIDIwHhcNOTkwNzA5MTIxMTAwWhcNMTkwNzA5
  53482. MjM1OTAwWjBxMQswCQYDVQQGEwJERTEcMBoGA1UEChMTRGV1dHNjaGUgVGVsZWtvbSBBRzEfMB0G
  53483. A1UECxMWVC1UZWxlU2VjIFRydXN0IENlbnRlcjEjMCEGA1UEAxMaRGV1dHNjaGUgVGVsZWtvbSBS
  53484. b290IENBIDIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCrC6M14IspFLEUha88EOQ5
  53485. bzVdSq7d6mGNlUn0b2SjGmBmpKlAIoTZ1KXleJMOaAGtuU1cOs7TuKhCQN/Po7qCWWqSG6wcmtoI
  53486. KyUn+WkjR/Hg6yx6m/UTAtB+NHzCnjwAWav12gz1MjwrrFDa1sPeg5TKqAyZMg4ISFZbavva4VhY
  53487. AUlfckE8FQYBjl2tqriTtM2e66foai1SNNs671x1Udrb8zH57nGYMsRUFUQM+ZtV7a3fGAigo4aK
  53488. Se5TBY8ZTNXeWHmb0mocQqvF1afPaA+W5OFhmHZhyJF81j4A4pFQh+GdCuatl9Idxjp9y7zaAzTV
  53489. jlsB9WoHtxa2bkp/AgMBAAGjQjBAMB0GA1UdDgQWBBQxw3kbuvVT1xfgiXotF2wKsyudMzAPBgNV
  53490. HRMECDAGAQH/AgEFMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQUFAAOCAQEAlGRZrTlk5ynr
  53491. E/5aw4sTV8gEJPB0d8Bg42f76Ymmg7+Wgnxu1MM9756AbrsptJh6sTtU6zkXR34ajgv8HzFZMQSy
  53492. zhfzLMdiNlXiItiJVbSYSKpk+tYcNthEeFpaIzpXl/V6ME+un2pMSyuOoAPjPuCp1NJ70rOo4nI8
  53493. rZ7/gFnkm0W09juwzTkZmDLl6iFhkOQxIY40sfcvNUqFENrnijchvllj4PKFiDFT1FQUhXB59C4G
  53494. dyd1Lx+4ivn+xbrYNuSD7Odlt79jWvNGr4GUN9RBjNYj1h7P9WgbRGOiWrqnNVmh5XAFmw4jV5mU
  53495. Cm26OWMohpLzGITY+9HPBVZkVw==
  53496. -----END CERTIFICATE-----
  53497. Cybertrust Global Root
  53498. ======================
  53499. -----BEGIN CERTIFICATE-----
  53500. MIIDoTCCAomgAwIBAgILBAAAAAABD4WqLUgwDQYJKoZIhvcNAQEFBQAwOzEYMBYGA1UEChMPQ3li
  53501. ZXJ0cnVzdCwgSW5jMR8wHQYDVQQDExZDeWJlcnRydXN0IEdsb2JhbCBSb290MB4XDTA2MTIxNTA4
  53502. MDAwMFoXDTIxMTIxNTA4MDAwMFowOzEYMBYGA1UEChMPQ3liZXJ0cnVzdCwgSW5jMR8wHQYDVQQD
  53503. ExZDeWJlcnRydXN0IEdsb2JhbCBSb290MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA
  53504. +Mi8vRRQZhP/8NN57CPytxrHjoXxEnOmGaoQ25yiZXRadz5RfVb23CO21O1fWLE3TdVJDm71aofW
  53505. 0ozSJ8bi/zafmGWgE07GKmSb1ZASzxQG9Dvj1Ci+6A74q05IlG2OlTEQXO2iLb3VOm2yHLtgwEZL
  53506. AfVJrn5GitB0jaEMAs7u/OePuGtm839EAL9mJRQr3RAwHQeWP032a7iPt3sMpTjr3kfb1V05/Iin
  53507. 89cqdPHoWqI7n1C6poxFNcJQZZXcY4Lv3b93TZxiyWNzFtApD0mpSPCzqrdsxacwOUBdrsTiXSZT
  53508. 8M4cIwhhqJQZugRiQOwfOHB3EgZxpzAYXSUnpQIDAQABo4GlMIGiMA4GA1UdDwEB/wQEAwIBBjAP
  53509. BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBS2CHsNesysIEyGVjJez6tuhS1wVzA/BgNVHR8EODA2
  53510. MDSgMqAwhi5odHRwOi8vd3d3Mi5wdWJsaWMtdHJ1c3QuY29tL2NybC9jdC9jdHJvb3QuY3JsMB8G
  53511. A1UdIwQYMBaAFLYIew16zKwgTIZWMl7Pq26FLXBXMA0GCSqGSIb3DQEBBQUAA4IBAQBW7wojoFRO
  53512. lZfJ+InaRcHUowAl9B8Tq7ejhVhpwjCt2BWKLePJzYFa+HMjWqd8BfP9IjsO0QbE2zZMcwSO5bAi
  53513. 5MXzLqXZI+O4Tkogp24CJJ8iYGd7ix1yCcUxXOl5n4BHPa2hCwcUPUf/A2kaDAtE52Mlp3+yybh2
  53514. hO0j9n0Hq0V+09+zv+mKts2oomcrUtW3ZfA5TGOgkXmTUg9U3YO7n9GPp1Nzw8v/MOx8BLjYRB+T
  53515. X3EJIrduPuocA06dGiBh+4E37F78CkWr1+cXVdCg6mCbpvbjjFspwgZgFJ0tl0ypkxWdYcQBX0jW
  53516. WL1WMRJOEcgh4LMRkWXbtKaIOM5V
  53517. -----END CERTIFICATE-----
  53518. ePKI Root Certification Authority
  53519. =================================
  53520. -----BEGIN CERTIFICATE-----
  53521. MIIFsDCCA5igAwIBAgIQFci9ZUdcr7iXAF7kBtK8nTANBgkqhkiG9w0BAQUFADBeMQswCQYDVQQG
  53522. EwJUVzEjMCEGA1UECgwaQ2h1bmdod2EgVGVsZWNvbSBDby4sIEx0ZC4xKjAoBgNVBAsMIWVQS0kg
  53523. Um9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNDEyMjAwMjMxMjdaFw0zNDEyMjAwMjMx
  53524. MjdaMF4xCzAJBgNVBAYTAlRXMSMwIQYDVQQKDBpDaHVuZ2h3YSBUZWxlY29tIENvLiwgTHRkLjEq
  53525. MCgGA1UECwwhZVBLSSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0B
  53526. AQEFAAOCAg8AMIICCgKCAgEA4SUP7o3biDN1Z82tH306Tm2d0y8U82N0ywEhajfqhFAHSyZbCUNs
  53527. IZ5qyNUD9WBpj8zwIuQf5/dqIjG3LBXy4P4AakP/h2XGtRrBp0xtInAhijHyl3SJCRImHJ7K2RKi
  53528. lTza6We/CKBk49ZCt0Xvl/T29de1ShUCWH2YWEtgvM3XDZoTM1PRYfl61dd4s5oz9wCGzh1NlDiv
  53529. qOx4UXCKXBCDUSH3ET00hl7lSM2XgYI1TBnsZfZrxQWh7kcT1rMhJ5QQCtkkO7q+RBNGMD+XPNjX
  53530. 12ruOzjjK9SXDrkb5wdJfzcq+Xd4z1TtW0ado4AOkUPB1ltfFLqfpo0kR0BZv3I4sjZsN/+Z0V0O
  53531. WQqraffAsgRFelQArr5T9rXn4fg8ozHSqf4hUmTFpmfwdQcGlBSBVcYn5AGPF8Fqcde+S/uUWH1+
  53532. ETOxQvdibBjWzwloPn9s9h6PYq2lY9sJpx8iQkEeb5mKPtf5P0B6ebClAZLSnT0IFaUQAS2zMnao
  53533. lQ2zepr7BxB4EW/hj8e6DyUadCrlHJhBmd8hh+iVBmoKs2pHdmX2Os+PYhcZewoozRrSgx4hxyy/
  53534. vv9haLdnG7t4TY3OZ+XkwY63I2binZB1NJipNiuKmpS5nezMirH4JYlcWrYvjB9teSSnUmjDhDXi
  53535. Zo1jDiVN1Rmy5nk3pyKdVDECAwEAAaNqMGgwHQYDVR0OBBYEFB4M97Zn8uGSJglFwFU5Lnc/Qkqi
  53536. MAwGA1UdEwQFMAMBAf8wOQYEZyoHAAQxMC8wLQIBADAJBgUrDgMCGgUAMAcGBWcqAwAABBRFsMLH
  53537. ClZ87lt4DJX5GFPBphzYEDANBgkqhkiG9w0BAQUFAAOCAgEACbODU1kBPpVJufGBuvl2ICO1J2B0
  53538. 1GqZNF5sAFPZn/KmsSQHRGoqxqWOeBLoR9lYGxMqXnmbnwoqZ6YlPwZpVnPDimZI+ymBV3QGypzq
  53539. KOg4ZyYr8dW1P2WT+DZdjo2NQCCHGervJ8A9tDkPJXtoUHRVnAxZfVo9QZQlUgjgRywVMRnVvwdV
  53540. xrsStZf0X4OFunHB2WyBEXYKCrC/gpf36j36+uwtqSiUO1bd0lEursC9CBWMd1I0ltabrNMdjmEP
  53541. NXubrjlpC2JgQCA2j6/7Nu4tCEoduL+bXPjqpRugc6bY+G7gMwRfaKonh+3ZwZCc7b3jajWvY9+r
  53542. GNm65ulK6lCKD2GTHuItGeIwlDWSXQ62B68ZgI9HkFFLLk3dheLSClIKF5r8GrBQAuUBo2M3IUxE
  53543. xJtRmREOc5wGj1QupyheRDmHVi03vYVElOEMSyycw5KFNGHLD7ibSkNS/jQ6fbjpKdx2qcgw+BRx
  53544. gMYeNkh0IkFch4LoGHGLQYlE535YW6i4jRPpp2zDR+2zGp1iro2C6pSe3VkQw63d4k3jMdXH7Ojy
  53545. sP6SHhYKGvzZ8/gntsm+HbRsZJB/9OTEW9c3rkIO3aQab3yIVMUWbuF6aC74Or8NpDyJO3inTmOD
  53546. BCEIZ43ygknQW/2xzQ+DhNQ+IIX3Sj0rnP0qCglN6oH4EZw=
  53547. -----END CERTIFICATE-----
  53548. certSIGN ROOT CA
  53549. ================
  53550. -----BEGIN CERTIFICATE-----
  53551. MIIDODCCAiCgAwIBAgIGIAYFFnACMA0GCSqGSIb3DQEBBQUAMDsxCzAJBgNVBAYTAlJPMREwDwYD
  53552. VQQKEwhjZXJ0U0lHTjEZMBcGA1UECxMQY2VydFNJR04gUk9PVCBDQTAeFw0wNjA3MDQxNzIwMDRa
  53553. Fw0zMTA3MDQxNzIwMDRaMDsxCzAJBgNVBAYTAlJPMREwDwYDVQQKEwhjZXJ0U0lHTjEZMBcGA1UE
  53554. CxMQY2VydFNJR04gUk9PVCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBALczuX7I
  53555. JUqOtdu0KBuqV5Do0SLTZLrTk+jUrIZhQGpgV2hUhE28alQCBf/fm5oqrl0Hj0rDKH/v+yv6efHH
  53556. rfAQUySQi2bJqIirr1qjAOm+ukbuW3N7LBeCgV5iLKECZbO9xSsAfsT8AzNXDe3i+s5dRdY4zTW2
  53557. ssHQnIFKquSyAVwdj1+ZxLGt24gh65AIgoDzMKND5pCCrlUoSe1b16kQOA7+j0xbm0bqQfWwCHTD
  53558. 0IgztnzXdN/chNFDDnU5oSVAKOp4yw4sLjmdjItuFhwvJoIQ4uNllAoEwF73XVv4EOLQunpL+943
  53559. AAAaWyjj0pxzPjKHmKHJUS/X3qwzs08CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8B
  53560. Af8EBAMCAcYwHQYDVR0OBBYEFOCMm9slSbPxfIbWskKHC9BroNnkMA0GCSqGSIb3DQEBBQUAA4IB
  53561. AQA+0hyJLjX8+HXd5n9liPRyTMks1zJO890ZeUe9jjtbkw9QSSQTaxQGcu8J06Gh40CEyecYMnQ8
  53562. SG4Pn0vU9x7Tk4ZkVJdjclDVVc/6IJMCopvDI5NOFlV2oHB5bc0hH88vLbwZ44gx+FkagQnIl6Z0
  53563. x2DEW8xXjrJ1/RsCCdtZb3KTafcxQdaIOL+Hsr0Wefmq5L6IJd1hJyMctTEHBDa0GpC9oHRxUIlt
  53564. vBTjD4au8as+x6AJzKNI0eDbZOeStc+vckNwi/nDhDwTqn6Sm1dTk/pwwpEOMfmbZ13pljheX7Nz
  53565. TogVZ96edhBiIL5VaZVDADlN9u6wWk5JRFRYX0KD
  53566. -----END CERTIFICATE-----
  53567. GeoTrust Primary Certification Authority - G3
  53568. =============================================
  53569. -----BEGIN CERTIFICATE-----
  53570. MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UE
  53571. BhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA4IEdlb1RydXN0
  53572. IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFy
  53573. eSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIz
  53574. NTk1OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAo
  53575. YykgMjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMT
  53576. LUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMzCCASIwDQYJKoZI
  53577. hvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz+uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5j
  53578. K/BGvESyiaHAKAxJcCGVn2TAppMSAmUmhsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdE
  53579. c5IiaacDiGydY8hS2pgn5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3C
  53580. IShwiP/WJmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exALDmKu
  53581. dlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZChuOl1UcCAwEAAaNC
  53582. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFMR5yo6hTgMdHNxr
  53583. 2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IBAQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9
  53584. cr5HqQ6XErhK8WTTOd8lNNTBzU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbE
  53585. Ap7aDHdlDkQNkv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD
  53586. AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUHSJsMC8tJP33s
  53587. t/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2Gspki4cErx5z481+oghLrGREt
  53588. -----END CERTIFICATE-----
  53589. thawte Primary Root CA - G2
  53590. ===========================
  53591. -----BEGIN CERTIFICATE-----
  53592. MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDELMAkGA1UEBhMC
  53593. VVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMpIDIwMDcgdGhhd3RlLCBJbmMu
  53594. IC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3Qg
  53595. Q0EgLSBHMjAeFw0wNzExMDUwMDAwMDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEV
  53596. MBMGA1UEChMMdGhhd3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBG
  53597. b3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAt
  53598. IEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/BebfowJPDQfGAFG6DAJS
  53599. LSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6papu+7qzcMBniKI11KOasf2twu8x+qi5
  53600. 8/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU
  53601. mtgAMADna3+FGO6Lts6KDPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUN
  53602. G4k8VIZ3KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41oxXZ3K
  53603. rr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg==
  53604. -----END CERTIFICATE-----
  53605. thawte Primary Root CA - G3
  53606. ===========================
  53607. -----BEGIN CERTIFICATE-----
  53608. MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCBrjELMAkGA1UE
  53609. BhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2
  53610. aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIwMDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhv
  53611. cml6ZWQgdXNlIG9ubHkxJDAiBgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0w
  53612. ODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh
  53613. d3RlLCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9uMTgwNgYD
  53614. VQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTEkMCIG
  53615. A1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEczMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  53616. MIIBCgKCAQEAsr8nLPvb2FvdeHsbnndmgcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2At
  53617. P0LMqmsywCPLLEHd5N/8YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC
  53618. +BsUa0Lfb1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS99irY
  53619. 7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2SzhkGcuYMXDhpxwTW
  53620. vGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUkOQIDAQABo0IwQDAPBgNVHRMBAf8E
  53621. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJ
  53622. KoZIhvcNAQELBQADggEBABpA2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweK
  53623. A3rD6z8KLFIWoCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu
  53624. t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7cKUGRIjxpp7sC
  53625. 8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fMm7v/OeZWYdMKp8RcTGB7BXcm
  53626. er/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZuMdRAGmI0Nj81Aa6sY6A=
  53627. -----END CERTIFICATE-----
  53628. GeoTrust Primary Certification Authority - G2
  53629. =============================================
  53630. -----BEGIN CERTIFICATE-----
  53631. MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDELMAkGA1UEBhMC
  53632. VVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChjKSAyMDA3IEdlb1RydXN0IElu
  53633. Yy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBD
  53634. ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1
  53635. OVowgZgxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg
  53636. MjAwNyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNVBAMTLUdl
  53637. b1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBHMjB2MBAGByqGSM49AgEG
  53638. BSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcLSo17VDs6bl8VAsBQps8lL33KSLjHUGMc
  53639. KiEIfJo22Av+0SbFWDEwKCXzXV2juLaltJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYD
  53640. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+
  53641. EVXVMAoGCCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGTqQ7m
  53642. ndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBuczrD6ogRLQy7rQkgu2
  53643. npaqBA+K
  53644. -----END CERTIFICATE-----
  53645. VeriSign Universal Root Certification Authority
  53646. ===============================================
  53647. -----BEGIN CERTIFICATE-----
  53648. MIIEuTCCA6GgAwIBAgIQQBrEZCGzEyEDDrvkEhrFHTANBgkqhkiG9w0BAQsFADCBvTELMAkGA1UE
  53649. BhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBO
  53650. ZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwOCBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVk
  53651. IHVzZSBvbmx5MTgwNgYDVQQDEy9WZXJpU2lnbiBVbml2ZXJzYWwgUm9vdCBDZXJ0aWZpY2F0aW9u
  53652. IEF1dGhvcml0eTAeFw0wODA0MDIwMDAwMDBaFw0zNzEyMDEyMzU5NTlaMIG9MQswCQYDVQQGEwJV
  53653. UzEXMBUGA1UEChMOVmVyaVNpZ24sIEluYy4xHzAdBgNVBAsTFlZlcmlTaWduIFRydXN0IE5ldHdv
  53654. cmsxOjA4BgNVBAsTMShjKSAyMDA4IFZlcmlTaWduLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl
  53655. IG9ubHkxODA2BgNVBAMTL1ZlcmlTaWduIFVuaXZlcnNhbCBSb290IENlcnRpZmljYXRpb24gQXV0
  53656. aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAx2E3XrEBNNti1xWb/1hajCMj
  53657. 1mCOkdeQmIN65lgZOIzF9uVkhbSicfvtvbnazU0AtMgtc6XHaXGVHzk8skQHnOgO+k1KxCHfKWGP
  53658. MiJhgsWHH26MfF8WIFFE0XBPV+rjHOPMee5Y2A7Cs0WTwCznmhcrewA3ekEzeOEz4vMQGn+HLL72
  53659. 9fdC4uW/h2KJXwBL38Xd5HVEMkE6HnFuacsLdUYI0crSK5XQz/u5QGtkjFdN/BMReYTtXlT2NJ8I
  53660. AfMQJQYXStrxHXpma5hgZqTZ79IugvHw7wnqRMkVauIDbjPTrJ9VAMf2CGqUuV/c4DPxhGD5WycR
  53661. tPwW8rtWaoAljQIDAQABo4GyMIGvMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMG0G
  53662. CCsGAQUFBwEMBGEwX6FdoFswWTBXMFUWCWltYWdlL2dpZjAhMB8wBwYFKw4DAhoEFI/l0xqGrI2O
  53663. a8PPgGrUSBgsexkuMCUWI2h0dHA6Ly9sb2dvLnZlcmlzaWduLmNvbS92c2xvZ28uZ2lmMB0GA1Ud
  53664. DgQWBBS2d/ppSEefUxLVwuoHMnYH0ZcHGTANBgkqhkiG9w0BAQsFAAOCAQEASvj4sAPmLGd75JR3
  53665. Y8xuTPl9Dg3cyLk1uXBPY/ok+myDjEedO2Pzmvl2MpWRsXe8rJq+seQxIcaBlVZaDrHC1LGmWazx
  53666. Y8u4TB1ZkErvkBYoH1quEPuBUDgMbMzxPcP1Y+Oz4yHJJDnp/RVmRvQbEdBNc6N9Rvk97ahfYtTx
  53667. P/jgdFcrGJ2BtMQo2pSXpXDrrB2+BxHw1dvd5Yzw1TKwg+ZX4o+/vqGqvz0dtdQ46tewXDpPaj+P
  53668. wGZsY6rp2aQW9IHRlRQOfc2VNNnSj3BzgXucfr2YYdhFh5iQxeuGMMY1v/D/w1WIg0vvBZIGcfK4
  53669. mJO37M2CYfE45k+XmCpajQ==
  53670. -----END CERTIFICATE-----
  53671. VeriSign Class 3 Public Primary Certification Authority - G4
  53672. ============================================================
  53673. -----BEGIN CERTIFICATE-----
  53674. MIIDhDCCAwqgAwIBAgIQL4D+I4wOIg9IZxIokYesszAKBggqhkjOPQQDAzCByjELMAkGA1UEBhMC
  53675. VVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBUcnVzdCBOZXR3
  53676. b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRob3JpemVkIHVz
  53677. ZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5IENlcnRpZmlj
  53678. YXRpb24gQXV0aG9yaXR5IC0gRzQwHhcNMDcxMTA1MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCByjEL
  53679. MAkGA1UEBhMCVVMxFzAVBgNVBAoTDlZlcmlTaWduLCBJbmMuMR8wHQYDVQQLExZWZXJpU2lnbiBU
  53680. cnVzdCBOZXR3b3JrMTowOAYDVQQLEzEoYykgMjAwNyBWZXJpU2lnbiwgSW5jLiAtIEZvciBhdXRo
  53681. b3JpemVkIHVzZSBvbmx5MUUwQwYDVQQDEzxWZXJpU2lnbiBDbGFzcyAzIFB1YmxpYyBQcmltYXJ5
  53682. IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzQwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAASnVnp8
  53683. Utpkmw4tXNherJI9/gHmGUo9FANL+mAnINmDiWn6VMaaGF5VKmTeBvaNSjutEDxlPZCIBIngMGGz
  53684. rl0Bp3vefLK+ymVhAIau2o970ImtTR1ZmkGxvEeA3J5iw/mjgbIwga8wDwYDVR0TAQH/BAUwAwEB
  53685. /zAOBgNVHQ8BAf8EBAMCAQYwbQYIKwYBBQUHAQwEYTBfoV2gWzBZMFcwVRYJaW1hZ2UvZ2lmMCEw
  53686. HzAHBgUrDgMCGgQUj+XTGoasjY5rw8+AatRIGCx7GS4wJRYjaHR0cDovL2xvZ28udmVyaXNpZ24u
  53687. Y29tL3ZzbG9nby5naWYwHQYDVR0OBBYEFLMWkf3upm7ktS5Jj4d4gYDs5bG1MAoGCCqGSM49BAMD
  53688. A2gAMGUCMGYhDBgmYFo4e1ZC4Kf8NoRRkSAsdk1DPcQdhCPQrNZ8NQbOzWm9kA3bbEhCHQ6qQgIx
  53689. AJw9SDkjOVgaFRJZap7v1VmyHVIsmXHNxynfGyphe3HR3vPA5Q06Sqotp9iGKt0uEA==
  53690. -----END CERTIFICATE-----
  53691. NetLock Arany (Class Gold) Főtanúsítvány
  53692. ========================================
  53693. -----BEGIN CERTIFICATE-----
  53694. MIIEFTCCAv2gAwIBAgIGSUEs5AAQMA0GCSqGSIb3DQEBCwUAMIGnMQswCQYDVQQGEwJIVTERMA8G
  53695. A1UEBwwIQnVkYXBlc3QxFTATBgNVBAoMDE5ldExvY2sgS2Z0LjE3MDUGA1UECwwuVGFuw7pzw610
  53696. dsOhbnlraWFkw7NrIChDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzKTE1MDMGA1UEAwwsTmV0TG9jayBB
  53697. cmFueSAoQ2xhc3MgR29sZCkgRsWRdGFuw7pzw610dsOhbnkwHhcNMDgxMjExMTUwODIxWhcNMjgx
  53698. MjA2MTUwODIxWjCBpzELMAkGA1UEBhMCSFUxETAPBgNVBAcMCEJ1ZGFwZXN0MRUwEwYDVQQKDAxO
  53699. ZXRMb2NrIEtmdC4xNzA1BgNVBAsMLlRhbsO6c8OtdHbDoW55a2lhZMOzayAoQ2VydGlmaWNhdGlv
  53700. biBTZXJ2aWNlcykxNTAzBgNVBAMMLE5ldExvY2sgQXJhbnkgKENsYXNzIEdvbGQpIEbFkXRhbsO6
  53701. c8OtdHbDoW55MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxCRec75LbRTDofTjl5Bu
  53702. 0jBFHjzuZ9lk4BqKf8owyoPjIMHj9DrTlF8afFttvzBPhCf2nx9JvMaZCpDyD/V/Q4Q3Y1GLeqVw
  53703. /HpYzY6b7cNGbIRwXdrzAZAj/E4wqX7hJ2Pn7WQ8oLjJM2P+FpD/sLj916jAwJRDC7bVWaaeVtAk
  53704. H3B5r9s5VA1lddkVQZQBr17s9o3x/61k/iCa11zr/qYfCGSji3ZVrR47KGAuhyXoqq8fxmRGILdw
  53705. fzzeSNuWU7c5d+Qa4scWhHaXWy+7GRWF+GmF9ZmnqfI0p6m2pgP8b4Y9VHx2BJtr+UBdADTHLpl1
  53706. neWIA6pN+APSQnbAGwIDAKiLo0UwQzASBgNVHRMBAf8ECDAGAQH/AgEEMA4GA1UdDwEB/wQEAwIB
  53707. BjAdBgNVHQ4EFgQUzPpnk/C2uNClwB7zU/2MU9+D15YwDQYJKoZIhvcNAQELBQADggEBAKt/7hwW
  53708. qZw8UQCgwBEIBaeZ5m8BiFRhbvG5GK1Krf6BQCOUL/t1fC8oS2IkgYIL9WHxHG64YTjrgfpioTta
  53709. YtOUZcTh5m2C+C8lcLIhJsFyUR+MLMOEkMNaj7rP9KdlpeuY0fsFskZ1FSNqb4VjMIDw1Z4fKRzC
  53710. bLBQWV2QWzuoDTDPv31/zvGdg73JRm4gpvlhUbohL3u+pRVjodSVh/GeufOJ8z2FuLjbvrW5Kfna
  53711. NwUASZQDhETnv0Mxz3WLJdH0pmT1kvarBes96aULNmLazAZfNou2XjG4Kvte9nHfRCaexOYNkbQu
  53712. dZWAUWpLMKawYqGT8ZvYzsRjdT9ZR7E=
  53713. -----END CERTIFICATE-----
  53714. Staat der Nederlanden Root CA - G2
  53715. ==================================
  53716. -----BEGIN CERTIFICATE-----
  53717. MIIFyjCCA7KgAwIBAgIEAJiWjDANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  53718. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  53719. Um9vdCBDQSAtIEcyMB4XDTA4MDMyNjExMTgxN1oXDTIwMDMyNTExMDMxMFowWjELMAkGA1UEBhMC
  53720. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  53721. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMVZ
  53722. 5291qj5LnLW4rJ4L5PnZyqtdj7U5EILXr1HgO+EASGrP2uEGQxGZqhQlEq0i6ABtQ8SpuOUfiUtn
  53723. vWFI7/3S4GCI5bkYYCjDdyutsDeqN95kWSpGV+RLufg3fNU254DBtvPUZ5uW6M7XxgpT0GtJlvOj
  53724. CwV3SPcl5XCsMBQgJeN/dVrlSPhOewMHBPqCYYdu8DvEpMfQ9XQ+pV0aCPKbJdL2rAQmPlU6Yiil
  53725. e7Iwr/g3wtG61jj99O9JMDeZJiFIhQGp5Rbn3JBV3w/oOM2ZNyFPXfUib2rFEhZgF1XyZWampzCR
  53726. OME4HYYEhLoaJXhena/MUGDWE4dS7WMfbWV9whUYdMrhfmQpjHLYFhN9C0lK8SgbIHRrxT3dsKpI
  53727. CT0ugpTNGmXZK4iambwYfp/ufWZ8Pr2UuIHOzZgweMFvZ9C+X+Bo7d7iscksWXiSqt8rYGPy5V65
  53728. 48r6f1CGPqI0GAwJaCgRHOThuVw+R7oyPxjMW4T182t0xHJ04eOLoEq9jWYv6q012iDTiIJh8BIi
  53729. trzQ1aTsr1SIJSQ8p22xcik/Plemf1WvbibG/ufMQFxRRIEKeN5KzlW/HdXZt1bv8Hb/C3m1r737
  53730. qWmRRpdogBQ2HbN/uymYNqUg+oJgYjOk7Na6B6duxc8UpufWkjTYgfX8HV2qXB72o007uPc5AgMB
  53731. AAGjgZcwgZQwDwYDVR0TAQH/BAUwAwEB/zBSBgNVHSAESzBJMEcGBFUdIAAwPzA9BggrBgEFBQcC
  53732. ARYxaHR0cDovL3d3dy5wa2lvdmVyaGVpZC5ubC9wb2xpY2llcy9yb290LXBvbGljeS1HMjAOBgNV
  53733. HQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJFoMocVHYnitfGsNig0jQt8YojrMA0GCSqGSIb3DQEBCwUA
  53734. A4ICAQCoQUpnKpKBglBu4dfYszk78wIVCVBR7y29JHuIhjv5tLySCZa59sCrI2AGeYwRTlHSeYAz
  53735. +51IvuxBQ4EffkdAHOV6CMqqi3WtFMTC6GY8ggen5ieCWxjmD27ZUD6KQhgpxrRW/FYQoAUXvQwj
  53736. f/ST7ZwaUb7dRUG/kSS0H4zpX897IZmflZ85OkYcbPnNe5yQzSipx6lVu6xiNGI1E0sUOlWDuYaN
  53737. kqbG9AclVMwWVxJKgnjIFNkXgiYtXSAfea7+1HAWFpWD2DU5/1JddRwWxRNVz0fMdWVSSt7wsKfk
  53738. CpYL+63C4iWEst3kvX5ZbJvw8NjnyvLplzh+ib7M+zkXYT9y2zqR2GUBGR2tUKRXCnxLvJxxcypF
  53739. URmFzI79R6d0lR2o0a9OF7FpJsKqeFdbxU2n5Z4FF5TKsl+gSRiNNOkmbEgeqmiSBeGCc1qb3Adb
  53740. CG19ndeNIdn8FCCqwkXfP+cAslHkwvgFuXkajDTznlvkN1trSt8sV4pAWja63XVECDdCcAz+3F4h
  53741. oKOKwJCcaNpQ5kUQR3i2TtJlycM33+FCY7BXN0Ute4qcvwXqZVUz9zkQxSgqIXobisQk+T8VyJoV
  53742. IPVVYpbtbZNQvOSqeK3Zywplh6ZmwcSBo3c6WB4L7oOLnR7SUqTMHW+wmG2UMbX4cQrcufx9MmDm
  53743. 66+KAQ==
  53744. -----END CERTIFICATE-----
  53745. Hongkong Post Root CA 1
  53746. =======================
  53747. -----BEGIN CERTIFICATE-----
  53748. MIIDMDCCAhigAwIBAgICA+gwDQYJKoZIhvcNAQEFBQAwRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoT
  53749. DUhvbmdrb25nIFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMB4XDTAzMDUx
  53750. NTA1MTMxNFoXDTIzMDUxNTA0NTIyOVowRzELMAkGA1UEBhMCSEsxFjAUBgNVBAoTDUhvbmdrb25n
  53751. IFBvc3QxIDAeBgNVBAMTF0hvbmdrb25nIFBvc3QgUm9vdCBDQSAxMIIBIjANBgkqhkiG9w0BAQEF
  53752. AAOCAQ8AMIIBCgKCAQEArP84tulmAknjorThkPlAj3n54r15/gK97iSSHSL22oVyaf7XPwnU3ZG1
  53753. ApzQjVrhVcNQhrkpJsLj2aDxaQMoIIBFIi1WpztUlVYiWR8o3x8gPW2iNr4joLFutbEnPzlTCeqr
  53754. auh0ssJlXI6/fMN4hM2eFvz1Lk8gKgifd/PFHsSaUmYeSF7jEAaPIpjhZY4bXSNmO7ilMlHIhqqh
  53755. qZ5/dpTCpmy3QfDVyAY45tQM4vM7TG1QjMSDJ8EThFk9nnV0ttgCXjqQesBCNnLsak3c78QA3xMY
  53756. V18meMjWCnl3v/evt3a5pQuEF10Q6m/hq5URX208o1xNg1vysxmKgIsLhwIDAQABoyYwJDASBgNV
  53757. HRMBAf8ECDAGAQH/AgEDMA4GA1UdDwEB/wQEAwIBxjANBgkqhkiG9w0BAQUFAAOCAQEADkbVPK7i
  53758. h9legYsCmEEIjEy82tvuJxuC52pF7BaLT4Wg87JwvVqWuspube5Gi27nKi6Wsxkz67SfqLI37pio
  53759. l7Yutmcn1KZJ/RyTZXaeQi/cImyaT/JaFTmxcdcrUehtHJjA2Sr0oYJ71clBoiMBdDhViw+5Lmei
  53760. IAQ32pwL0xch4I+XeTRvhEgCIDMb5jREn5Fw9IBehEPCKdJsEhTkYY2sEJCehFC78JZvRZ+K88ps
  53761. T/oROhUVRsPNH4NbLUES7VBnQRM9IauUiqpOfMGx+6fWtScvl6tu4B3i0RwsH0Ti/L6RoZz71ilT
  53762. c4afU9hDDl3WY4JxHYB0yvbiAmvZWg==
  53763. -----END CERTIFICATE-----
  53764. SecureSign RootCA11
  53765. ===================
  53766. -----BEGIN CERTIFICATE-----
  53767. MIIDbTCCAlWgAwIBAgIBATANBgkqhkiG9w0BAQUFADBYMQswCQYDVQQGEwJKUDErMCkGA1UEChMi
  53768. SmFwYW4gQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcywgSW5jLjEcMBoGA1UEAxMTU2VjdXJlU2lnbiBS
  53769. b290Q0ExMTAeFw0wOTA0MDgwNDU2NDdaFw0yOTA0MDgwNDU2NDdaMFgxCzAJBgNVBAYTAkpQMSsw
  53770. KQYDVQQKEyJKYXBhbiBDZXJ0aWZpY2F0aW9uIFNlcnZpY2VzLCBJbmMuMRwwGgYDVQQDExNTZWN1
  53771. cmVTaWduIFJvb3RDQTExMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/XeqpRyQBTvL
  53772. TJszi1oURaTnkBbR31fSIRCkF/3frNYfp+TbfPfs37gD2pRY/V1yfIw/XwFndBWW4wI8h9uuywGO
  53773. wvNmxoVF9ALGOrVisq/6nL+k5tSAMJjzDbaTj6nU2DbysPyKyiyhFTOVMdrAG/LuYpmGYz+/3ZMq
  53774. g6h2uRMft85OQoWPIucuGvKVCbIFtUROd6EgvanyTgp9UK31BQ1FT0Zx/Sg+U/sE2C3XZR1KG/rP
  53775. O7AxmjVuyIsG0wCR8pQIZUyxNAYAeoni8McDWc/V1uinMrPmmECGxc0nEovMe863ETxiYAcjPitA
  53776. bpSACW22s293bzUIUPsCh8U+iQIDAQABo0IwQDAdBgNVHQ4EFgQUW/hNT7KlhtQ60vFjmqC+CfZX
  53777. t94wDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEFBQADggEBAKCh
  53778. OBZmLqdWHyGcBvod7bkixTgm2E5P7KN/ed5GIaGHd48HCJqypMWvDzKYC3xmKbabfSVSSUOrTC4r
  53779. bnpwrxYO4wJs+0LmGJ1F2FXI6Dvd5+H0LgscNFxsWEr7jIhQX5Ucv+2rIrVls4W6ng+4reV6G4pQ
  53780. Oh29Dbx7VFALuUKvVaAYga1lme++5Jy/xIWrQbJUb9wlze144o4MjQlJ3WN7WmmWAiGovVJZ6X01
  53781. y8hSyn+B/tlr0/cR7SXf+Of5pPpyl4RTDaXQMhhRdlkUbA/r7F+AjHVDg8OFmP9Mni0N5HeDk061
  53782. lgeLKBObjBmNQSdJQO7e5iNEOdyhIta6A/I=
  53783. -----END CERTIFICATE-----
  53784. Microsec e-Szigno Root CA 2009
  53785. ==============================
  53786. -----BEGIN CERTIFICATE-----
  53787. MIIECjCCAvKgAwIBAgIJAMJ+QwRORz8ZMA0GCSqGSIb3DQEBCwUAMIGCMQswCQYDVQQGEwJIVTER
  53788. MA8GA1UEBwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jv
  53789. c2VjIGUtU3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5o
  53790. dTAeFw0wOTA2MTYxMTMwMThaFw0yOTEyMzAxMTMwMThaMIGCMQswCQYDVQQGEwJIVTERMA8GA1UE
  53791. BwwIQnVkYXBlc3QxFjAUBgNVBAoMDU1pY3Jvc2VjIEx0ZC4xJzAlBgNVBAMMHk1pY3Jvc2VjIGUt
  53792. U3ppZ25vIFJvb3QgQ0EgMjAwOTEfMB0GCSqGSIb3DQEJARYQaW5mb0BlLXN6aWduby5odTCCASIw
  53793. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOn4j/NjrdqG2KfgQvvPkd6mJviZpWNwrZuuyjNA
  53794. fW2WbqEORO7hE52UQlKavXWFdCyoDh2Tthi3jCyoz/tccbna7P7ofo/kLx2yqHWH2Leh5TvPmUpG
  53795. 0IMZfcChEhyVbUr02MelTTMuhTlAdX4UfIASmFDHQWe4oIBhVKZsTh/gnQ4H6cm6M+f+wFUoLAKA
  53796. pxn1ntxVUwOXewdI/5n7N4okxFnMUBBjjqqpGrCEGob5X7uxUG6k0QrM1XF+H6cbfPVTbiJfyyvm
  53797. 1HxdrtbCxkzlBQHZ7Vf8wSN5/PrIJIOV87VqUQHQd9bpEqH5GoP7ghu5sJf0dgYzQ0mg/wu1+rUC
  53798. AwEAAaOBgDB+MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBTLD8bf
  53799. QkPMPcu1SCOhGnqmKrs0aDAfBgNVHSMEGDAWgBTLD8bfQkPMPcu1SCOhGnqmKrs0aDAbBgNVHREE
  53800. FDASgRBpbmZvQGUtc3ppZ25vLmh1MA0GCSqGSIb3DQEBCwUAA4IBAQDJ0Q5eLtXMs3w+y/w9/w0o
  53801. lZMEyL/azXm4Q5DwpL7v8u8hmLzU1F0G9u5C7DBsoKqpyvGvivo/C3NqPuouQH4frlRheesuCDfX
  53802. I/OMn74dseGkddug4lQUsbocKaQY9hK6ohQU4zE1yED/t+AFdlfBHFny+L/k7SViXITwfn4fs775
  53803. tyERzAMBVnCnEJIeGzSBHq2cGsMEPO0CYdYeBvNfOofyK/FFh+U9rNHHV4S9a67c2Pm2G2JwCz02
  53804. yULyMtd6YebS2z3PyKnJm9zbWETXbzivf3jTo60adbocwTZ8jx5tHMN1Rq41Bab2XD0h7lbwyYIi
  53805. LXpUq3DDfSJlgnCW
  53806. -----END CERTIFICATE-----
  53807. GlobalSign Root CA - R3
  53808. =======================
  53809. -----BEGIN CERTIFICATE-----
  53810. MIIDXzCCAkegAwIBAgILBAAAAAABIVhTCKIwDQYJKoZIhvcNAQELBQAwTDEgMB4GA1UECxMXR2xv
  53811. YmFsU2lnbiBSb290IENBIC0gUjMxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkdsb2Jh
  53812. bFNpZ24wHhcNMDkwMzE4MTAwMDAwWhcNMjkwMzE4MTAwMDAwWjBMMSAwHgYDVQQLExdHbG9iYWxT
  53813. aWduIFJvb3QgQ0EgLSBSMzETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFsU2ln
  53814. bjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMwldpB5BngiFvXAg7aEyiie/QV2EcWt
  53815. iHL8RgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsTgHeMCOFJ
  53816. 0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmmKPZpO/bLyCiR5Z2KYVc3
  53817. rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zdQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjl
  53818. OCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2
  53819. xmmFghcCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  53820. FI/wS3+oLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZURUm7
  53821. lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMpjjM5RcOO5LlXbKr8
  53822. EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK6fBdRoyV3XpYKBovHd7NADdBj+1E
  53823. bddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQXmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18
  53824. YIvDQVETI53O9zJrlAGomecsMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7r
  53825. kpeDMdmztcpHWD9f
  53826. -----END CERTIFICATE-----
  53827. Autoridad de Certificacion Firmaprofesional CIF A62634068
  53828. =========================================================
  53829. -----BEGIN CERTIFICATE-----
  53830. MIIGFDCCA/ygAwIBAgIIU+w77vuySF8wDQYJKoZIhvcNAQEFBQAwUTELMAkGA1UEBhMCRVMxQjBA
  53831. BgNVBAMMOUF1dG9yaWRhZCBkZSBDZXJ0aWZpY2FjaW9uIEZpcm1hcHJvZmVzaW9uYWwgQ0lGIEE2
  53832. MjYzNDA2ODAeFw0wOTA1MjAwODM4MTVaFw0zMDEyMzEwODM4MTVaMFExCzAJBgNVBAYTAkVTMUIw
  53833. QAYDVQQDDDlBdXRvcmlkYWQgZGUgQ2VydGlmaWNhY2lvbiBGaXJtYXByb2Zlc2lvbmFsIENJRiBB
  53834. NjI2MzQwNjgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDKlmuO6vj78aI14H9M2uDD
  53835. Utd9thDIAl6zQyrET2qyyhxdKJp4ERppWVevtSBC5IsP5t9bpgOSL/UR5GLXMnE42QQMcas9UX4P
  53836. B99jBVzpv5RvwSmCwLTaUbDBPLutN0pcyvFLNg4kq7/DhHf9qFD0sefGL9ItWY16Ck6WaVICqjaY
  53837. 7Pz6FIMMNx/Jkjd/14Et5cS54D40/mf0PmbR0/RAz15iNA9wBj4gGFrO93IbJWyTdBSTo3OxDqqH
  53838. ECNZXyAFGUftaI6SEspd/NYrspI8IM/hX68gvqB2f3bl7BqGYTM+53u0P6APjqK5am+5hyZvQWyI
  53839. plD9amML9ZMWGxmPsu2bm8mQ9QEM3xk9Dz44I8kvjwzRAv4bVdZO0I08r0+k8/6vKtMFnXkIoctX
  53840. MbScyJCyZ/QYFpM6/EfY0XiWMR+6KwxfXZmtY4laJCB22N/9q06mIqqdXuYnin1oKaPnirjaEbsX
  53841. LZmdEyRG98Xi2J+Of8ePdG1asuhy9azuJBCtLxTa/y2aRnFHvkLfuwHb9H/TKI8xWVvTyQKmtFLK
  53842. bpf7Q8UIJm+K9Lv9nyiqDdVF8xM6HdjAeI9BZzwelGSuewvF6NkBiDkal4ZkQdU7hwxu+g/GvUgU
  53843. vzlN1J5Bto+WHWOWk9mVBngxaJ43BjuAiUVhOSPHG0SjFeUc+JIwuwIDAQABo4HvMIHsMBIGA1Ud
  53844. EwEB/wQIMAYBAf8CAQEwDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRlzeurNR4APn7VdMActHNH
  53845. DhpkLzCBpgYDVR0gBIGeMIGbMIGYBgRVHSAAMIGPMC8GCCsGAQUFBwIBFiNodHRwOi8vd3d3LmZp
  53846. cm1hcHJvZmVzaW9uYWwuY29tL2NwczBcBggrBgEFBQcCAjBQHk4AUABhAHMAZQBvACAAZABlACAA
  53847. bABhACAAQgBvAG4AYQBuAG8AdgBhACAANAA3ACAAQgBhAHIAYwBlAGwAbwBuAGEAIAAwADgAMAAx
  53848. ADcwDQYJKoZIhvcNAQEFBQADggIBABd9oPm03cXF661LJLWhAqvdpYhKsg9VSytXjDvlMd3+xDLx
  53849. 51tkljYyGOylMnfX40S2wBEqgLk9am58m9Ot/MPWo+ZkKXzR4Tgegiv/J2Wv+xYVxC5xhOW1//qk
  53850. R71kMrv2JYSiJ0L1ILDCExARzRAVukKQKtJE4ZYm6zFIEv0q2skGz3QeqUvVhyj5eTSSPi5E6PaP
  53851. T481PyWzOdxjKpBrIF/EUhJOlywqrJ2X3kjyo2bbwtKDlaZmp54lD+kLM5FlClrD2VQS3a/DTg4f
  53852. Jl4N3LON7NWBcN7STyQF82xO9UxJZo3R/9ILJUFI/lGExkKvgATP0H5kSeTy36LssUzAKh3ntLFl
  53853. osS88Zj0qnAHY7S42jtM+kAiMFsRpvAFDsYCA0irhpuF3dvd6qJ2gHN99ZwExEWN57kci57q13XR
  53854. crHedUTnQn3iV2t93Jm8PYMo6oCTjcVMZcFwgbg4/EMxsvYDNEeyrPsiBsse3RdHHF9mudMaotoR
  53855. saS8I8nkvof/uZS2+F0gStRf571oe2XyFR7SOqkt6dhrJKyXWERHrVkY8SFlcN7ONGCoQPHzPKTD
  53856. KCOM/iczQ0CgFzzr6juwcqajuUpLXhZI9LK8yIySxZ2frHI2vDSANGupi5LAuBft7HZT9SQBjLMi
  53857. 6Et8Vcad+qMUu2WFbm5PEn4KPJ2V
  53858. -----END CERTIFICATE-----
  53859. Izenpe.com
  53860. ==========
  53861. -----BEGIN CERTIFICATE-----
  53862. MIIF8TCCA9mgAwIBAgIQALC3WhZIX7/hy/WL1xnmfTANBgkqhkiG9w0BAQsFADA4MQswCQYDVQQG
  53863. EwJFUzEUMBIGA1UECgwLSVpFTlBFIFMuQS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wHhcNMDcxMjEz
  53864. MTMwODI4WhcNMzcxMjEzMDgyNzI1WjA4MQswCQYDVQQGEwJFUzEUMBIGA1UECgwLSVpFTlBFIFMu
  53865. QS4xEzARBgNVBAMMCkl6ZW5wZS5jb20wggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDJ
  53866. 03rKDx6sp4boFmVqscIbRTJxldn+EFvMr+eleQGPicPK8lVx93e+d5TzcqQsRNiekpsUOqHnJJAK
  53867. ClaOxdgmlOHZSOEtPtoKct2jmRXagaKH9HtuJneJWK3W6wyyQXpzbm3benhB6QiIEn6HLmYRY2xU
  53868. +zydcsC8Lv/Ct90NduM61/e0aL6i9eOBbsFGb12N4E3GVFWJGjMxCrFXuaOKmMPsOzTFlUFpfnXC
  53869. PCDFYbpRR6AgkJOhkEvzTnyFRVSa0QUmQbC1TR0zvsQDyCV8wXDbO/QJLVQnSKwv4cSsPsjLkkxT
  53870. OTcj7NMB+eAJRE1NZMDhDVqHIrytG6P+JrUV86f8hBnp7KGItERphIPzidF0BqnMC9bC3ieFUCbK
  53871. F7jJeodWLBoBHmy+E60QrLUk9TiRodZL2vG70t5HtfG8gfZZa88ZU+mNFctKy6lvROUbQc/hhqfK
  53872. 0GqfvEyNBjNaooXlkDWgYlwWTvDjovoDGrQscbNYLN57C9saD+veIR8GdwYDsMnvmfzAuU8Lhij+
  53873. 0rnq49qlw0dpEuDb8PYZi+17cNcC1u2HGCgsBCRMd+RIihrGO5rUD8r6ddIBQFqNeb+Lz0vPqhbB
  53874. leStTIo+F5HUsWLlguWABKQDfo2/2n+iD5dPDNMN+9fR5XJ+HMh3/1uaD7euBUbl8agW7EekFwID
  53875. AQABo4H2MIHzMIGwBgNVHREEgagwgaWBD2luZm9AaXplbnBlLmNvbaSBkTCBjjFHMEUGA1UECgw+
  53876. SVpFTlBFIFMuQS4gLSBDSUYgQTAxMzM3MjYwLVJNZXJjLlZpdG9yaWEtR2FzdGVpeiBUMTA1NSBG
  53877. NjIgUzgxQzBBBgNVBAkMOkF2ZGEgZGVsIE1lZGl0ZXJyYW5lbyBFdG9yYmlkZWEgMTQgLSAwMTAx
  53878. MCBWaXRvcmlhLUdhc3RlaXowDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  53879. BBYEFB0cZQ6o8iV7tJHP5LGx5r1VdGwFMA0GCSqGSIb3DQEBCwUAA4ICAQB4pgwWSp9MiDrAyw6l
  53880. Fn2fuUhfGI8NYjb2zRlrrKvV9pF9rnHzP7MOeIWblaQnIUdCSnxIOvVFfLMMjlF4rJUT3sb9fbga
  53881. kEyrkgPH7UIBzg/YsfqikuFgba56awmqxinuaElnMIAkejEWOVt+8Rwu3WwJrfIxwYJOubv5vr8q
  53882. hT/AQKM6WfxZSzwoJNu0FXWuDYi6LnPAvViH5ULy617uHjAimcs30cQhbIHsvm0m5hzkQiCeR7Cs
  53883. g1lwLDXWrzY0tM07+DKo7+N4ifuNRSzanLh+QBxh5z6ikixL8s36mLYp//Pye6kfLqCTVyvehQP5
  53884. aTfLnnhqBbTFMXiJ7HqnheG5ezzevh55hM6fcA5ZwjUukCox2eRFekGkLhObNA5me0mrZJfQRsN5
  53885. nXJQY6aYWwa9SG3YOYNw6DXwBdGqvOPbyALqfP2C2sJbUjWumDqtujWTI6cfSN01RpiyEGjkpTHC
  53886. ClguGYEQyVB1/OpaFs4R1+7vUIgtYf8/QnMFlEPVjjxOAToZpR9GTnfQXeWBIiGH/pR9hNiTrdZo
  53887. Q0iy2+tzJOeRf1SktoA+naM8THLCV8Sg1Mw4J87VBp6iSNnpn86CcDaTmjvfliHjWbcM2pE38P1Z
  53888. WrOZyGlsQyYBNWNgVYkDOnXYukrZVP/u3oDYLdE41V4tC5h9Pmzb/CaIxw==
  53889. -----END CERTIFICATE-----
  53890. Chambers of Commerce Root - 2008
  53891. ================================
  53892. -----BEGIN CERTIFICATE-----
  53893. MIIHTzCCBTegAwIBAgIJAKPaQn6ksa7aMA0GCSqGSIb3DQEBBQUAMIGuMQswCQYDVQQGEwJFVTFD
  53894. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53895. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53896. QS4xKTAnBgNVBAMTIENoYW1iZXJzIG9mIENvbW1lcmNlIFJvb3QgLSAyMDA4MB4XDTA4MDgwMTEy
  53897. Mjk1MFoXDTM4MDczMTEyMjk1MFowga4xCzAJBgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNl
  53898. ZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNhbWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQF
  53899. EwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJl
  53900. cnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDgwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC
  53901. AQCvAMtwNyuAWko6bHiUfaN/Gh/2NdW928sNRHI+JrKQUrpjOyhYb6WzbZSm891kDFX29ufyIiKA
  53902. XuFixrYp4YFs8r/lfTJqVKAyGVn+H4vXPWCGhSRv4xGzdz4gljUha7MI2XAuZPeEklPWDrCQiorj
  53903. h40G072QDuKZoRuGDtqaCrsLYVAGUvGef3bsyw/QHg3PmTA9HMRFEFis1tPo1+XqxQEHd9ZR5gN/
  53904. ikilTWh1uem8nk4ZcfUyS5xtYBkL+8ydddy/Js2Pk3g5eXNeJQ7KXOt3EgfLZEFHcpOrUMPrCXZk
  53905. NNI5t3YRCQ12RcSprj1qr7V9ZS+UWBDsXHyvfuK2GNnQm05aSd+pZgvMPMZ4fKecHePOjlO+Bd5g
  53906. D2vlGts/4+EhySnB8esHnFIbAURRPHsl18TlUlRdJQfKFiC4reRB7noI/plvg6aRArBsNlVq5331
  53907. lubKgdaX8ZSD6e2wsWsSaR6s+12pxZjptFtYer49okQ6Y1nUCyXeG0+95QGezdIp1Z8XGQpvvwyQ
  53908. 0wlf2eOKNcx5Wk0ZN5K3xMGtr/R5JJqyAQuxr1yW84Ay+1w9mPGgP0revq+ULtlVmhduYJ1jbLhj
  53909. ya6BXBg14JC7vjxPNyK5fuvPnnchpj04gftI2jE9K+OJ9dC1vX7gUMQSibMjmhAxhduub+84Mxh2
  53910. EQIDAQABo4IBbDCCAWgwEgYDVR0TAQH/BAgwBgEB/wIBDDAdBgNVHQ4EFgQU+SSsD7K1+HnA+mCI
  53911. G8TZTQKeFxkwgeMGA1UdIwSB2zCB2IAU+SSsD7K1+HnA+mCIG8TZTQKeFxmhgbSkgbEwga4xCzAJ
  53912. BgNVBAYTAkVVMUMwQQYDVQQHEzpNYWRyaWQgKHNlZSBjdXJyZW50IGFkZHJlc3MgYXQgd3d3LmNh
  53913. bWVyZmlybWEuY29tL2FkZHJlc3MpMRIwEAYDVQQFEwlBODI3NDMyODcxGzAZBgNVBAoTEkFDIENh
  53914. bWVyZmlybWEgUy5BLjEpMCcGA1UEAxMgQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdCAtIDIwMDiC
  53915. CQCj2kJ+pLGu2jAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUH
  53916. AgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAJASryI1
  53917. wqM58C7e6bXpeHxIvj99RZJe6dqxGfwWPJ+0W2aeaufDuV2I6A+tzyMP3iU6XsxPpcG1Lawk0lgH
  53918. 3qLPaYRgM+gQDROpI9CF5Y57pp49chNyM/WqfcZjHwj0/gF/JM8rLFQJ3uIrbZLGOU8W6jx+ekbU
  53919. RWpGqOt1glanq6B8aBMz9p0w8G8nOSQjKpD9kCk18pPfNKXG9/jvjA9iSnyu0/VU+I22mlaHFoI6
  53920. M6taIgj3grrqLuBHmrS1RaMFO9ncLkVAO+rcf+g769HsJtg1pDDFOqxXnrN2pSB7+R5KBWIBpih1
  53921. YJeSDW4+TTdDDZIVnBgizVGZoCkaPF+KMjNbMMeJL0eYD6MDxvbxrN8y8NmBGuScvfaAFPDRLLmF
  53922. 9dijscilIeUcE5fuDr3fKanvNFNb0+RqE4QGtjICxFKuItLcsiFCGtpA8CnJ7AoMXOLQusxI0zcK
  53923. zBIKinmwPQN/aUv0NCB9szTqjktk9T79syNnFQ0EuPAtwQlRPLJsFfClI9eDdOTlLsn+mCdCxqvG
  53924. nrDQWzilm1DefhiYtUU79nm06PcaewaD+9CL2rvHvRirCG88gGtAPxkZumWK5r7VXNM21+9AUiRg
  53925. OGcEMeyP84LG3rlV8zsxkVrctQgVrXYlCg17LofiDKYGvCYQbTed7N14jHyAxfDZd0jQ
  53926. -----END CERTIFICATE-----
  53927. Global Chambersign Root - 2008
  53928. ==============================
  53929. -----BEGIN CERTIFICATE-----
  53930. MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYDVQQGEwJFVTFD
  53931. MEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNv
  53932. bS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMu
  53933. QS4xJzAlBgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMx
  53934. NDBaFw0zODA3MzExMjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUg
  53935. Y3VycmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ
  53936. QTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD
  53937. aGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMDf
  53938. VtPkOpt2RbQT2//BthmLN0EYlVJH6xedKYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXf
  53939. XjaOcNFccUMd2drvXNL7G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0
  53940. ZJJ0YPP2zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4ddPB
  53941. /gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyGHoiMvvKRhI9lNNgA
  53942. TH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2Id3UwD2ln58fQ1DJu7xsepeY7s2M
  53943. H/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3VyJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfe
  53944. Ox2YItaswTXbo6Al/3K1dh3ebeksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSF
  53945. HTynyQbehP9r6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh
  53946. wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsogzCtLkykPAgMB
  53947. AAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQWBBS5CcqcHtvTbDprru1U8VuT
  53948. BjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDprru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UE
  53949. BhMCRVUxQzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJm
  53950. aXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJm
  53951. aXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiCCQDJzdPp
  53952. 1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCowKAYIKwYBBQUHAgEWHGh0
  53953. dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZIhvcNAQEFBQADggIBAICIf3DekijZBZRG
  53954. /5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZUohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6
  53955. ReAJ3spED8IXDneRRXozX1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/s
  53956. dZ7LoR/xfxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVza2Mg
  53957. 9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yydYhz2rXzdpjEetrHH
  53958. foUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMdSqlapskD7+3056huirRXhOukP9Du
  53959. qqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9OAP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETr
  53960. P3iZ8ntxPjzxmKfFGBI/5rsoM0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVq
  53961. c5iJWzouE4gev8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z
  53962. 09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B
  53963. -----END CERTIFICATE-----
  53964. Go Daddy Root Certificate Authority - G2
  53965. ========================================
  53966. -----BEGIN CERTIFICATE-----
  53967. MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53968. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoTEUdvRGFkZHkuY29tLCBJbmMu
  53969. MTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRpZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5
  53970. MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6
  53971. b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8G
  53972. A1UEAxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZI
  53973. hvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKDE6bFIEMBO4Tx5oVJnyfq
  53974. 9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD
  53975. +qK+ihVqf94Lw7YZFAXK6sOoBJQ7RnwyDfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutd
  53976. fMh8+7ArU6SSYmlRJQVhGkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMl
  53977. NAJWJwGRtDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEAAaNC
  53978. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFDqahQcQZyi27/a9
  53979. BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmXWWcDYfF+OwYxdS2hII5PZYe096ac
  53980. vNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r
  53981. 5N9ss4UXnT3ZJE95kTXWXwTrgIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYV
  53982. N8Gb5DKj7Tjo2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO
  53983. LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI4uJEvlz36hz1
  53984. -----END CERTIFICATE-----
  53985. Starfield Root Certificate Authority - G2
  53986. =========================================
  53987. -----BEGIN CERTIFICATE-----
  53988. MIID3TCCAsWgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBjzELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  53989. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  53990. b2dpZXMsIEluYy4xMjAwBgNVBAMTKVN0YXJmaWVsZCBSb290IENlcnRpZmljYXRlIEF1dGhvcml0
  53991. eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgY8xCzAJBgNVBAYTAlVTMRAw
  53992. DgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxTdGFyZmllbGQg
  53993. VGVjaG5vbG9naWVzLCBJbmMuMTIwMAYDVQQDEylTdGFyZmllbGQgUm9vdCBDZXJ0aWZpY2F0ZSBB
  53994. dXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3twQP89o/8ArFv
  53995. W59I2Z154qK3A2FWGMNHttfKPTUuiUP3oWmb3ooa/RMgnLRJdzIpVv257IzdIvpy3Cdhl+72WoTs
  53996. bhm5iSzchFvVdPtrX8WJpRBSiUZV9Lh1HOZ/5FSuS/hVclcCGfgXcVnrHigHdMWdSL5stPSksPNk
  53997. N3mSwOxGXn/hbVNMYq/NHwtjuzqd+/x5AJhhdM8mgkBj87JyahkNmcrUDnXMN/uLicFZ8WJ/X7Nf
  53998. ZTD4p7dNdloedl40wOiWVpmKs/B/pM293DIxfJHP4F8R+GuqSVzRmZTRouNjWwl2tVZi4Ut0HZbU
  53999. JtQIBFnQmA4O5t78w+wfkPECAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54000. AQYwHQYDVR0OBBYEFHwMMh+n2TB/xH1oo2Kooc6rB1snMA0GCSqGSIb3DQEBCwUAA4IBAQARWfol
  54001. TwNvlJk7mh+ChTnUdgWUXuEok21iXQnCoKjUsHU48TRqneSfioYmUeYs0cYtbpUgSpIB7LiKZ3sx
  54002. 4mcujJUDJi5DnUox9g61DLu34jd/IroAow57UvtruzvE03lRTs2Q9GcHGcg8RnoNAX3FWOdt5oUw
  54003. F5okxBDgBPfg8n/Uqgr/Qh037ZTlZFkSIHc40zI+OIF1lnP6aI+xy84fxez6nH7PfrHxBy22/L/K
  54004. pL/QlwVKvOoYKAKQvVR4CSFx09F9HdkWsKlhPdAKACL8x3vLCWRFCztAgfd9fDL1mMpYjn0q7pBZ
  54005. c2T5NnReJaH1ZgUufzkVqSr7UIuOhWn0
  54006. -----END CERTIFICATE-----
  54007. Starfield Services Root Certificate Authority - G2
  54008. ==================================================
  54009. -----BEGIN CERTIFICATE-----
  54010. MIID7zCCAtegAwIBAgIBADANBgkqhkiG9w0BAQsFADCBmDELMAkGA1UEBhMCVVMxEDAOBgNVBAgT
  54011. B0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxJTAjBgNVBAoTHFN0YXJmaWVsZCBUZWNobm9s
  54012. b2dpZXMsIEluYy4xOzA5BgNVBAMTMlN0YXJmaWVsZCBTZXJ2aWNlcyBSb290IENlcnRpZmljYXRl
  54013. IEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIzNTk1OVowgZgxCzAJBgNV
  54014. BAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQHEwpTY290dHNkYWxlMSUwIwYDVQQKExxT
  54015. dGFyZmllbGQgVGVjaG5vbG9naWVzLCBJbmMuMTswOQYDVQQDEzJTdGFyZmllbGQgU2VydmljZXMg
  54016. Um9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
  54017. AQoCggEBANUMOsQq+U7i9b4Zl1+OiFOxHz/Lz58gE20pOsgPfTz3a3Y4Y9k2YKibXlwAgLIvWX/2
  54018. h/klQ4bnaRtSmpDhcePYLQ1Ob/bISdm28xpWriu2dBTrz/sm4xq6HZYuajtYlIlHVv8loJNwU4Pa
  54019. hHQUw2eeBGg6345AWh1KTs9DkTvnVtYAcMtS7nt9rjrnvDH5RfbCYM8TWQIrgMw0R9+53pBlbQLP
  54020. LJGmpufehRhJfGZOozptqbXuNC66DQO4M99H67FrjSXZm86B0UVGMpZwh94CDklDhbZsc7tk6mFB
  54021. rMnUVN+HL8cisibMn1lUaJ/8viovxFUcdUBgF4UCVTmLfwUCAwEAAaNCMEAwDwYDVR0TAQH/BAUw
  54022. AwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFJxfAN+qAdcwKziIorhtSpzyEZGDMA0GCSqG
  54023. SIb3DQEBCwUAA4IBAQBLNqaEd2ndOxmfZyMIbw5hyf2E3F/YNoHN2BtBLZ9g3ccaaNnRbobhiCPP
  54024. E95Dz+I0swSdHynVv/heyNXBve6SbzJ08pGCL72CQnqtKrcgfU28elUSwhXqvfdqlS5sdJ/PHLTy
  54025. xQGjhdByPq1zqwubdQxtRbeOlKyWN7Wg0I8VRw7j6IPdj/3vQQF3zCepYoUz8jcI73HPdwbeyBkd
  54026. iEDPfUYd/x7H4c7/I9vG+o1VTqkC50cRRj70/b17KSa7qWFiNyi2LSr2EIZkyXCn0q23KXB56jza
  54027. YyWf/Wi3MOxw+3WKt21gZ7IeyLnp2KhvAotnDU0mV3HaIPzBSlCNsSi6
  54028. -----END CERTIFICATE-----
  54029. AffirmTrust Commercial
  54030. ======================
  54031. -----BEGIN CERTIFICATE-----
  54032. MIIDTDCCAjSgAwIBAgIId3cGJyapsXwwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCVVMxFDAS
  54033. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMB4XDTEw
  54034. MDEyOTE0MDYwNloXDTMwMTIzMTE0MDYwNlowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  54035. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBDb21tZXJjaWFsMIIBIjANBgkqhkiG9w0BAQEF
  54036. AAOCAQ8AMIIBCgKCAQEA9htPZwcroRX1BiLLHwGy43NFBkRJLLtJJRTWzsO3qyxPxkEylFf6Eqdb
  54037. DuKPHx6GGaeqtS25Xw2Kwq+FNXkyLbscYjfysVtKPcrNcV/pQr6U6Mje+SJIZMblq8Yrba0F8PrV
  54038. C8+a5fBQpIs7R6UjW3p6+DM/uO+Zl+MgwdYoic+U+7lF7eNAFxHUdPALMeIrJmqbTFeurCA+ukV6
  54039. BfO9m2kVrn1OIGPENXY6BwLJN/3HR+7o8XYdcxXyl6S1yHp52UKqK39c/s4mT6NmgTWvRLpUHhww
  54040. MmWd5jyTXlBOeuM61G7MGvv50jeuJCqrVwMiKA1JdX+3KNp1v47j3A55MQIDAQABo0IwQDAdBgNV
  54041. HQ4EFgQUnZPGU4teyq8/nx4P5ZmVvCT2lI8wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54042. AQYwDQYJKoZIhvcNAQELBQADggEBAFis9AQOzcAN/wr91LoWXym9e2iZWEnStB03TX8nfUYGXUPG
  54043. hi4+c7ImfU+TqbbEKpqrIZcUsd6M06uJFdhrJNTxFq7YpFzUf1GO7RgBsZNjvbz4YYCanrHOQnDi
  54044. qX0GJX0nof5v7LMeJNrjS1UaADs1tDvZ110w/YETifLCBivtZ8SOyUOyXGsViQK8YvxO8rUzqrJv
  54045. 0wqiUOP2O+guRMLbZjipM1ZI8W0bM40NjD9gN53Tym1+NH4Nn3J2ixufcv1SNUFFApYvHLKac0kh
  54046. sUlHRUe072o0EclNmsxZt9YCnlpOZbWUrhvfKbAW8b8Angc6F2S1BLUjIZkKlTuXfO8=
  54047. -----END CERTIFICATE-----
  54048. AffirmTrust Networking
  54049. ======================
  54050. -----BEGIN CERTIFICATE-----
  54051. MIIDTDCCAjSgAwIBAgIIfE8EORzUmS0wDQYJKoZIhvcNAQEFBQAwRDELMAkGA1UEBhMCVVMxFDAS
  54052. BgNVBAoMC0FmZmlybVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMB4XDTEw
  54053. MDEyOTE0MDgyNFoXDTMwMTIzMTE0MDgyNFowRDELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmly
  54054. bVRydXN0MR8wHQYDVQQDDBZBZmZpcm1UcnVzdCBOZXR3b3JraW5nMIIBIjANBgkqhkiG9w0BAQEF
  54055. AAOCAQ8AMIIBCgKCAQEAtITMMxcua5Rsa2FSoOujz3mUTOWUgJnLVWREZY9nZOIG41w3SfYvm4SE
  54056. Hi3yYJ0wTsyEheIszx6e/jarM3c1RNg1lho9Nuh6DtjVR6FqaYvZ/Ls6rnla1fTWcbuakCNrmreI
  54057. dIcMHl+5ni36q1Mr3Lt2PpNMCAiMHqIjHNRqrSK6mQEubWXLviRmVSRLQESxG9fhwoXA3hA/Pe24
  54058. /PHxI1Pcv2WXb9n5QHGNfb2V1M6+oF4nI979ptAmDgAp6zxG8D1gvz9Q0twmQVGeFDdCBKNwV6gb
  54059. h+0t+nvujArjqWaJGctB+d1ENmHP4ndGyH329JKBNv3bNPFyfvMMFr20FQIDAQABo0IwQDAdBgNV
  54060. HQ4EFgQUBx/S55zawm6iQLSwelAQUHTEyL0wDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  54061. AQYwDQYJKoZIhvcNAQEFBQADggEBAIlXshZ6qML91tmbmzTCnLQyFE2npN/svqe++EPbkTfOtDIu
  54062. UFUaNU52Q3Eg75N3ThVwLofDwR1t3Mu1J9QsVtFSUzpE0nPIxBsFZVpikpzuQY0x2+c06lkh1QF6
  54063. 12S4ZDnNye2v7UsDSKegmQGA3GWjNq5lWUhPgkvIZfFXHeVZLgo/bNjR9eUJtGxUAArgFU2HdW23
  54064. WJZa3W3SAKD0m0i+wzekujbgfIeFlxoVot4uolu9rxj5kFDNcFn4J2dHy8egBzp90SxdbBk6ZrV9
  54065. /ZFvgrG+CJPbFEfxojfHRZ48x3evZKiT3/Zpg4Jg8klCNO1aAFSFHBY2kgxc+qatv9s=
  54066. -----END CERTIFICATE-----
  54067. AffirmTrust Premium
  54068. ===================
  54069. -----BEGIN CERTIFICATE-----
  54070. MIIFRjCCAy6gAwIBAgIIbYwURrGmCu4wDQYJKoZIhvcNAQEMBQAwQTELMAkGA1UEBhMCVVMxFDAS
  54071. BgNVBAoMC0FmZmlybVRydXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMB4XDTEwMDEy
  54072. OTE0MTAzNloXDTQwMTIzMTE0MTAzNlowQTELMAkGA1UEBhMCVVMxFDASBgNVBAoMC0FmZmlybVRy
  54073. dXN0MRwwGgYDVQQDDBNBZmZpcm1UcnVzdCBQcmVtaXVtMIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54074. MIICCgKCAgEAxBLfqV/+Qd3d9Z+K4/as4Tx4mrzY8H96oDMq3I0gW64tb+eT2TZwamjPjlGjhVtn
  54075. BKAQJG9dKILBl1fYSCkTtuG+kU3fhQxTGJoeJKJPj/CihQvL9Cl/0qRY7iZNyaqoe5rZ+jjeRFcV
  54076. 5fiMyNlI4g0WJx0eyIOFJbe6qlVBzAMiSy2RjYvmia9mx+n/K+k8rNrSs8PhaJyJ+HoAVt70VZVs
  54077. +7pk3WKL3wt3MutizCaam7uqYoNMtAZ6MMgpv+0GTZe5HMQxK9VfvFMSF5yZVylmd2EhMQcuJUmd
  54078. GPLu8ytxjLW6OQdJd/zvLpKQBY0tL3d770O/Nbua2Plzpyzy0FfuKE4mX4+QaAkvuPjcBukumj5R
  54079. p9EixAqnOEhss/n/fauGV+O61oV4d7pD6kh/9ti+I20ev9E2bFhc8e6kGVQa9QPSdubhjL08s9NI
  54080. S+LI+H+SqHZGnEJlPqQewQcDWkYtuJfzt9WyVSHvutxMAJf7FJUnM7/oQ0dG0giZFmA7mn7S5u04
  54081. 6uwBHjxIVkkJx0w3AJ6IDsBz4W9m6XJHMD4Q5QsDyZpCAGzFlH5hxIrff4IaC1nEWTJ3s7xgaVY5
  54082. /bQGeyzWZDbZvUjthB9+pSKPKrhC9IK31FOQeE4tGv2Bb0TXOwF0lkLgAOIua+rF7nKsu7/+6qqo
  54083. +Nz2snmKtmcCAwEAAaNCMEAwHQYDVR0OBBYEFJ3AZ6YMItkm9UWrpmVSESfYRaxjMA8GA1UdEwEB
  54084. /wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBDAUAA4ICAQCzV00QYk465KzquByv
  54085. MiPIs0laUZx2KI15qldGF9X1Uva3ROgIRL8YhNILgM3FEv0AVQVhh0HctSSePMTYyPtwni94loMg
  54086. Nt58D2kTiKV1NpgIpsbfrM7jWNa3Pt668+s0QNiigfV4Py/VpfzZotReBA4Xrf5B8OWycvpEgjNC
  54087. 6C1Y91aMYj+6QrCcDFx+LmUmXFNPALJ4fqENmS2NuB2OosSw/WDQMKSOyARiqcTtNd56l+0OOF6S
  54088. L5Nwpamcb6d9Ex1+xghIsV5n61EIJenmJWtSKZGc0jlzCFfemQa0W50QBuHCAKi4HEoCChTQwUHK
  54089. +4w1IX2COPKpVJEZNZOUbWo6xbLQu4mGk+ibyQ86p3q4ofB4Rvr8Ny/lioTz3/4E2aFooC8k4gmV
  54090. BtWVyuEklut89pMFu+1z6S3RdTnX5yTb2E5fQ4+e0BQ5v1VwSJlXMbSc7kqYA5YwH2AG7hsj/oFg
  54091. IxpHYoWlzBk0gG+zrBrjn/B7SK3VAdlntqlyk+otZrWyuOQ9PLLvTIzq6we/qzWaVYa8GKa1qF60
  54092. g2xraUDTn9zxw2lrueFtCfTxqlB2Cnp9ehehVZZCmTEJ3WARjQUwfuaORtGdFNrHF+QFlozEJLUb
  54093. zxQHskD4o55BhrwE0GuWyCqANP2/7waj3VjFhT0+j/6eKeC2uAloGRwYQw==
  54094. -----END CERTIFICATE-----
  54095. AffirmTrust Premium ECC
  54096. =======================
  54097. -----BEGIN CERTIFICATE-----
  54098. MIIB/jCCAYWgAwIBAgIIdJclisc/elQwCgYIKoZIzj0EAwMwRTELMAkGA1UEBhMCVVMxFDASBgNV
  54099. BAoMC0FmZmlybVRydXN0MSAwHgYDVQQDDBdBZmZpcm1UcnVzdCBQcmVtaXVtIEVDQzAeFw0xMDAx
  54100. MjkxNDIwMjRaFw00MDEyMzExNDIwMjRaMEUxCzAJBgNVBAYTAlVTMRQwEgYDVQQKDAtBZmZpcm1U
  54101. cnVzdDEgMB4GA1UEAwwXQWZmaXJtVHJ1c3QgUHJlbWl1bSBFQ0MwdjAQBgcqhkjOPQIBBgUrgQQA
  54102. IgNiAAQNMF4bFZ0D0KF5Nbc6PJJ6yhUczWLznCZcBz3lVPqj1swS6vQUX+iOGasvLkjmrBhDeKzQ
  54103. N8O9ss0s5kfiGuZjuD0uL3jET9v0D6RoTFVya5UdThhClXjMNzyR4ptlKymjQjBAMB0GA1UdDgQW
  54104. BBSaryl6wBE1NSZRMADDav5A1a7WPDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAK
  54105. BggqhkjOPQQDAwNnADBkAjAXCfOHiFBar8jAQr9HX/VsaobgxCd05DhT1wV/GzTjxi+zygk8N53X
  54106. 57hG8f2h4nECMEJZh0PUUd+60wkyWs6Iflc9nF9Ca/UHLbXwgpP5WW+uZPpY5Yse42O+tYHNbwKM
  54107. eQ==
  54108. -----END CERTIFICATE-----
  54109. Certum Trusted Network CA
  54110. =========================
  54111. -----BEGIN CERTIFICATE-----
  54112. MIIDuzCCAqOgAwIBAgIDBETAMA0GCSqGSIb3DQEBBQUAMH4xCzAJBgNVBAYTAlBMMSIwIAYDVQQK
  54113. ExlVbml6ZXRvIFRlY2hub2xvZ2llcyBTLkEuMScwJQYDVQQLEx5DZXJ0dW0gQ2VydGlmaWNhdGlv
  54114. biBBdXRob3JpdHkxIjAgBgNVBAMTGUNlcnR1bSBUcnVzdGVkIE5ldHdvcmsgQ0EwHhcNMDgxMDIy
  54115. MTIwNzM3WhcNMjkxMjMxMTIwNzM3WjB+MQswCQYDVQQGEwJQTDEiMCAGA1UEChMZVW5pemV0byBU
  54116. ZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  54117. MSIwIAYDVQQDExlDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENBMIIBIjANBgkqhkiG9w0BAQEFAAOC
  54118. AQ8AMIIBCgKCAQEA4/t9o3K6wvDJFIf1awFO4W5AB7ptJ11/91sts1rHUV+rpDKmYYe2bg+G0jAC
  54119. l/jXaVehGDldamR5xgFZrDwxSjh80gTSSyjoIF87B6LMTXPb865Px1bVWqeWifrzq2jUI4ZZJ88J
  54120. J7ysbnKDHDBy3+Ci6dLhdHUZvSqeexVUBBvXQzmtVSjF4hq79MDkrjhJM8x2hZ85RdKknvISjFH4
  54121. fOQtf/WsX+sWn7Et0brMkUJ3TCXJkDhv2/DM+44el1k+1WBO5gUo7Ul5E0u6SNsv+XLTOcr+H9g0
  54122. cvW0QM8xAcPs3hEtF10fuFDRXhmnad4HMyjKUJX5p1TLVIZQRan5SQIDAQABo0IwQDAPBgNVHRMB
  54123. Af8EBTADAQH/MB0GA1UdDgQWBBQIds3LB/8k9sXN7buQvOKEN0Z19zAOBgNVHQ8BAf8EBAMCAQYw
  54124. DQYJKoZIhvcNAQEFBQADggEBAKaorSLOAT2mo/9i0Eidi15ysHhE49wcrwn9I0j6vSrEuVUEtRCj
  54125. jSfeC4Jj0O7eDDd5QVsisrCaQVymcODU0HfLI9MA4GxWL+FpDQ3Zqr8hgVDZBqWo/5U30Kr+4rP1
  54126. mS1FhIrlQgnXdAIv94nYmem8J9RHjboNRhx3zxSkHLmkMcScKHQDNP8zGSal6Q10tz6XxnboJ5aj
  54127. Zt3hrvJBW8qYVoNzcOSGGtIxQbovvi0TWnZvTuhOgQ4/WwMioBK+ZlgRSssDxLQqKi2WF+A5VLxI
  54128. 03YnnZotBqbJ7DnSq9ufmgsnAjUpsUCV5/nonFWIGUbWtzT1fs45mtk48VH3Tyw=
  54129. -----END CERTIFICATE-----
  54130. TWCA Root Certification Authority
  54131. =================================
  54132. -----BEGIN CERTIFICATE-----
  54133. MIIDezCCAmOgAwIBAgIBATANBgkqhkiG9w0BAQUFADBfMQswCQYDVQQGEwJUVzESMBAGA1UECgwJ
  54134. VEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NBIFJvb3QgQ2VydGlmaWNh
  54135. dGlvbiBBdXRob3JpdHkwHhcNMDgwODI4MDcyNDMzWhcNMzAxMjMxMTU1OTU5WjBfMQswCQYDVQQG
  54136. EwJUVzESMBAGA1UECgwJVEFJV0FOLUNBMRAwDgYDVQQLDAdSb290IENBMSowKAYDVQQDDCFUV0NB
  54137. IFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
  54138. AoIBAQCwfnK4pAOU5qfeCTiRShFAh6d8WWQUe7UREN3+v9XAu1bihSX0NXIP+FPQQeFEAcK0HMMx
  54139. QhZHhTMidrIKbw/lJVBPhYa+v5guEGcevhEFhgWQxFnQfHgQsIBct+HHK3XLfJ+utdGdIzdjp9xC
  54140. oi2SBBtQwXu4PhvJVgSLL1KbralW6cH/ralYhzC2gfeXRfwZVzsrb+RH9JlF/h3x+JejiB03HFyP
  54141. 4HYlmlD4oFT/RJB2I9IyxsOrBr/8+7/zrX2SYgJbKdM1o5OaQ2RgXbL6Mv87BK9NQGr5x+PvI/1r
  54142. y+UPizgN7gr8/g+YnzAx3WxSZfmLgb4i4RxYA7qRG4kHAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIB
  54143. BjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqOFsmjd6LWvJPelSDGRjjCDWmujANBgkqhkiG
  54144. 9w0BAQUFAAOCAQEAPNV3PdrfibqHDAhUaiBQkr6wQT25JmSDCi/oQMCXKCeCMErJk/9q56YAf4lC
  54145. mtYR5VPOL8zy2gXE/uJQxDqGfczafhAJO5I1KlOy/usrBdlsXebQ79NqZp4VKIV66IIArB6nCWlW
  54146. QtNoURi+VJq/REG6Sb4gumlc7rh3zc5sH62Dlhh9DrUUOYTxKOkto557HnpyWoOzeW/vtPzQCqVY
  54147. T0bf+215WfKEIlKuD8z7fDvnaspHYcN6+NOSBB+4IIThNlQWx0DeO4pz3N/GCUzf7Nr/1FNCocny
  54148. Yh0igzyXxfkZYiesZSLX0zzG5Y6yU8xJzrww/nsOM5D77dIUkR8Hrw==
  54149. -----END CERTIFICATE-----
  54150. Security Communication RootCA2
  54151. ==============================
  54152. -----BEGIN CERTIFICATE-----
  54153. MIIDdzCCAl+gAwIBAgIBADANBgkqhkiG9w0BAQsFADBdMQswCQYDVQQGEwJKUDElMCMGA1UEChMc
  54154. U0VDT00gVHJ1c3QgU3lzdGVtcyBDTy4sTFRELjEnMCUGA1UECxMeU2VjdXJpdHkgQ29tbXVuaWNh
  54155. dGlvbiBSb290Q0EyMB4XDTA5MDUyOTA1MDAzOVoXDTI5MDUyOTA1MDAzOVowXTELMAkGA1UEBhMC
  54156. SlAxJTAjBgNVBAoTHFNFQ09NIFRydXN0IFN5c3RlbXMgQ08uLExURC4xJzAlBgNVBAsTHlNlY3Vy
  54157. aXR5IENvbW11bmljYXRpb24gUm9vdENBMjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54158. ANAVOVKxUrO6xVmCxF1SrjpDZYBLx/KWvNs2l9amZIyoXvDjChz335c9S672XewhtUGrzbl+dp++
  54159. +T42NKA7wfYxEUV0kz1XgMX5iZnK5atq1LXaQZAQwdbWQonCv/Q4EpVMVAX3NuRFg3sUZdbcDE3R
  54160. 3n4MqzvEFb46VqZab3ZpUql6ucjrappdUtAtCms1FgkQhNBqyjoGADdH5H5XTz+L62e4iKrFvlNV
  54161. spHEfbmwhRkGeC7bYRr6hfVKkaHnFtWOojnflLhwHyg/i/xAXmODPIMqGplrz95Zajv8bxbXH/1K
  54162. EOtOghY6rCcMU/Gt1SSwawNQwS08Ft1ENCcadfsCAwEAAaNCMEAwHQYDVR0OBBYEFAqFqXdlBZh8
  54163. QIH4D5csOPEK7DzPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEB
  54164. CwUAA4IBAQBMOqNErLlFsceTfsgLCkLfZOoc7llsCLqJX2rKSpWeeo8HxdpFcoJxDjrSzG+ntKEj
  54165. u/Ykn8sX/oymzsLS28yN/HH8AynBbF0zX2S2ZTuJbxh2ePXcokgfGT+Ok+vx+hfuzU7jBBJV1uXk
  54166. 3fs+BXziHV7Gp7yXT2g69ekuCkO2r1dcYmh8t/2jioSgrGK+KwmHNPBqAbubKVY8/gA3zyNs8U6q
  54167. tnRGEmyR7jTV7JqR50S+kDFy1UkC9gLl9B/rfNmWVan/7Ir5mUf/NVoCqgTLiluHcSmRvaS0eg29
  54168. mvVXIwAHIRc/SjnRBUkLp7Y3gaVdjKozXoEofKd9J+sAro03
  54169. -----END CERTIFICATE-----
  54170. EC-ACC
  54171. ======
  54172. -----BEGIN CERTIFICATE-----
  54173. MIIFVjCCBD6gAwIBAgIQ7is969Qh3hSoYqwE893EATANBgkqhkiG9w0BAQUFADCB8zELMAkGA1UE
  54174. BhMCRVMxOzA5BgNVBAoTMkFnZW5jaWEgQ2F0YWxhbmEgZGUgQ2VydGlmaWNhY2lvIChOSUYgUS0w
  54175. ODAxMTc2LUkpMSgwJgYDVQQLEx9TZXJ2ZWlzIFB1YmxpY3MgZGUgQ2VydGlmaWNhY2lvMTUwMwYD
  54176. VQQLEyxWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5ldC92ZXJhcnJlbCAoYykwMzE1MDMGA1UE
  54177. CxMsSmVyYXJxdWlhIEVudGl0YXRzIGRlIENlcnRpZmljYWNpbyBDYXRhbGFuZXMxDzANBgNVBAMT
  54178. BkVDLUFDQzAeFw0wMzAxMDcyMzAwMDBaFw0zMTAxMDcyMjU5NTlaMIHzMQswCQYDVQQGEwJFUzE7
  54179. MDkGA1UEChMyQWdlbmNpYSBDYXRhbGFuYSBkZSBDZXJ0aWZpY2FjaW8gKE5JRiBRLTA4MDExNzYt
  54180. SSkxKDAmBgNVBAsTH1NlcnZlaXMgUHVibGljcyBkZSBDZXJ0aWZpY2FjaW8xNTAzBgNVBAsTLFZl
  54181. Z2V1IGh0dHBzOi8vd3d3LmNhdGNlcnQubmV0L3ZlcmFycmVsIChjKTAzMTUwMwYDVQQLEyxKZXJh
  54182. cnF1aWEgRW50aXRhdHMgZGUgQ2VydGlmaWNhY2lvIENhdGFsYW5lczEPMA0GA1UEAxMGRUMtQUND
  54183. MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsyLHT+KXQpWIR4NA9h0X84NzJB5R85iK
  54184. w5K4/0CQBXCHYMkAqbWUZRkiFRfCQ2xmRJoNBD45b6VLeqpjt4pEndljkYRm4CgPukLjbo73FCeT
  54185. ae6RDqNfDrHrZqJyTxIThmV6PttPB/SnCWDaOkKZx7J/sxaVHMf5NLWUhdWZXqBIoH7nF2W4onW4
  54186. HvPlQn2v7fOKSGRdghST2MDk/7NQcvJ29rNdQlB50JQ+awwAvthrDk4q7D7SzIKiGGUzE3eeml0a
  54187. E9jD2z3Il3rucO2n5nzbcc8tlGLfbdb1OL4/pYUKGbio2Al1QnDE6u/LDsg0qBIimAy4E5S2S+zw
  54188. 0JDnJwIDAQABo4HjMIHgMB0GA1UdEQQWMBSBEmVjX2FjY0BjYXRjZXJ0Lm5ldDAPBgNVHRMBAf8E
  54189. BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUoMOLRKo3pUW/l4Ba0fF4opvpXY0wfwYD
  54190. VR0gBHgwdjB0BgsrBgEEAfV4AQMBCjBlMCwGCCsGAQUFBwIBFiBodHRwczovL3d3dy5jYXRjZXJ0
  54191. Lm5ldC92ZXJhcnJlbDA1BggrBgEFBQcCAjApGidWZWdldSBodHRwczovL3d3dy5jYXRjZXJ0Lm5l
  54192. dC92ZXJhcnJlbCAwDQYJKoZIhvcNAQEFBQADggEBAKBIW4IB9k1IuDlVNZyAelOZ1Vr/sXE7zDkJ
  54193. lF7W2u++AVtd0x7Y/X1PzaBB4DSTv8vihpw3kpBWHNzrKQXlxJ7HNd+KDM3FIUPpqojlNcAZQmNa
  54194. Al6kSBg6hW/cnbw/nZzBh7h6YQjpdwt/cKt63dmXLGQehb+8dJahw3oS7AwaboMMPOhyRp/7SNVe
  54195. l+axofjk70YllJyJ22k4vuxcDlbHZVHlUIiIv0LVKz3l+bqeLrPK9HOSAgu+TGbrIP65y7WZf+a2
  54196. E/rKS03Z7lNGBjvGTq2TWoF+bCpLagVFjPIhpDGQh2xlnJ2lYJU6Un/10asIbvPuW/mIPX64b24D
  54197. 5EI=
  54198. -----END CERTIFICATE-----
  54199. Hellenic Academic and Research Institutions RootCA 2011
  54200. =======================================================
  54201. -----BEGIN CERTIFICATE-----
  54202. MIIEMTCCAxmgAwIBAgIBADANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMCR1IxRDBCBgNVBAoT
  54203. O0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9y
  54204. aXR5MUAwPgYDVQQDEzdIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54205. IFJvb3RDQSAyMDExMB4XDTExMTIwNjEzNDk1MloXDTMxMTIwMTEzNDk1MlowgZUxCzAJBgNVBAYT
  54206. AkdSMUQwQgYDVQQKEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25z
  54207. IENlcnQuIEF1dGhvcml0eTFAMD4GA1UEAxM3SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNo
  54208. IEluc3RpdHV0aW9ucyBSb290Q0EgMjAxMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEB
  54209. AKlTAOMupvaO+mDYLZU++CwqVE7NuYRhlFhPjz2L5EPzdYmNUeTDN9KKiE15HrcS3UN4SoqS5tdI
  54210. 1Q+kOilENbgH9mgdVc04UfCMJDGFr4PJfel3r+0ae50X+bOdOFAPplp5kYCvN66m0zH7tSYJnTxa
  54211. 71HFK9+WXesyHgLacEnsbgzImjeN9/E2YEsmLIKe0HjzDQ9jpFEw4fkrJxIH2Oq9GGKYsFk3fb7u
  54212. 8yBRQlqD75O6aRXxYp2fmTmCobd0LovUxQt7L/DICto9eQqakxylKHJzkUOap9FNhYS5qXSPFEDH
  54213. 3N6sQWRstBmbAmNtJGSPRLIl6s5ddAxjMlyNh+UCAwEAAaOBiTCBhjAPBgNVHRMBAf8EBTADAQH/
  54214. MAsGA1UdDwQEAwIBBjAdBgNVHQ4EFgQUppFC/RNhSiOeCKQp5dgTBCPuQSUwRwYDVR0eBEAwPqA8
  54215. MAWCAy5ncjAFggMuZXUwBoIELmVkdTAGggQub3JnMAWBAy5ncjAFgQMuZXUwBoEELmVkdTAGgQQu
  54216. b3JnMA0GCSqGSIb3DQEBBQUAA4IBAQAf73lB4XtuP7KMhjdCSk4cNx6NZrokgclPEg8hwAOXhiVt
  54217. XdMiKahsog2p6z0GW5k6x8zDmjR/qw7IThzh+uTczQ2+vyT+bOdrwg3IBp5OjWEopmr95fZi6hg8
  54218. TqBTnbI6nOulnJEWtk2C4AwFSKls9cz4y51JtPACpf1wA+2KIaWuE4ZJwzNzvoc7dIsXRSZMFpGD
  54219. /md9zU1jZ/rzAxKWeAaNsWftjj++n08C9bMJL/NMh98qy5V8AcysNnq/onN694/BtZqhFLKPM58N
  54220. 7yLcZnuEvUUXBj08yrl3NI/K6s8/MT7jiOOASSXIl7WdmplNsDz4SgCbZN2fOUvRJ9e4
  54221. -----END CERTIFICATE-----
  54222. Actalis Authentication Root CA
  54223. ==============================
  54224. -----BEGIN CERTIFICATE-----
  54225. MIIFuzCCA6OgAwIBAgIIVwoRl0LE48wwDQYJKoZIhvcNAQELBQAwazELMAkGA1UEBhMCSVQxDjAM
  54226. BgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlzIFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UE
  54227. AwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290IENBMB4XDTExMDkyMjExMjIwMloXDTMwMDky
  54228. MjExMjIwMlowazELMAkGA1UEBhMCSVQxDjAMBgNVBAcMBU1pbGFuMSMwIQYDVQQKDBpBY3RhbGlz
  54229. IFMucC5BLi8wMzM1ODUyMDk2NzEnMCUGA1UEAwweQWN0YWxpcyBBdXRoZW50aWNhdGlvbiBSb290
  54230. IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAp8bEpSmkLO/lGMWwUKNvUTufClrJ
  54231. wkg4CsIcoBh/kbWHuUA/3R1oHwiD1S0eiKD4j1aPbZkCkpAW1V8IbInX4ay8IMKx4INRimlNAJZa
  54232. by/ARH6jDuSRzVju3PvHHkVH3Se5CAGfpiEd9UEtL0z9KK3giq0itFZljoZUj5NDKd45RnijMCO6
  54233. zfB9E1fAXdKDa0hMxKufgFpbOr3JpyI/gCczWw63igxdBzcIy2zSekciRDXFzMwujt0q7bd9Zg1f
  54234. YVEiVRvjRuPjPdA1YprbrxTIW6HMiRvhMCb8oJsfgadHHwTrozmSBp+Z07/T6k9QnBn+locePGX2
  54235. oxgkg4YQ51Q+qDp2JE+BIcXjDwL4k5RHILv+1A7TaLndxHqEguNTVHnd25zS8gebLra8Pu2Fbe8l
  54236. EfKXGkJh90qX6IuxEAf6ZYGyojnP9zz/GPvG8VqLWeICrHuS0E4UT1lF9gxeKF+w6D9Fz8+vm2/7
  54237. hNN3WpVvrJSEnu68wEqPSpP4RCHiMUVhUE4Q2OM1fEwZtN4Fv6MGn8i1zeQf1xcGDXqVdFUNaBr8
  54238. EBtiZJ1t4JWgw5QHVw0U5r0F+7if5t+L4sbnfpb2U8WANFAoWPASUHEXMLrmeGO89LKtmyuy/uE5
  54239. jF66CyCU3nuDuP/jVo23Eek7jPKxwV2dpAtMK9myGPW1n0sCAwEAAaNjMGEwHQYDVR0OBBYEFFLY
  54240. iDrIn3hm7YnzezhwlMkCAjbQMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUUtiIOsifeGbt
  54241. ifN7OHCUyQICNtAwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3DQEBCwUAA4ICAQALe3KHwGCmSUyI
  54242. WOYdiPcUZEim2FgKDk8TNd81HdTtBjHIgT5q1d07GjLukD0R0i70jsNjLiNmsGe+b7bAEzlgqqI0
  54243. JZN1Ut6nna0Oh4lScWoWPBkdg/iaKWW+9D+a2fDzWochcYBNy+A4mz+7+uAwTc+G02UQGRjRlwKx
  54244. K3JCaKygvU5a2hi/a5iB0P2avl4VSM0RFbnAKVy06Ij3Pjaut2L9HmLecHgQHEhb2rykOLpn7VU+
  54245. Xlff1ANATIGk0k9jpwlCCRT8AKnCgHNPLsBA2RF7SOp6AsDT6ygBJlh0wcBzIm2Tlf05fbsq4/aC
  54246. 4yyXX04fkZT6/iyj2HYauE2yOE+b+h1IYHkm4vP9qdCa6HCPSXrW5b0KDtst842/6+OkfcvHlXHo
  54247. 2qN8xcL4dJIEG4aspCJTQLas/kx2z/uUMsA1n3Y/buWQbqCmJqK4LL7RK4X9p2jIugErsWx0Hbhz
  54248. lefut8cl8ABMALJ+tguLHPPAUJ4lueAI3jZm/zel0btUZCzJJ7VLkn5l/9Mt4blOvH+kQSGQQXem
  54249. OR/qnuOf0GZvBeyqdn6/axag67XH/JJULysRJyU3eExRarDzzFhdFPFqSBX/wge2sY0PjlxQRrM9
  54250. vwGYT7JZVEc+NHt4bVaTLnPqZih4zR0Uv6CPLy64Lo7yFIrM6bV8+2ydDKXhlg==
  54251. -----END CERTIFICATE-----
  54252. Trustis FPS Root CA
  54253. ===================
  54254. -----BEGIN CERTIFICATE-----
  54255. MIIDZzCCAk+gAwIBAgIQGx+ttiD5JNM2a/fH8YygWTANBgkqhkiG9w0BAQUFADBFMQswCQYDVQQG
  54256. EwJHQjEYMBYGA1UEChMPVHJ1c3RpcyBMaW1pdGVkMRwwGgYDVQQLExNUcnVzdGlzIEZQUyBSb290
  54257. IENBMB4XDTAzMTIyMzEyMTQwNloXDTI0MDEyMTExMzY1NFowRTELMAkGA1UEBhMCR0IxGDAWBgNV
  54258. BAoTD1RydXN0aXMgTGltaXRlZDEcMBoGA1UECxMTVHJ1c3RpcyBGUFMgUm9vdCBDQTCCASIwDQYJ
  54259. KoZIhvcNAQEBBQADggEPADCCAQoCggEBAMVQe547NdDfxIzNjpvto8A2mfRC6qc+gIMPpqdZh8mQ
  54260. RUN+AOqGeSoDvT03mYlmt+WKVoaTnGhLaASMk5MCPjDSNzoiYYkchU59j9WvezX2fihHiTHcDnlk
  54261. H5nSW7r+f2C/revnPDgpai/lkQtV/+xvWNUtyd5MZnGPDNcE2gfmHhjjvSkCqPoc4Vu5g6hBSLwa
  54262. cY3nYuUtsuvffM/bq1rKMfFMIvMFE/eC+XN5DL7XSxzA0RU8k0Fk0ea+IxciAIleH2ulrG6nS4zt
  54263. o3Lmr2NNL4XSFDWaLk6M6jKYKIahkQlBOrTh4/L68MkKokHdqeMDx4gVOxzUGpTXn2RZEm0CAwEA
  54264. AaNTMFEwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS6+nEleYtXQSUhhgtx67JkDoshZzAd
  54265. BgNVHQ4EFgQUuvpxJXmLV0ElIYYLceuyZA6LIWcwDQYJKoZIhvcNAQEFBQADggEBAH5Y//01GX2c
  54266. GE+esCu8jowU/yyg2kdbw++BLa8F6nRIW/M+TgfHbcWzk88iNVy2P3UnXwmWzaD+vkAMXBJV+JOC
  54267. yinpXj9WV4s4NvdFGkwozZ5BuO1WTISkQMi4sKUraXAEasP41BIy+Q7DsdwyhEQsb8tGD+pmQQ9P
  54268. 8Vilpg0ND2HepZ5dfWWhPBfnqFVO76DH7cZEf1T1o+CP8HxVIo8ptoGj4W1OLBuAZ+ytIJ8MYmHV
  54269. l/9D7S3B2l0pKoU/rGXuhg8FjZBf3+6f9L/uHfuY5H+QK4R4EA5sSVPvFVtlRkpdr7r7OnIdzfYl
  54270. iB6XzCGcKQENZetX2fNXlrtIzYE=
  54271. -----END CERTIFICATE-----
  54272. Buypass Class 2 Root CA
  54273. =======================
  54274. -----BEGIN CERTIFICATE-----
  54275. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54276. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMiBSb290IENBMB4X
  54277. DTEwMTAyNjA4MzgwM1oXDTQwMTAyNjA4MzgwM1owTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54278. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDIgUm9vdCBDQTCCAiIw
  54279. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANfHXvfBB9R3+0Mh9PT1aeTuMgHbo4Yf5FkNuud1
  54280. g1Lr6hxhFUi7HQfKjK6w3Jad6sNgkoaCKHOcVgb/S2TwDCo3SbXlzwx87vFKu3MwZfPVL4O2fuPn
  54281. 9Z6rYPnT8Z2SdIrkHJasW4DptfQxh6NR/Md+oW+OU3fUl8FVM5I+GC911K2GScuVr1QGbNgGE41b
  54282. /+EmGVnAJLqBcXmQRFBoJJRfuLMR8SlBYaNByyM21cHxMlAQTn/0hpPshNOOvEu/XAFOBz3cFIqU
  54283. CqTqc/sLUegTBxj6DvEr0VQVfTzh97QZQmdiXnfgolXsttlpF9U6r0TtSsWe5HonfOV116rLJeff
  54284. awrbD02TTqigzXsu8lkBarcNuAeBfos4GzjmCleZPe4h6KP1DBbdi+w0jpwqHAAVF41og9JwnxgI
  54285. zRFo1clrUs3ERo/ctfPYV3Me6ZQ5BL/T3jjetFPsaRyifsSP5BtwrfKi+fv3FmRmaZ9JUaLiFRhn
  54286. Bkp/1Wy1TbMz4GHrXb7pmA8y1x1LPC5aAVKRCfLf6o3YBkBjqhHk/sM3nhRSP/TizPJhk9H9Z2vX
  54287. Uq6/aKtAQ6BXNVN48FP4YUIHZMbXb5tMOA1jrGKvNouicwoN9SG9dKpN6nIDSdvHXx1iY8f93ZHs
  54288. M+71bbRuMGjeyNYmsHVee7QHIJihdjK4TWxPAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54289. VR0OBBYEFMmAd+BikoL1RpzzuvdMw964o605MA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54290. AAOCAgEAU18h9bqwOlI5LJKwbADJ784g7wbylp7ppHR/ehb8t/W2+xUbP6umwHJdELFx7rxP462s
  54291. A20ucS6vxOOto70MEae0/0qyexAQH6dXQbLArvQsWdZHEIjzIVEpMMpghq9Gqx3tOluwlN5E40EI
  54292. osHsHdb9T7bWR9AUC8rmyrV7d35BH16Dx7aMOZawP5aBQW9gkOLo+fsicdl9sz1Gv7SEr5AcD48S
  54293. aq/v7h56rgJKihcrdv6sVIkkLE8/trKnToyokZf7KcZ7XC25y2a2t6hbElGFtQl+Ynhw/qlqYLYd
  54294. DnkM/crqJIByw5c/8nerQyIKx+u2DISCLIBrQYoIwOula9+ZEsuK1V6ADJHgJgg2SMX6OBE1/yWD
  54295. LfJ6v9r9jv6ly0UsH8SIU653DtmadsWOLB2jutXsMq7Aqqz30XpN69QH4kj3Io6wpJ9qzo6ysmD0
  54296. oyLQI+uUWnpp3Q+/QFesa1lQ2aOZ4W7+jQF5JyMV3pKdewlNWudLSDBaGOYKbeaP4NK75t98biGC
  54297. wWg5TbSYWGZizEqQXsP6JwSxeRV0mcy+rSDeJmAc61ZRpqPq5KM/p/9h3PFaTWwyI0PurKju7koS
  54298. CTxdccK+efrCh2gdC/1cacwG0Jp9VJkqyTkaGa9LKkPzY11aWOIv4x3kqdbQCtCev9eBCfHJxyYN
  54299. rJgWVqA=
  54300. -----END CERTIFICATE-----
  54301. Buypass Class 3 Root CA
  54302. =======================
  54303. -----BEGIN CERTIFICATE-----
  54304. MIIFWTCCA0GgAwIBAgIBAjANBgkqhkiG9w0BAQsFADBOMQswCQYDVQQGEwJOTzEdMBsGA1UECgwU
  54305. QnV5cGFzcyBBUy05ODMxNjMzMjcxIDAeBgNVBAMMF0J1eXBhc3MgQ2xhc3MgMyBSb290IENBMB4X
  54306. DTEwMTAyNjA4Mjg1OFoXDTQwMTAyNjA4Mjg1OFowTjELMAkGA1UEBhMCTk8xHTAbBgNVBAoMFEJ1
  54307. eXBhc3MgQVMtOTgzMTYzMzI3MSAwHgYDVQQDDBdCdXlwYXNzIENsYXNzIDMgUm9vdCBDQTCCAiIw
  54308. DQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAKXaCpUWUOOV8l6ddjEGMnqb8RB2uACatVI2zSRH
  54309. sJ8YZLya9vrVediQYkwiL944PdbgqOkcLNt4EemOaFEVcsfzM4fkoF0LXOBXByow9c3EN3coTRiR
  54310. 5r/VUv1xLXA+58bEiuPwKAv0dpihi4dVsjoT/Lc+JzeOIuOoTyrvYLs9tznDDgFHmV0ST9tD+leh
  54311. 7fmdvhFHJlsTmKtdFoqwNxxXnUX/iJY2v7vKB3tvh2PX0DJq1l1sDPGzbjniazEuOQAnFN44wOwZ
  54312. ZoYS6J1yFhNkUsepNxz9gjDthBgd9K5c/3ATAOux9TN6S9ZV+AWNS2mw9bMoNlwUxFFzTWsL8TQH
  54313. 2xc519woe2v1n/MuwU8XKhDzzMro6/1rqy6any2CbgTUUgGTLT2G/H783+9CHaZr77kgxve9oKeV
  54314. /afmiSTYzIw0bOIjL9kSGiG5VZFvC5F5GQytQIgLcOJ60g7YaEi7ghM5EFjp2CoHxhLbWNvSO1UQ
  54315. RwUVZ2J+GGOmRj8JDlQyXr8NYnon74Do29lLBlo3WiXQCBJ31G8JUJc9yB3D34xFMFbG02SrZvPA
  54316. Xpacw8Tvw3xrizp5f7NJzz3iiZ+gMEuFuZyUJHmPfWupRWgPK9Dx2hzLabjKSWJtyNBjYt1gD1iq
  54317. j6G8BaVmos8bdrKEZLFMOVLAMLrwjEsCsLa3AgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wHQYD
  54318. VR0OBBYEFEe4zf/lb+74suwvTg75JbCOPGvDMA4GA1UdDwEB/wQEAwIBBjANBgkqhkiG9w0BAQsF
  54319. AAOCAgEAACAjQTUEkMJAYmDv4jVM1z+s4jSQuKFvdvoWFqRINyzpkMLyPPgKn9iB5btb2iUspKdV
  54320. cSQy9sgL8rxq+JOssgfCX5/bzMiKqr5qb+FJEMwx14C7u8jYog5kV+qi9cKpMRXSIGrs/CIBKM+G
  54321. uIAeqcwRpTzyFrNHnfzSgCHEy9BHcEGhyoMZCCxt8l13nIoUE9Q2HJLw5QY33KbmkJs4j1xrG0aG
  54322. Q0JfPgEHU1RdZX33inOhmlRaHylDFCfChQ+1iHsaO5S3HWCntZznKWlXWpuTekMwGwPXYshApqr8
  54323. ZORK15FTAaggiG6cX0S5y2CBNOxv033aSF/rtJC8LakcC6wc1aJoIIAE1vyxjy+7SjENSoYc6+I2
  54324. KSb12tjE8nVhz36udmNKekBlk4f4HoCMhuWG1o8O/FMsYOgWYRqiPkN7zTlgVGr18okmAWiDSKIz
  54325. 6MkEkbIRNBE+6tBDGR8Dk5AM/1E9V/RBbuHLoL7ryWPNbczk+DaqaJ3tvV2XcEQNtg413OEMXbug
  54326. UZTLfhbrES+jkkXITHHZvMmZUldGL1DPvTVp9D0VzgalLA8+9oG6lLvDu79leNKGef9JOxqDDPDe
  54327. eOzI8k1MGt6CKfjBWtrt7uYnXuhF0J0cUahoq0Tj0Itq4/g7u9xN12TyUb7mqqta6THuBrxzvxNi
  54328. Cp/HuZc=
  54329. -----END CERTIFICATE-----
  54330. T-TeleSec GlobalRoot Class 3
  54331. ============================
  54332. -----BEGIN CERTIFICATE-----
  54333. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54334. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54335. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwHhcNMDgx
  54336. MDAxMTAyOTU2WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54337. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54338. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDMwggEiMA0GCSqGSIb3
  54339. DQEBAQUAA4IBDwAwggEKAoIBAQC9dZPwYiJvJK7genasfb3ZJNW4t/zN8ELg63iIVl6bmlQdTQyK
  54340. 9tPPcPRStdiTBONGhnFBSivwKixVA9ZIw+A5OO3yXDw/RLyTPWGrTs0NvvAgJ1gORH8EGoel15YU
  54341. NpDQSXuhdfsaa3Ox+M6pCSzyU9XDFES4hqX2iys52qMzVNn6chr3IhUciJFrf2blw2qAsCTz34ZF
  54342. iP0Zf3WHHx+xGwpzJFu5ZeAsVMhg02YXP+HMVDNzkQI6pn97djmiH5a2OK61yJN0HZ65tOVgnS9W
  54343. 0eDrXltMEnAMbEQgqxHY9Bn20pxSN+f6tsIxO0rUFJmtxxr1XV/6B7h8DR/Wgx6zAgMBAAGjQjBA
  54344. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS1A/d2O2GCahKqGFPr
  54345. AyGUv/7OyjANBgkqhkiG9w0BAQsFAAOCAQEAVj3vlNW92nOyWL6ukK2YJ5f+AbGwUgC4TeQbIXQb
  54346. fsDuXmkqJa9c1h3a0nnJ85cp4IaH3gRZD/FZ1GSFS5mvJQQeyUapl96Cshtwn5z2r3Ex3XsFpSzT
  54347. ucpH9sry9uetuUg/vBa3wW306gmv7PO15wWeph6KU1HWk4HMdJP2udqmJQV0eVp+QD6CSyYRMG7h
  54348. P0HHRwA11fXT91Q+gT3aSWqas+8QPebrb9HIIkfLzM8BMZLZGOMivgkeGj5asuRrDFR6fUNOuIml
  54349. e9eiPZaGzPImNC1qkp2aGtAw4l1OBLBfiyB+d8E9lYLRRpo7PHi4b6HQDWSieB4pTpPDpFQUWw==
  54350. -----END CERTIFICATE-----
  54351. EE Certification Centre Root CA
  54352. ===============================
  54353. -----BEGIN CERTIFICATE-----
  54354. MIIEAzCCAuugAwIBAgIQVID5oHPtPwBMyonY43HmSjANBgkqhkiG9w0BAQUFADB1MQswCQYDVQQG
  54355. EwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEoMCYGA1UEAwwfRUUgQ2Vy
  54356. dGlmaWNhdGlvbiBDZW50cmUgUm9vdCBDQTEYMBYGCSqGSIb3DQEJARYJcGtpQHNrLmVlMCIYDzIw
  54357. MTAxMDMwMTAxMDMwWhgPMjAzMDEyMTcyMzU5NTlaMHUxCzAJBgNVBAYTAkVFMSIwIAYDVQQKDBlB
  54358. UyBTZXJ0aWZpdHNlZXJpbWlza2Vza3VzMSgwJgYDVQQDDB9FRSBDZXJ0aWZpY2F0aW9uIENlbnRy
  54359. ZSBSb290IENBMRgwFgYJKoZIhvcNAQkBFglwa2lAc2suZWUwggEiMA0GCSqGSIb3DQEBAQUAA4IB
  54360. DwAwggEKAoIBAQDIIMDs4MVLqwd4lfNE7vsLDP90jmG7sWLqI9iroWUyeuuOF0+W2Ap7kaJjbMeM
  54361. TC55v6kF/GlclY1i+blw7cNRfdCT5mzrMEvhvH2/UpvObntl8jixwKIy72KyaOBhU8E2lf/slLo2
  54362. rpwcpzIP5Xy0xm90/XsY6KxX7QYgSzIwWFv9zajmofxwvI6Sc9uXp3whrj3B9UiHbCe9nyV0gVWw
  54363. 93X2PaRka9ZP585ArQ/dMtO8ihJTmMmJ+xAdTX7Nfh9WDSFwhfYggx/2uh8Ej+p3iDXE/+pOoYtN
  54364. P2MbRMNE1CV2yreN1x5KZmTNXMWcg+HCCIia7E6j8T4cLNlsHaFLAgMBAAGjgYowgYcwDwYDVR0T
  54365. AQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBLyWj7qVhy/zQas8fElyalL1BSZ
  54366. MEUGA1UdJQQ+MDwGCCsGAQUFBwMCBggrBgEFBQcDAQYIKwYBBQUHAwMGCCsGAQUFBwMEBggrBgEF
  54367. BQcDCAYIKwYBBQUHAwkwDQYJKoZIhvcNAQEFBQADggEBAHv25MANqhlHt01Xo/6tu7Fq1Q+e2+Rj
  54368. xY6hUFaTlrg4wCQiZrxTFGGVv9DHKpY5P30osxBAIWrEr7BSdxjhlthWXePdNl4dp1BUoMUq5KqM
  54369. lIpPnTX/dqQGE5Gion0ARD9V04I8GtVbvFZMIi5GQ4okQC3zErg7cBqklrkar4dBGmoYDQZPxz5u
  54370. uSlNDUmJEYcyW+ZLBMjkXOZ0c5RdFpgTlf7727FE5TpwrDdr5rMzcijJs1eg9gIWiAYLtqZLICjU
  54371. 3j2LrTcFU3T+bsy8QxdxXvnFzBqpYe73dgzzcvRyrc9yAjYHR8/vGVCJYMzpJJUPwssd8m92kMfM
  54372. dcGWxZ0=
  54373. -----END CERTIFICATE-----
  54374. D-TRUST Root Class 3 CA 2 2009
  54375. ==============================
  54376. -----BEGIN CERTIFICATE-----
  54377. MIIEMzCCAxugAwIBAgIDCYPzMA0GCSqGSIb3DQEBCwUAME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54378. DAxELVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTAe
  54379. Fw0wOTExMDUwODM1NThaFw0yOTExMDUwODM1NThaME0xCzAJBgNVBAYTAkRFMRUwEwYDVQQKDAxE
  54380. LVRydXN0IEdtYkgxJzAlBgNVBAMMHkQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgMjAwOTCCASIw
  54381. DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANOySs96R+91myP6Oi/WUEWJNTrGa9v+2wBoqOAD
  54382. ER03UAifTUpolDWzU9GUY6cgVq/eUXjsKj3zSEhQPgrfRlWLJ23DEE0NkVJD2IfgXU42tSHKXzlA
  54383. BF9bfsyjxiupQB7ZNoTWSPOSHjRGICTBpFGOShrvUD9pXRl/RcPHAY9RySPocq60vFYJfxLLHLGv
  54384. KZAKyVXMD9O0Gu1HNVpK7ZxzBCHQqr0ME7UAyiZsxGsMlFqVlNpQmvH/pStmMaTJOKDfHR+4CS7z
  54385. p+hnUquVH+BGPtikw8paxTGA6Eian5Rp/hnd2HN8gcqW3o7tszIFZYQ05ub9VxC1X3a/L7AQDcUC
  54386. AwEAAaOCARowggEWMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFP3aFMSfMN4hvR5COfyrYyNJ
  54387. 4PGEMA4GA1UdDwEB/wQEAwIBBjCB0wYDVR0fBIHLMIHIMIGAoH6gfIZ6bGRhcDovL2RpcmVjdG9y
  54388. eS5kLXRydXN0Lm5ldC9DTj1ELVRSVVNUJTIwUm9vdCUyMENsYXNzJTIwMyUyMENBJTIwMiUyMDIw
  54389. MDksTz1ELVRydXN0JTIwR21iSCxDPURFP2NlcnRpZmljYXRlcmV2b2NhdGlvbmxpc3QwQ6BBoD+G
  54390. PWh0dHA6Ly93d3cuZC10cnVzdC5uZXQvY3JsL2QtdHJ1c3Rfcm9vdF9jbGFzc18zX2NhXzJfMjAw
  54391. OS5jcmwwDQYJKoZIhvcNAQELBQADggEBAH+X2zDI36ScfSF6gHDOFBJpiBSVYEQBrLLpME+bUMJm
  54392. 2H6NMLVwMeniacfzcNsgFYbQDfC+rAF1hM5+n02/t2A7nPPKHeJeaNijnZflQGDSNiH+0LS4F9p0
  54393. o3/U37CYAqxva2ssJSRyoWXuJVrl5jLn8t+rSfrzkGkj2wTZ51xY/GXUl77M/C4KzCUqNQT4YJEV
  54394. dT1B/yMfGchs64JTBKbkTCJNjYy6zltz7GRUUG3RnFX7acM2w4y8PIWmawomDeCTmGCufsYkl4ph
  54395. X5GOZpIJhzbNi5stPvZR1FDUWSi9g/LMKHtThm3YJohw1+qRzT65ysCQblrGXnRl11z+o+I=
  54396. -----END CERTIFICATE-----
  54397. D-TRUST Root Class 3 CA 2 EV 2009
  54398. =================================
  54399. -----BEGIN CERTIFICATE-----
  54400. MIIEQzCCAyugAwIBAgIDCYP0MA0GCSqGSIb3DQEBCwUAMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54401. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54402. OTAeFw0wOTExMDUwODUwNDZaFw0yOTExMDUwODUwNDZaMFAxCzAJBgNVBAYTAkRFMRUwEwYDVQQK
  54403. DAxELVRydXN0IEdtYkgxKjAoBgNVBAMMIUQtVFJVU1QgUm9vdCBDbGFzcyAzIENBIDIgRVYgMjAw
  54404. OTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAJnxhDRwui+3MKCOvXwEz75ivJn9gpfS
  54405. egpnljgJ9hBOlSJzmY3aFS3nBfwZcyK3jpgAvDw9rKFs+9Z5JUut8Mxk2og+KbgPCdM03TP1YtHh
  54406. zRnp7hhPTFiu4h7WDFsVWtg6uMQYZB7jM7K1iXdODL/ZlGsTl28So/6ZqQTMFexgaDbtCHu39b+T
  54407. 7WYxg4zGcTSHThfqr4uRjRxWQa4iN1438h3Z0S0NL2lRp75mpoo6Kr3HGrHhFPC+Oh25z1uxav60
  54408. sUYgovseO3Dvk5h9jHOW8sXvhXCtKSb8HgQ+HKDYD8tSg2J87otTlZCpV6LqYQXY+U3EJ/pure35
  54409. 11H3a6UCAwEAAaOCASQwggEgMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFNOUikxiEyoZLsyv
  54410. cop9NteaHNxnMA4GA1UdDwEB/wQEAwIBBjCB3QYDVR0fBIHVMIHSMIGHoIGEoIGBhn9sZGFwOi8v
  54411. ZGlyZWN0b3J5LmQtdHJ1c3QubmV0L0NOPUQtVFJVU1QlMjBSb290JTIwQ2xhc3MlMjAzJTIwQ0El
  54412. MjAyJTIwRVYlMjAyMDA5LE89RC1UcnVzdCUyMEdtYkgsQz1ERT9jZXJ0aWZpY2F0ZXJldm9jYXRp
  54413. b25saXN0MEagRKBChkBodHRwOi8vd3d3LmQtdHJ1c3QubmV0L2NybC9kLXRydXN0X3Jvb3RfY2xh
  54414. c3NfM19jYV8yX2V2XzIwMDkuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQA07XtaPKSUiO8aEXUHL7P+
  54415. PPoeUSbrh/Yp3uDx1MYkCenBz1UbtDDZzhr+BlGmFaQt77JLvyAoJUnRpjZ3NOhk31KxEcdzes05
  54416. nsKtjHEh8lprr988TlWvsoRlFIm5d8sqMb7Po23Pb0iUMkZv53GMoKaEGTcH8gNFCSuGdXzfX2lX
  54417. ANtu2KZyIktQ1HWYVt+3GP9DQ1CuekR78HlR10M9p9OB0/DJT7naxpeG0ILD5EJt/rDiZE4OJudA
  54418. NCa1CInXCGNjOCd1HjPqbqjdn5lPdE2BiYBL3ZqXKVwvvoFBuYz/6n1gBp7N1z3TLqMVvKjmJuVv
  54419. w9y4AyHqnxbxLFS1
  54420. -----END CERTIFICATE-----
  54421. CA Disig Root R2
  54422. ================
  54423. -----BEGIN CERTIFICATE-----
  54424. MIIFaTCCA1GgAwIBAgIJAJK4iNuwisFjMA0GCSqGSIb3DQEBCwUAMFIxCzAJBgNVBAYTAlNLMRMw
  54425. EQYDVQQHEwpCcmF0aXNsYXZhMRMwEQYDVQQKEwpEaXNpZyBhLnMuMRkwFwYDVQQDExBDQSBEaXNp
  54426. ZyBSb290IFIyMB4XDTEyMDcxOTA5MTUzMFoXDTQyMDcxOTA5MTUzMFowUjELMAkGA1UEBhMCU0sx
  54427. EzARBgNVBAcTCkJyYXRpc2xhdmExEzARBgNVBAoTCkRpc2lnIGEucy4xGTAXBgNVBAMTEENBIERp
  54428. c2lnIFJvb3QgUjIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCio8QACdaFXS1tFPbC
  54429. w3OeNcJxVX6B+6tGUODBfEl45qt5WDza/3wcn9iXAng+a0EE6UG9vgMsRfYvZNSrXaNHPWSb6Wia
  54430. xswbP7q+sos0Ai6YVRn8jG+qX9pMzk0DIaPY0jSTVpbLTAwAFjxfGs3Ix2ymrdMxp7zo5eFm1tL7
  54431. A7RBZckQrg4FY8aAamkw/dLukO8NJ9+flXP04SXabBbeQTg06ov80egEFGEtQX6sx3dOy1FU+16S
  54432. GBsEWmjGycT6txOgmLcRK7fWV8x8nhfRyyX+hk4kLlYMeE2eARKmK6cBZW58Yh2EhN/qwGu1pSqV
  54433. g8NTEQxzHQuyRpDRQjrOQG6Vrf/GlK1ul4SOfW+eioANSW1z4nuSHsPzwfPrLgVv2RvPN3YEyLRa
  54434. 5Beny912H9AZdugsBbPWnDTYltxhh5EF5EQIM8HauQhl1K6yNg3ruji6DOWbnuuNZt2Zz9aJQfYE
  54435. koopKW1rOhzndX0CcQ7zwOe9yxndnWCywmZgtrEE7snmhrmaZkCo5xHtgUUDi/ZnWejBBhG93c+A
  54436. Ak9lQHhcR1DIm+YfgXvkRKhbhZri3lrVx/k6RGZL5DJUfORsnLMOPReisjQS1n6yqEm70XooQL6i
  54437. Fh/f5DcfEXP7kAplQ6INfPgGAVUzfbANuPT1rqVCV3w2EYx7XsQDnYx5nQIDAQABo0IwQDAPBgNV
  54438. HRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUtZn4r7CU9eMg1gqtzk5WpC5u
  54439. Qu0wDQYJKoZIhvcNAQELBQADggIBACYGXnDnZTPIgm7ZnBc6G3pmsgH2eDtpXi/q/075KMOYKmFM
  54440. tCQSin1tERT3nLXK5ryeJ45MGcipvXrA1zYObYVybqjGom32+nNjf7xueQgcnYqfGopTpti72TVV
  54441. sRHFqQOzVju5hJMiXn7B9hJSi+osZ7z+Nkz1uM/Rs0mSO9MpDpkblvdhuDvEK7Z4bLQjb/D907Je
  54442. dR+Zlais9trhxTF7+9FGs9K8Z7RiVLoJ92Owk6Ka+elSLotgEqv89WBW7xBci8QaQtyDW2QOy7W8
  54443. 1k/BfDxujRNt+3vrMNDcTa/F1balTFtxyegxvug4BkihGuLq0t4SOVga/4AOgnXmt8kHbA7v/zjx
  54444. mHHEt38OFdAlab0inSvtBfZGR6ztwPDUO+Ls7pZbkBNOHlY667DvlruWIxG68kOGdGSVyCh13x01
  54445. utI3gzhTODY7z2zp+WsO0PsE6E9312UBeIYMej4hYvF/Y3EMyZ9E26gnonW+boE+18DrG5gPcFw0
  54446. sorMwIUY6256s/daoQe/qUKS82Ail+QUoQebTnbAjn39pCXHR+3/H3OszMOl6W8KjptlwlCFtaOg
  54447. UxLMVYdh84GuEEZhvUQhuMI9dM9+JDX6HAcOmz0iyu8xL4ysEr3vQCj8KWefshNPZiTEUxnpHikV
  54448. 7+ZtsH8tZ/3zbBt1RqPlShfppNcL
  54449. -----END CERTIFICATE-----
  54450. ACCVRAIZ1
  54451. =========
  54452. -----BEGIN CERTIFICATE-----
  54453. MIIH0zCCBbugAwIBAgIIXsO3pkN/pOAwDQYJKoZIhvcNAQEFBQAwQjESMBAGA1UEAwwJQUNDVlJB
  54454. SVoxMRAwDgYDVQQLDAdQS0lBQ0NWMQ0wCwYDVQQKDARBQ0NWMQswCQYDVQQGEwJFUzAeFw0xMTA1
  54455. MDUwOTM3MzdaFw0zMDEyMzEwOTM3MzdaMEIxEjAQBgNVBAMMCUFDQ1ZSQUlaMTEQMA4GA1UECwwH
  54456. UEtJQUNDVjENMAsGA1UECgwEQUNDVjELMAkGA1UEBhMCRVMwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  54457. DwAwggIKAoICAQCbqau/YUqXry+XZpp0X9DZlv3P4uRm7x8fRzPCRKPfmt4ftVTdFXxpNRFvu8gM
  54458. jmoYHtiP2Ra8EEg2XPBjs5BaXCQ316PWywlxufEBcoSwfdtNgM3802/J+Nq2DoLSRYWoG2ioPej0
  54459. RGy9ocLLA76MPhMAhN9KSMDjIgro6TenGEyxCQ0jVn8ETdkXhBilyNpAlHPrzg5XPAOBOp0KoVdD
  54460. aaxXbXmQeOW1tDvYvEyNKKGno6e6Ak4l0Squ7a4DIrhrIA8wKFSVf+DuzgpmndFALW4ir50awQUZ
  54461. 0m/A8p/4e7MCQvtQqR0tkw8jq8bBD5L/0KIV9VMJcRz/RROE5iZe+OCIHAr8Fraocwa48GOEAqDG
  54462. WuzndN9wrqODJerWx5eHk6fGioozl2A3ED6XPm4pFdahD9GILBKfb6qkxkLrQaLjlUPTAYVtjrs7
  54463. 8yM2x/474KElB0iryYl0/wiPgL/AlmXz7uxLaL2diMMxs0Dx6M/2OLuc5NF/1OVYm3z61PMOm3WR
  54464. 5LpSLhl+0fXNWhn8ugb2+1KoS5kE3fj5tItQo05iifCHJPqDQsGH+tUtKSpacXpkatcnYGMN285J
  54465. 9Y0fkIkyF/hzQ7jSWpOGYdbhdQrqeWZ2iE9x6wQl1gpaepPluUsXQA+xtrn13k/c4LOsOxFwYIRK
  54466. Q26ZIMApcQrAZQIDAQABo4ICyzCCAscwfQYIKwYBBQUHAQEEcTBvMEwGCCsGAQUFBzAChkBodHRw
  54467. Oi8vd3d3LmFjY3YuZXMvZmlsZWFkbWluL0FyY2hpdm9zL2NlcnRpZmljYWRvcy9yYWl6YWNjdjEu
  54468. Y3J0MB8GCCsGAQUFBzABhhNodHRwOi8vb2NzcC5hY2N2LmVzMB0GA1UdDgQWBBTSh7Tj3zcnk1X2
  54469. VuqB5TbMjB4/vTAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFNKHtOPfNyeTVfZW6oHlNsyM
  54470. Hj+9MIIBcwYDVR0gBIIBajCCAWYwggFiBgRVHSAAMIIBWDCCASIGCCsGAQUFBwICMIIBFB6CARAA
  54471. QQB1AHQAbwByAGkAZABhAGQAIABkAGUAIABDAGUAcgB0AGkAZgBpAGMAYQBjAGkA8wBuACAAUgBh
  54472. AO0AegAgAGQAZQAgAGwAYQAgAEEAQwBDAFYAIAAoAEEAZwBlAG4AYwBpAGEAIABkAGUAIABUAGUA
  54473. YwBuAG8AbABvAGcA7QBhACAAeQAgAEMAZQByAHQAaQBmAGkAYwBhAGMAaQDzAG4AIABFAGwAZQBj
  54474. AHQAcgDzAG4AaQBjAGEALAAgAEMASQBGACAAUQA0ADYAMAAxADEANQA2AEUAKQAuACAAQwBQAFMA
  54475. IABlAG4AIABoAHQAdABwADoALwAvAHcAdwB3AC4AYQBjAGMAdgAuAGUAczAwBggrBgEFBQcCARYk
  54476. aHR0cDovL3d3dy5hY2N2LmVzL2xlZ2lzbGFjaW9uX2MuaHRtMFUGA1UdHwROMEwwSqBIoEaGRGh0
  54477. dHA6Ly93d3cuYWNjdi5lcy9maWxlYWRtaW4vQXJjaGl2b3MvY2VydGlmaWNhZG9zL3JhaXphY2N2
  54478. MV9kZXIuY3JsMA4GA1UdDwEB/wQEAwIBBjAXBgNVHREEEDAOgQxhY2N2QGFjY3YuZXMwDQYJKoZI
  54479. hvcNAQEFBQADggIBAJcxAp/n/UNnSEQU5CmH7UwoZtCPNdpNYbdKl02125DgBS4OxnnQ8pdpD70E
  54480. R9m+27Up2pvZrqmZ1dM8MJP1jaGo/AaNRPTKFpV8M9xii6g3+CfYCS0b78gUJyCpZET/LtZ1qmxN
  54481. YEAZSUNUY9rizLpm5U9EelvZaoErQNV/+QEnWCzI7UiRfD+mAM/EKXMRNt6GGT6d7hmKG9Ww7Y49
  54482. nCrADdg9ZuM8Db3VlFzi4qc1GwQA9j9ajepDvV+JHanBsMyZ4k0ACtrJJ1vnE5Bc5PUzolVt3OAJ
  54483. TS+xJlsndQAJxGJ3KQhfnlmstn6tn1QwIgPBHnFk/vk4CpYY3QIUrCPLBhwepH2NDd4nQeit2hW3
  54484. sCPdK6jT2iWH7ehVRE2I9DZ+hJp4rPcOVkkO1jMl1oRQQmwgEh0q1b688nCBpHBgvgW1m54ERL5h
  54485. I6zppSSMEYCUWqKiuUnSwdzRp+0xESyeGabu4VXhwOrPDYTkF7eifKXeVSUG7szAh1xA2syVP1Xg
  54486. Nce4hL60Xc16gwFy7ofmXx2utYXGJt/mwZrpHgJHnyqobalbz+xFd3+YJ5oyXSrjhO7FmGYvliAd
  54487. 3djDJ9ew+f7Zfc3Qn48LFFhRny+Lwzgt3uiP1o2HpPVWQxaZLPSkVrQ0uGE3ycJYgBugl6H8WY3p
  54488. EfbRD0tVNEYqi4Y7
  54489. -----END CERTIFICATE-----
  54490. TWCA Global Root CA
  54491. ===================
  54492. -----BEGIN CERTIFICATE-----
  54493. MIIFQTCCAymgAwIBAgICDL4wDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCVFcxEjAQBgNVBAoT
  54494. CVRBSVdBTi1DQTEQMA4GA1UECxMHUm9vdCBDQTEcMBoGA1UEAxMTVFdDQSBHbG9iYWwgUm9vdCBD
  54495. QTAeFw0xMjA2MjcwNjI4MzNaFw0zMDEyMzExNTU5NTlaMFExCzAJBgNVBAYTAlRXMRIwEAYDVQQK
  54496. EwlUQUlXQU4tQ0ExEDAOBgNVBAsTB1Jvb3QgQ0ExHDAaBgNVBAMTE1RXQ0EgR2xvYmFsIFJvb3Qg
  54497. Q0EwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCwBdvI64zEbooh745NnHEKH1Jw7W2C
  54498. nJfF10xORUnLQEK1EjRsGcJ0pDFfhQKX7EMzClPSnIyOt7h52yvVavKOZsTuKwEHktSz0ALfUPZV
  54499. r2YOy+BHYC8rMjk1Ujoog/h7FsYYuGLWRyWRzvAZEk2tY/XTP3VfKfChMBwqoJimFb3u/Rk28OKR
  54500. Q4/6ytYQJ0lM793B8YVwm8rqqFpD/G2Gb3PpN0Wp8DbHzIh1HrtsBv+baz4X7GGqcXzGHaL3SekV
  54501. tTzWoWH1EfcFbx39Eb7QMAfCKbAJTibc46KokWofwpFFiFzlmLhxpRUZyXx1EcxwdE8tmx2RRP1W
  54502. KKD+u4ZqyPpcC1jcxkt2yKsi2XMPpfRaAok/T54igu6idFMqPVMnaR1sjjIsZAAmY2E2TqNGtz99
  54503. sy2sbZCilaLOz9qC5wc0GZbpuCGqKX6mOL6OKUohZnkfs8O1CWfe1tQHRvMq2uYiN2DLgbYPoA/p
  54504. yJV/v1WRBXrPPRXAb94JlAGD1zQbzECl8LibZ9WYkTunhHiVJqRaCPgrdLQABDzfuBSO6N+pjWxn
  54505. kjMdwLfS7JLIvgm/LCkFbwJrnu+8vyq8W8BQj0FwcYeyTbcEqYSjMq+u7msXi7Kx/mzhkIyIqJdI
  54506. zshNy/MGz19qCkKxHh53L46g5pIOBvwFItIm4TFRfTLcDwIDAQABoyMwITAOBgNVHQ8BAf8EBAMC
  54507. AQYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAAOCAgEAXzSBdu+WHdXltdkCY4QWwa6g
  54508. cFGn90xHNcgL1yg9iXHZqjNB6hQbbCEAwGxCGX6faVsgQt+i0trEfJdLjbDorMjupWkEmQqSpqsn
  54509. LhpNgb+E1HAerUf+/UqdM+DyucRFCCEK2mlpc3INvjT+lIutwx4116KD7+U4x6WFH6vPNOw/KP4M
  54510. 8VeGTslV9xzU2KV9Bnpv1d8Q34FOIWWxtuEXeZVFBs5fzNxGiWNoRI2T9GRwoD2dKAXDOXC4Ynsg
  54511. /eTb6QihuJ49CcdP+yz4k3ZB3lLg4VfSnQO8d57+nile98FRYB/e2guyLXW3Q0iT5/Z5xoRdgFlg
  54512. lPx4mI88k1HtQJAH32RjJMtOcQWh15QaiDLxInQirqWm2BJpTGCjAu4r7NRjkgtevi92a6O2JryP
  54513. A9gK8kxkRr05YuWW6zRjESjMlfGt7+/cgFhI6Uu46mWs6fyAtbXIRfmswZ/ZuepiiI7E8UuDEq3m
  54514. i4TWnsLrgxifarsbJGAzcMzs9zLzXNl5fe+epP7JI8Mk7hWSsT2RTyaGvWZzJBPqpK5jwa19hAM8
  54515. EHiGG3njxPPyBJUgriOCxLM6AGK/5jYk4Ve6xx6QddVfP5VhK8E7zeWzaGHQRiapIVJpLesux+t3
  54516. zqY6tQMzT3bR51xUAV3LePTJDL/PEo4XLSNolOer/qmyKwbQBM0=
  54517. -----END CERTIFICATE-----
  54518. TeliaSonera Root CA v1
  54519. ======================
  54520. -----BEGIN CERTIFICATE-----
  54521. MIIFODCCAyCgAwIBAgIRAJW+FqD3LkbxezmCcvqLzZYwDQYJKoZIhvcNAQEFBQAwNzEUMBIGA1UE
  54522. CgwLVGVsaWFTb25lcmExHzAdBgNVBAMMFlRlbGlhU29uZXJhIFJvb3QgQ0EgdjEwHhcNMDcxMDE4
  54523. MTIwMDUwWhcNMzIxMDE4MTIwMDUwWjA3MRQwEgYDVQQKDAtUZWxpYVNvbmVyYTEfMB0GA1UEAwwW
  54524. VGVsaWFTb25lcmEgUm9vdCBDQSB2MTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAMK+
  54525. 6yfwIaPzaSZVfp3FVRaRXP3vIb9TgHot0pGMYzHw7CTww6XScnwQbfQ3t+XmfHnqjLWCi65ItqwA
  54526. 3GV17CpNX8GH9SBlK4GoRz6JI5UwFpB/6FcHSOcZrr9FZ7E3GwYq/t75rH2D+1665I+XZ75Ljo1k
  54527. B1c4VWk0Nj0TSO9P4tNmHqTPGrdeNjPUtAa9GAH9d4RQAEX1jF3oI7x+/jXh7VB7qTCNGdMJjmhn
  54528. Xb88lxhTuylixcpecsHHltTbLaC0H2kD7OriUPEMPPCs81Mt8Bz17Ww5OXOAFshSsCPN4D7c3TxH
  54529. oLs1iuKYaIu+5b9y7tL6pe0S7fyYGKkmdtwoSxAgHNN/Fnct7W+A90m7UwW7XWjH1Mh1Fj+JWov3
  54530. F0fUTPHSiXk+TT2YqGHeOh7S+F4D4MHJHIzTjU3TlTazN19jY5szFPAtJmtTfImMMsJu7D0hADnJ
  54531. oWjiUIMusDor8zagrC/kb2HCUQk5PotTubtn2txTuXZZNp1D5SDgPTJghSJRt8czu90VL6R4pgd7
  54532. gUY2BIbdeTXHlSw7sKMXNeVzH7RcWe/a6hBle3rQf5+ztCo3O3CLm1u5K7fsslESl1MpWtTwEhDc
  54533. TwK7EpIvYtQ/aUN8Ddb8WHUBiJ1YFkveupD/RwGJBmr2X7KQarMCpgKIv7NHfirZ1fpoeDVNAgMB
  54534. AAGjPzA9MA8GA1UdEwEB/wQFMAMBAf8wCwYDVR0PBAQDAgEGMB0GA1UdDgQWBBTwj1k4ALP1j5qW
  54535. DNXr+nuqF+gTEjANBgkqhkiG9w0BAQUFAAOCAgEAvuRcYk4k9AwI//DTDGjkk0kiP0Qnb7tt3oNm
  54536. zqjMDfz1mgbldxSR651Be5kqhOX//CHBXfDkH1e3damhXwIm/9fH907eT/j3HEbAek9ALCI18Bmx
  54537. 0GtnLLCo4MBANzX2hFxc469CeP6nyQ1Q6g2EdvZR74NTxnr/DlZJLo961gzmJ1TjTQpgcmLNkQfW
  54538. pb/ImWvtxBnmq0wROMVvMeJuScg/doAmAyYp4Db29iBT4xdwNBedY2gea+zDTYa4EzAvXUYNR0PV
  54539. G6pZDrlcjQZIrXSHX8f8MVRBE+LHIQ6e4B4N4cB7Q4WQxYpYxmUKeFfyxiMPAdkgS94P+5KFdSpc
  54540. c41teyWRyu5FrgZLAMzTsVlQ2jqIOylDRl6XK1TOU2+NSueW+r9xDkKLfP0ooNBIytrEgUy7onOT
  54541. JsjrDNYmiLbAJM+7vVvrdX3pCI6GMyx5dwlppYn8s3CQh3aP0yK7Qs69cwsgJirQmz1wHiRszYd2
  54542. qReWt88NkvuOGKmYSdGe/mBEciG5Ge3C9THxOUiIkCR1VBatzvT4aRRkOfujuLpwQMcnHL/EVlP6
  54543. Y2XQ8xwOFvVrhlhNGNTkDY6lnVuR3HYkUD/GKvvZt5y11ubQ2egZixVxSK236thZiNSQvxaz2ems
  54544. WWFUyBy6ysHK4bkgTI86k4mloMy/0/Z1pHWWbVY=
  54545. -----END CERTIFICATE-----
  54546. E-Tugra Certification Authority
  54547. ===============================
  54548. -----BEGIN CERTIFICATE-----
  54549. MIIGSzCCBDOgAwIBAgIIamg+nFGby1MwDQYJKoZIhvcNAQELBQAwgbIxCzAJBgNVBAYTAlRSMQ8w
  54550. DQYDVQQHDAZBbmthcmExQDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamls
  54551. ZXJpIHZlIEhpem1ldGxlcmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBN
  54552. ZXJrZXppMSgwJgYDVQQDDB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTEzMDMw
  54553. NTEyMDk0OFoXDTIzMDMwMzEyMDk0OFowgbIxCzAJBgNVBAYTAlRSMQ8wDQYDVQQHDAZBbmthcmEx
  54554. QDA+BgNVBAoMN0UtVHXEn3JhIEVCRyBCaWxpxZ9pbSBUZWtub2xvamlsZXJpIHZlIEhpem1ldGxl
  54555. cmkgQS7Fni4xJjAkBgNVBAsMHUUtVHVncmEgU2VydGlmaWthc3lvbiBNZXJrZXppMSgwJgYDVQQD
  54556. DB9FLVR1Z3JhIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  54557. MIICCgKCAgEA4vU/kwVRHoViVF56C/UYB4Oufq9899SKa6VjQzm5S/fDxmSJPZQuVIBSOTkHS0vd
  54558. hQd2h8y/L5VMzH2nPbxHD5hw+IyFHnSOkm0bQNGZDbt1bsipa5rAhDGvykPL6ys06I+XawGb1Q5K
  54559. CKpbknSFQ9OArqGIW66z6l7LFpp3RMih9lRozt6Plyu6W0ACDGQXwLWTzeHxE2bODHnv0ZEoq1+g
  54560. ElIwcxmOj+GMB6LDu0rw6h8VqO4lzKRG+Bsi77MOQ7osJLjFLFzUHPhdZL3Dk14opz8n8Y4e0ypQ
  54561. BaNV2cvnOVPAmJ6MVGKLJrD3fY185MaeZkJVgkfnsliNZvcHfC425lAcP9tDJMW/hkd5s3kc91r0
  54562. E+xs+D/iWR+V7kI+ua2oMoVJl0b+SzGPWsutdEcf6ZG33ygEIqDUD13ieU/qbIWGvaimzuT6w+Gz
  54563. rt48Ue7LE3wBf4QOXVGUnhMMti6lTPk5cDZvlsouDERVxcr6XQKj39ZkjFqzAQqptQpHF//vkUAq
  54564. jqFGOjGY5RH8zLtJVor8udBhmm9lbObDyz51Sf6Pp+KJxWfXnUYTTjF2OySznhFlhqt/7x3U+Lzn
  54565. rFpct1pHXFXOVbQicVtbC/DP3KBhZOqp12gKY6fgDT+gr9Oq0n7vUaDmUStVkhUXU8u3Zg5mTPj5
  54566. dUyQ5xJwx0UCAwEAAaNjMGEwHQYDVR0OBBYEFC7j27JJ0JxUeVz6Jyr+zE7S6E5UMA8GA1UdEwEB
  54567. /wQFMAMBAf8wHwYDVR0jBBgwFoAULuPbsknQnFR5XPonKv7MTtLoTlQwDgYDVR0PAQH/BAQDAgEG
  54568. MA0GCSqGSIb3DQEBCwUAA4ICAQAFNzr0TbdF4kV1JI+2d1LoHNgQk2Xz8lkGpD4eKexd0dCrfOAK
  54569. kEh47U6YA5n+KGCRHTAduGN8qOY1tfrTYXbm1gdLymmasoR6d5NFFxWfJNCYExL/u6Au/U5Mh/jO
  54570. XKqYGwXgAEZKgoClM4so3O0409/lPun++1ndYYRP0lSWE2ETPo+Aab6TR7U1Q9Jauz1c77NCR807
  54571. VRMGsAnb/WP2OogKmW9+4c4bU2pEZiNRCHu8W1Ki/QY3OEBhj0qWuJA3+GbHeJAAFS6LrVE1Uweo
  54572. a2iu+U48BybNCAVwzDk/dr2l02cmAYamU9JgO3xDf1WKvJUawSg5TB9D0pH0clmKuVb8P7Sd2nCc
  54573. dlqMQ1DujjByTd//SffGqWfZbawCEeI6FiWnWAjLb1NBnEg4R2gz0dfHj9R0IdTDBZB6/86WiLEV
  54574. KV0jq9BgoRJP3vQXzTLlyb/IQ639Lo7xr+L0mPoSHyDYwKcMhcWQ9DstliaxLL5Mq+ux0orJ23gT
  54575. Dx4JnW2PAJ8C2sH6H3p6CcRK5ogql5+Ji/03X186zjhZhkuvcQu02PJwT58yE+Owp1fl2tpDy4Q0
  54576. 8ijE6m30Ku/Ba3ba+367hTzSU8JNvnHhRdH9I2cNE3X7z2VnIp2usAnRCf8dNL/+I5c30jn6PQ0G
  54577. C7TbO6Orb1wdtn7os4I07QZcJA==
  54578. -----END CERTIFICATE-----
  54579. T-TeleSec GlobalRoot Class 2
  54580. ============================
  54581. -----BEGIN CERTIFICATE-----
  54582. MIIDwzCCAqugAwIBAgIBATANBgkqhkiG9w0BAQsFADCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoM
  54583. IlQtU3lzdGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBU
  54584. cnVzdCBDZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwHhcNMDgx
  54585. MDAxMTA0MDE0WhcNMzMxMDAxMjM1OTU5WjCBgjELMAkGA1UEBhMCREUxKzApBgNVBAoMIlQtU3lz
  54586. dGVtcyBFbnRlcnByaXNlIFNlcnZpY2VzIEdtYkgxHzAdBgNVBAsMFlQtU3lzdGVtcyBUcnVzdCBD
  54587. ZW50ZXIxJTAjBgNVBAMMHFQtVGVsZVNlYyBHbG9iYWxSb290IENsYXNzIDIwggEiMA0GCSqGSIb3
  54588. DQEBAQUAA4IBDwAwggEKAoIBAQCqX9obX+hzkeXaXPSi5kfl82hVYAUdAqSzm1nzHoqvNK38DcLZ
  54589. SBnuaY/JIPwhqgcZ7bBcrGXHX+0CfHt8LRvWurmAwhiCFoT6ZrAIxlQjgeTNuUk/9k9uN0goOA/F
  54590. vudocP05l03Sx5iRUKrERLMjfTlH6VJi1hKTXrcxlkIF+3anHqP1wvzpesVsqXFP6st4vGCvx970
  54591. 2cu+fjOlbpSD8DT6IavqjnKgP6TeMFvvhk1qlVtDRKgQFRzlAVfFmPHmBiiRqiDFt1MmUUOyCxGV
  54592. WOHAD3bZwI18gfNycJ5v/hqO2V81xrJvNHy+SE/iWjnX2J14np+GPgNeGYtEotXHAgMBAAGjQjBA
  54593. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBS/WSA2AHmgoCJrjNXy
  54594. YdK4LMuCSjANBgkqhkiG9w0BAQsFAAOCAQEAMQOiYQsfdOhyNsZt+U2e+iKo4YFWz827n+qrkRk4
  54595. r6p8FU3ztqONpfSO9kSpp+ghla0+AGIWiPACuvxhI+YzmzB6azZie60EI4RYZeLbK4rnJVM3YlNf
  54596. vNoBYimipidx5joifsFvHZVwIEoHNN/q/xWA5brXethbdXwFeilHfkCoMRN3zUA7tFFHei4R40cR
  54597. 3p1m0IvVVGb6g1XqfMIpiRvpb7PO4gWEyS8+eIVibslfwXhjdFjASBgMmTnrpMwatXlajRWc2BQN
  54598. 9noHV8cigwUtPJslJj0Ys6lDfMjIq2SPDqO/nBudMNva0Bkuqjzx+zOAduTNrRlPBSeOE6Fuwg==
  54599. -----END CERTIFICATE-----
  54600. Atos TrustedRoot 2011
  54601. =====================
  54602. -----BEGIN CERTIFICATE-----
  54603. MIIDdzCCAl+gAwIBAgIIXDPLYixfszIwDQYJKoZIhvcNAQELBQAwPDEeMBwGA1UEAwwVQXRvcyBU
  54604. cnVzdGVkUm9vdCAyMDExMQ0wCwYDVQQKDARBdG9zMQswCQYDVQQGEwJERTAeFw0xMTA3MDcxNDU4
  54605. MzBaFw0zMDEyMzEyMzU5NTlaMDwxHjAcBgNVBAMMFUF0b3MgVHJ1c3RlZFJvb3QgMjAxMTENMAsG
  54606. A1UECgwEQXRvczELMAkGA1UEBhMCREUwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCV
  54607. hTuXbyo7LjvPpvMpNb7PGKw+qtn4TaA+Gke5vJrf8v7MPkfoepbCJI419KkM/IL9bcFyYie96mvr
  54608. 54rMVD6QUM+A1JX76LWC1BTFtqlVJVfbsVD2sGBkWXppzwO3bw2+yj5vdHLqqjAqc2K+SZFhyBH+
  54609. DgMq92og3AIVDV4VavzjgsG1xZ1kCWyjWZgHJ8cblithdHFsQ/H3NYkQ4J7sVaE3IqKHBAUsR320
  54610. HLliKWYoyrfhk/WklAOZuXCFteZI6o1Q/NnezG8HDt0Lcp2AMBYHlT8oDv3FdU9T1nSatCQujgKR
  54611. z3bFmx5VdJx4IbHwLfELn8LVlhgf8FQieowHAgMBAAGjfTB7MB0GA1UdDgQWBBSnpQaxLKYJYO7R
  54612. l+lwrrw7GWzbITAPBgNVHRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFKelBrEspglg7tGX6XCuvDsZ
  54613. bNshMBgGA1UdIAQRMA8wDQYLKwYBBAGwLQMEAQEwDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEB
  54614. CwUAA4IBAQAmdzTblEiGKkGdLD4GkGDEjKwLVLgfuXvTBznk+j57sj1O7Z8jvZfza1zv7v1Apt+h
  54615. k6EKhqzvINB5Ab149xnYJDE0BAGmuhWawyfc2E8PzBhj/5kPDpFrdRbhIfzYJsdHt6bPWHJxfrrh
  54616. TZVHO8mvbaG0weyJ9rQPOLXiZNwlz6bb65pcmaHFCN795trV1lpFDMS3wrUU77QR/w4VtfX128a9
  54617. 61qn8FYiqTxlVMYVqL2Gns2Dlmh6cYGJ4Qvh6hEbaAjMaZ7snkGeRDImeuKHCnE96+RapNLbxc3G
  54618. 3mB/ufNPRJLvKrcYPqcZ2Qt9sTdBQrC6YB3y/gkRsPCHe6ed
  54619. -----END CERTIFICATE-----
  54620. QuoVadis Root CA 1 G3
  54621. =====================
  54622. -----BEGIN CERTIFICATE-----
  54623. MIIFYDCCA0igAwIBAgIUeFhfLq0sGUvjNwc1NBMotZbUZZMwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54624. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54625. b3QgQ0EgMSBHMzAeFw0xMjAxMTIxNzI3NDRaFw00MjAxMTIxNzI3NDRaMEgxCzAJBgNVBAYTAkJN
  54626. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDEg
  54627. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCgvlAQjunybEC0BJyFuTHK3C3kEakE
  54628. PBtVwedYMB0ktMPvhd6MLOHBPd+C5k+tR4ds7FtJwUrVu4/sh6x/gpqG7D0DmVIB0jWerNrwU8lm
  54629. PNSsAgHaJNM7qAJGr6Qc4/hzWHa39g6QDbXwz8z6+cZM5cOGMAqNF34168Xfuw6cwI2H44g4hWf6
  54630. Pser4BOcBRiYz5P1sZK0/CPTz9XEJ0ngnjybCKOLXSoh4Pw5qlPafX7PGglTvF0FBM+hSo+LdoIN
  54631. ofjSxxR3W5A2B4GbPgb6Ul5jxaYA/qXpUhtStZI5cgMJYr2wYBZupt0lwgNm3fME0UDiTouG9G/l
  54632. g6AnhF4EwfWQvTA9xO+oabw4m6SkltFi2mnAAZauy8RRNOoMqv8hjlmPSlzkYZqn0ukqeI1RPToV
  54633. 7qJZjqlc3sX5kCLliEVx3ZGZbHqfPT2YfF72vhZooF6uCyP8Wg+qInYtyaEQHeTTRCOQiJ/GKubX
  54634. 9ZqzWB4vMIkIG1SitZgj7Ah3HJVdYdHLiZxfokqRmu8hqkkWCKi9YSgxyXSthfbZxbGL0eUQMk1f
  54635. iyA6PEkfM4VZDdvLCXVDaXP7a3F98N/ETH3Goy7IlXnLc6KOTk0k+17kBL5yG6YnLUlamXrXXAkg
  54636. t3+UuU/xDRxeiEIbEbfnkduebPRq34wGmAOtzCjvpUfzUwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54637. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUo5fW816iEOGrRZ88F2Q87gFwnMwwDQYJKoZI
  54638. hvcNAQELBQADggIBABj6W3X8PnrHX3fHyt/PX8MSxEBd1DKquGrX1RUVRpgjpeaQWxiZTOOtQqOC
  54639. MTaIzen7xASWSIsBx40Bz1szBpZGZnQdT+3Btrm0DWHMY37XLneMlhwqI2hrhVd2cDMT/uFPpiN3
  54640. GPoajOi9ZcnPP/TJF9zrx7zABC4tRi9pZsMbj/7sPtPKlL92CiUNqXsCHKnQO18LwIE6PWThv6ct
  54641. Tr1NxNgpxiIY0MWscgKCP6o6ojoilzHdCGPDdRS5YCgtW2jgFqlmgiNR9etT2DGbe+m3nUvriBbP
  54642. +V04ikkwj+3x6xn0dxoxGE1nVGwvb2X52z3sIexe9PSLymBlVNFxZPT5pqOBMzYzcfCkeF9OrYMh
  54643. 3jRJjehZrJ3ydlo28hP0r+AJx2EqbPfgna67hkooby7utHnNkDPDs3b69fBsnQGQ+p6Q9pxyz0fa
  54644. wx/kNSBT8lTR32GDpgLiJTjehTItXnOQUl1CxM49S+H5GYQd1aJQzEH7QRTDvdbJWqNjZgKAvQU6
  54645. O0ec7AAmTPWIUb+oI38YB7AL7YsmoWTTYUrrXJ/es69nA7Mf3W1daWhpq1467HxpvMc7hU6eFbm0
  54646. FU/DlXpY18ls6Wy58yljXrQs8C097Vpl4KlbQMJImYFtnh8GKjwStIsPm6Ik8KaN1nrgS7ZklmOV
  54647. hMJKzRwuJIczYOXD
  54648. -----END CERTIFICATE-----
  54649. QuoVadis Root CA 2 G3
  54650. =====================
  54651. -----BEGIN CERTIFICATE-----
  54652. MIIFYDCCA0igAwIBAgIURFc0JFuBiZs18s64KztbpybwdSgwDQYJKoZIhvcNAQELBQAwSDELMAkG
  54653. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54654. b3QgQ0EgMiBHMzAeFw0xMjAxMTIxODU5MzJaFw00MjAxMTIxODU5MzJaMEgxCzAJBgNVBAYTAkJN
  54655. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDIg
  54656. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQChriWyARjcV4g/Ruv5r+LrI3HimtFh
  54657. ZiFfqq8nUeVuGxbULX1QsFN3vXg6YOJkApt8hpvWGo6t/x8Vf9WVHhLL5hSEBMHfNrMWn4rjyduY
  54658. NM7YMxcoRvynyfDStNVNCXJJ+fKH46nafaF9a7I6JaltUkSs+L5u+9ymc5GQYaYDFCDy54ejiK2t
  54659. oIz/pgslUiXnFgHVy7g1gQyjO/Dh4fxaXc6AcW34Sas+O7q414AB+6XrW7PFXmAqMaCvN+ggOp+o
  54660. MiwMzAkd056OXbxMmO7FGmh77FOm6RQ1o9/NgJ8MSPsc9PG/Srj61YxxSscfrf5BmrODXfKEVu+l
  54661. V0POKa2Mq1W/xPtbAd0jIaFYAI7D0GoT7RPjEiuA3GfmlbLNHiJuKvhB1PLKFAeNilUSxmn1uIZo
  54662. L1NesNKqIcGY5jDjZ1XHm26sGahVpkUG0CM62+tlXSoREfA7T8pt9DTEceT/AFr2XK4jYIVz8eQQ
  54663. sSWu1ZK7E8EM4DnatDlXtas1qnIhO4M15zHfeiFuuDIIfR0ykRVKYnLP43ehvNURG3YBZwjgQQvD
  54664. 6xVu+KQZ2aKrr+InUlYrAoosFCT5v0ICvybIxo/gbjh9Uy3l7ZizlWNof/k19N+IxWA1ksB8aRxh
  54665. lRbQ694Lrz4EEEVlWFA4r0jyWbYW8jwNkALGcC4BrTwV1wIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54666. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQU7edvdlq/YOxJW8ald7tyFnGbxD0wDQYJKoZI
  54667. hvcNAQELBQADggIBAJHfgD9DCX5xwvfrs4iP4VGyvD11+ShdyLyZm3tdquXK4Qr36LLTn91nMX66
  54668. AarHakE7kNQIXLJgapDwyM4DYvmL7ftuKtwGTTwpD4kWilhMSA/ohGHqPHKmd+RCroijQ1h5fq7K
  54669. pVMNqT1wvSAZYaRsOPxDMuHBR//47PERIjKWnML2W2mWeyAMQ0GaW/ZZGYjeVYg3UQt4XAoeo0L9
  54670. x52ID8DyeAIkVJOviYeIyUqAHerQbj5hLja7NQ4nlv1mNDthcnPxFlxHBlRJAHpYErAK74X9sbgz
  54671. dWqTHBLmYF5vHX/JHyPLhGGfHoJE+V+tYlUkmlKY7VHnoX6XOuYvHxHaU4AshZ6rNRDbIl9qxV6X
  54672. U/IyAgkwo1jwDQHVcsaxfGl7w/U2Rcxhbl5MlMVerugOXou/983g7aEOGzPuVBj+D77vfoRrQ+Nw
  54673. mNtddbINWQeFFSM51vHfqSYP1kjHs6Yi9TM3WpVHn3u6GBVv/9YUZINJ0gpnIdsPNWNgKCLjsZWD
  54674. zYWm3S8P52dSbrsvhXz1SnPnxT7AvSESBT/8twNJAlvIJebiVDj1eYeMHVOyToV7BjjHLPj4sHKN
  54675. JeV3UvQDHEimUF+IIDBu8oJDqz2XhOdT+yHBTw8imoa4WSr2Rz0ZiC3oheGe7IUIarFsNMkd7Egr
  54676. O3jtZsSOeWmD3n+M
  54677. -----END CERTIFICATE-----
  54678. QuoVadis Root CA 3 G3
  54679. =====================
  54680. -----BEGIN CERTIFICATE-----
  54681. MIIFYDCCA0igAwIBAgIULvWbAiin23r/1aOp7r0DoM8Sah0wDQYJKoZIhvcNAQELBQAwSDELMAkG
  54682. A1UEBhMCQk0xGTAXBgNVBAoTEFF1b1ZhZGlzIExpbWl0ZWQxHjAcBgNVBAMTFVF1b1ZhZGlzIFJv
  54683. b3QgQ0EgMyBHMzAeFw0xMjAxMTIyMDI2MzJaFw00MjAxMTIyMDI2MzJaMEgxCzAJBgNVBAYTAkJN
  54684. MRkwFwYDVQQKExBRdW9WYWRpcyBMaW1pdGVkMR4wHAYDVQQDExVRdW9WYWRpcyBSb290IENBIDMg
  54685. RzMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCzyw4QZ47qFJenMioKVjZ/aEzHs286
  54686. IxSR/xl/pcqs7rN2nXrpixurazHb+gtTTK/FpRp5PIpM/6zfJd5O2YIyC0TeytuMrKNuFoM7pmRL
  54687. Mon7FhY4futD4tN0SsJiCnMK3UmzV9KwCoWdcTzeo8vAMvMBOSBDGzXRU7Ox7sWTaYI+FrUoRqHe
  54688. 6okJ7UO4BUaKhvVZR74bbwEhELn9qdIoyhA5CcoTNs+cra1AdHkrAj80//ogaX3T7mH1urPnMNA3
  54689. I4ZyYUUpSFlob3emLoG+B01vr87ERRORFHAGjx+f+IdpsQ7vw4kZ6+ocYfx6bIrc1gMLnia6Et3U
  54690. VDmrJqMz6nWB2i3ND0/kA9HvFZcba5DFApCTZgIhsUfei5pKgLlVj7WiL8DWM2fafsSntARE60f7
  54691. 5li59wzweyuxwHApw0BiLTtIadwjPEjrewl5qW3aqDCYz4ByA4imW0aucnl8CAMhZa634RylsSqi
  54692. Md5mBPfAdOhx3v89WcyWJhKLhZVXGqtrdQtEPREoPHtht+KPZ0/l7DxMYIBpVzgeAVuNVejH38DM
  54693. dyM0SXV89pgR6y3e7UEuFAUCf+D+IOs15xGsIs5XPd7JMG0QA4XN8f+MFrXBsj6IbGB/kE+V9/Yt
  54694. rQE5BwT6dYB9v0lQ7e/JxHwc64B+27bQ3RP+ydOc17KXqQIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  54695. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUxhfQvKjqAkPyGwaZXSuQILnXnOQwDQYJKoZI
  54696. hvcNAQELBQADggIBADRh2Va1EodVTd2jNTFGu6QHcrxfYWLopfsLN7E8trP6KZ1/AvWkyaiTt3px
  54697. KGmPc+FSkNrVvjrlt3ZqVoAh313m6Tqe5T72omnHKgqwGEfcIHB9UqM+WXzBusnIFUBhynLWcKzS
  54698. t/Ac5IYp8M7vaGPQtSCKFWGafoaYtMnCdvvMujAWzKNhxnQT5WvvoxXqA/4Ti2Tk08HS6IT7SdEQ
  54699. TXlm66r99I0xHnAUrdzeZxNMgRVhvLfZkXdxGYFgu/BYpbWcC/ePIlUnwEsBbTuZDdQdm2NnL9Du
  54700. DcpmvJRPpq3t/O5jrFc/ZSXPsoaP0Aj/uHYUbt7lJ+yreLVTubY/6CD50qi+YUbKh4yE8/nxoGib
  54701. Ih6BJpsQBJFxwAYf3KDTuVan45gtf4Od34wrnDKOMpTwATwiKp9Dwi7DmDkHOHv8XgBCH/MyJnmD
  54702. hPbl8MFREsALHgQjDFSlTC9JxUrRtm5gDWv8a4uFJGS3iQ6rJUdbPM9+Sb3H6QrG2vd+DhcI00iX
  54703. 0HGS8A85PjRqHH3Y8iKuu2n0M7SmSFXRDw4m6Oy2Cy2nhTXN/VnIn9HNPlopNLk9hM6xZdRZkZFW
  54704. dSHBd575euFgndOtBBj0fOtek49TSiIp+EgrPk2GrFt/ywaZWWDYWGWVjUTR939+J399roD1B0y2
  54705. PpxxVJkES/1Y+Zj0
  54706. -----END CERTIFICATE-----
  54707. DigiCert Assured ID Root G2
  54708. ===========================
  54709. -----BEGIN CERTIFICATE-----
  54710. MIIDljCCAn6gAwIBAgIQC5McOtY5Z+pnI7/Dr5r0SzANBgkqhkiG9w0BAQsFADBlMQswCQYDVQQG
  54711. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQw
  54712. IgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIwHhcNMTMwODAxMTIwMDAwWhcNMzgw
  54713. MTE1MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQL
  54714. ExB3d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzIw
  54715. ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDZ5ygvUj82ckmIkzTz+GoeMVSAn61UQbVH
  54716. 35ao1K+ALbkKz3X9iaV9JPrjIgwrvJUXCzO/GU1BBpAAvQxNEP4HteccbiJVMWWXvdMX0h5i89vq
  54717. bFCMP4QMls+3ywPgym2hFEwbid3tALBSfK+RbLE4E9HpEgjAALAcKxHad3A2m67OeYfcgnDmCXRw
  54718. VWmvo2ifv922ebPynXApVfSr/5Vh88lAbx3RvpO704gqu52/clpWcTs/1PPRCv4o76Pu2ZmvA9OP
  54719. YLfykqGxvYmJHzDNw6YuYjOuFgJ3RFrngQo8p0Quebg/BLxcoIfhG69Rjs3sLPr4/m3wOnyqi+Rn
  54720. lTGNAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTO
  54721. w0q5mVXyuNtgv6l+vVa1lzan1jANBgkqhkiG9w0BAQsFAAOCAQEAyqVVjOPIQW5pJ6d1Ee88hjZv
  54722. 0p3GeDgdaZaikmkuOGybfQTUiaWxMTeKySHMq2zNixya1r9I0jJmwYrA8y8678Dj1JGG0VDjA9tz
  54723. d29KOVPt3ibHtX2vK0LRdWLjSisCx1BL4GnilmwORGYQRI+tBev4eaymG+g3NJ1TyWGqolKvSnAW
  54724. hsI6yLETcDbYz+70CjTVW0z9B5yiutkBclzzTcHdDrEcDcRjvq30FPuJ7KJBDkzMyFdA0G4Dqs0M
  54725. jomZmWzwPDCvON9vvKO+KSAnq3T/EyJ43pdSVR6DtVQgA+6uwE9W3jfMw3+qBCe703e4YtsXfJwo
  54726. IhNzbM8m9Yop5w==
  54727. -----END CERTIFICATE-----
  54728. DigiCert Assured ID Root G3
  54729. ===========================
  54730. -----BEGIN CERTIFICATE-----
  54731. MIICRjCCAc2gAwIBAgIQC6Fa+h3foLVJRK/NJKBs7DAKBggqhkjOPQQDAzBlMQswCQYDVQQGEwJV
  54732. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSQwIgYD
  54733. VQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54734. MTIwMDAwWjBlMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54735. d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgRzMwdjAQ
  54736. BgcqhkjOPQIBBgUrgQQAIgNiAAQZ57ysRGXtzbg/WPuNsVepRC0FFfLvC/8QdJ+1YlJfZn4f5dwb
  54737. RXkLzMZTCp2NXQLZqVneAlr2lSoOjThKiknGvMYDOAdfVdp+CW7if17QRSAPWXYQ1qAk8C3eNvJs
  54738. KTmjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBTL0L2p4ZgF
  54739. UaFNN6KDec6NHSrkhDAKBggqhkjOPQQDAwNnADBkAjAlpIFFAmsSS3V0T8gj43DydXLefInwz5Fy
  54740. YZ5eEJJZVrmDxxDnOOlYJjZ91eQ0hjkCMHw2U/Aw5WJjOpnitqM7mzT6HtoQknFekROn3aRukswy
  54741. 1vUhZscv6pZjamVFkpUBtA==
  54742. -----END CERTIFICATE-----
  54743. DigiCert Global Root G2
  54744. =======================
  54745. -----BEGIN CERTIFICATE-----
  54746. MIIDjjCCAnagAwIBAgIQAzrx5qcRqaC7KGSxHQn65TANBgkqhkiG9w0BAQsFADBhMQswCQYDVQQG
  54747. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAw
  54748. HgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMjAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUx
  54749. MjAwMDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3
  54750. dy5kaWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEcyMIIBIjANBgkq
  54751. hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuzfNNNx7a8myaJCtSnX/RrohCgiN9RlUyfuI2/Ou8jqJ
  54752. kTx65qsGGmvPrC3oXgkkRLpimn7Wo6h+4FR1IAWsULecYxpsMNzaHxmx1x7e/dfgy5SDN67sH0NO
  54753. 3Xss0r0upS/kqbitOtSZpLYl6ZtrAGCSYP9PIUkY92eQq2EGnI/yuum06ZIya7XzV+hdG82MHauV
  54754. BJVJ8zUtluNJbd134/tJS7SsVQepj5WztCO7TG1F8PapspUwtP1MVYwnSlcUfIKdzXOS0xZKBgyM
  54755. UNGPHgm+F6HmIcr9g+UQvIOlCsRnKPZzFBQ9RnbDhxSJITRNrw9FDKZJobq7nMWxM4MphQIDAQAB
  54756. o0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUTiJUIBiV5uNu
  54757. 5g/6+rkS7QYXjzkwDQYJKoZIhvcNAQELBQADggEBAGBnKJRvDkhj6zHd6mcY1Yl9PMWLSn/pvtsr
  54758. F9+wX3N3KjITOYFnQoQj8kVnNeyIv/iPsGEMNKSuIEyExtv4NeF22d+mQrvHRAiGfzZ0JFrabA0U
  54759. WTW98kndth/Jsw1HKj2ZL7tcu7XUIOGZX1NGFdtom/DzMNU+MeKNhJ7jitralj41E6Vf8PlwUHBH
  54760. QRFXGU7Aj64GxJUTFy8bJZ918rGOmaFvE7FBcf6IKshPECBV1/MUReXgRPTqh5Uykw7+U0b6LJ3/
  54761. iyK5S9kJRaTepLiaWN0bfVKfjllDiIGknibVb63dDcY3fe0Dkhvld1927jyNxF1WW6LZZm6zNTfl
  54762. MrY=
  54763. -----END CERTIFICATE-----
  54764. DigiCert Global Root G3
  54765. =======================
  54766. -----BEGIN CERTIFICATE-----
  54767. MIICPzCCAcWgAwIBAgIQBVVWvPJepDU1w6QP1atFcjAKBggqhkjOPQQDAzBhMQswCQYDVQQGEwJV
  54768. UzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSAwHgYD
  54769. VQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBHMzAeFw0xMzA4MDExMjAwMDBaFw0zODAxMTUxMjAw
  54770. MDBaMGExCzAJBgNVBAYTAlVTMRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5k
  54771. aWdpY2VydC5jb20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IEczMHYwEAYHKoZIzj0C
  54772. AQYFK4EEACIDYgAE3afZu4q4C/sLfyHS8L6+c/MzXRq8NOrexpu80JX28MzQC7phW1FGfp4tn+6O
  54773. YwwX7Adw9c+ELkCDnOg/QW07rdOkFFk2eJ0DQ+4QE2xy3q6Ip6FrtUPOZ9wj/wMco+I+o0IwQDAP
  54774. BgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjAdBgNVHQ4EFgQUs9tIpPmhxdiuNkHMEWNp
  54775. Yim8S8YwCgYIKoZIzj0EAwMDaAAwZQIxAK288mw/EkrRLTnDCgmXc/SINoyIJ7vmiI1Qhadj+Z4y
  54776. 3maTD/HMsQmP3Wyr+mt/oAIwOWZbwmSNuJ5Q3KjVSaLtx9zRSX8XAbjIho9OjIgrqJqpisXRAL34
  54777. VOKa5Vt8sycX
  54778. -----END CERTIFICATE-----
  54779. DigiCert Trusted Root G4
  54780. ========================
  54781. -----BEGIN CERTIFICATE-----
  54782. MIIFkDCCA3igAwIBAgIQBZsbV56OITLiOQe9p3d1XDANBgkqhkiG9w0BAQwFADBiMQswCQYDVQQG
  54783. EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNlcnQuY29tMSEw
  54784. HwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwHhcNMTMwODAxMTIwMDAwWhcNMzgwMTE1
  54785. MTIwMDAwWjBiMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3
  54786. d3cuZGlnaWNlcnQuY29tMSEwHwYDVQQDExhEaWdpQ2VydCBUcnVzdGVkIFJvb3QgRzQwggIiMA0G
  54787. CSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC/5pBzaN675F1KPDAiMGkz7MKnJS7JIT3yithZwuEp
  54788. pz1Yq3aaza57G4QNxDAf8xukOBbrVsaXbR2rsnnyyhHS5F/WBTxSD1Ifxp4VpX6+n6lXFllVcq9o
  54789. k3DCsrp1mWpzMpTREEQQLt+C8weE5nQ7bXHiLQwb7iDVySAdYyktzuxeTsiT+CFhmzTrBcZe7Fsa
  54790. vOvJz82sNEBfsXpm7nfISKhmV1efVFiODCu3T6cw2Vbuyntd463JT17lNecxy9qTXtyOj4DatpGY
  54791. QJB5w3jHtrHEtWoYOAMQjdjUN6QuBX2I9YI+EJFwq1WCQTLX2wRzKm6RAXwhTNS8rhsDdV14Ztk6
  54792. MUSaM0C/CNdaSaTC5qmgZ92kJ7yhTzm1EVgX9yRcRo9k98FpiHaYdj1ZXUJ2h4mXaXpI8OCiEhtm
  54793. mnTK3kse5w5jrubU75KSOp493ADkRSWJtppEGSt+wJS00mFt6zPZxd9LBADMfRyVw4/3IbKyEbe7
  54794. f/LVjHAsQWCqsWMYRJUadmJ+9oCw++hkpjPRiQfhvbfmQ6QYuKZ3AeEPlAwhHbJUKSWJbOUOUlFH
  54795. dL4mrLZBdd56rF+NP8m800ERElvlEFDrMcXKchYiCd98THU/Y+whX8QgUWtvsauGi0/C1kVfnSD8
  54796. oR7FwI+isX4KJpn15GkvmB0t9dmpsh3lGwIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1Ud
  54797. DwEB/wQEAwIBhjAdBgNVHQ4EFgQU7NfjgtJxXWRM3y5nP+e6mK4cD08wDQYJKoZIhvcNAQEMBQAD
  54798. ggIBALth2X2pbL4XxJEbw6GiAI3jZGgPVs93rnD5/ZpKmbnJeFwMDF/k5hQpVgs2SV1EY+CtnJYY
  54799. ZhsjDT156W1r1lT40jzBQ0CuHVD1UvyQO7uYmWlrx8GnqGikJ9yd+SeuMIW59mdNOj6PWTkiU0Tr
  54800. yF0Dyu1Qen1iIQqAyHNm0aAFYF/opbSnr6j3bTWcfFqK1qI4mfN4i/RN0iAL3gTujJtHgXINwBQy
  54801. 7zBZLq7gcfJW5GqXb5JQbZaNaHqasjYUegbyJLkJEVDXCLG4iXqEI2FCKeWjzaIgQdfRnGTZ6iah
  54802. ixTXTBmyUEFxPT9NcCOGDErcgdLMMpSEDQgJlxxPwO5rIHQw0uA5NBCFIRUBCOhVMt5xSdkoF1BN
  54803. 5r5N0XWs0Mr7QbhDparTwwVETyw2m+L64kW4I1NsBm9nVX9GtUw/bihaeSbSpKhil9Ie4u1Ki7wb
  54804. /UdKDd9nZn6yW0HQO+T0O/QEY+nvwlQAUaCKKsnOeMzV6ocEGLPOr0mIr/OSmbaz5mEP0oUA51Aa
  54805. 5BuVnRmhuZyxm7EAHu/QD09CbMkKvO5D+jpxpchNJqU1/YldvIViHTLSoCtU7ZpXwdv6EM8Zt4tK
  54806. G48BtieVU+i2iW1bvGjUI+iLUaJW+fCmgKDWHrO8Dw9TdSmq6hN35N6MgSGtBxBHEa2HPQfRdbzP
  54807. 82Z+
  54808. -----END CERTIFICATE-----
  54809. COMODO RSA Certification Authority
  54810. ==================================
  54811. -----BEGIN CERTIFICATE-----
  54812. MIIF2DCCA8CgAwIBAgIQTKr5yttjb+Af907YWwOGnTANBgkqhkiG9w0BAQwFADCBhTELMAkGA1UE
  54813. BhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgG
  54814. A1UEChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlv
  54815. biBBdXRob3JpdHkwHhcNMTAwMTE5MDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBhTELMAkGA1UEBhMC
  54816. R0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEaMBgGA1UE
  54817. ChMRQ09NT0RPIENBIExpbWl0ZWQxKzApBgNVBAMTIkNPTU9ETyBSU0EgQ2VydGlmaWNhdGlvbiBB
  54818. dXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCR6FSS0gpWsawNJN3Fz0Rn
  54819. dJkrN6N9I3AAcbxT38T6KhKPS38QVr2fcHK3YX/JSw8Xpz3jsARh7v8Rl8f0hj4K+j5c+ZPmNHrZ
  54820. FGvnnLOFoIJ6dq9xkNfs/Q36nGz637CC9BR++b7Epi9Pf5l/tfxnQ3K9DADWietrLNPtj5gcFKt+
  54821. 5eNu/Nio5JIk2kNrYrhV/erBvGy2i/MOjZrkm2xpmfh4SDBF1a3hDTxFYPwyllEnvGfDyi62a+pG
  54822. x8cgoLEfZd5ICLqkTqnyg0Y3hOvozIFIQ2dOciqbXL1MGyiKXCJ7tKuY2e7gUYPDCUZObT6Z+pUX
  54823. 2nwzV0E8jVHtC7ZcryxjGt9XyD+86V3Em69FmeKjWiS0uqlWPc9vqv9JWL7wqP/0uK3pN/u6uPQL
  54824. OvnoQ0IeidiEyxPx2bvhiWC4jChWrBQdnArncevPDt09qZahSL0896+1DSJMwBGB7FY79tOi4lu3
  54825. sgQiUpWAk2nojkxl8ZEDLXB0AuqLZxUpaVICu9ffUGpVRr+goyhhf3DQw6KqLCGqR84onAZFdr+C
  54826. GCe01a60y1Dma/RMhnEw6abfFobg2P9A3fvQQoh/ozM6LlweQRGBY84YcWsr7KaKtzFcOmpH4MN5
  54827. WdYgGq/yapiqcrxXStJLnbsQ/LBMQeXtHT1eKJ2czL+zUdqnR+WEUwIDAQABo0IwQDAdBgNVHQ4E
  54828. FgQUu69+Aj36pvE8hI6t7jiY7NkyMtQwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8w
  54829. DQYJKoZIhvcNAQEMBQADggIBAArx1UaEt65Ru2yyTUEUAJNMnMvlwFTPoCWOAvn9sKIN9SCYPBMt
  54830. rFaisNZ+EZLpLrqeLppysb0ZRGxhNaKatBYSaVqM4dc+pBroLwP0rmEdEBsqpIt6xf4FpuHA1sj+
  54831. nq6PK7o9mfjYcwlYRm6mnPTXJ9OV2jeDchzTc+CiR5kDOF3VSXkAKRzH7JsgHAckaVd4sjn8OoSg
  54832. tZx8jb8uk2IntznaFxiuvTwJaP+EmzzV1gsD41eeFPfR60/IvYcjt7ZJQ3mFXLrrkguhxuhoqEwW
  54833. sRqZCuhTLJK7oQkYdQxlqHvLI7cawiiFwxv/0Cti76R7CZGYZ4wUAc1oBmpjIXUDgIiKboHGhfKp
  54834. pC3n9KUkEEeDys30jXlYsQab5xoq2Z0B15R97QNKyvDb6KkBPvVWmckejkk9u+UJueBPSZI9FoJA
  54835. zMxZxuY67RIuaTxslbH9qh17f4a+Hg4yRvv7E491f0yLS0Zj/gA0QHDBw7mh3aZw4gSzQbzpgJHq
  54836. ZJx64SIDqZxubw5lT2yHh17zbqD5daWbQOhTsiedSrnAdyGN/4fy3ryM7xfft0kL0fJuMAsaDk52
  54837. 7RH89elWsn2/x20Kk4yl0MC2Hb46TpSi125sC8KKfPog88Tk5c0NqMuRkrF8hey1FGlmDoLnzc7I
  54838. LaZRfyHBNVOFBkpdn627G190
  54839. -----END CERTIFICATE-----
  54840. USERTrust RSA Certification Authority
  54841. =====================================
  54842. -----BEGIN CERTIFICATE-----
  54843. MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE
  54844. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54845. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54846. dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE
  54847. BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK
  54848. ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh
  54849. dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz
  54850. 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j
  54851. Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn
  54852. RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O
  54853. +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq
  54854. /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE
  54855. Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM
  54856. lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8
  54857. yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+
  54858. eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd
  54859. BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF
  54860. MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW
  54861. FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ
  54862. 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ
  54863. Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM
  54864. 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi
  54865. FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi
  54866. yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c
  54867. J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw
  54868. sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx
  54869. Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9
  54870. -----END CERTIFICATE-----
  54871. USERTrust ECC Certification Authority
  54872. =====================================
  54873. -----BEGIN CERTIFICATE-----
  54874. MIICjzCCAhWgAwIBAgIQXIuZxVqUxdJxVt7NiYDMJjAKBggqhkjOPQQDAzCBiDELMAkGA1UEBhMC
  54875. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54876. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54877. biBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UEBhMC
  54878. VVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQKExVU
  54879. aGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBFQ0MgQ2VydGlmaWNhdGlv
  54880. biBBdXRob3JpdHkwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQarFRaqfloI+d61SRvU8Za2EurxtW2
  54881. 0eZzca7dnNYMYf3boIkDuAUU7FfO7l0/4iGzzvfUinngo4N+LZfQYcTxmdwlkWOrfzCjtHDix6Ez
  54882. nPO/LlxTsV+zfTJ/ijTjeXmjQjBAMB0GA1UdDgQWBBQ64QmG1M8ZwpZ2dEl23OA1xmNjmjAOBgNV
  54883. HQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNoADBlAjA2Z6EWCNzklwBB
  54884. HU6+4WMBzzuqQhFkoJ2UOQIReVx7Hfpkue4WQrO/isIJxOzksU0CMQDpKmFHjFJKS04YcPbWRNZu
  54885. 9YO6bVi9JNlWSOrvxKJGgYhqOkbRqZtNyWHa0V1Xahg=
  54886. -----END CERTIFICATE-----
  54887. GlobalSign ECC Root CA - R4
  54888. ===========================
  54889. -----BEGIN CERTIFICATE-----
  54890. MIIB4TCCAYegAwIBAgIRKjikHJYKBN5CsiilC+g0mAIwCgYIKoZIzj0EAwIwUDEkMCIGA1UECxMb
  54891. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54892. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54893. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI0MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54894. EwpHbG9iYWxTaWduMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEuMZ5049sJQ6fLjkZHAOkrprl
  54895. OQcJFspjsbmG+IpXwVfOQvpzofdlQv8ewQCybnMO/8ch5RikqtlxP6jUuc6MHaNCMEAwDgYDVR0P
  54896. AQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFFSwe61FuOJAf/sKbvu+M8k8o4TV
  54897. MAoGCCqGSM49BAMCA0gAMEUCIQDckqGgE6bPA7DmxCGXkPoUVy0D7O48027KqGx2vKLeuwIgJ6iF
  54898. JzWbVsaj8kfSt24bAgAXqmemFZHe+pTsewv4n4Q=
  54899. -----END CERTIFICATE-----
  54900. GlobalSign ECC Root CA - R5
  54901. ===========================
  54902. -----BEGIN CERTIFICATE-----
  54903. MIICHjCCAaSgAwIBAgIRYFlJ4CYuu1X5CneKcflK2GwwCgYIKoZIzj0EAwMwUDEkMCIGA1UECxMb
  54904. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54905. EwpHbG9iYWxTaWduMB4XDTEyMTExMzAwMDAwMFoXDTM4MDExOTAzMTQwN1owUDEkMCIGA1UECxMb
  54906. R2xvYmFsU2lnbiBFQ0MgUm9vdCBDQSAtIFI1MRMwEQYDVQQKEwpHbG9iYWxTaWduMRMwEQYDVQQD
  54907. EwpHbG9iYWxTaWduMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAER0UOlvt9Xb/pOdEh+J8LttV7HpI6
  54908. SFkc8GIxLcB6KP4ap1yztsyX50XUWPrRd21DosCHZTQKH3rd6zwzocWdTaRvQZU4f8kehOvRnkmS
  54909. h5SHDDqFSmafnVmTTZdhBoZKo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  54910. BgNVHQ4EFgQUPeYpSJvqB8ohREom3m7e0oPQn1kwCgYIKoZIzj0EAwMDaAAwZQIxAOVpEslu28Yx
  54911. uglB4Zf4+/2a4n0Sye18ZNPLBSWLVtmg515dTguDnFt2KaAJJiFqYgIwcdK1j1zqO+F4CYWodZI7
  54912. yFz9SO8NdCKoCOJuxUnOxwy8p2Fp8fc74SrL+SvzZpA3
  54913. -----END CERTIFICATE-----
  54914. Staat der Nederlanden Root CA - G3
  54915. ==================================
  54916. -----BEGIN CERTIFICATE-----
  54917. MIIFdDCCA1ygAwIBAgIEAJiiOTANBgkqhkiG9w0BAQsFADBaMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54918. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSswKQYDVQQDDCJTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54919. Um9vdCBDQSAtIEczMB4XDTEzMTExNDExMjg0MloXDTI4MTExMzIzMDAwMFowWjELMAkGA1UEBhMC
  54920. TkwxHjAcBgNVBAoMFVN0YWF0IGRlciBOZWRlcmxhbmRlbjErMCkGA1UEAwwiU3RhYXQgZGVyIE5l
  54921. ZGVybGFuZGVuIFJvb3QgQ0EgLSBHMzCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAL4y
  54922. olQPcPssXFnrbMSkUeiFKrPMSjTysF/zDsccPVMeiAho2G89rcKezIJnByeHaHE6n3WWIkYFsO2t
  54923. x1ueKt6c/DrGlaf1F2cY5y9JCAxcz+bMNO14+1Cx3Gsy8KL+tjzk7FqXxz8ecAgwoNzFs21v0IJy
  54924. EavSgWhZghe3eJJg+szeP4TrjTgzkApyI/o1zCZxMdFyKJLZWyNtZrVtB0LrpjPOktvA9mxjeM3K
  54925. Tj215VKb8b475lRgsGYeCasH/lSJEULR9yS6YHgamPfJEf0WwTUaVHXvQ9Plrk7O53vDxk5hUUur
  54926. mkVLoR9BvUhTFXFkC4az5S6+zqQbwSmEorXLCCN2QyIkHxcE1G6cxvx/K2Ya7Irl1s9N9WMJtxU5
  54927. 1nus6+N86U78dULI7ViVDAZCopz35HCz33JvWjdAidiFpNfxC95DGdRKWCyMijmev4SH8RY7Ngzp
  54928. 07TKbBlBUgmhHbBqv4LvcFEhMtwFdozL92TkA1CvjJFnq8Xy7ljY3r735zHPbMk7ccHViLVlvMDo
  54929. FxcHErVc0qsgk7TmgoNwNsXNo42ti+yjwUOH5kPiNL6VizXtBznaqB16nzaeErAMZRKQFWDZJkBE
  54930. 41ZgpRDUajz9QdwOWke275dhdU/Z/seyHdTtXUmzqWrLZoQT1Vyg3N9udwbRcXXIV2+vD3dbAgMB
  54931. AAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBRUrfrHkleu
  54932. yjWcLhL75LpdINyUVzANBgkqhkiG9w0BAQsFAAOCAgEAMJmdBTLIXg47mAE6iqTnB/d6+Oea31BD
  54933. U5cqPco8R5gu4RV78ZLzYdqQJRZlwJ9UXQ4DO1t3ApyEtg2YXzTdO2PCwyiBwpwpLiniyMMB8jPq
  54934. KqrMCQj3ZWfGzd/TtiunvczRDnBfuCPRy5FOCvTIeuXZYzbB1N/8Ipf3YF3qKS9Ysr1YvY2WTxB1
  54935. v0h7PVGHoTx0IsL8B3+A3MSs/mrBcDCw6Y5p4ixpgZQJut3+TcCDjJRYwEYgr5wfAvg1VUkvRtTA
  54936. 8KCWAg8zxXHzniN9lLf9OtMJgwYh/WA9rjLA0u6NpvDntIJ8CsxwyXmA+P5M9zWEGYox+wrZ13+b
  54937. 8KKaa8MFSu1BYBQw0aoRQm7TIwIEC8Zl3d1Sd9qBa7Ko+gE4uZbqKmxnl4mUnrzhVNXkanjvSr0r
  54938. mj1AfsbAddJu+2gw7OyLnflJNZoaLNmzlTnVHpL3prllL+U9bTpITAjc5CgSKL59NVzq4BZ+Extq
  54939. 1z7XnvwtdbLBFNUjA9tbbws+eC8N3jONFrdI54OagQ97wUNNVQQXOEpR1VmiiXTTn74eS9fGbbeI
  54940. JG9gkaSChVtWQbzQRKtqE77RLFi3EjNYsjdj3BP1lB0/QFH1T/U67cjF68IeHRaVesd+QnGTbksV
  54941. tzDfqu1XhUisHWrdOWnk4Xl4vs4Fv6EM94B7IWcnMFk=
  54942. -----END CERTIFICATE-----
  54943. Staat der Nederlanden EV Root CA
  54944. ================================
  54945. -----BEGIN CERTIFICATE-----
  54946. MIIFcDCCA1igAwIBAgIEAJiWjTANBgkqhkiG9w0BAQsFADBYMQswCQYDVQQGEwJOTDEeMBwGA1UE
  54947. CgwVU3RhYXQgZGVyIE5lZGVybGFuZGVuMSkwJwYDVQQDDCBTdGFhdCBkZXIgTmVkZXJsYW5kZW4g
  54948. RVYgUm9vdCBDQTAeFw0xMDEyMDgxMTE5MjlaFw0yMjEyMDgxMTEwMjhaMFgxCzAJBgNVBAYTAk5M
  54949. MR4wHAYDVQQKDBVTdGFhdCBkZXIgTmVkZXJsYW5kZW4xKTAnBgNVBAMMIFN0YWF0IGRlciBOZWRl
  54950. cmxhbmRlbiBFViBSb290IENBMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA48d+ifkk
  54951. SzrSM4M1LGns3Amk41GoJSt5uAg94JG6hIXGhaTK5skuU6TJJB79VWZxXSzFYGgEt9nCUiY4iKTW
  54952. O0Cmws0/zZiTs1QUWJZV1VD+hq2kY39ch/aO5ieSZxeSAgMs3NZmdO3dZ//BYY1jTw+bbRcwJu+r
  54953. 0h8QoPnFfxZpgQNH7R5ojXKhTbImxrpsX23Wr9GxE46prfNeaXUmGD5BKyF/7otdBwadQ8QpCiv8
  54954. Kj6GyzyDOvnJDdrFmeK8eEEzduG/L13lpJhQDBXd4Pqcfzho0LKmeqfRMb1+ilgnQ7O6M5HTp5gV
  54955. XJrm0w912fxBmJc+qiXbj5IusHsMX/FjqTf5m3VpTCgmJdrV8hJwRVXj33NeN/UhbJCONVrJ0yPr
  54956. 08C+eKxCKFhmpUZtcALXEPlLVPxdhkqHz3/KRawRWrUgUY0viEeXOcDPusBCAUCZSCELa6fS/ZbV
  54957. 0b5GnUngC6agIk440ME8MLxwjyx1zNDFjFE7PZQIZCZhfbnDZY8UnCHQqv0XcgOPvZuM5l5Tnrmd
  54958. 74K74bzickFbIZTTRTeU0d8JOV3nI6qaHcptqAqGhYqCvkIH1vI4gnPah1vlPNOePqc7nvQDs/nx
  54959. fRN0Av+7oeX6AHkcpmZBiFxgV6YuCcS6/ZrPpx9Aw7vMWgpVSzs4dlG4Y4uElBbmVvMCAwEAAaNC
  54960. MEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFP6rAJCYniT8qcwa
  54961. ivsnuL8wbqg7MA0GCSqGSIb3DQEBCwUAA4ICAQDPdyxuVr5Os7aEAJSrR8kN0nbHhp8dB9O2tLsI
  54962. eK9p0gtJ3jPFrK3CiAJ9Brc1AsFgyb/E6JTe1NOpEyVa/m6irn0F3H3zbPB+po3u2dfOWBfoqSmu
  54963. c0iH55vKbimhZF8ZE/euBhD/UcabTVUlT5OZEAFTdfETzsemQUHSv4ilf0X8rLiltTMMgsT7B/Zq
  54964. 5SWEXwbKwYY5EdtYzXc7LMJMD16a4/CrPmEbUCTCwPTxGfARKbalGAKb12NMcIxHowNDXLldRqAN
  54965. b/9Zjr7dn3LDWyvfjFvO5QxGbJKyCqNMVEIYFRIYvdr8unRu/8G2oGTYqV9Vrp9canaW2HNnh/tN
  54966. f1zuacpzEPuKqf2evTY4SUmH9A4U8OmHuD+nT3pajnnUk+S7aFKErGzp85hwVXIy+TSrK0m1zSBi
  54967. 5Dp6Z2Orltxtrpfs/J92VoguZs9btsmksNcFuuEnL5O7Jiqik7Ab846+HUCjuTaPPoIaGl6I6lD4
  54968. WeKDRikL40Rc4ZW2aZCaFG+XroHPaO+Zmr615+F/+PoTRxZMzG0IQOeLeG9QgkRQP2YGiqtDhFZK
  54969. DyAthg710tvSeopLzaXoTvFeJiUBWSOgftL2fiFX1ye8FVdMpEbB4IMeDExNH08GGeL5qPQ6gqGy
  54970. eUN51q1veieQA6TqJIc/2b3Z6fJfUEkc7uzXLg==
  54971. -----END CERTIFICATE-----
  54972. IdenTrust Commercial Root CA 1
  54973. ==============================
  54974. -----BEGIN CERTIFICATE-----
  54975. MIIFYDCCA0igAwIBAgIQCgFCgAAAAUUjyES1AAAAAjANBgkqhkiG9w0BAQsFADBKMQswCQYDVQQG
  54976. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBS
  54977. b290IENBIDEwHhcNMTQwMTE2MTgxMjIzWhcNMzQwMTE2MTgxMjIzWjBKMQswCQYDVQQGEwJVUzES
  54978. MBAGA1UEChMJSWRlblRydXN0MScwJQYDVQQDEx5JZGVuVHJ1c3QgQ29tbWVyY2lhbCBSb290IENB
  54979. IDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnUBneP5k91DNG8W9RYYKyqU+PZ4ld
  54980. hNlT3Qwo2dfw/66VQ3KZ+bVdfIrBQuExUHTRgQ18zZshq0PirK1ehm7zCYofWjK9ouuU+ehcCuz/
  54981. mNKvcbO0U59Oh++SvL3sTzIwiEsXXlfEU8L2ApeN2WIrvyQfYo3fw7gpS0l4PJNgiCL8mdo2yMKi
  54982. 1CxUAGc1bnO/AljwpN3lsKImesrgNqUZFvX9t++uP0D1bVoE/c40yiTcdCMbXTMTEl3EASX2MN0C
  54983. XZ/g1Ue9tOsbobtJSdifWwLziuQkkORiT0/Br4sOdBeo0XKIanoBScy0RnnGF7HamB4HWfp1IYVl
  54984. 3ZBWzvurpWCdxJ35UrCLvYf5jysjCiN2O/cz4ckA82n5S6LgTrx+kzmEB/dEcH7+B1rlsazRGMzy
  54985. NeVJSQjKVsk9+w8YfYs7wRPCTY/JTw436R+hDmrfYi7LNQZReSzIJTj0+kuniVyc0uMNOYZKdHzV
  54986. WYfCP04MXFL0PfdSgvHqo6z9STQaKPNBiDoT7uje/5kdX7rL6B7yuVBgwDHTc+XvvqDtMwt0viAg
  54987. xGds8AgDelWAf0ZOlqf0Hj7h9tgJ4TNkK2PXMl6f+cB7D3hvl7yTmvmcEpB4eoCHFddydJxVdHix
  54988. uuFucAS6T6C6aMN7/zHwcz09lCqxC0EOoP5NiGVreTO01wIDAQABo0IwQDAOBgNVHQ8BAf8EBAMC
  54989. AQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU7UQZwNPwBovupHu+QucmVMiONnYwDQYJKoZI
  54990. hvcNAQELBQADggIBAA2ukDL2pkt8RHYZYR4nKM1eVO8lvOMIkPkp165oCOGUAFjvLi5+U1KMtlwH
  54991. 6oi6mYtQlNeCgN9hCQCTrQ0U5s7B8jeUeLBfnLOic7iPBZM4zY0+sLj7wM+x8uwtLRvM7Kqas6pg
  54992. ghstO8OEPVeKlh6cdbjTMM1gCIOQ045U8U1mwF10A0Cj7oV+wh93nAbowacYXVKV7cndJZ5t+qnt
  54993. ozo00Fl72u1Q8zW/7esUTTHHYPTa8Yec4kjixsU3+wYQ+nVZZjFHKdp2mhzpgq7vmrlR94gjmmmV
  54994. YjzlVYA211QC//G5Xc7UI2/YRYRKW2XviQzdFKcgyxilJbQN+QHwotL0AMh0jqEqSI5l2xPE4iUX
  54995. feu+h1sXIFRRk0pTAwvsXcoz7WL9RccvW9xYoIA55vrX/hMUpu09lEpCdNTDd1lzzY9GvlU47/ro
  54996. kTLql1gEIt44w8y8bckzOmoKaT+gyOpyj4xjhiO9bTyWnpXgSUyqorkqG5w2gXjtw+hG4iZZRHUe
  54997. 2XWJUc0QhJ1hYMtd+ZciTY6Y5uN/9lu7rs3KSoFrXgvzUeF0K+l+J6fZmUlO+KWA2yUPHGNiiskz
  54998. Z2s8EIPGrd6ozRaOjfAHN3Gf8qv8QfXBi+wAN10J5U6A7/qxXDgGpRtK4dw4LTzcqx+QGtVKnO7R
  54999. cGzM7vRX+Bi6hG6H
  55000. -----END CERTIFICATE-----
  55001. IdenTrust Public Sector Root CA 1
  55002. =================================
  55003. -----BEGIN CERTIFICATE-----
  55004. MIIFZjCCA06gAwIBAgIQCgFCgAAAAUUjz0Z8AAAAAjANBgkqhkiG9w0BAQsFADBNMQswCQYDVQQG
  55005. EwJVUzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3Rv
  55006. ciBSb290IENBIDEwHhcNMTQwMTE2MTc1MzMyWhcNMzQwMTE2MTc1MzMyWjBNMQswCQYDVQQGEwJV
  55007. UzESMBAGA1UEChMJSWRlblRydXN0MSowKAYDVQQDEyFJZGVuVHJ1c3QgUHVibGljIFNlY3RvciBS
  55008. b290IENBIDEwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2IpT8pEiv6EdrCvsnduTy
  55009. P4o7ekosMSqMjbCpwzFrqHd2hCa2rIFCDQjrVVi7evi8ZX3yoG2LqEfpYnYeEe4IFNGyRBb06tD6
  55010. Hi9e28tzQa68ALBKK0CyrOE7S8ItneShm+waOh7wCLPQ5CQ1B5+ctMlSbdsHyo+1W/CD80/HLaXI
  55011. rcuVIKQxKFdYWuSNG5qrng0M8gozOSI5Cpcu81N3uURF/YTLNiCBWS2ab21ISGHKTN9T0a9SvESf
  55012. qy9rg3LvdYDaBjMbXcjaY8ZNzaxmMc3R3j6HEDbhuaR672BQssvKplbgN6+rNBM5Jeg5ZuSYeqoS
  55013. mJxZZoY+rfGwyj4GD3vwEUs3oERte8uojHH01bWRNszwFcYr3lEXsZdMUD2xlVl8BX0tIdUAvwFn
  55014. ol57plzy9yLxkA2T26pEUWbMfXYD62qoKjgZl3YNa4ph+bz27nb9cCvdKTz4Ch5bQhyLVi9VGxyh
  55015. LrXHFub4qjySjmm2AcG1hp2JDws4lFTo6tyePSW8Uybt1as5qsVATFSrsrTZ2fjXctscvG29ZV/v
  55016. iDUqZi/u9rNl8DONfJhBaUYPQxxp+pu10GFqzcpL2UyQRqsVWaFHVCkugyhfHMKiq3IXAAaOReyL
  55017. 4jM9f9oZRORicsPfIsbyVtTdX5Vy7W1f90gDW/3FKqD2cyOEEBsB5wIDAQABo0IwQDAOBgNVHQ8B
  55018. Af8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU43HgntinQtnbcZFrlJPrw6PRFKMw
  55019. DQYJKoZIhvcNAQELBQADggIBAEf63QqwEZE4rU1d9+UOl1QZgkiHVIyqZJnYWv6IAcVYpZmxI1Qj
  55020. t2odIFflAWJBF9MJ23XLblSQdf4an4EKwt3X9wnQW3IV5B4Jaj0z8yGa5hV+rVHVDRDtfULAj+7A
  55021. mgjVQdZcDiFpboBhDhXAuM/FSRJSzL46zNQuOAXeNf0fb7iAaJg9TaDKQGXSc3z1i9kKlT/YPyNt
  55022. GtEqJBnZhbMX73huqVjRI9PHE+1yJX9dsXNw0H8GlwmEKYBhHfpe/3OsoOOJuBxxFcbeMX8S3OFt
  55023. m6/n6J91eEyrRjuazr8FGF1NFTwWmhlQBJqymm9li1JfPFgEKCXAZmExfrngdbkaqIHWchezxQMx
  55024. NRF4eKLg6TCMf4DfWN88uieW4oA0beOY02QnrEh+KHdcxiVhJfiFDGX6xDIvpZgF5PgLZxYWxoK4
  55025. Mhn5+bl53B/N66+rDt0b20XkeucC4pVd/GnwU2lhlXV5C15V5jgclKlZM57IcXR5f1GJtshquDDI
  55026. ajjDbp7hNxbqBWJMWxJH7ae0s1hWx0nzfxJoCTFx8G34Tkf71oXuxVhAGaQdp/lLQzfcaFpPz+vC
  55027. ZHTetBXZ9FRUGi8c15dxVJCO2SCdUyt/q4/i6jC8UDfv8Ue1fXwsBOxonbRJRBD0ckscZOf85muQ
  55028. 3Wl9af0AVqW3rLatt8o+Ae+c
  55029. -----END CERTIFICATE-----
  55030. Entrust Root Certification Authority - G2
  55031. =========================================
  55032. -----BEGIN CERTIFICATE-----
  55033. MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMCVVMxFjAUBgNV
  55034. BAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVy
  55035. bXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ug
  55036. b25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIw
  55037. HhcNMDkwNzA3MTcyNTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoT
  55038. DUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMx
  55039. OTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25s
  55040. eTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwggEi
  55041. MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP
  55042. /vaCeb9zYQYKpSfYs1/TRU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXz
  55043. HHfV1IWNcCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hWwcKU
  55044. s/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1U1+cPvQXLOZprE4y
  55045. TGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0jaWvYkxN4FisZDQSA/i2jZRjJKRx
  55046. AgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ6
  55047. 0B7vfec7aVHUbI2fkBJmqzANBgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5Z
  55048. iXMRrEPR9RP/jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ
  55049. Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v1fN2D807iDgi
  55050. nWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4RnAuknZoh8/CbCzB428Hch0P+
  55051. vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmHVHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xO
  55052. e4pIb4tF9g==
  55053. -----END CERTIFICATE-----
  55054. Entrust Root Certification Authority - EC1
  55055. ==========================================
  55056. -----BEGIN CERTIFICATE-----
  55057. MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkGA1UEBhMCVVMx
  55058. FjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVn
  55059. YWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXpl
  55060. ZCB1c2Ugb25seTEzMDEGA1UEAxMqRW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5
  55061. IC0gRUMxMB4XDTEyMTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYw
  55062. FAYDVQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0L2xlZ2Fs
  55063. LXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0gZm9yIGF1dGhvcml6ZWQg
  55064. dXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAt
  55065. IEVDMTB2MBAGByqGSM49AgEGBSuBBAAiA2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHy
  55066. AsWfoPZb1YsGGYZPUxBtByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef
  55067. 9eNi1KlHBz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYE
  55068. FLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVCR98crlOZF7ZvHH3h
  55069. vxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nXhTcGtXsI/esni0qU+eH6p44mCOh8
  55070. kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G
  55071. -----END CERTIFICATE-----
  55072. CFCA EV ROOT
  55073. ============
  55074. -----BEGIN CERTIFICATE-----
  55075. MIIFjTCCA3WgAwIBAgIEGErM1jANBgkqhkiG9w0BAQsFADBWMQswCQYDVQQGEwJDTjEwMC4GA1UE
  55076. CgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQDDAxDRkNB
  55077. IEVWIFJPT1QwHhcNMTIwODA4MDMwNzAxWhcNMjkxMjMxMDMwNzAxWjBWMQswCQYDVQQGEwJDTjEw
  55078. MC4GA1UECgwnQ2hpbmEgRmluYW5jaWFsIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRUwEwYDVQQD
  55079. DAxDRkNBIEVWIFJPT1QwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDXXWvNED8fBVnV
  55080. BU03sQ7smCuOFR36k0sXgiFxEFLXUWRwFsJVaU2OFW2fvwwbwuCjZ9YMrM8irq93VCpLTIpTUnrD
  55081. 7i7es3ElweldPe6hL6P3KjzJIx1qqx2hp/Hz7KDVRM8Vz3IvHWOX6Jn5/ZOkVIBMUtRSqy5J35DN
  55082. uF++P96hyk0g1CXohClTt7GIH//62pCfCqktQT+x8Rgp7hZZLDRJGqgG16iI0gNyejLi6mhNbiyW
  55083. ZXvKWfry4t3uMCz7zEasxGPrb382KzRzEpR/38wmnvFyXVBlWY9ps4deMm/DGIq1lY+wejfeWkU7
  55084. xzbh72fROdOXW3NiGUgthxwG+3SYIElz8AXSG7Ggo7cbcNOIabla1jj0Ytwli3i/+Oh+uFzJlU9f
  55085. py25IGvPa931DfSCt/SyZi4QKPaXWnuWFo8BGS1sbn85WAZkgwGDg8NNkt0yxoekN+kWzqotaK8K
  55086. gWU6cMGbrU1tVMoqLUuFG7OA5nBFDWteNfB/O7ic5ARwiRIlk9oKmSJgamNgTnYGmE69g60dWIol
  55087. hdLHZR4tjsbftsbhf4oEIRUpdPA+nJCdDC7xij5aqgwJHsfVPKPtl8MeNPo4+QgO48BdK4PRVmrJ
  55088. tqhUUy54Mmc9gn900PvhtgVguXDbjgv5E1hvcWAQUhC5wUEJ73IfZzF4/5YFjQIDAQABo2MwYTAf
  55089. BgNVHSMEGDAWgBTj/i39KNALtbq2osS/BqoFjJP7LzAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB
  55090. /wQEAwIBBjAdBgNVHQ4EFgQU4/4t/SjQC7W6tqLEvwaqBYyT+y8wDQYJKoZIhvcNAQELBQADggIB
  55091. ACXGumvrh8vegjmWPfBEp2uEcwPenStPuiB/vHiyz5ewG5zz13ku9Ui20vsXiObTej/tUxPQ4i9q
  55092. ecsAIyjmHjdXNYmEwnZPNDatZ8POQQaIxffu2Bq41gt/UP+TqhdLjOztUmCypAbqTuv0axn96/Ua
  55093. 4CUqmtzHQTb3yHQFhDmVOdYLO6Qn+gjYXB74BGBSESgoA//vU2YApUo0FmZ8/Qmkrp5nGm9BC2sG
  55094. E5uPhnEFtC+NiWYzKXZUmhH4J/qyP5Hgzg0b8zAarb8iXRvTvyUFTeGSGn+ZnzxEk8rUQElsgIfX
  55095. BDrDMlI1Dlb4pd19xIsNER9Tyx6yF7Zod1rg1MvIB671Oi6ON7fQAUtDKXeMOZePglr4UeWJoBjn
  55096. aH9dCi77o0cOPaYjesYBx4/IXr9tgFa+iiS6M+qf4TIRnvHST4D2G0CvOJ4RUHlzEhLN5mydLIhy
  55097. PDCBBpEi6lmt2hkuIsKNuYyH4Ga8cyNfIWRjgEj1oDwYPZTISEEdQLpe/v5WOaHIz16eGWRGENoX
  55098. kbcFgKyLmZJ956LYBws2J+dIeWCKw9cTXPhyQN9Ky8+ZAAoACxGV2lZFA4gKn2fQ1XmxqI1AbQ3C
  55099. ekD6819kR5LLU7m7Wc5P/dAVUwHY3+vZ5nbv0CO7O6l5s9UCKc2Jo5YPSjXnTkLAdc0Hz+Ys63su
  55100. -----END CERTIFICATE-----
  55101. OISTE WISeKey Global Root GB CA
  55102. ===============================
  55103. -----BEGIN CERTIFICATE-----
  55104. MIIDtTCCAp2gAwIBAgIQdrEgUnTwhYdGs/gjGvbCwDANBgkqhkiG9w0BAQsFADBtMQswCQYDVQQG
  55105. EwJDSDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNl
  55106. ZDEoMCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQiBDQTAeFw0xNDEyMDExNTAw
  55107. MzJaFw0zOTEyMDExNTEwMzFaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYD
  55108. VQQLExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEds
  55109. b2JhbCBSb290IEdCIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2Be3HEokKtaX
  55110. scriHvt9OO+Y9bI5mE4nuBFde9IllIiCFSZqGzG7qFshISvYD06fWvGxWuR51jIjK+FTzJlFXHtP
  55111. rby/h0oLS5daqPZI7H17Dc0hBt+eFf1Biki3IPShehtX1F1Q/7pn2COZH8g/497/b1t3sWtuuMlk
  55112. 9+HKQUYOKXHQuSP8yYFfTvdv37+ErXNku7dCjmn21HYdfp2nuFeKUWdy19SouJVUQHMD9ur06/4o
  55113. Qnc/nSMbsrY9gBQHTC5P99UKFg29ZkM3fiNDecNAhvVMKdqOmq0NpQSHiB6F4+lT1ZvIiwNjeOvg
  55114. GUpuuy9rM2RYk61pv48b74JIxwIDAQABo1EwTzALBgNVHQ8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB
  55115. /zAdBgNVHQ4EFgQUNQ/INmNe4qPs+TtmFc5RUuORmj0wEAYJKwYBBAGCNxUBBAMCAQAwDQYJKoZI
  55116. hvcNAQELBQADggEBAEBM+4eymYGQfp3FsLAmzYh7KzKNbrghcViXfa43FK8+5/ea4n32cZiZBKpD
  55117. dHij40lhPnOMTZTg+XHEthYOU3gf1qKHLwI5gSk8rxWYITD+KJAAjNHhy/peyP34EEY7onhCkRd0
  55118. VQreUGdNZtGn//3ZwLWoo4rOZvUPQ82nK1d7Y0Zqqi5S2PTt4W2tKZB4SLrhI6qjiey1q5bAtEui
  55119. HZeeevJuQHHfaPFlTc58Bd9TZaml8LGXBHAVRgOY1NK/VLSgWH1Sb9pWJmLU2NuJMW8c8CLC02Ic
  55120. Nc1MaRVUGpCY3useX8p3x8uOPUNpnJpY0CQ73xtAln41rYHHTnG6iBM=
  55121. -----END CERTIFICATE-----
  55122. SZAFIR ROOT CA2
  55123. ===============
  55124. -----BEGIN CERTIFICATE-----
  55125. MIIDcjCCAlqgAwIBAgIUPopdB+xV0jLVt+O2XwHrLdzk1uQwDQYJKoZIhvcNAQELBQAwUTELMAkG
  55126. A1UEBhMCUEwxKDAmBgNVBAoMH0tyYWpvd2EgSXpiYSBSb3psaWN6ZW5pb3dhIFMuQS4xGDAWBgNV
  55127. BAMMD1NaQUZJUiBST09UIENBMjAeFw0xNTEwMTkwNzQzMzBaFw0zNTEwMTkwNzQzMzBaMFExCzAJ
  55128. BgNVBAYTAlBMMSgwJgYDVQQKDB9LcmFqb3dhIEl6YmEgUm96bGljemVuaW93YSBTLkEuMRgwFgYD
  55129. VQQDDA9TWkFGSVIgUk9PVCBDQTIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC3vD5Q
  55130. qEvNQLXOYeeWyrSh2gwisPq1e3YAd4wLz32ohswmUeQgPYUM1ljj5/QqGJ3a0a4m7utT3PSQ1hNK
  55131. DJA8w/Ta0o4NkjrcsbH/ON7Dui1fgLkCvUqdGw+0w8LBZwPd3BucPbOw3gAeqDRHu5rr/gsUvTaE
  55132. 2g0gv/pby6kWIK05YO4vdbbnl5z5Pv1+TW9NL++IDWr63fE9biCloBK0TXC5ztdyO4mTp4CEHCdJ
  55133. ckm1/zuVnsHMyAHs6A6KCpbns6aH5db5BSsNl0BwPLqsdVqc1U2dAgrSS5tmS0YHF2Wtn2yIANwi
  55134. ieDhZNRnvDF5YTy7ykHNXGoAyDw4jlivAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0P
  55135. AQH/BAQDAgEGMB0GA1UdDgQWBBQuFqlKGLXLzPVvUPMjX/hd56zwyDANBgkqhkiG9w0BAQsFAAOC
  55136. AQEAtXP4A9xZWx126aMqe5Aosk3AM0+qmrHUuOQn/6mWmc5G4G18TKI4pAZw8PRBEew/R40/cof5
  55137. O/2kbytTAOD/OblqBw7rHRz2onKQy4I9EYKL0rufKq8h5mOGnXkZ7/e7DDWQw4rtTw/1zBLZpD67
  55138. oPwglV9PJi8RI4NOdQcPv5vRtB3pEAT+ymCPoky4rc/hkA/NrgrHXXu3UNLUYfrVFdvXn4dRVOul
  55139. 4+vJhaAlIDf7js4MNIThPIGyd05DpYhfhmehPea0XGG2Ptv+tyjFogeutcrKjSoS75ftwjCkySp6
  55140. +/NNIxuZMzSgLvWpCz/UXeHPhJ/iGcJfitYgHuNztw==
  55141. -----END CERTIFICATE-----
  55142. Certum Trusted Network CA 2
  55143. ===========================
  55144. -----BEGIN CERTIFICATE-----
  55145. MIIF0jCCA7qgAwIBAgIQIdbQSk8lD8kyN/yqXhKN6TANBgkqhkiG9w0BAQ0FADCBgDELMAkGA1UE
  55146. BhMCUEwxIjAgBgNVBAoTGVVuaXpldG8gVGVjaG5vbG9naWVzIFMuQS4xJzAlBgNVBAsTHkNlcnR1
  55147. bSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTEkMCIGA1UEAxMbQ2VydHVtIFRydXN0ZWQgTmV0d29y
  55148. ayBDQSAyMCIYDzIwMTExMDA2MDgzOTU2WhgPMjA0NjEwMDYwODM5NTZaMIGAMQswCQYDVQQGEwJQ
  55149. TDEiMCAGA1UEChMZVW5pemV0byBUZWNobm9sb2dpZXMgUy5BLjEnMCUGA1UECxMeQ2VydHVtIENl
  55150. cnRpZmljYXRpb24gQXV0aG9yaXR5MSQwIgYDVQQDExtDZXJ0dW0gVHJ1c3RlZCBOZXR3b3JrIENB
  55151. IDIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC9+Xj45tWADGSdhhuWZGc/IjoedQF9
  55152. 7/tcZ4zJzFxrqZHmuULlIEub2pt7uZld2ZuAS9eEQCsn0+i6MLs+CRqnSZXvK0AkwpfHp+6bJe+o
  55153. CgCXhVqqndwpyeI1B+twTUrWwbNWuKFBOJvR+zF/j+Bf4bE/D44WSWDXBo0Y+aomEKsq09DRZ40b
  55154. Rr5HMNUuctHFY9rnY3lEfktjJImGLjQ/KUxSiyqnwOKRKIm5wFv5HdnnJ63/mgKXwcZQkpsCLL2p
  55155. uTRZCr+ESv/f/rOf69me4Jgj7KZrdxYq28ytOxykh9xGc14ZYmhFV+SQgkK7QtbwYeDBoz1mo130
  55156. GO6IyY0XRSmZMnUCMe4pJshrAua1YkV/NxVaI2iJ1D7eTiew8EAMvE0Xy02isx7QBlrd9pPPV3WZ
  55157. 9fqGGmd4s7+W/jTcvedSVuWz5XV710GRBdxdaeOVDUO5/IOWOZV7bIBaTxNyxtd9KXpEulKkKtVB
  55158. Rgkg/iKgtlswjbyJDNXXcPiHUv3a76xRLgezTv7QCdpw75j6VuZt27VXS9zlLCUVyJ4ueE742pye
  55159. hizKV/Ma5ciSixqClnrDvFASadgOWkaLOusm+iPJtrCBvkIApPjW/jAux9JG9uWOdf3yzLnQh1vM
  55160. BhBgu4M1t15n3kfsmUjxpKEV/q2MYo45VU85FrmxY53/twIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55161. AQH/MB0GA1UdDgQWBBS2oVQ5AsOgP46KvPrU+Bym0ToO/TAOBgNVHQ8BAf8EBAMCAQYwDQYJKoZI
  55162. hvcNAQENBQADggIBAHGlDs7k6b8/ONWJWsQCYftMxRQXLYtPU2sQF/xlhMcQSZDe28cmk4gmb3DW
  55163. Al45oPePq5a1pRNcgRRtDoGCERuKTsZPpd1iHkTfCVn0W3cLN+mLIMb4Ck4uWBzrM9DPhmDJ2vuA
  55164. L55MYIR4PSFk1vtBHxgP58l1cb29XN40hz5BsA72udY/CROWFC/emh1auVbONTqwX3BNXuMp8SMo
  55165. clm2q8KMZiYcdywmdjWLKKdpoPk79SPdhRB0yZADVpHnr7pH1BKXESLjokmUbOe3lEu6LaTaM4tM
  55166. pkT/WjzGHWTYtTHkpjx6qFcL2+1hGsvxznN3Y6SHb0xRONbkX8eftoEq5IVIeVheO/jbAoJnwTnb
  55167. w3RLPTYe+SmTiGhbqEQZIfCn6IENLOiTNrQ3ssqwGyZ6miUfmpqAnksqP/ujmv5zMnHCnsZy4Ypo
  55168. J/HkD7TETKVhk/iXEAcqMCWpuchxuO9ozC1+9eB+D4Kob7a6bINDd82Kkhehnlt4Fj1F4jNy3eFm
  55169. ypnTycUm/Q1oBEauttmbjL4ZvrHG8hnjXALKLNhvSgfZyTXaQHXyxKcZb55CEJh15pWLYLztxRLX
  55170. is7VmFxWlgPF7ncGNf/P5O4/E2Hu29othfDNrp2yGAlFw5Khchf8R7agCyzxxN5DaAhqXzvwdmP7
  55171. zAYspsbiDrW5viSP
  55172. -----END CERTIFICATE-----
  55173. Hellenic Academic and Research Institutions RootCA 2015
  55174. =======================================================
  55175. -----BEGIN CERTIFICATE-----
  55176. MIIGCzCCA/OgAwIBAgIBADANBgkqhkiG9w0BAQsFADCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcT
  55177. BkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0
  55178. aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNVBAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNl
  55179. YXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIwMTUwHhcNMTUwNzA3MTAxMTIxWhcNNDAwNjMwMTAx
  55180. MTIxWjCBpjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0aGVuczFEMEIGA1UEChM7SGVsbGVuaWMg
  55181. QWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9ucyBDZXJ0LiBBdXRob3JpdHkxQDA+BgNV
  55182. BAMTN0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgUm9vdENBIDIw
  55183. MTUwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDC+Kk/G4n8PDwEXT2QNrCROnk8Zlrv
  55184. bTkBSRq0t89/TSNTt5AA4xMqKKYx8ZEA4yjsriFBzh/a/X0SWwGDD7mwX5nh8hKDgE0GPt+sr+eh
  55185. iGsxr/CL0BgzuNtFajT0AoAkKAoCFZVedioNmToUW/bLy1O8E00BiDeUJRtCvCLYjqOWXjrZMts+
  55186. 6PAQZe104S+nfK8nNLspfZu2zwnI5dMK/IhlZXQK3HMcXM1AsRzUtoSMTFDPaI6oWa7CJ06CojXd
  55187. FPQf/7J31Ycvqm59JCfnxssm5uX+Zwdj2EUN3TpZZTlYepKZcj2chF6IIbjV9Cz82XBST3i4vTwr
  55188. i5WY9bPRaM8gFH5MXF/ni+X1NYEZN9cRCLdmvtNKzoNXADrDgfgXy5I2XdGj2HUb4Ysn6npIQf1F
  55189. GQatJ5lOwXBH3bWfgVMS5bGMSF0xQxfjjMZ6Y5ZLKTBOhE5iGV48zpeQpX8B653g+IuJ3SWYPZK2
  55190. fu/Z8VFRfS0myGlZYeCsargqNhEEelC9MoS+L9xy1dcdFkfkR2YgP/SWxa+OAXqlD3pk9Q0Yh9mu
  55191. iNX6hME6wGkoLfINaFGq46V3xqSQDqE3izEjR8EJCOtu93ib14L8hCCZSRm2Ekax+0VVFqmjZayc
  55192. Bw/qa9wfLgZy7IaIEuQt218FL+TwA9MmM+eAws1CoRc0CwIDAQABo0IwQDAPBgNVHRMBAf8EBTAD
  55193. AQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUcRVnyMjJvXVdctA4GGqd83EkVAswDQYJKoZI
  55194. hvcNAQELBQADggIBAHW7bVRLqhBYRjTyYtcWNl0IXtVsyIe9tC5G8jH4fOpCtZMWVdyhDBKg2mF+
  55195. D1hYc2Ryx+hFjtyp8iY/xnmMsVMIM4GwVhO+5lFc2JsKT0ucVlMC6U/2DWDqTUJV6HwbISHTGzrM
  55196. d/K4kPFox/la/vot9L/J9UUbzjgQKjeKeaO04wlshYaT/4mWJ3iBj2fjRnRUjtkNaeJK9E10A/+y
  55197. d+2VZ5fkscWrv2oj6NSU4kQoYsRL4vDY4ilrGnB+JGGTe08DMiUNRSQrlrRGar9KC/eaj8GsGsVn
  55198. 82800vpzY4zvFrCopEYq+OsS7HK07/grfoxSwIuEVPkvPuNVqNxmsdnhX9izjFk0WaSrT2y7Hxjb
  55199. davYy5LNlDhhDgcGH0tGEPEVvo2FXDtKK4F5D7Rpn0lQl033DlZdwJVqwjbDG2jJ9SrcR5q+ss7F
  55200. Jej6A7na+RZukYT1HCjI/CbM1xyQVqdfbzoEvM14iQuODy+jqk+iGxI9FghAD/FGTNeqewjBCvVt
  55201. J94Cj8rDtSvK6evIIVM4pcw72Hc3MKJP2W/R8kCtQXoXxdZKNYm3QdV8hn9VTYNKpXMgwDqvkPGa
  55202. JI7ZjnHKe7iG2rKPmT4dEw0SEe7Uq/DpFXYC5ODfqiAeW2GFZECpkJcNrVPSWh2HagCXZWK0vm9q
  55203. p/UsQu0yrbYhnr68
  55204. -----END CERTIFICATE-----
  55205. Hellenic Academic and Research Institutions ECC RootCA 2015
  55206. ===========================================================
  55207. -----BEGIN CERTIFICATE-----
  55208. MIICwzCCAkqgAwIBAgIBADAKBggqhkjOPQQDAjCBqjELMAkGA1UEBhMCR1IxDzANBgNVBAcTBkF0
  55209. aGVuczFEMEIGA1UEChM7SGVsbGVuaWMgQWNhZGVtaWMgYW5kIFJlc2VhcmNoIEluc3RpdHV0aW9u
  55210. cyBDZXJ0LiBBdXRob3JpdHkxRDBCBgNVBAMTO0hlbGxlbmljIEFjYWRlbWljIGFuZCBSZXNlYXJj
  55211. aCBJbnN0aXR1dGlvbnMgRUNDIFJvb3RDQSAyMDE1MB4XDTE1MDcwNzEwMzcxMloXDTQwMDYzMDEw
  55212. MzcxMlowgaoxCzAJBgNVBAYTAkdSMQ8wDQYDVQQHEwZBdGhlbnMxRDBCBgNVBAoTO0hlbGxlbmlj
  55213. IEFjYWRlbWljIGFuZCBSZXNlYXJjaCBJbnN0aXR1dGlvbnMgQ2VydC4gQXV0aG9yaXR5MUQwQgYD
  55214. VQQDEztIZWxsZW5pYyBBY2FkZW1pYyBhbmQgUmVzZWFyY2ggSW5zdGl0dXRpb25zIEVDQyBSb290
  55215. Q0EgMjAxNTB2MBAGByqGSM49AgEGBSuBBAAiA2IABJKgQehLgoRc4vgxEZmGZE4JJS+dQS8KrjVP
  55216. dJWyUWRrjWvmP3CV8AVER6ZyOFB2lQJajq4onvktTpnvLEhvTCUp6NFxW98dwXU3tNf6e3pCnGoK
  55217. Vlp8aQuqgAkkbH7BRqNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0O
  55218. BBYEFLQiC4KZJAEOnLvkDv2/+5cgk5kqMAoGCCqGSM49BAMCA2cAMGQCMGfOFmI4oqxiRaeplSTA
  55219. GiecMjvAwNW6qef4BENThe5SId6d9SWDPp5YSy/XZxMOIQIwBeF1Ad5o7SofTUwJCA3sS61kFyjn
  55220. dc5FZXIhF8siQQ6ME5g4mlRtm8rifOoCWCKR
  55221. -----END CERTIFICATE-----
  55222. ISRG Root X1
  55223. ============
  55224. -----BEGIN CERTIFICATE-----
  55225. MIIFazCCA1OgAwIBAgIRAIIQz7DSQONZRGPgu2OCiwAwDQYJKoZIhvcNAQELBQAwTzELMAkGA1UE
  55226. BhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2VhcmNoIEdyb3VwMRUwEwYDVQQD
  55227. EwxJU1JHIFJvb3QgWDEwHhcNMTUwNjA0MTEwNDM4WhcNMzUwNjA0MTEwNDM4WjBPMQswCQYDVQQG
  55228. EwJVUzEpMCcGA1UEChMgSW50ZXJuZXQgU2VjdXJpdHkgUmVzZWFyY2ggR3JvdXAxFTATBgNVBAMT
  55229. DElTUkcgUm9vdCBYMTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAK3oJHP0FDfzm54r
  55230. Vygch77ct984kIxuPOZXoHj3dcKi/vVqbvYATyjb3miGbESTtrFj/RQSa78f0uoxmyF+0TM8ukj1
  55231. 3Xnfs7j/EvEhmkvBioZxaUpmZmyPfjxwv60pIgbz5MDmgK7iS4+3mX6UA5/TR5d8mUgjU+g4rk8K
  55232. b4Mu0UlXjIB0ttov0DiNewNwIRt18jA8+o+u3dpjq+sWT8KOEUt+zwvo/7V3LvSye0rgTBIlDHCN
  55233. Aymg4VMk7BPZ7hm/ELNKjD+Jo2FR3qyHB5T0Y3HsLuJvW5iB4YlcNHlsdu87kGJ55tukmi8mxdAQ
  55234. 4Q7e2RCOFvu396j3x+UCB5iPNgiV5+I3lg02dZ77DnKxHZu8A/lJBdiB3QW0KtZB6awBdpUKD9jf
  55235. 1b0SHzUvKBds0pjBqAlkd25HN7rOrFleaJ1/ctaJxQZBKT5ZPt0m9STJEadao0xAH0ahmbWnOlFu
  55236. hjuefXKnEgV4We0+UXgVCwOPjdAvBbI+e0ocS3MFEvzG6uBQE3xDk3SzynTnjh8BCNAw1FtxNrQH
  55237. usEwMFxIt4I7mKZ9YIqioymCzLq9gwQbooMDQaHWBfEbwrbwqHyGO0aoSCqI3Haadr8faqU9GY/r
  55238. OPNk3sgrDQoo//fb4hVC1CLQJ13hef4Y53CIrU7m2Ys6xt0nUW7/vGT1M0NPAgMBAAGjQjBAMA4G
  55239. A1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBR5tFnme7bl5AFzgAiIyBpY
  55240. 9umbbjANBgkqhkiG9w0BAQsFAAOCAgEAVR9YqbyyqFDQDLHYGmkgJykIrGF1XIpu+ILlaS/V9lZL
  55241. ubhzEFnTIZd+50xx+7LSYK05qAvqFyFWhfFQDlnrzuBZ6brJFe+GnY+EgPbk6ZGQ3BebYhtF8GaV
  55242. 0nxvwuo77x/Py9auJ/GpsMiu/X1+mvoiBOv/2X/qkSsisRcOj/KKNFtY2PwByVS5uCbMiogziUwt
  55243. hDyC3+6WVwW6LLv3xLfHTjuCvjHIInNzktHCgKQ5ORAzI4JMPJ+GslWYHb4phowim57iaztXOoJw
  55244. TdwJx4nLCgdNbOhdjsnvzqvHu7UrTkXWStAmzOVyyghqpZXjFaH3pO3JLF+l+/+sKAIuvtd7u+Nx
  55245. e5AW0wdeRlN8NwdCjNPElpzVmbUq4JUagEiuTDkHzsxHpFKVK7q4+63SM1N95R1NbdWhscdCb+ZA
  55246. JzVcoyi3B43njTOQ5yOf+1CceWxG1bQVs5ZufpsMljq4Ui0/1lvh+wjChP4kqKOJ2qxq4RgqsahD
  55247. YVvTH9w7jXbyLeiNdd8XM2w9U/t7y0Ff/9yi0GE44Za4rF2LN9d11TPAmRGunUHBcnWEvgJBQl9n
  55248. JEiU0Zsnvgc/ubhPgXRR4Xq37Z0j4r7g1SgEEzwxA57demyPxgcYxn/eR44/KJ4EBs+lVDR3veyJ
  55249. m+kXQ99b21/+jh5Xos1AnX5iItreGCc=
  55250. -----END CERTIFICATE-----
  55251. AC RAIZ FNMT-RCM
  55252. ================
  55253. -----BEGIN CERTIFICATE-----
  55254. MIIFgzCCA2ugAwIBAgIPXZONMGc2yAYdGsdUhGkHMA0GCSqGSIb3DQEBCwUAMDsxCzAJBgNVBAYT
  55255. AkVTMREwDwYDVQQKDAhGTk1ULVJDTTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTAeFw0wODEw
  55256. MjkxNTU5NTZaFw0zMDAxMDEwMDAwMDBaMDsxCzAJBgNVBAYTAkVTMREwDwYDVQQKDAhGTk1ULVJD
  55257. TTEZMBcGA1UECwwQQUMgUkFJWiBGTk1ULVJDTTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55258. ggIBALpxgHpMhm5/yBNtwMZ9HACXjywMI7sQmkCpGreHiPibVmr75nuOi5KOpyVdWRHbNi63URcf
  55259. qQgfBBckWKo3Shjf5TnUV/3XwSyRAZHiItQDwFj8d0fsjz50Q7qsNI1NOHZnjrDIbzAzWHFctPVr
  55260. btQBULgTfmxKo0nRIBnuvMApGGWn3v7v3QqQIecaZ5JCEJhfTzC8PhxFtBDXaEAUwED653cXeuYL
  55261. j2VbPNmaUtu1vZ5Gzz3rkQUCwJaydkxNEJY7kvqcfw+Z374jNUUeAlz+taibmSXaXvMiwzn15Cou
  55262. 08YfxGyqxRxqAQVKL9LFwag0Jl1mpdICIfkYtwb1TplvqKtMUejPUBjFd8g5CSxJkjKZqLsXF3mw
  55263. WsXmo8RZZUc1g16p6DULmbvkzSDGm0oGObVo/CK67lWMK07q87Hj/LaZmtVC+nFNCM+HHmpxffnT
  55264. tOmlcYF7wk5HlqX2doWjKI/pgG6BU6VtX7hI+cL5NqYuSf+4lsKMB7ObiFj86xsc3i1w4peSMKGJ
  55265. 47xVqCfWS+2QrYv6YyVZLag13cqXM7zlzced0ezvXg5KkAYmY6252TUtB7p2ZSysV4999AeU14EC
  55266. ll2jB0nVetBX+RvnU0Z1qrB5QstocQjpYL05ac70r8NWQMetUqIJ5G+GR4of6ygnXYMgrwTJbFaa
  55267. i0b1AgMBAAGjgYMwgYAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE
  55268. FPd9xf3E6Jobd2Sn9R2gzL+HYJptMD4GA1UdIAQ3MDUwMwYEVR0gADArMCkGCCsGAQUFBwIBFh1o
  55269. dHRwOi8vd3d3LmNlcnQuZm5tdC5lcy9kcGNzLzANBgkqhkiG9w0BAQsFAAOCAgEAB5BK3/MjTvDD
  55270. nFFlm5wioooMhfNzKWtN/gHiqQxjAb8EZ6WdmF/9ARP67Jpi6Yb+tmLSbkyU+8B1RXxlDPiyN8+s
  55271. D8+Nb/kZ94/sHvJwnvDKuO+3/3Y3dlv2bojzr2IyIpMNOmqOFGYMLVN0V2Ue1bLdI4E7pWYjJ2cJ
  55272. j+F3qkPNZVEI7VFY/uY5+ctHhKQV8Xa7pO6kO8Rf77IzlhEYt8llvhjho6Tc+hj507wTmzl6NLrT
  55273. Qfv6MooqtyuGC2mDOL7Nii4LcK2NJpLuHvUBKwrZ1pebbuCoGRw6IYsMHkCtA+fdZn71uSANA+iW
  55274. +YJF1DngoABd15jmfZ5nc8OaKveri6E6FO80vFIOiZiaBECEHX5FaZNXzuvO+FB8TxxuBEOb+dY7
  55275. Ixjp6o7RTUaN8Tvkasq6+yO3m/qZASlaWFot4/nUbQ4mrcFuNLwy+AwF+mWj2zs3gyLp1txyM/1d
  55276. 8iC9djwj2ij3+RvrWWTV3F9yfiD8zYm1kGdNYno/Tq0dwzn+evQoFt9B9kiABdcPUXmsEKvU7ANm
  55277. 5mqwujGSQkBqvjrTcuFqN1W8rB2Vt2lh8kORdOag0wokRqEIr9baRRmW1FMdW4R58MD3R++Lj8UG
  55278. rp1MYp3/RgT408m2ECVAdf4WqslKYIYvuu8wd+RU4riEmViAqhOLUTpPSPaLtrM=
  55279. -----END CERTIFICATE-----
  55280. Amazon Root CA 1
  55281. ================
  55282. -----BEGIN CERTIFICATE-----
  55283. MIIDQTCCAimgAwIBAgITBmyfz5m/jAo54vB4ikPmljZbyjANBgkqhkiG9w0BAQsFADA5MQswCQYD
  55284. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAxMB4XDTE1
  55285. MDUyNjAwMDAwMFoXDTM4MDExNzAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55286. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
  55287. ggEBALJ4gHHKeNXjca9HgFB0fW7Y14h29Jlo91ghYPl0hAEvrAIthtOgQ3pOsqTQNroBvo3bSMgH
  55288. FzZM9O6II8c+6zf1tRn4SWiw3te5djgdYZ6k/oI2peVKVuRF4fn9tBb6dNqcmzU5L/qwIFAGbHrQ
  55289. gLKm+a/sRxmPUDgH3KKHOVj4utWp+UhnMJbulHheb4mjUcAwhmahRWa6VOujw5H5SNz/0egwLX0t
  55290. dHA114gk957EWW67c4cX8jJGKLhD+rcdqsq08p8kDi1L93FcXmn/6pUCyziKrlA4b9v7LWIbxcce
  55291. VOF34GfID5yHI9Y/QCB/IIDEgEw+OyQmjgSubJrIqg0CAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB
  55292. /zAOBgNVHQ8BAf8EBAMCAYYwHQYDVR0OBBYEFIQYzIU07LwMlJQuCFmcx7IQTgoIMA0GCSqGSIb3
  55293. DQEBCwUAA4IBAQCY8jdaQZChGsV2USggNiMOruYou6r4lK5IpDB/G/wkjUu0yKGX9rbxenDIU5PM
  55294. CCjjmCXPI6T53iHTfIUJrU6adTrCC2qJeHZERxhlbI1Bjjt/msv0tadQ1wUsN+gDS63pYaACbvXy
  55295. 8MWy7Vu33PqUXHeeE6V/Uq2V8viTO96LXFvKWlJbYK8U90vvo/ufQJVtMVT8QtPHRh8jrdkPSHCa
  55296. 2XV4cdFyQzR1bldZwgJcJmApzyMZFo6IQ6XU5MsI+yMRQ+hDKXJioaldXgjUkK642M4UwtBV8ob2
  55297. xJNDd2ZhwLnoQdeXeGADbkpyrqXRfboQnoZsG4q5WTP468SQvvG5
  55298. -----END CERTIFICATE-----
  55299. Amazon Root CA 2
  55300. ================
  55301. -----BEGIN CERTIFICATE-----
  55302. MIIFQTCCAymgAwIBAgITBmyf0pY1hp8KD+WGePhbJruKNzANBgkqhkiG9w0BAQwFADA5MQswCQYD
  55303. VQQGEwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAyMB4XDTE1
  55304. MDUyNjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpv
  55305. bjEZMBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoC
  55306. ggIBAK2Wny2cSkxKgXlRmeyKy2tgURO8TW0G/LAIjd0ZEGrHJgw12MBvIITplLGbhQPDW9tK6Mj4
  55307. kHbZW0/jTOgGNk3Mmqw9DJArktQGGWCsN0R5hYGCrVo34A3MnaZMUnbqQ523BNFQ9lXg1dKmSYXp
  55308. N+nKfq5clU1Imj+uIFptiJXZNLhSGkOQsL9sBbm2eLfq0OQ6PBJTYv9K8nu+NQWpEjTj82R0Yiw9
  55309. AElaKP4yRLuH3WUnAnE72kr3H9rN9yFVkE8P7K6C4Z9r2UXTu/Bfh+08LDmG2j/e7HJV63mjrdvd
  55310. fLC6HM783k81ds8P+HgfajZRRidhW+mez/CiVX18JYpvL7TFz4QuK/0NURBs+18bvBt+xa47mAEx
  55311. kv8LV/SasrlX6avvDXbR8O70zoan4G7ptGmh32n2M8ZpLpcTnqWHsFcQgTfJU7O7f/aS0ZzQGPSS
  55312. btqDT6ZjmUyl+17vIWR6IF9sZIUVyzfpYgwLKhbcAS4y2j5L9Z469hdAlO+ekQiG+r5jqFoz7Mt0
  55313. Q5X5bGlSNscpb/xVA1wf+5+9R+vnSUeVC06JIglJ4PVhHvG/LopyboBZ/1c6+XUyo05f7O0oYtlN
  55314. c/LMgRdg7c3r3NunysV+Ar3yVAhU/bQtCSwXVEqY0VThUWcI0u1ufm8/0i2BWSlmy5A5lREedCf+
  55315. 3euvAgMBAAGjQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSw
  55316. DPBMMPQFWAJI/TPlUq9LhONmUjANBgkqhkiG9w0BAQwFAAOCAgEAqqiAjw54o+Ci1M3m9Zh6O+oA
  55317. A7CXDpO8Wqj2LIxyh6mx/H9z/WNxeKWHWc8w4Q0QshNabYL1auaAn6AFC2jkR2vHat+2/XcycuUY
  55318. +gn0oJMsXdKMdYV2ZZAMA3m3MSNjrXiDCYZohMr/+c8mmpJ5581LxedhpxfL86kSk5Nrp+gvU5LE
  55319. YFiwzAJRGFuFjWJZY7attN6a+yb3ACfAXVU3dJnJUH/jWS5E4ywl7uxMMne0nxrpS10gxdr9HIcW
  55320. xkPo1LsmmkVwXqkLN1PiRnsn/eBG8om3zEK2yygmbtmlyTrIQRNg91CMFa6ybRoVGld45pIq2WWQ
  55321. gj9sAq+uEjonljYE1x2igGOpm/HlurR8FLBOybEfdF849lHqm/osohHUqS0nGkWxr7JOcQ3AWEbW
  55322. aQbLU8uz/mtBzUF+fUwPfHJ5elnNXkoOrJupmHN5fLT0zLm4BwyydFy4x2+IoZCn9Kr5v2c69BoV
  55323. Yh63n749sSmvZ6ES8lgQGVMDMBu4Gon2nL2XA46jCfMdiyHxtN/kHNGfZQIG6lzWE7OE76KlXIx3
  55324. KadowGuuQNKotOrN8I1LOJwZmhsoVLiJkO/KdYE+HvJkJMcYr07/R54H9jVlpNMKVv/1F2Rs76gi
  55325. JUmTtt8AF9pYfl3uxRuw0dFfIRDH+fO6AgonB8Xx1sfT4PsJYGw=
  55326. -----END CERTIFICATE-----
  55327. Amazon Root CA 3
  55328. ================
  55329. -----BEGIN CERTIFICATE-----
  55330. MIIBtjCCAVugAwIBAgITBmyf1XSXNmY/Owua2eiedgPySjAKBggqhkjOPQQDAjA5MQswCQYDVQQG
  55331. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSAzMB4XDTE1MDUy
  55332. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55333. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgMzBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABCmXp8ZB
  55334. f8ANm+gBG1bG8lKlui2yEujSLtf6ycXYqm0fc4E7O5hrOXwzpcVOho6AF2hiRVd9RFgdszflZwjr
  55335. Zt6jQjBAMA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMB0GA1UdDgQWBBSrttvXBp43
  55336. rDCGB5Fwx5zEGbF4wDAKBggqhkjOPQQDAgNJADBGAiEA4IWSoxe3jfkrBqWTrBqYaGFy+uGh0Psc
  55337. eGCmQ5nFuMQCIQCcAu/xlJyzlvnrxir4tiz+OpAUFteMYyRIHN8wfdVoOw==
  55338. -----END CERTIFICATE-----
  55339. Amazon Root CA 4
  55340. ================
  55341. -----BEGIN CERTIFICATE-----
  55342. MIIB8jCCAXigAwIBAgITBmyf18G7EEwpQ+Vxe3ssyBrBDjAKBggqhkjOPQQDAzA5MQswCQYDVQQG
  55343. EwJVUzEPMA0GA1UEChMGQW1hem9uMRkwFwYDVQQDExBBbWF6b24gUm9vdCBDQSA0MB4XDTE1MDUy
  55344. NjAwMDAwMFoXDTQwMDUyNjAwMDAwMFowOTELMAkGA1UEBhMCVVMxDzANBgNVBAoTBkFtYXpvbjEZ
  55345. MBcGA1UEAxMQQW1hem9uIFJvb3QgQ0EgNDB2MBAGByqGSM49AgEGBSuBBAAiA2IABNKrijdPo1MN
  55346. /sGKe0uoe0ZLY7Bi9i0b2whxIdIA6GO9mif78DluXeo9pcmBqqNbIJhFXRbb/egQbeOc4OO9X4Ri
  55347. 83BkM6DLJC9wuoihKqB1+IGuYgbEgds5bimwHvouXKNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNV
  55348. HQ8BAf8EBAMCAYYwHQYDVR0OBBYEFNPsxzplbszh2naaVvuc84ZtV+WBMAoGCCqGSM49BAMDA2gA
  55349. MGUCMDqLIfG9fhGt0O9Yli/W651+kI0rz2ZVwyzjKKlwCkcO8DdZEv8tmZQoTipPNU0zWgIxAOp1
  55350. AE47xDqUEpHJWEadIRNyp4iciuRMStuW1KyLa2tJElMzrdfkviT8tQp21KW8EA==
  55351. -----END CERTIFICATE-----
  55352. LuxTrust Global Root 2
  55353. ======================
  55354. -----BEGIN CERTIFICATE-----
  55355. MIIFwzCCA6ugAwIBAgIUCn6m30tEntpqJIWe5rgV0xZ/u7EwDQYJKoZIhvcNAQELBQAwRjELMAkG
  55356. A1UEBhMCTFUxFjAUBgNVBAoMDUx1eFRydXN0IFMuQS4xHzAdBgNVBAMMFkx1eFRydXN0IEdsb2Jh
  55357. bCBSb290IDIwHhcNMTUwMzA1MTMyMTU3WhcNMzUwMzA1MTMyMTU3WjBGMQswCQYDVQQGEwJMVTEW
  55358. MBQGA1UECgwNTHV4VHJ1c3QgUy5BLjEfMB0GA1UEAwwWTHV4VHJ1c3QgR2xvYmFsIFJvb3QgMjCC
  55359. AiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBANeFl78RmOnwYoNMPIf5U2o3C/IPPIfOb9wm
  55360. Kb3FibrJgz337spbxm1Jc7TJRqMbNBM/wYlFV/TZsfs2ZUv7COJIcRHIbjuend+JZTemhfY7RBi2
  55361. xjcwYkSSl2l9QjAk5A0MiWtj3sXh306pFGxT4GHO9hcvHTy95iJMHZP1EMShduxq3sVs35a0VkBC
  55362. wGKSMKEtFZSg0iAGCW5qbeXrt77U8PEVfIvmTroTzEsnXpk8F12PgX8zPU/TPxvsXD/wPEx1bvKm
  55363. 1Z3aLQdjAsZy6ZS8TEmVT4hSyNvoaYL4zDRbIvCGp4m9SAptZoFtyMhk+wHh9OHe2Z7d21vUKpkm
  55364. FRseTJIpgp7VkoGSQXAZ96Tlk0u8d2cx3Rz9MXANF5kM+Qw5GSoXtTBxVdUPrljhPS80m8+f9niF
  55365. wpN6cj5mj5wWEWCPnolvZ77gR1o7DJpni89Gxq44o/KnvObWhWszJHAiS8sIm7vI+AIpHb4gDEa/
  55366. a4ebsypmQjVGbKq6rfmYe+lQVRQxv7HaLe2ArWgk+2mr2HETMOZns4dA/Yl+8kPREd8vZS9kzl8U
  55367. ubG/Mb2HeFpZZYiq/FkySIbWTLkpS5XTdvN3JW1CHDiDTf2jX5t/Lax5Gw5CMZdjpPuKadUiDTSQ
  55368. MC6otOBttpSsvItO13D8xTiOZCXhTTmQzsmHhFhxAgMBAAGjgagwgaUwDwYDVR0TAQH/BAUwAwEB
  55369. /zBCBgNVHSAEOzA5MDcGByuBKwEBAQowLDAqBggrBgEFBQcCARYeaHR0cHM6Ly9yZXBvc2l0b3J5
  55370. Lmx1eHRydXN0Lmx1MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBT/GCh2+UgFLKGu8SsbK7JT
  55371. +Et8szAdBgNVHQ4EFgQU/xgodvlIBSyhrvErGyuyU/hLfLMwDQYJKoZIhvcNAQELBQADggIBAGoZ
  55372. FO1uecEsh9QNcH7X9njJCwROxLHOk3D+sFTAMs2ZMGQXvw/l4jP9BzZAcg4atmpZ1gDlaCDdLnIN
  55373. H2pkMSCEfUmmWjfrRcmF9dTHF5kH5ptV5AzoqbTOjFu1EVzPig4N1qx3gf4ynCSecs5U89BvolbW
  55374. 7MM3LGVYvlcAGvI1+ut7MV3CwRI9loGIlonBWVx65n9wNOeD4rHh4bhY79SV5GCc8JaXcozrhAIu
  55375. ZY+kt9J/Z93I055cqqmkoCUUBpvsT34tC38ddfEz2O3OuHVtPlu5mB0xDVbYQw8wkbIEa91WvpWA
  55376. VWe+2M2D2RjuLg+GLZKecBPs3lHJQ3gCpU3I+V/EkVhGFndadKpAvAefMLmx9xIX3eP/JEAdemrR
  55377. TxgKqpAd60Ae36EeRJIQmvKN4dFLRp7oRUKX6kWZ8+xm1QL68qZKJKrezrnK+T+Tb/mjuuqlPpmt
  55378. /f97mfVl7vBZKGfXkJWkE4SphMHozs51k2MavDzq1WQfLSoSOcbDWjLtR5EWDrw4wVDej8oqkDQc
  55379. 7kGUnF4ZLvhFSZl0kbAEb+MEWrGrKqv+x9CWttrhSmQGbmBNvUJO/3jaJMobtNeWOWyu8Q6qp31I
  55380. iyBMz2TWuJdGsE7RKlY6oJO9r4Ak4Ap+58rVyuiFVdw2KuGUaJPHZnJED4AhMmwlxyOAgwrr
  55381. -----END CERTIFICATE-----
  55382. TUBITAK Kamu SM SSL Kok Sertifikasi - Surum 1
  55383. =============================================
  55384. -----BEGIN CERTIFICATE-----
  55385. MIIEYzCCA0ugAwIBAgIBATANBgkqhkiG9w0BAQsFADCB0jELMAkGA1UEBhMCVFIxGDAWBgNVBAcT
  55386. D0dlYnplIC0gS29jYWVsaTFCMEAGA1UEChM5VHVya2l5ZSBCaWxpbXNlbCB2ZSBUZWtub2xvamlr
  55387. IEFyYXN0aXJtYSBLdXJ1bXUgLSBUVUJJVEFLMS0wKwYDVQQLEyRLYW11IFNlcnRpZmlrYXN5b24g
  55388. TWVya2V6aSAtIEthbXUgU00xNjA0BgNVBAMTLVRVQklUQUsgS2FtdSBTTSBTU0wgS29rIFNlcnRp
  55389. ZmlrYXNpIC0gU3VydW0gMTAeFw0xMzExMjUwODI1NTVaFw00MzEwMjUwODI1NTVaMIHSMQswCQYD
  55390. VQQGEwJUUjEYMBYGA1UEBxMPR2ViemUgLSBLb2NhZWxpMUIwQAYDVQQKEzlUdXJraXllIEJpbGlt
  55391. c2VsIHZlIFRla25vbG9qaWsgQXJhc3Rpcm1hIEt1cnVtdSAtIFRVQklUQUsxLTArBgNVBAsTJEth
  55392. bXUgU2VydGlmaWthc3lvbiBNZXJrZXppIC0gS2FtdSBTTTE2MDQGA1UEAxMtVFVCSVRBSyBLYW11
  55393. IFNNIFNTTCBLb2sgU2VydGlmaWthc2kgLSBTdXJ1bSAxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8A
  55394. MIIBCgKCAQEAr3UwM6q7a9OZLBI3hNmNe5eA027n/5tQlT6QlVZC1xl8JoSNkvoBHToP4mQ4t4y8
  55395. 6Ij5iySrLqP1N+RAjhgleYN1Hzv/bKjFxlb4tO2KRKOrbEz8HdDc72i9z+SqzvBV96I01INrN3wc
  55396. wv61A+xXzry0tcXtAA9TNypN9E8Mg/uGz8v+jE69h/mniyFXnHrfA2eJLJ2XYacQuFWQfw4tJzh0
  55397. 3+f92k4S400VIgLI4OD8D62K18lUUMw7D8oWgITQUVbDjlZ/iSIzL+aFCr2lqBs23tPcLG07xxO9
  55398. WSMs5uWk99gL7eqQQESolbuT1dCANLZGeA4fAJNG4e7p+exPFwIDAQABo0IwQDAdBgNVHQ4EFgQU
  55399. ZT/HiobGPN08VFw1+DrtUgxHV8gwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJ
  55400. KoZIhvcNAQELBQADggEBACo/4fEyjq7hmFxLXs9rHmoJ0iKpEsdeV31zVmSAhHqT5Am5EM2fKifh
  55401. AHe+SMg1qIGf5LgsyX8OsNJLN13qudULXjS99HMpw+0mFZx+CFOKWI3QSyjfwbPfIPP54+M638yc
  55402. lNhOT8NrF7f3cuitZjO1JVOr4PhMqZ398g26rrnZqsZr+ZO7rqu4lzwDGrpDxpa5RXI4s6ehlj2R
  55403. e37AIVNMh+3yC1SVUZPVIqUNivGTDj5UDrDYyU7c8jEyVupk+eq1nRZmQnLzf9OxMUP8pI4X8W0j
  55404. q5Rm+K37DwhuJi1/FwcJsoz7UMCflo3Ptv0AnVoUmr8CRPXBwp8iXqIPoeM=
  55405. -----END CERTIFICATE-----
  55406. GDCA TrustAUTH R5 ROOT
  55407. ======================
  55408. -----BEGIN CERTIFICATE-----
  55409. MIIFiDCCA3CgAwIBAgIIfQmX/vBH6nowDQYJKoZIhvcNAQELBQAwYjELMAkGA1UEBhMCQ04xMjAw
  55410. BgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZIENPLixMVEQuMR8wHQYDVQQD
  55411. DBZHRENBIFRydXN0QVVUSCBSNSBST09UMB4XDTE0MTEyNjA1MTMxNVoXDTQwMTIzMTE1NTk1OVow
  55412. YjELMAkGA1UEBhMCQ04xMjAwBgNVBAoMKUdVQU5HIERPTkcgQ0VSVElGSUNBVEUgQVVUSE9SSVRZ
  55413. IENPLixMVEQuMR8wHQYDVQQDDBZHRENBIFRydXN0QVVUSCBSNSBST09UMIICIjANBgkqhkiG9w0B
  55414. AQEFAAOCAg8AMIICCgKCAgEA2aMW8Mh0dHeb7zMNOwZ+Vfy1YI92hhJCfVZmPoiC7XJjDp6L3TQs
  55415. AlFRwxn9WVSEyfFrs0yw6ehGXTjGoqcuEVe6ghWinI9tsJlKCvLriXBjTnnEt1u9ol2x8kECK62p
  55416. OqPseQrsXzrj/e+APK00mxqriCZ7VqKChh/rNYmDf1+uKU49tm7srsHwJ5uu4/Ts765/94Y9cnrr
  55417. pftZTqfrlYwiOXnhLQiPzLyRuEH3FMEjqcOtmkVEs7LXLM3GKeJQEK5cy4KOFxg2fZfmiJqwTTQJ
  55418. 9Cy5WmYqsBebnh52nUpmMUHfP/vFBu8btn4aRjb3ZGM74zkYI+dndRTVdVeSN72+ahsmUPI2JgaQ
  55419. xXABZG12ZuGR224HwGGALrIuL4xwp9E7PLOR5G62xDtw8mySlwnNR30YwPO7ng/Wi64HtloPzgsM
  55420. R6flPri9fcebNaBhlzpBdRfMK5Z3KpIhHtmVdiBnaM8Nvd/WHwlqmuLMc3GkL30SgLdTMEZeS1SZ
  55421. D2fJpcjyIMGC7J0R38IC+xo70e0gmu9lZJIQDSri3nDxGGeCjGHeuLzRL5z7D9Ar7Rt2ueQ5Vfj4
  55422. oR24qoAATILnsn8JuLwwoC8N9VKejveSswoAHQBUlwbgsQfZxw9cZX08bVlX5O2ljelAU58VS6Bx
  55423. 9hoh49pwBiFYFIeFd3mqgnkCAwEAAaNCMEAwHQYDVR0OBBYEFOLJQJ9NzuiaoXzPDj9lxSmIahlR
  55424. MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQDRSVfg
  55425. p8xoWLoBDysZzY2wYUWsEe1jUGn4H3++Fo/9nesLqjJHdtJnJO29fDMylyrHBYZmDRd9FBUb1Ov9
  55426. H5r2XpdptxolpAqzkT9fNqyL7FeoPueBihhXOYV0GkLH6VsTX4/5COmSdI31R9KrO9b7eGZONn35
  55427. 6ZLpBN79SWP8bfsUcZNnL0dKt7n/HipzcEYwv1ryL3ml4Y0M2fmyYzeMN2WFcGpcWwlyua1jPLHd
  55428. +PwyvzeG5LuOmCd+uh8W4XAR8gPfJWIyJyYYMoSf/wA6E7qaTfRPuBRwIrHKK5DOKcFw9C+df/KQ
  55429. HtZa37dG/OaG+svgIHZ6uqbL9XzeYqWxi+7egmaKTjowHz+Ay60nugxe19CxVsp3cbK1daFQqUBD
  55430. F8Io2c9Si1vIY9RCPqAzekYu9wogRlR+ak8x8YF+QnQ4ZXMn7sZ8uI7XpTrXmKGcjBBV09tL7ECQ
  55431. 8s1uV9JiDnxXk7Gnbc2dg7sq5+W2O3FYrf3RRbxake5TFW/TRQl1brqQXR4EzzffHqhmsYzmIGrv
  55432. /EhOdJhCrylvLmrH+33RZjEizIYAfmaDDEL0vTSSwxrqT8p+ck0LcIymSLumoRT2+1hEmRSuqguT
  55433. aaApJUqlyyvdimYHFngVV3Eb7PVHhPOeMTd61X8kreS8/f3MboPoDKi3QWwH3b08hpcv0g==
  55434. -----END CERTIFICATE-----
  55435. TrustCor RootCert CA-1
  55436. ======================
  55437. -----BEGIN CERTIFICATE-----
  55438. MIIEMDCCAxigAwIBAgIJANqb7HHzA7AZMA0GCSqGSIb3DQEBCwUAMIGkMQswCQYDVQQGEwJQQTEP
  55439. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55440. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55441. dHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0IENBLTEwHhcNMTYwMjA0MTIzMjE2WhcNMjkx
  55442. MjMxMTcyMzE2WjCBpDELMAkGA1UEBhMCUEExDzANBgNVBAgMBlBhbmFtYTEUMBIGA1UEBwwLUGFu
  55443. YW1hIENpdHkxJDAiBgNVBAoMG1RydXN0Q29yIFN5c3RlbXMgUy4gZGUgUi5MLjEnMCUGA1UECwwe
  55444. VHJ1c3RDb3IgQ2VydGlmaWNhdGUgQXV0aG9yaXR5MR8wHQYDVQQDDBZUcnVzdENvciBSb290Q2Vy
  55445. dCBDQS0xMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv463leLCJhJrMxnHQFgKq1mq
  55446. jQCj/IDHUHuO1CAmujIS2CNUSSUQIpidRtLByZ5OGy4sDjjzGiVoHKZaBeYei0i/mJZ0PmnK6bV4
  55447. pQa81QBeCQryJ3pS/C3Vseq0iWEk8xoT26nPUu0MJLq5nux+AHT6k61sKZKuUbS701e/s/OojZz0
  55448. JEsq1pme9J7+wH5COucLlVPat2gOkEz7cD+PSiyU8ybdY2mplNgQTsVHCJCZGxdNuWxu72CVEY4h
  55449. gLW9oHPY0LJ3xEXqWib7ZnZ2+AYfYW0PVcWDtxBWcgYHpfOxGgMFZA6dWorWhnAbJN7+KIor0Gqw
  55450. /Hqi3LJ5DotlDwIDAQABo2MwYTAdBgNVHQ4EFgQU7mtJPHo/DeOxCbeKyKsZn3MzUOcwHwYDVR0j
  55451. BBgwFoAU7mtJPHo/DeOxCbeKyKsZn3MzUOcwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMC
  55452. AYYwDQYJKoZIhvcNAQELBQADggEBACUY1JGPE+6PHh0RU9otRCkZoB5rMZ5NDp6tPVxBb5UrJKF5
  55453. mDo4Nvu7Zp5I/5CQ7z3UuJu0h3U/IJvOcs+hVcFNZKIZBqEHMwwLKeXx6quj7LUKdJDHfXLy11yf
  55454. ke+Ri7fc7Waiz45mO7yfOgLgJ90WmMCV1Aqk5IGadZQ1nJBfiDcGrVmVCrDRZ9MZyonnMlo2HD6C
  55455. qFqTvsbQZJG2z9m2GM/bftJlo6bEjhcxwft+dtvTheNYsnd6djtsL1Ac59v2Z3kf9YKVmgenFK+P
  55456. 3CghZwnS1k1aHBkcjndcw5QkPTJrS37UeJSDvjdNzl/HHk484IkzlQsPpTLWPFp5LBk=
  55457. -----END CERTIFICATE-----
  55458. TrustCor RootCert CA-2
  55459. ======================
  55460. -----BEGIN CERTIFICATE-----
  55461. MIIGLzCCBBegAwIBAgIIJaHfyjPLWQIwDQYJKoZIhvcNAQELBQAwgaQxCzAJBgNVBAYTAlBBMQ8w
  55462. DQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5MSQwIgYDVQQKDBtUcnVzdENvciBT
  55463. eXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29yIENlcnRpZmljYXRlIEF1dGhvcml0
  55464. eTEfMB0GA1UEAwwWVHJ1c3RDb3IgUm9vdENlcnQgQ0EtMjAeFw0xNjAyMDQxMjMyMjNaFw0zNDEy
  55465. MzExNzI2MzlaMIGkMQswCQYDVQQGEwJQQTEPMA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5h
  55466. bWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3IgU3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5U
  55467. cnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxHzAdBgNVBAMMFlRydXN0Q29yIFJvb3RDZXJ0
  55468. IENBLTIwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCnIG7CKqJiJJWQdsg4foDSq8Gb
  55469. ZQWU9MEKENUCrO2fk8eHyLAnK0IMPQo+QVqedd2NyuCb7GgypGmSaIwLgQ5WoD4a3SwlFIIvl9Nk
  55470. RvRUqdw6VC0xK5mC8tkq1+9xALgxpL56JAfDQiDyitSSBBtlVkxs1Pu2YVpHI7TYabS3OtB0PAx1
  55471. oYxOdqHp2yqlO/rOsP9+aij9JxzIsekp8VduZLTQwRVtDr4uDkbIXvRR/u8OYzo7cbrPb1nKDOOb
  55472. XUm4TOJXsZiKQlecdu/vvdFoqNL0Cbt3Nb4lggjEFixEIFapRBF37120Hapeaz6LMvYHL1cEksr1
  55473. /p3C6eizjkxLAjHZ5DxIgif3GIJ2SDpxsROhOdUuxTTCHWKF3wP+TfSvPd9cW436cOGlfifHhi5q
  55474. jxLGhF5DUVCcGZt45vz27Ud+ez1m7xMTiF88oWP7+ayHNZ/zgp6kPwqcMWmLmaSISo5uZk3vFsQP
  55475. eSghYA2FFn3XVDjxklb9tTNMg9zXEJ9L/cb4Qr26fHMC4P99zVvh1Kxhe1fVSntb1IVYJ12/+Ctg
  55476. rKAmrhQhJ8Z3mjOAPF5GP/fDsaOGM8boXg25NSyqRsGFAnWAoOsk+xWq5Gd/bnc/9ASKL3x74xdh
  55477. 8N0JqSDIvgmk0H5Ew7IwSjiqqewYmgeCK9u4nBit2uBGF6zPXQIDAQABo2MwYTAdBgNVHQ4EFgQU
  55478. 2f4hQG6UnrybPZx9mCAZ5YwwYrIwHwYDVR0jBBgwFoAU2f4hQG6UnrybPZx9mCAZ5YwwYrIwDwYD
  55479. VR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQELBQADggIBAJ5Fngw7tu/h
  55480. Osh80QA9z+LqBrWyOrsGS2h60COXdKcs8AjYeVrXWoSK2BKaG9l9XE1wxaX5q+WjiYndAfrs3fnp
  55481. kpfbsEZC89NiqpX+MWcUaViQCqoL7jcjx1BRtPV+nuN79+TMQjItSQzL/0kMmx40/W5ulop5A7Zv
  55482. 2wnL/V9lFDfhOPXzYRZY5LVtDQsEGz9QLX+zx3oaFoBg+Iof6Rsqxvm6ARppv9JYx1RXCI/hOWB3
  55483. S6xZhBqI8d3LT3jX5+EzLfzuQfogsL7L9ziUwOHQhQ+77Sxzq+3+knYaZH9bDTMJBzN7Bj8RpFxw
  55484. PIXAz+OQqIN3+tvmxYxoZxBnpVIt8MSZj3+/0WvitUfW2dCFmU2Umw9Lje4AWkcdEQOsQRivh7dv
  55485. DDqPys/cA8GiCcjl/YBeyGBCARsaU1q7N6a3vLqE6R5sGtRk2tRD/pOLS/IseRYQ1JMLiI+h2IYU
  55486. RpFHmygk71dSTlxCnKr3Sewn6EAes6aJInKc9Q0ztFijMDvd1GpUk74aTfOTlPf8hAs/hCBcNANE
  55487. xdqtvArBAs8e5ZTZ845b2EzwnexhF7sUMlQMAimTHpKG9n/v55IFDlndmQguLvqcAFLTxWYp5KeX
  55488. RKQOKIETNcX2b2TmQcTVL8w0RSXPQQCWPUouwpaYT05KnJe32x+SMsj/D1Fu1uwJ
  55489. -----END CERTIFICATE-----
  55490. TrustCor ECA-1
  55491. ==============
  55492. -----BEGIN CERTIFICATE-----
  55493. MIIEIDCCAwigAwIBAgIJAISCLF8cYtBAMA0GCSqGSIb3DQEBCwUAMIGcMQswCQYDVQQGEwJQQTEP
  55494. MA0GA1UECAwGUGFuYW1hMRQwEgYDVQQHDAtQYW5hbWEgQ2l0eTEkMCIGA1UECgwbVHJ1c3RDb3Ig
  55495. U3lzdGVtcyBTLiBkZSBSLkwuMScwJQYDVQQLDB5UcnVzdENvciBDZXJ0aWZpY2F0ZSBBdXRob3Jp
  55496. dHkxFzAVBgNVBAMMDlRydXN0Q29yIEVDQS0xMB4XDTE2MDIwNDEyMzIzM1oXDTI5MTIzMTE3Mjgw
  55497. N1owgZwxCzAJBgNVBAYTAlBBMQ8wDQYDVQQIDAZQYW5hbWExFDASBgNVBAcMC1BhbmFtYSBDaXR5
  55498. MSQwIgYDVQQKDBtUcnVzdENvciBTeXN0ZW1zIFMuIGRlIFIuTC4xJzAlBgNVBAsMHlRydXN0Q29y
  55499. IENlcnRpZmljYXRlIEF1dGhvcml0eTEXMBUGA1UEAwwOVHJ1c3RDb3IgRUNBLTEwggEiMA0GCSqG
  55500. SIb3DQEBAQUAA4IBDwAwggEKAoIBAQDPj+ARtZ+odnbb3w9U73NjKYKtR8aja+3+XzP4Q1HpGjOR
  55501. MRegdMTUpwHmspI+ap3tDvl0mEDTPwOABoJA6LHip1GnHYMma6ve+heRK9jGrB6xnhkB1Zem6g23
  55502. xFUfJ3zSCNV2HykVh0A53ThFEXXQmqc04L/NyFIduUd+Dbi7xgz2c1cWWn5DkR9VOsZtRASqnKmc
  55503. p0yJF4OuowReUoCLHhIlERnXDH19MURB6tuvsBzvgdAsxZohmz3tQjtQJvLsznFhBmIhVE5/wZ0+
  55504. fyCMgMsq2JdiyIMzkX2woloPV+g7zPIlstR8L+xNxqE6FXrntl019fZISjZFZtS6mFjBAgMBAAGj
  55505. YzBhMB0GA1UdDgQWBBREnkj1zG1I1KBLf/5ZJC+Dl5mahjAfBgNVHSMEGDAWgBREnkj1zG1I1KBL
  55506. f/5ZJC+Dl5mahjAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBhjANBgkqhkiG9w0BAQsF
  55507. AAOCAQEABT41XBVwm8nHc2FvcivUwo/yQ10CzsSUuZQRg2dd4mdsdXa/uwyqNsatR5Nj3B5+1t4u
  55508. /ukZMjgDfxT2AHMsWbEhBuH7rBiVDKP/mZb3Kyeb1STMHd3BOuCYRLDE5D53sXOpZCz2HAF8P11F
  55509. hcCF5yWPldwX8zyfGm6wyuMdKulMY/okYWLW2n62HGz1Ah3UKt1VkOsqEUc8Ll50soIipX1TH0Xs
  55510. J5F95yIW6MBoNtjG8U+ARDL54dHRHareqKucBK+tIA5kmE2la8BIWJZpTdwHjFGTot+fDz2LYLSC
  55511. jaoITmJF4PkL0uDgPFveXHEnJcLmA4GLEFPjx1WitJ/X5g==
  55512. -----END CERTIFICATE-----
  55513. SSL.com Root Certification Authority RSA
  55514. ========================================
  55515. -----BEGIN CERTIFICATE-----
  55516. MIIF3TCCA8WgAwIBAgIIeyyb0xaAMpkwDQYJKoZIhvcNAQELBQAwfDELMAkGA1UEBhMCVVMxDjAM
  55517. BgNVBAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24x
  55518. MTAvBgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBSU0EwHhcNMTYw
  55519. MjEyMTczOTM5WhcNNDEwMjEyMTczOTM5WjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55520. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NM
  55521. LmNvbSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IFJTQTCCAiIwDQYJKoZIhvcNAQEBBQAD
  55522. ggIPADCCAgoCggIBAPkP3aMrfcvQKv7sZ4Wm5y4bunfh4/WvpOz6Sl2RxFdHaxh3a3by/ZPkPQ/C
  55523. Fp4LZsNWlJ4Xg4XOVu/yFv0AYvUiCVToZRdOQbngT0aXqhvIuG5iXmmxX9sqAn78bMrzQdjt0Oj8
  55524. P2FI7bADFB0QDksZ4LtO7IZl/zbzXmcCC52GVWH9ejjt/uIZALdvoVBidXQ8oPrIJZK0bnoix/ge
  55525. oeOy3ZExqysdBP+lSgQ36YWkMyv94tZVNHwZpEpox7Ko07fKoZOI68GXvIz5HdkihCR0xwQ9aqkp
  55526. k8zruFvh/l8lqjRYyMEjVJ0bmBHDOJx+PYZspQ9AhnwC9FwCTyjLrnGfDzrIM/4RJTXq/LrFYD3Z
  55527. fBjVsqnTdXgDciLKOsMf7yzlLqn6niy2UUb9rwPW6mBo6oUWNmuF6R7As93EJNyAKoFBbZQ+yODJ
  55528. gUEAnl6/f8UImKIYLEJAs/lvOCdLToD0PYFH4Ih86hzOtXVcUS4cK38acijnALXRdMbX5J+tB5O2
  55529. UzU1/Dfkw/ZdFr4hc96SCvigY2q8lpJqPvi8ZVWb3vUNiSYE/CUapiVpy8JtynziWV+XrOvvLsi8
  55530. 1xtZPCvM8hnIk2snYxnP/Okm+Mpxm3+T/jRnhE6Z6/yzeAkzcLpmpnbtG3PrGqUNxCITIJRWCk4s
  55531. bE6x/c+cCbqiM+2HAgMBAAGjYzBhMB0GA1UdDgQWBBTdBAkHovV6fVJTEpKV7jiAJQ2mWTAPBgNV
  55532. HRMBAf8EBTADAQH/MB8GA1UdIwQYMBaAFN0ECQei9Xp9UlMSkpXuOIAlDaZZMA4GA1UdDwEB/wQE
  55533. AwIBhjANBgkqhkiG9w0BAQsFAAOCAgEAIBgRlCn7Jp0cHh5wYfGVcpNxJK1ok1iOMq8bs3AD/CUr
  55534. dIWQPXhq9LmLpZc7tRiRux6n+UBbkflVma8eEdBcHadm47GUBwwyOabqG7B52B2ccETjit3E+ZUf
  55535. ijhDPwGFpUenPUayvOUiaPd7nNgsPgohyC0zrL/FgZkxdMF1ccW+sfAjRfSda/wZY52jvATGGAsl
  55536. u1OJD7OAUN5F7kR/q5R4ZJjT9ijdh9hwZXT7DrkT66cPYakylszeu+1jTBi7qUD3oFRuIIhxdRjq
  55537. erQ0cuAjJ3dctpDqhiVAq+8zD8ufgr6iIPv2tS0a5sKFsXQP+8hlAqRSAUfdSSLBv9jra6x+3uxj
  55538. MxW3IwiPxg+NQVrdjsW5j+VFP3jbutIbQLH+cU0/4IGiul607BXgk90IH37hVZkLId6Tngr75qNJ
  55539. vTYw/ud3sqB1l7UtgYgXZSD32pAAn8lSzDLKNXz1PQ/YK9f1JmzJBjSWFupwWRoyeXkLtoh/D1JI
  55540. Pb9s2KJELtFOt3JY04kTlf5Eq/jXixtunLwsoFvVagCvXzfh1foQC5ichucmj87w7G6KVwuA406y
  55541. wKBjYZC6VWg3dGq2ktufoYYitmUnDuy2n0Jg5GfCtdpBC8TTi2EbvPofkSvXRAdeuims2cXp71NI
  55542. WuuA8ShYIc2wBlX7Jz9TkHCpBB5XJ7k=
  55543. -----END CERTIFICATE-----
  55544. SSL.com Root Certification Authority ECC
  55545. ========================================
  55546. -----BEGIN CERTIFICATE-----
  55547. MIICjTCCAhSgAwIBAgIIdebfy8FoW6gwCgYIKoZIzj0EAwIwfDELMAkGA1UEBhMCVVMxDjAMBgNV
  55548. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xMTAv
  55549. BgNVBAMMKFNTTC5jb20gUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYwMjEy
  55550. MTgxNDAzWhcNNDEwMjEyMTgxNDAzWjB8MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMxEDAO
  55551. BgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjExMC8GA1UEAwwoU1NMLmNv
  55552. bSBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuBBAAiA2IA
  55553. BEVuqVDEpiM2nl8ojRfLliJkP9x6jh3MCLOicSS6jkm5BBtHllirLZXI7Z4INcgn64mMU1jrYor+
  55554. 8FsPazFSY0E7ic3s7LaNGdM0B9y7xgZ/wkWV7Mt/qCPgCemB+vNH06NjMGEwHQYDVR0OBBYEFILR
  55555. hXMw5zUE044CkvvlpNHEIejNMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUgtGFczDnNQTT
  55556. jgKS++Wk0cQh6M0wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2cAMGQCMG/n61kRpGDPYbCW
  55557. e+0F+S8Tkdzt5fxQaxFGRrMcIQBiu77D5+jNB5n5DQtdcj7EqgIwH7y6C+IwJPt8bYBVCpk+gA0z
  55558. 5Wajs6O7pdWLjwkspl1+4vAHCGht0nxpbl/f5Wpl
  55559. -----END CERTIFICATE-----
  55560. SSL.com EV Root Certification Authority RSA R2
  55561. ==============================================
  55562. -----BEGIN CERTIFICATE-----
  55563. MIIF6zCCA9OgAwIBAgIIVrYpzTS8ePYwDQYJKoZIhvcNAQELBQAwgYIxCzAJBgNVBAYTAlVTMQ4w
  55564. DAYDVQQIDAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9u
  55565. MTcwNQYDVQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIy
  55566. MB4XDTE3MDUzMTE4MTQzN1oXDTQyMDUzMDE4MTQzN1owgYIxCzAJBgNVBAYTAlVTMQ4wDAYDVQQI
  55567. DAVUZXhhczEQMA4GA1UEBwwHSG91c3RvbjEYMBYGA1UECgwPU1NMIENvcnBvcmF0aW9uMTcwNQYD
  55568. VQQDDC5TU0wuY29tIEVWIFJvb3QgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgUlNBIFIyMIICIjAN
  55569. BgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAjzZlQOHWTcDXtOlG2mvqM0fNTPl9fb69LT3w23jh
  55570. hqXZuglXaO1XPqDQCEGD5yhBJB/jchXQARr7XnAjssufOePPxU7Gkm0mxnu7s9onnQqG6YE3Bf7w
  55571. cXHswxzpY6IXFJ3vG2fThVUCAtZJycxa4bH3bzKfydQ7iEGonL3Lq9ttewkfokxykNorCPzPPFTO
  55572. Zw+oz12WGQvE43LrrdF9HSfvkusQv1vrO6/PgN3B0pYEW3p+pKk8OHakYo6gOV7qd89dAFmPZiw+
  55573. B6KjBSYRaZfqhbcPlgtLyEDhULouisv3D5oi53+aNxPN8k0TayHRwMwi8qFG9kRpnMphNQcAb9Zh
  55574. CBHqurj26bNg5U257J8UZslXWNvNh2n4ioYSA0e/ZhN2rHd9NCSFg83XqpyQGp8hLH94t2S42Oim
  55575. 9HizVcuE0jLEeK6jj2HdzghTreyI/BXkmg3mnxp3zkyPuBQVPWKchjgGAGYS5Fl2WlPAApiiECto
  55576. RHuOec4zSnaqW4EWG7WK2NAAe15itAnWhmMOpgWVSbooi4iTsjQc2KRVbrcc0N6ZVTsj9CLg+Slm
  55577. JuwgUHfbSguPvuUCYHBBXtSuUDkiFCbLsjtzdFVHB3mBOagwE0TlBIqulhMlQg+5U8Sb/M3kHN48
  55578. +qvWBkofZ6aYMBzdLNvcGJVXZsb/XItW9XcCAwEAAaNjMGEwDwYDVR0TAQH/BAUwAwEB/zAfBgNV
  55579. HSMEGDAWgBT5YLvU49U09rj1BoAlp3PbRmmonjAdBgNVHQ4EFgQU+WC71OPVNPa49QaAJadz20Zp
  55580. qJ4wDgYDVR0PAQH/BAQDAgGGMA0GCSqGSIb3DQEBCwUAA4ICAQBWs47LCp1Jjr+kxJG7ZhcFUZh1
  55581. ++VQLHqe8RT6q9OKPv+RKY9ji9i0qVQBDb6Thi/5Sm3HXvVX+cpVHBK+Rw82xd9qt9t1wkclf7nx
  55582. Y/hoLVUE0fKNsKTPvDxeH3jnpaAgcLAExbf3cqfeIg29MyVGjGSSJuM+LmOW2puMPfgYCdcDzH2G
  55583. guDKBAdRUNf/ktUM79qGn5nX67evaOI5JpS6aLe/g9Pqemc9YmeuJeVy6OLk7K4S9ksrPJ/psEDz
  55584. OFSz/bdoyNrGj1E8svuR3Bznm53htw1yj+KkxKl4+esUrMZDBcJlOSgYAsOCsp0FvmXtll9ldDz7
  55585. CTUue5wT/RsPXcdtgTpWD8w74a8CLyKsRspGPKAcTNZEtF4uXBVmCeEmKf7GUmG6sXP/wwyc5Wxq
  55586. lD8UykAWlYTzWamsX0xhk23RO8yilQwipmdnRC652dKKQbNmC1r7fSOl8hqw/96bg5Qu0T/fkreR
  55587. rwU7ZcegbLHNYhLDkBvjJc40vG93drEQw/cFGsDWr3RiSBd3kmmQYRzelYB0VI8YHMPzA9C/pEN1
  55588. hlMYegouCRw2n5H9gooiS9EOUCXdywMMF8mDAAhONU2Ki+3wApRmLER/y5UnlhetCTCstnEXbosX
  55589. 9hwJ1C07mKVx01QT2WDz9UtmT/rx7iASjbSsV7FFY6GsdqnC+w==
  55590. -----END CERTIFICATE-----
  55591. SSL.com EV Root Certification Authority ECC
  55592. ===========================================
  55593. -----BEGIN CERTIFICATE-----
  55594. MIIClDCCAhqgAwIBAgIILCmcWxbtBZUwCgYIKoZIzj0EAwIwfzELMAkGA1UEBhMCVVMxDjAMBgNV
  55595. BAgMBVRleGFzMRAwDgYDVQQHDAdIb3VzdG9uMRgwFgYDVQQKDA9TU0wgQ29ycG9yYXRpb24xNDAy
  55596. BgNVBAMMK1NTTC5jb20gRVYgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSBFQ0MwHhcNMTYw
  55597. MjEyMTgxNTIzWhcNNDEwMjEyMTgxNTIzWjB/MQswCQYDVQQGEwJVUzEOMAwGA1UECAwFVGV4YXMx
  55598. EDAOBgNVBAcMB0hvdXN0b24xGDAWBgNVBAoMD1NTTCBDb3Jwb3JhdGlvbjE0MDIGA1UEAwwrU1NM
  55599. LmNvbSBFViBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IEVDQzB2MBAGByqGSM49AgEGBSuB
  55600. BAAiA2IABKoSR5CYG/vvw0AHgyBO8TCCogbR8pKGYfL2IWjKAMTH6kMAVIbc/R/fALhBYlzccBYy
  55601. 3h+Z1MzFB8gIH2EWB1E9fVwHU+M1OIzfzZ/ZLg1KthkuWnBaBu2+8KGwytAJKaNjMGEwHQYDVR0O
  55602. BBYEFFvKXuXe0oGqzagtZFG22XKbl+ZPMA8GA1UdEwEB/wQFMAMBAf8wHwYDVR0jBBgwFoAUW8pe
  55603. 5d7SgarNqC1kUbbZcpuX5k8wDgYDVR0PAQH/BAQDAgGGMAoGCCqGSM49BAMCA2gAMGUCMQCK5kCJ
  55604. N+vp1RPZytRrJPOwPYdGWBrssd9v+1a6cGvHOMzosYxPD/fxZ3YOg9AeUY8CMD32IygmTMZgh5Mm
  55605. m7I1HrrW9zzRHM76JTymGoEVW/MSD2zuZYrJh6j5B+BimoxcSg==
  55606. -----END CERTIFICATE-----
  55607. GlobalSign Root CA - R6
  55608. =======================
  55609. -----BEGIN CERTIFICATE-----
  55610. MIIFgzCCA2ugAwIBAgIORea7A4Mzw4VlSOb/RVEwDQYJKoZIhvcNAQEMBQAwTDEgMB4GA1UECxMX
  55611. R2xvYmFsU2lnbiBSb290IENBIC0gUjYxEzARBgNVBAoTCkdsb2JhbFNpZ24xEzARBgNVBAMTCkds
  55612. b2JhbFNpZ24wHhcNMTQxMjEwMDAwMDAwWhcNMzQxMjEwMDAwMDAwWjBMMSAwHgYDVQQLExdHbG9i
  55613. YWxTaWduIFJvb3QgQ0EgLSBSNjETMBEGA1UEChMKR2xvYmFsU2lnbjETMBEGA1UEAxMKR2xvYmFs
  55614. U2lnbjCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAJUH6HPKZvnsFMp7PPcNCPG0RQss
  55615. grRIxutbPK6DuEGSMxSkb3/pKszGsIhrxbaJ0cay/xTOURQh7ErdG1rG1ofuTToVBu1kZguSgMpE
  55616. 3nOUTvOniX9PeGMIyBJQbUJmL025eShNUhqKGoC3GYEOfsSKvGRMIRxDaNc9PIrFsmbVkJq3MQbF
  55617. vuJtMgamHvm566qjuL++gmNQ0PAYid/kD3n16qIfKtJwLnvnvJO7bVPiSHyMEAc4/2ayd2F+4OqM
  55618. PKq0pPbzlUoSB239jLKJz9CgYXfIWHSw1CM69106yqLbnQneXUQtkPGBzVeS+n68UARjNN9rkxi+
  55619. azayOeSsJDa38O+2HBNXk7besvjihbdzorg1qkXy4J02oW9UivFyVm4uiMVRQkQVlO6jxTiWm05O
  55620. WgtH8wY2SXcwvHE35absIQh1/OZhFj931dmRl4QKbNQCTXTAFO39OfuD8l4UoQSwC+n+7o/hbguy
  55621. CLNhZglqsQY6ZZZZwPA1/cnaKI0aEYdwgQqomnUdnjqGBQCe24DWJfncBZ4nWUx2OVvq+aWh2IMP
  55622. 0f/fMBH5hc8zSPXKbWQULHpYT9NLCEnFlWQaYw55PfWzjMpYrZxCRXluDocZXFSxZba/jJvcE+kN
  55623. b7gu3GduyYsRtYQUigAZcIN5kZeR1BonvzceMgfYFGM8KEyvAgMBAAGjYzBhMA4GA1UdDwEB/wQE
  55624. AwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSubAWjkxPioufi1xzWx/B/yGdToDAfBgNV
  55625. HSMEGDAWgBSubAWjkxPioufi1xzWx/B/yGdToDANBgkqhkiG9w0BAQwFAAOCAgEAgyXt6NH9lVLN
  55626. nsAEoJFp5lzQhN7craJP6Ed41mWYqVuoPId8AorRbrcWc+ZfwFSY1XS+wc3iEZGtIxg93eFyRJa0
  55627. lV7Ae46ZeBZDE1ZXs6KzO7V33EByrKPrmzU+sQghoefEQzd5Mr6155wsTLxDKZmOMNOsIeDjHfrY
  55628. BzN2VAAiKrlNIC5waNrlU/yDXNOd8v9EDERm8tLjvUYAGm0CuiVdjaExUd1URhxN25mW7xocBFym
  55629. Fe944Hn+Xds+qkxV/ZoVqW/hpvvfcDDpw+5CRu3CkwWJ+n1jez/QcYF8AOiYrg54NMMl+68KnyBr
  55630. 3TsTjxKM4kEaSHpzoHdpx7Zcf4LIHv5YGygrqGytXm3ABdJ7t+uA/iU3/gKbaKxCXcPu9czc8FB1
  55631. 0jZpnOZ7BN9uBmm23goJSFmH63sUYHpkqmlD75HHTOwY3WzvUy2MmeFe8nI+z1TIvWfspA9MRf/T
  55632. uTAjB0yPEL+GltmZWrSZVxykzLsViVO6LAUP5MSeGbEYNNVMnbrt9x+vJJUEeKgDu+6B5dpffItK
  55633. oZB0JaezPkvILFa9x8jvOOJckvB595yEunQtYQEgfn7R8k8HWV+LLUNS60YMlOH1Zkd5d9VUWx+t
  55634. JDfLRVpOoERIyNiwmcUVhAn21klJwGW45hpxbqCo8YLoRT5s1gLXCmeDBVrJpBA=
  55635. -----END CERTIFICATE-----
  55636. OISTE WISeKey Global Root GC CA
  55637. ===============================
  55638. -----BEGIN CERTIFICATE-----
  55639. MIICaTCCAe+gAwIBAgIQISpWDK7aDKtARb8roi066jAKBggqhkjOPQQDAzBtMQswCQYDVQQGEwJD
  55640. SDEQMA4GA1UEChMHV0lTZUtleTEiMCAGA1UECxMZT0lTVEUgRm91bmRhdGlvbiBFbmRvcnNlZDEo
  55641. MCYGA1UEAxMfT0lTVEUgV0lTZUtleSBHbG9iYWwgUm9vdCBHQyBDQTAeFw0xNzA1MDkwOTQ4MzRa
  55642. Fw00MjA1MDkwOTU4MzNaMG0xCzAJBgNVBAYTAkNIMRAwDgYDVQQKEwdXSVNlS2V5MSIwIAYDVQQL
  55643. ExlPSVNURSBGb3VuZGF0aW9uIEVuZG9yc2VkMSgwJgYDVQQDEx9PSVNURSBXSVNlS2V5IEdsb2Jh
  55644. bCBSb290IEdDIENBMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAETOlQwMYPchi82PG6s4nieUqjFqdr
  55645. VCTbUf/q9Akkwwsin8tqJ4KBDdLArzHkdIJuyiXZjHWd8dvQmqJLIX4Wp2OQ0jnUsYd4XxiWD1Ab
  55646. NTcPasbc2RNNpI6QN+a9WzGRo1QwUjAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAd
  55647. BgNVHQ4EFgQUSIcUrOPDnpBgOtfKie7TrYy0UGYwEAYJKwYBBAGCNxUBBAMCAQAwCgYIKoZIzj0E
  55648. AwMDaAAwZQIwJsdpW9zV57LnyAyMjMPdeYwbY9XJUpROTYJKcx6ygISpJcBMWm1JKWB4E+J+SOtk
  55649. AjEA2zQgMgj/mkkCtojeFK9dbJlxjRo/i9fgojaGHAeCOnZT/cKi7e97sIBPWA9LUzm9
  55650. -----END CERTIFICATE-----
  55651. GTS Root R1
  55652. ===========
  55653. -----BEGIN CERTIFICATE-----
  55654. MIIFWjCCA0KgAwIBAgIQbkepxUtHDA3sM9CJuRz04TANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55655. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55656. b3QgUjEwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55657. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjEwggIi
  55658. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQC2EQKLHuOhd5s73L+UPreVp0A8of2C+X0yBoJx
  55659. 9vaMf/vo27xqLpeXo4xL+Sv2sfnOhB2x+cWX3u+58qPpvBKJXqeqUqv4IyfLpLGcY9vXmX7wCl7r
  55660. aKb0xlpHDU0QM+NOsROjyBhsS+z8CZDfnWQpJSMHobTSPS5g4M/SCYe7zUjwTcLCeoiKu7rPWRnW
  55661. r4+wB7CeMfGCwcDfLqZtbBkOtdh+JhpFAz2weaSUKK0PfyblqAj+lug8aJRT7oM6iCsVlgmy4HqM
  55662. LnXWnOunVmSPlk9orj2XwoSPwLxAwAtcvfaHszVsrBhQf4TgTM2S0yDpM7xSma8ytSmzJSq0SPly
  55663. 4cpk9+aCEI3oncKKiPo4Zor8Y/kB+Xj9e1x3+naH+uzfsQ55lVe0vSbv1gHR6xYKu44LtcXFilWr
  55664. 06zqkUspzBmkMiVOKvFlRNACzqrOSbTqn3yDsEB750Orp2yjj32JgfpMpf/VjsPOS+C12LOORc92
  55665. wO1AK/1TD7Cn1TsNsYqiA94xrcx36m97PtbfkSIS5r762DL8EGMUUXLeXdYWk70paDPvOmbsB4om
  55666. 3xPXV2V4J95eSRQAogB/mqghtqmxlbCluQ0WEdrHbEg8QOB+DVrNVjzRlwW5y0vtOUucxD/SVRNu
  55667. JLDWcfr0wbrM7Rv1/oFB2ACYPTrIrnqYNxgFlQIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55668. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQU5K8rJnEaK0gnhS9SZizv8IkTcT4wDQYJKoZIhvcNAQEM
  55669. BQADggIBADiWCu49tJYeX++dnAsznyvgyv3SjgofQXSlfKqE1OXyHuY3UjKcC9FhHb8owbZEKTV1
  55670. d5iyfNm9dKyKaOOpMQkpAWBz40d8U6iQSifvS9efk+eCNs6aaAyC58/UEBZvXw6ZXPYfcX3v73sv
  55671. fuo21pdwCxXu11xWajOl40k4DLh9+42FpLFZXvRq4d2h9mREruZRgyFmxhE+885H7pwoHyXa/6xm
  55672. ld01D1zvICxi/ZG6qcz8WpyTgYMpl0p8WnK0OdC3d8t5/Wk6kjftbjhlRn7pYL15iJdfOBL07q9b
  55673. gsiG1eGZbYwE8na6SfZu6W0eX6DvJ4J2QPim01hcDyxC2kLGe4g0x8HYRZvBPsVhHdljUEn2NIVq
  55674. 4BjFbkerQUIpm/ZgDdIx02OYI5NaAIFItO/Nis3Jz5nu2Z6qNuFoS3FJFDYoOj0dzpqPJeaAcWEr
  55675. tXvM+SUWgeExX6GjfhaknBZqlxi9dnKlC54dNuYvoS++cJEPqOba+MSSQGwlfnuzCdyyF62ARPBo
  55676. pY+Udf90WuioAnwMCeKpSwughQtiue+hMZL77/ZRBIls6Kl0obsXs7X9SQ98POyDGCBDTtWTurQ0
  55677. sR8WNh8M5mQ5Fkzc4P4dyKliPUDqysU0ArSuiYgzNdwsE3PYJ/HQcu51OyLemGhmW/HGY0dVHLql
  55678. CFF1pkgl
  55679. -----END CERTIFICATE-----
  55680. GTS Root R2
  55681. ===========
  55682. -----BEGIN CERTIFICATE-----
  55683. MIIFWjCCA0KgAwIBAgIQbkepxlqz5yDFMJo/aFLybzANBgkqhkiG9w0BAQwFADBHMQswCQYDVQQG
  55684. EwJVUzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJv
  55685. b3QgUjIwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAG
  55686. A1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjIwggIi
  55687. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQDO3v2m++zsFDQ8BwZabFn3GTXd98GdVarTzTuk
  55688. k3LvCvptnfbwhYBboUhSnznFt+4orO/LdmgUud+tAWyZH8QiHZ/+cnfgLFuv5AS/T3KgGjSY6Dlo
  55689. 7JUle3ah5mm5hRm9iYz+re026nO8/4Piy33B0s5Ks40FnotJk9/BW9BuXvAuMC6C/Pq8tBcKSOWI
  55690. m8Wba96wyrQD8Nr0kLhlZPdcTK3ofmZemde4wj7I0BOdre7kRXuJVfeKH2JShBKzwkCX44ofR5Gm
  55691. dFrS+LFjKBC4swm4VndAoiaYecb+3yXuPuWgf9RhD1FLPD+M2uFwdNjCaKH5wQzpoeJ/u1U8dgbu
  55692. ak7MkogwTZq9TwtImoS1mKPV+3PBV2HdKFZ1E66HjucMUQkQdYhMvI35ezzUIkgfKtzra7tEscsz
  55693. cTJGr61K8YzodDqs5xoic4DSMPclQsciOzsSrZYuxsN2B6ogtzVJV+mSSeh2FnIxZyuWfoqjx5RW
  55694. Ir9qS34BIbIjMt/kmkRtWVtd9QCgHJvGeJeNkP+byKq0rxFROV7Z+2et1VsRnTKaG73Vululycsl
  55695. aVNVJ1zgyjbLiGH7HrfQy+4W+9OmTN6SpdTi3/UGVN4unUu0kzCqgc7dGtxRcw1PcOnlthYhGXmy
  55696. 5okLdWTK1au8CcEYof/UVKGFPP0UJAOyh9OktwIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYD
  55697. VR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUu//KjiOfT5nK2+JopqUVJxce2Q4wDQYJKoZIhvcNAQEM
  55698. BQADggIBALZp8KZ3/p7uC4Gt4cCpx/k1HUCCq+YEtN/L9x0Pg/B+E02NjO7jMyLDOfxA325BS0JT
  55699. vhaI8dI4XsRomRyYUpOM52jtG2pzegVATX9lO9ZY8c6DR2Dj/5epnGB3GFW1fgiTz9D2PGcDFWEJ
  55700. +YF59exTpJ/JjwGLc8R3dtyDovUMSRqodt6Sm2T4syzFJ9MHwAiApJiS4wGWAqoC7o87xdFtCjMw
  55701. c3i5T1QWvwsHoaRc5svJXISPD+AVdyx+Jn7axEvbpxZ3B7DNdehyQtaVhJ2Gg/LkkM0JR9SLA3Da
  55702. WsYDQvTtN6LwG1BUSw7YhN4ZKJmBR64JGz9I0cNv4rBgF/XuIwKl2gBbbZCr7qLpGzvpx0QnRY5r
  55703. n/WkhLx3+WuXrD5RRaIRpsyF7gpo8j5QOHokYh4XIDdtak23CZvJ/KRY9bb7nE4Yu5UC56Gtmwfu
  55704. Nmsk0jmGwZODUNKBRqhfYlcsu2xkiAhu7xNUX90txGdj08+JN7+dIPT7eoOboB6BAFDC5AwiWVIQ
  55705. 7UNWhwD4FFKnHYuTjKJNRn8nxnGbJN7k2oaLDX5rIMHAnuFl2GqjpuiFizoHCBy69Y9Vmhh1fuXs
  55706. gWbRIXOhNUQLgD1bnF5vKheW0YMjiGZt5obicDIvUiLnyOd/xCxgXS/Dr55FBcOEArf9LAhST4Ld
  55707. o/DUhgkC
  55708. -----END CERTIFICATE-----
  55709. GTS Root R3
  55710. ===========
  55711. -----BEGIN CERTIFICATE-----
  55712. MIICDDCCAZGgAwIBAgIQbkepx2ypcyRAiQ8DVd2NHTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55713. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55714. UjMwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55715. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjMwdjAQBgcq
  55716. hkjOPQIBBgUrgQQAIgNiAAQfTzOHMymKoYTey8chWEGJ6ladK0uFxh1MJ7x/JlFyb+Kf1qPKzEUU
  55717. Rout736GjOyxfi//qXGdGIRFBEFVbivqJn+7kAHjSxm65FSWRQmx1WyRRK2EE46ajA2ADDL24Cej
  55718. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTB8Sa6oC2uhYHP
  55719. 0/EqEr24Cmf9vDAKBggqhkjOPQQDAwNpADBmAjEAgFukfCPAlaUs3L6JbyO5o91lAFJekazInXJ0
  55720. glMLfalAvWhgxeG4VDvBNhcl2MG9AjEAnjWSdIUlUfUk7GRSJFClH9voy8l27OyCbvWFGFPouOOa
  55721. KaqW04MjyaR7YbPMAuhd
  55722. -----END CERTIFICATE-----
  55723. GTS Root R4
  55724. ===========
  55725. -----BEGIN CERTIFICATE-----
  55726. MIICCjCCAZGgAwIBAgIQbkepyIuUtui7OyrYorLBmTAKBggqhkjOPQQDAzBHMQswCQYDVQQGEwJV
  55727. UzEiMCAGA1UEChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3Qg
  55728. UjQwHhcNMTYwNjIyMDAwMDAwWhcNMzYwNjIyMDAwMDAwWjBHMQswCQYDVQQGEwJVUzEiMCAGA1UE
  55729. ChMZR29vZ2xlIFRydXN0IFNlcnZpY2VzIExMQzEUMBIGA1UEAxMLR1RTIFJvb3QgUjQwdjAQBgcq
  55730. hkjOPQIBBgUrgQQAIgNiAATzdHOnaItgrkO4NcWBMHtLSZ37wWHO5t5GvWvVYRg1rkDdc/eJkTBa
  55731. 6zzuhXyiQHY7qca4R9gq55KRanPpsXI5nymfopjTX15YhmUPoYRlBtHci8nHc8iMai/lxKvRHYqj
  55732. QjBAMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBSATNbrdP9JNqPV
  55733. 2Py1PsVq8JQdjDAKBggqhkjOPQQDAwNnADBkAjBqUFJ0CMRw3J5QdCHojXohw0+WbhXRIjVhLfoI
  55734. N+4Zba3bssx9BzT1YBkstTTZbyACMANxsbqjYAuG7ZoIapVon+Kz4ZNkfF6Tpt95LY2F45TPI11x
  55735. zPKwTdb+mciUqXWi4w==
  55736. -----END CERTIFICATE-----
  55737. UCA Global G2 Root
  55738. ==================
  55739. -----BEGIN CERTIFICATE-----
  55740. MIIFRjCCAy6gAwIBAgIQXd+x2lqj7V2+WmUgZQOQ7zANBgkqhkiG9w0BAQsFADA9MQswCQYDVQQG
  55741. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxGzAZBgNVBAMMElVDQSBHbG9iYWwgRzIgUm9vdDAeFw0x
  55742. NjAzMTEwMDAwMDBaFw00MDEyMzEwMDAwMDBaMD0xCzAJBgNVBAYTAkNOMREwDwYDVQQKDAhVbmlU
  55743. cnVzdDEbMBkGA1UEAwwSVUNBIEdsb2JhbCBHMiBSb290MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A
  55744. MIICCgKCAgEAxeYrb3zvJgUno4Ek2m/LAfmZmqkywiKHYUGRO8vDaBsGxUypK8FnFyIdK+35KYmT
  55745. oni9kmugow2ifsqTs6bRjDXVdfkX9s9FxeV67HeToI8jrg4aA3++1NDtLnurRiNb/yzmVHqUwCoV
  55746. 8MmNsHo7JOHXaOIxPAYzRrZUEaalLyJUKlgNAQLx+hVRZ2zA+te2G3/RVogvGjqNO7uCEeBHANBS
  55747. h6v7hn4PJGtAnTRnvI3HLYZveT6OqTwXS3+wmeOwcWDcC/Vkw85DvG1xudLeJ1uK6NjGruFZfc8o
  55748. LTW4lVYa8bJYS7cSN8h8s+1LgOGN+jIjtm+3SJUIsUROhYw6AlQgL9+/V087OpAh18EmNVQg7Mc/
  55749. R+zvWr9LesGtOxdQXGLYD0tK3Cv6brxzks3sx1DoQZbXqX5t2Okdj4q1uViSukqSKwxW/YDrCPBe
  55750. KW4bHAyvj5OJrdu9o54hyokZ7N+1wxrrFv54NkzWbtA+FxyQF2smuvt6L78RHBgOLXMDj6DlNaBa
  55751. 4kx1HXHhOThTeEDMg5PXCp6dW4+K5OXgSORIskfNTip1KnvyIvbJvgmRlld6iIis7nCs+dwp4wwc
  55752. OxJORNanTrAmyPPZGpeRaOrvjUYG0lZFWJo8DA+DuAUlwznPO6Q0ibd5Ei9Hxeepl2n8pndntd97
  55753. 8XplFeRhVmUCAwEAAaNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O
  55754. BBYEFIHEjMz15DD/pQwIX4wVZyF0Ad/fMA0GCSqGSIb3DQEBCwUAA4ICAQATZSL1jiutROTL/7lo
  55755. 5sOASD0Ee/ojL3rtNtqyzm325p7lX1iPyzcyochltq44PTUbPrw7tgTQvPlJ9Zv3hcU2tsu8+Mg5
  55756. 1eRfB70VVJd0ysrtT7q6ZHafgbiERUlMjW+i67HM0cOU2kTC5uLqGOiiHycFutfl1qnN3e92mI0A
  55757. Ds0b+gO3joBYDic/UvuUospeZcnWhNq5NXHzJsBPd+aBJ9J3O5oUb3n09tDh05S60FdRvScFDcH9
  55758. yBIw7m+NESsIndTUv4BFFJqIRNow6rSn4+7vW4LVPtateJLbXDzz2K36uGt/xDYotgIVilQsnLAX
  55759. c47QN6MUPJiVAAwpBVueSUmxX8fjy88nZY41F7dXyDDZQVu5FLbowg+UMaeUmMxq67XhJ/UQqAHo
  55760. jhJi6IjMtX9Gl8CbEGY4GjZGXyJoPd/JxhMnq1MGrKI8hgZlb7F+sSlEmqO6SWkoaY/X5V+tBIZk
  55761. bxqgDMUIYs6Ao9Dz7GjevjPHF1t/gMRMTLGmhIrDO7gJzRSBuhjjVFc2/tsvfEehOjPI+Vg7RE+x
  55762. ygKJBJYoaMVLuCaJu9YzL1DV/pqJuhgyklTGW+Cd+V7lDSKb9triyCGyYiGqhkCyLmTTX8jjfhFn
  55763. RR8F/uOi77Oos/N9j/gMHyIfLXC0uAE0djAA5SN4p1bXUB+K+wb1whnw0A==
  55764. -----END CERTIFICATE-----
  55765. UCA Extended Validation Root
  55766. ============================
  55767. -----BEGIN CERTIFICATE-----
  55768. MIIFWjCCA0KgAwIBAgIQT9Irj/VkyDOeTzRYZiNwYDANBgkqhkiG9w0BAQsFADBHMQswCQYDVQQG
  55769. EwJDTjERMA8GA1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9u
  55770. IFJvb3QwHhcNMTUwMzEzMDAwMDAwWhcNMzgxMjMxMDAwMDAwWjBHMQswCQYDVQQGEwJDTjERMA8G
  55771. A1UECgwIVW5pVHJ1c3QxJTAjBgNVBAMMHFVDQSBFeHRlbmRlZCBWYWxpZGF0aW9uIFJvb3QwggIi
  55772. MA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCpCQcoEwKwmeBkqh5DFnpzsZGgdT6o+uM4AHrs
  55773. iWogD4vFsJszA1qGxliG1cGFu0/GnEBNyr7uaZa4rYEwmnySBesFK5pI0Lh2PpbIILvSsPGP2KxF
  55774. Rv+qZ2C0d35qHzwaUnoEPQc8hQ2E0B92CvdqFN9y4zR8V05WAT558aopO2z6+I9tTcg1367r3CTu
  55775. eUWnhbYFiN6IXSV8l2RnCdm/WhUFhvMJHuxYMjMR83dksHYf5BA1FxvyDrFspCqjc/wJHx4yGVMR
  55776. 59mzLC52LqGj3n5qiAno8geK+LLNEOfic0CTuwjRP+H8C5SzJe98ptfRr5//lpr1kXuYC3fUfugH
  55777. 0mK1lTnj8/FtDw5lhIpjVMWAtuCeS31HJqcBCF3RiJ7XwzJE+oJKCmhUfzhTA8ykADNkUVkLo4KR
  55778. el7sFsLzKuZi2irbWWIQJUoqgQtHB0MGcIfS+pMRKXpITeuUx3BNr2fVUbGAIAEBtHoIppB/TuDv
  55779. B0GHr2qlXov7z1CymlSvw4m6WC31MJixNnI5fkkE/SmnTHnkBVfblLkWU41Gsx2VYVdWf6/wFlth
  55780. WG82UBEL2KwrlRYaDh8IzTY0ZRBiZtWAXxQgXy0MoHgKaNYs1+lvK9JKBZP8nm9rZ/+I8U6laUpS
  55781. NwXqxhaN0sSZ0YIrO7o1dfdRUVjzyAfd5LQDfwIDAQABo0IwQDAdBgNVHQ4EFgQU2XQ65DA9DfcS
  55782. 3H5aBZ8eNJr34RQwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAYYwDQYJKoZIhvcNAQEL
  55783. BQADggIBADaNl8xCFWQpN5smLNb7rhVpLGsaGvdftvkHTFnq88nIua7Mui563MD1sC3AO6+fcAUR
  55784. ap8lTwEpcOPlDOHqWnzcSbvBHiqB9RZLcpHIojG5qtr8nR/zXUACE/xOHAbKsxSQVBcZEhrxH9cM
  55785. aVr2cXj0lH2RC47skFSOvG+hTKv8dGT9cZr4QQehzZHkPJrgmzI5c6sq1WnIeJEmMX3ixzDx/BR4
  55786. dxIOE/TdFpS/S2d7cFOFyrC78zhNLJA5wA3CXWvp4uXViI3WLL+rG761KIcSF3Ru/H38j9CHJrAb
  55787. +7lsq+KePRXBOy5nAliRn+/4Qh8st2j1da3Ptfb/EX3C8CSlrdP6oDyp+l3cpaDvRKS+1ujl5BOW
  55788. F3sGPjLtx7dCvHaj2GU4Kzg1USEODm8uNBNA4StnDG1KQTAYI1oyVZnJF+A83vbsea0rWBmirSwi
  55789. GpWOvpaQXUJXxPkUAzUrHC1RVwinOt4/5Mi0A3PCwSaAuwtCH60NryZy2sy+s6ODWA2CxR9GUeOc
  55790. GMyNm43sSet1UNWMKFnKdDTajAshqx7qG+XH/RU+wBeq+yNuJkbL+vmxcmtpzyKEC2IPrNkZAJSi
  55791. djzULZrtBJ4tBmIQN1IchXIbJ+XMxjHsN+xjWZsLHXbMfjKaiJUINlK73nZfdklJrX+9ZSCyycEr
  55792. dhh2n1ax
  55793. -----END CERTIFICATE-----
  55794. Certigna Root CA
  55795. ================
  55796. -----BEGIN CERTIFICATE-----
  55797. MIIGWzCCBEOgAwIBAgIRAMrpG4nxVQMNo+ZBbcTjpuEwDQYJKoZIhvcNAQELBQAwWjELMAkGA1UE
  55798. BhMCRlIxEjAQBgNVBAoMCURoaW15b3RpczEcMBoGA1UECwwTMDAwMiA0ODE0NjMwODEwMDAzNjEZ
  55799. MBcGA1UEAwwQQ2VydGlnbmEgUm9vdCBDQTAeFw0xMzEwMDEwODMyMjdaFw0zMzEwMDEwODMyMjda
  55800. MFoxCzAJBgNVBAYTAkZSMRIwEAYDVQQKDAlEaGlteW90aXMxHDAaBgNVBAsMEzAwMDIgNDgxNDYz
  55801. MDgxMDAwMzYxGTAXBgNVBAMMEENlcnRpZ25hIFJvb3QgQ0EwggIiMA0GCSqGSIb3DQEBAQUAA4IC
  55802. DwAwggIKAoICAQDNGDllGlmx6mQWDoyUJJV8g9PFOSbcDO8WV43X2KyjQn+Cyu3NW9sOty3tRQgX
  55803. stmzy9YXUnIo245Onoq2C/mehJpNdt4iKVzSs9IGPjA5qXSjklYcoW9MCiBtnyN6tMbaLOQdLNyz
  55804. KNAT8kxOAkmhVECe5uUFoC2EyP+YbNDrihqECB63aCPuI9Vwzm1RaRDuoXrC0SIxwoKF0vJVdlB8
  55805. JXrJhFwLrN1CTivngqIkicuQstDuI7pmTLtipPlTWmR7fJj6o0ieD5Wupxj0auwuA0Wv8HT4Ks16
  55806. XdG+RCYyKfHx9WzMfgIhC59vpD++nVPiz32pLHxYGpfhPTc3GGYo0kDFUYqMwy3OU4gkWGQwFsWq
  55807. 4NYKpkDfePb1BHxpE4S80dGnBs8B92jAqFe7OmGtBIyT46388NtEbVncSVmurJqZNjBBe3YzIoej
  55808. wpKGbvlw7q6Hh5UbxHq9MfPU0uWZ/75I7HX1eBYdpnDBfzwboZL7z8g81sWTCo/1VTp2lc5ZmIoJ
  55809. lXcymoO6LAQ6l73UL77XbJuiyn1tJslV1c/DeVIICZkHJC1kJWumIWmbat10TWuXekG9qxf5kBdI
  55810. jzb5LdXF2+6qhUVB+s06RbFo5jZMm5BX7CO5hwjCxAnxl4YqKE3idMDaxIzb3+KhF1nOJFl0Mdp/
  55811. /TBt2dzhauH8XwIDAQABo4IBGjCCARYwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw
  55812. HQYDVR0OBBYEFBiHVuBud+4kNTxOc5of1uHieX4rMB8GA1UdIwQYMBaAFBiHVuBud+4kNTxOc5of
  55813. 1uHieX4rMEQGA1UdIAQ9MDswOQYEVR0gADAxMC8GCCsGAQUFBwIBFiNodHRwczovL3d3d3cuY2Vy
  55814. dGlnbmEuZnIvYXV0b3JpdGVzLzBtBgNVHR8EZjBkMC+gLaArhilodHRwOi8vY3JsLmNlcnRpZ25h
  55815. LmZyL2NlcnRpZ25hcm9vdGNhLmNybDAxoC+gLYYraHR0cDovL2NybC5kaGlteW90aXMuY29tL2Nl
  55816. cnRpZ25hcm9vdGNhLmNybDANBgkqhkiG9w0BAQsFAAOCAgEAlLieT/DjlQgi581oQfccVdV8AOIt
  55817. OoldaDgvUSILSo3L6btdPrtcPbEo/uRTVRPPoZAbAh1fZkYJMyjhDSSXcNMQH+pkV5a7XdrnxIxP
  55818. TGRGHVyH41neQtGbqH6mid2PHMkwgu07nM3A6RngatgCdTer9zQoKJHyBApPNeNgJgH60BGM+RFq
  55819. 7q89w1DTj18zeTyGqHNFkIwgtnJzFyO+B2XleJINugHA64wcZr+shncBlA2c5uk5jR+mUYyZDDl3
  55820. 4bSb+hxnV29qao6pK0xXeXpXIs/NX2NGjVxZOob4Mkdio2cNGJHc+6Zr9UhhcyNZjgKnvETq9Emd
  55821. 8VRY+WCv2hikLyhF3HqgiIZd8zvn/yk1gPxkQ5Tm4xxvvq0OKmOZK8l+hfZx6AYDlf7ej0gcWtSS
  55822. 6Cvu5zHbugRqh5jnxV/vfaci9wHYTfmJ0A6aBVmknpjZbyvKcL5kwlWj9Omvw5Ip3IgWJJk8jSaY
  55823. tlu3zM63Nwf9JtmYhST/WSMDmu2dnajkXjjO11INb9I/bbEFa0nOipFGc/T2L/Coc3cOZayhjWZS
  55824. aX5LaAzHHjcng6WMxwLkFM1JAbBzs/3GkDpv0mztO+7skb6iQ12LAEpmJURw3kAP+HwV96LOPNde
  55825. E4yBFxgX0b3xdxA61GU5wSesVywlVP+i2k+KYTlerj1KjL0=
  55826. -----END CERTIFICATE-----
  55827. emSign Root CA - G1
  55828. ===================
  55829. -----BEGIN CERTIFICATE-----
  55830. MIIDlDCCAnygAwIBAgIKMfXkYgxsWO3W2DANBgkqhkiG9w0BAQsFADBnMQswCQYDVQQGEwJJTjET
  55831. MBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRl
  55832. ZDEcMBoGA1UEAxMTZW1TaWduIFJvb3QgQ0EgLSBHMTAeFw0xODAyMTgxODMwMDBaFw00MzAyMTgx
  55833. ODMwMDBaMGcxCzAJBgNVBAYTAklOMRMwEQYDVQQLEwplbVNpZ24gUEtJMSUwIwYDVQQKExxlTXVk
  55834. aHJhIFRlY2hub2xvZ2llcyBMaW1pdGVkMRwwGgYDVQQDExNlbVNpZ24gUm9vdCBDQSAtIEcxMIIB
  55835. IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAk0u76WaK7p1b1TST0Bsew+eeuGQzf2N4aLTN
  55836. LnF115sgxk0pvLZoYIr3IZpWNVrzdr3YzZr/k1ZLpVkGoZM0Kd0WNHVO8oG0x5ZOrRkVUkr+PHB1
  55837. cM2vK6sVmjM8qrOLqs1D/fXqcP/tzxE7lM5OMhbTI0Aqd7OvPAEsbO2ZLIvZTmmYsvePQbAyeGHW
  55838. DV/D+qJAkh1cF+ZwPjXnorfCYuKrpDhMtTk1b+oDafo6VGiFbdbyL0NVHpENDtjVaqSW0RM8LHhQ
  55839. 6DqS0hdW5TUaQBw+jSztOd9C4INBdN+jzcKGYEho42kLVACL5HZpIQ15TjQIXhTCzLG3rdd8cIrH
  55840. hQIDAQABo0IwQDAdBgNVHQ4EFgQU++8Nhp6w492pufEhF38+/PB3KxowDgYDVR0PAQH/BAQDAgEG
  55841. MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAFn/8oz1h31xPaOfG1vR2vjTnGs2
  55842. vZupYeveFix0PZ7mddrXuqe8QhfnPZHr5X3dPpzxz5KsbEjMwiI/aTvFthUvozXGaCocV685743Q
  55843. NcMYDHsAVhzNixl03r4PEuDQqqE/AjSxcM6dGNYIAwlG7mDgfrbESQRRfXBgvKqy/3lyeqYdPV8q
  55844. +Mri/Tm3R7nrft8EI6/6nAYH6ftjk4BAtcZsCjEozgyfz7MjNYBBjWzEN3uBL4ChQEKF6dk4jeih
  55845. U80Bv2noWgbyRQuQ+q7hv53yrlc8pa6yVvSLZUDp/TGBLPQ5Cdjua6e0ph0VpZj3AYHYhX3zUVxx
  55846. iN66zB+Afko=
  55847. -----END CERTIFICATE-----
  55848. emSign ECC Root CA - G3
  55849. =======================
  55850. -----BEGIN CERTIFICATE-----
  55851. MIICTjCCAdOgAwIBAgIKPPYHqWhwDtqLhDAKBggqhkjOPQQDAzBrMQswCQYDVQQGEwJJTjETMBEG
  55852. A1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEg
  55853. MB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0gRzMwHhcNMTgwMjE4MTgzMDAwWhcNNDMwMjE4
  55854. MTgzMDAwWjBrMQswCQYDVQQGEwJJTjETMBEGA1UECxMKZW1TaWduIFBLSTElMCMGA1UEChMcZU11
  55855. ZGhyYSBUZWNobm9sb2dpZXMgTGltaXRlZDEgMB4GA1UEAxMXZW1TaWduIEVDQyBSb290IENBIC0g
  55856. RzMwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQjpQy4LRL1KPOxst3iAhKAnjlfSU2fySU0WXTsuwYc
  55857. 58Byr+iuL+FBVIcUqEqy6HyC5ltqtdyzdc6LBtCGI79G1Y4PPwT01xySfvalY8L1X44uT6EYGQIr
  55858. MgqCZH0Wk9GjQjBAMB0GA1UdDgQWBBR8XQKEE9TMipuBzhccLikenEhjQjAOBgNVHQ8BAf8EBAMC
  55859. AQYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNpADBmAjEAvvNhzwIQHWSVB7gYboiFBS+D
  55860. CBeQyh+KTOgNG3qxrdWBCUfvO6wIBHxcmbHtRwfSAjEAnbpV/KlK6O3t5nYBQnvI+GDZjVGLVTv7
  55861. jHvrZQnD+JbNR6iC8hZVdyR+EhCVBCyj
  55862. -----END CERTIFICATE-----
  55863. emSign Root CA - C1
  55864. ===================
  55865. -----BEGIN CERTIFICATE-----
  55866. MIIDczCCAlugAwIBAgILAK7PALrEzzL4Q7IwDQYJKoZIhvcNAQELBQAwVjELMAkGA1UEBhMCVVMx
  55867. EzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQDExNlbVNp
  55868. Z24gUm9vdCBDQSAtIEMxMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowVjELMAkGA1UE
  55869. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMRwwGgYDVQQD
  55870. ExNlbVNpZ24gUm9vdCBDQSAtIEMxMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+up
  55871. ufGZBczYKCFK83M0UYRWEPWgTywS4/oTmifQz/l5GnRfHXk5/Fv4cI7gklL35CX5VIPZHdPIWoU/
  55872. Xse2B+4+wM6ar6xWQio5JXDWv7V7Nq2s9nPczdcdioOl+yuQFTdrHCZH3DspVpNqs8FqOp099cGX
  55873. OFgFixwR4+S0uF2FHYP+eF8LRWgYSKVGczQ7/g/IdrvHGPMF0Ybzhe3nudkyrVWIzqa2kbBPrH4V
  55874. I5b2P/AgNBbeCsbEBEV5f6f9vtKppa+cxSMq9zwhbL2vj07FOrLzNBL834AaSaTUqZX3noleooms
  55875. lMuoaJuvimUnzYnu3Yy1aylwQ6BpC+S5DwIDAQABo0IwQDAdBgNVHQ4EFgQU/qHgcB4qAzlSWkK+
  55876. XJGFehiqTbUwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQELBQAD
  55877. ggEBAMJKVvoVIXsoounlHfv4LcQ5lkFMOycsxGwYFYDGrK9HWS8mC+M2sO87/kOXSTKZEhVb3xEp
  55878. /6tT+LvBeA+snFOvV71ojD1pM/CjoCNjO2RnIkSt1XHLVip4kqNPEjE2NuLe/gDEo2APJ62gsIq1
  55879. NnpSob0n9CAnYuhNlCQT5AoE6TyrLshDCUrGYQTlSTR+08TI9Q/Aqum6VF7zYytPT1DU/rl7mYw9
  55880. wC68AivTxEDkigcxHpvOJpkT+xHqmiIMERnHXhuBUDDIlhJu58tBf5E7oke3VIAb3ADMmpDqw8NQ
  55881. BmIMMMAVSKeoWXzhriKi4gp6D/piq1JM4fHfyr6DDUI=
  55882. -----END CERTIFICATE-----
  55883. emSign ECC Root CA - C3
  55884. =======================
  55885. -----BEGIN CERTIFICATE-----
  55886. MIICKzCCAbGgAwIBAgIKe3G2gla4EnycqDAKBggqhkjOPQQDAzBaMQswCQYDVQQGEwJVUzETMBEG
  55887. A1UECxMKZW1TaWduIFBLSTEUMBIGA1UEChMLZU11ZGhyYSBJbmMxIDAeBgNVBAMTF2VtU2lnbiBF
  55888. Q0MgUm9vdCBDQSAtIEMzMB4XDTE4MDIxODE4MzAwMFoXDTQzMDIxODE4MzAwMFowWjELMAkGA1UE
  55889. BhMCVVMxEzARBgNVBAsTCmVtU2lnbiBQS0kxFDASBgNVBAoTC2VNdWRocmEgSW5jMSAwHgYDVQQD
  55890. ExdlbVNpZ24gRUNDIFJvb3QgQ0EgLSBDMzB2MBAGByqGSM49AgEGBSuBBAAiA2IABP2lYa57JhAd
  55891. 6bciMK4G9IGzsUJxlTm801Ljr6/58pc1kjZGDoeVjbk5Wum739D+yAdBPLtVb4OjavtisIGJAnB9
  55892. SMVK4+kiVCJNk7tCDK93nCOmfddhEc5lx/h//vXyqaNCMEAwHQYDVR0OBBYEFPtaSNCAIEDyqOkA
  55893. B2kZd6fmw/TPMA4GA1UdDwEB/wQEAwIBBjAPBgNVHRMBAf8EBTADAQH/MAoGCCqGSM49BAMDA2gA
  55894. MGUCMQC02C8Cif22TGK6Q04ThHK1rt0c3ta13FaPWEBaLd4gTCKDypOofu4SQMfWh0/434UCMBwU
  55895. ZOR8loMRnLDRWmFLpg9J0wD8ofzkpf9/rdcw0Md3f76BB1UwUCAU9Vc4CqgxUQ==
  55896. -----END CERTIFICATE-----
  55897. Hongkong Post Root CA 3
  55898. =======================
  55899. -----BEGIN CERTIFICATE-----
  55900. MIIFzzCCA7egAwIBAgIUCBZfikyl7ADJk0DfxMauI7gcWqQwDQYJKoZIhvcNAQELBQAwbzELMAkG
  55901. A1UEBhMCSEsxEjAQBgNVBAgTCUhvbmcgS29uZzESMBAGA1UEBxMJSG9uZyBLb25nMRYwFAYDVQQK
  55902. Ew1Ib25na29uZyBQb3N0MSAwHgYDVQQDExdIb25na29uZyBQb3N0IFJvb3QgQ0EgMzAeFw0xNzA2
  55903. MDMwMjI5NDZaFw00MjA2MDMwMjI5NDZaMG8xCzAJBgNVBAYTAkhLMRIwEAYDVQQIEwlIb25nIEtv
  55904. bmcxEjAQBgNVBAcTCUhvbmcgS29uZzEWMBQGA1UEChMNSG9uZ2tvbmcgUG9zdDEgMB4GA1UEAxMX
  55905. SG9uZ2tvbmcgUG9zdCBSb290IENBIDMwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCz
  55906. iNfqzg8gTr7m1gNt7ln8wlffKWihgw4+aMdoWJwcYEuJQwy51BWy7sFOdem1p+/l6TWZ5Mwc50tf
  55907. jTMwIDNT2aa71T4Tjukfh0mtUC1Qyhi+AViiE3CWu4mIVoBc+L0sPOFMV4i707mV78vH9toxdCim
  55908. 5lSJ9UExyuUmGs2C4HDaOym71QP1mbpV9WTRYA6ziUm4ii8F0oRFKHyPaFASePwLtVPLwpgchKOe
  55909. sL4jpNrcyCse2m5FHomY2vkALgbpDDtw1VAliJnLzXNg99X/NWfFobxeq81KuEXryGgeDQ0URhLj
  55910. 0mRiikKYvLTGCAj4/ahMZJx2Ab0vqWwzD9g/KLg8aQFChn5pwckGyuV6RmXpwtZQQS4/t+TtbNe/
  55911. JgERohYpSms0BpDsE9K2+2p20jzt8NYt3eEV7KObLyzJPivkaTv/ciWxNoZbx39ri1UbSsUgYT2u
  55912. y1DhCDq+sI9jQVMwCFk8mB13umOResoQUGC/8Ne8lYePl8X+l2oBlKN8W4UdKjk60FSh0Tlxnf0h
  55913. +bV78OLgAo9uliQlLKAeLKjEiafv7ZkGL7YKTE/bosw3Gq9HhS2KX8Q0NEwA/RiTZxPRN+ZItIsG
  55914. xVd7GYYKecsAyVKvQv83j+GjHno9UKtjBucVtT+2RTeUN7F+8kjDf8V1/peNRY8apxpyKBpADwID
  55915. AQABo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAfBgNVHSMEGDAWgBQXnc0e
  55916. i9Y5K3DTXNSguB+wAPzFYTAdBgNVHQ4EFgQUF53NHovWOStw01zUoLgfsAD8xWEwDQYJKoZIhvcN
  55917. AQELBQADggIBAFbVe27mIgHSQpsY1Q7XZiNc4/6gx5LS6ZStS6LG7BJ8dNVI0lkUmcDrudHr9Egw
  55918. W62nV3OZqdPlt9EuWSRY3GguLmLYauRwCy0gUCCkMpXRAJi70/33MvJJrsZ64Ee+bs7Lo3I6LWld
  55919. y8joRTnU+kLBEUx3XZL7av9YROXrgZ6voJmtvqkBZss4HTzfQx/0TW60uhdG/H39h4F5ag0zD/ov
  55920. +BS5gLNdTaqX4fnkGMX41TiMJjz98iji7lpJiCzfeT2OnpA8vUFKOt1b9pq0zj8lMH8yfaIDlNDc
  55921. eqFS3m6TjRgm/VWsvY+b0s+v54Ysyx8Jb6NvqYTUc79NoXQbTiNg8swOqn+knEwlqLJmOzj/2ZQw
  55922. 9nKEvmhVEA/GcywWaZMH/rFF7buiVWqw2rVKAiUnhde3t4ZEFolsgCs+l6mc1X5VTMbeRRAc6uk7
  55923. nwNT7u56AQIWeNTowr5GdogTPyK7SBIdUgC0An4hGh6cJfTzPV4e0hz5sy229zdcxsshTrD3mUcY
  55924. hcErulWuBurQB7Lcq9CClnXO0lD+mefPL5/ndtFhKvshuzHQqp9HpLIiyhY6UFfEW0NnxWViA0kB
  55925. 60PZ2Pierc+xYw5F9KBaLJstxabArahH9CdMOA0uG0k7UvToiIMrVCjU8jVStDKDYmlkDJGcn5fq
  55926. dBb9HxEGmpv0
  55927. -----END CERTIFICATE-----
  55928. <?php
  55929. if (PHP_SAPI !== 'cli' && PHP_SAPI !== 'phpdbg') {
  55930. echo 'Warning: Composer should be invoked via the CLI version of PHP, not the '.PHP_SAPI.' SAPI'.PHP_EOL;
  55931. }
  55932. setlocale(LC_ALL, 'C');
  55933. require __DIR__.'/../src/bootstrap.php';
  55934. use Composer\Console\Application;
  55935. use Composer\XdebugHandler\XdebugHandler;
  55936. error_reporting(-1);
  55937. // Restart without xdebug
  55938. $xdebug = new XdebugHandler('Composer', '--ansi');
  55939. $xdebug->check();
  55940. unset($xdebug);
  55941. if (defined('HHVM_VERSION') && version_compare(HHVM_VERSION, '4.0', '>=')) {
  55942. echo 'HHVM 4.0 has dropped support for Composer, please use PHP instead. Aborting.'.PHP_EOL;
  55943. exit(1);
  55944. }
  55945. if (function_exists('ini_set')) {
  55946. @ini_set('display_errors', 1);
  55947. $memoryInBytes = function ($value) {
  55948. $unit = strtolower(substr($value, -1, 1));
  55949. $value = (int) $value;
  55950. switch($unit) {
  55951. case 'g':
  55952. $value *= 1024;
  55953. // no break (cumulative multiplier)
  55954. case 'm':
  55955. $value *= 1024;
  55956. // no break (cumulative multiplier)
  55957. case 'k':
  55958. $value *= 1024;
  55959. }
  55960. return $value;
  55961. };
  55962. $memoryLimit = trim(ini_get('memory_limit'));
  55963. // Increase memory_limit if it is lower than 1.5GB
  55964. if ($memoryLimit != -1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1536) {
  55965. @ini_set('memory_limit', '1536M');
  55966. }
  55967. // Set user defined memory limit
  55968. if ($memoryLimit = getenv('COMPOSER_MEMORY_LIMIT')) {
  55969. @ini_set('memory_limit', $memoryLimit);
  55970. }
  55971. unset($memoryInBytes, $memoryLimit);
  55972. }
  55973. putenv('COMPOSER_BINARY='.realpath($_SERVER['argv'][0]));
  55974. // run the command application
  55975. $application = new Application();
  55976. $application->run();
  55977. Copyright (c) Nils Adermann, Jordi Boggiano
  55978. Permission is hereby granted, free of charge, to any person obtaining a copy
  55979. of this software and associated documentation files (the "Software"), to deal
  55980. in the Software without restriction, including without limitation the rights
  55981. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  55982. copies of the Software, and to permit persons to whom the Software is furnished
  55983. to do so, subject to the following conditions:
  55984. The above copyright notice and this permission notice shall be included in all
  55985. copies or substantial portions of the Software.
  55986. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  55987. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  55988. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  55989. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  55990. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  55991. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  55992. THE SOFTWARE.
  55993. Ã4+½À cZ¿\*t¨ç�¢¯Ú|���GBMB